/* ===== CityIntel Theme ===== */
:root {
  --brand-red:#D01616; 
  --brand-black:#0C0C0C;
  --brand-gray-900:#111214; 
  --brand-gray-800:#16171a; 
  --brand-gray-700:#1c1e22;
  --brand-gray-600:#24272c; 
  --brand-gray-500:#2e3238;
  --muted:#8e97a3; 
  --text:#e9edf2; 
  --ok:#33c48d; 
  --warn:#f0b429; 
  --danger:#ff5a5f;
  --card-radius:16px; 
  --shadow:0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing:border-box; }
html, body { height:100%; }
body {
  margin:0;
  background:linear-gradient(180deg,var(--brand-gray-900),var(--brand-gray-800));
  color:var(--text);
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
}

/* ===== Layout ===== */
.app {
  display:grid;
  grid-template-columns:260px 1fr;
  grid-template-rows:60px 1fr;
  grid-template-areas:"sidebar topbar" "sidebar main";
  min-height:100vh;
}

.sidebar {
  grid-area:sidebar;
  background:linear-gradient(180deg,var(--brand-black),#131416);
  border-right:1px solid var(--brand-gray-600);
  display:flex;
  flex-direction:column;
  padding:18px 14px;
  gap:18px;
}
.brand {
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:12px;
  background:linear-gradient(90deg,rgba(208,22,22,0.2),rgba(208,22,22,0));
}
.brand img { width:34px;height:34px;object-fit:contain;border-radius:6px;background:#fff; }
.brand .title { font-weight:700;letter-spacing:.3px; }

nav a {
  display:flex;
  align-items:center;
  gap:10px;
  color:#e9edf2;
  text-decoration:none;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid transparent;
}
nav a:hover { background:#24272c; border-color:#2e3238; }
nav a.active { background:rgba(208,22,22,0.15); border-color:#D01616; }

.sidebar-note {
  margin-top:auto;
  color:var(--muted);
  font-size:12px;
}

.topbar {
  grid-area:topbar;
  background:rgba(255,255,255,0.02);
  border-bottom:1px solid var(--brand-gray-600);
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  position:sticky;
  top:0;
  z-index:10;
}

.search {
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--brand-gray-700);
  border:1px solid var(--brand-gray-600);
  border-radius:12px;
  padding:8px 12px;
}
.search input {
  flex:1;
  background:transparent;
  border:none;
  outline:none;
  color:var(--text);
}

.top-actions { position:relative; }

/* ===== Cards ===== */
.card {
  background:linear-gradient(180deg,#1a1c20,#131417);
  border:1px solid var(--brand-gray-600);
  border-radius:var(--card-radius);
  box-shadow:var(--shadow);
  padding:16px;
}
.card h3 { margin:0 0 10px 0; font-size:16px; letter-spacing:.2px; }

.metric { display:flex; align-items:baseline; gap:10px; }
.metric .value { font-size:28px; font-weight:800; }
.metric .delta { font-size:12px; padding:2px 8px; border-radius:999px; }
.delta.up { background:rgba(51,196,141,.15); color:var(--ok); border:1px solid rgba(51,196,141,.35); }
.delta.down { background:rgba(255,90,95,.15); color:var(--danger); border:1px solid rgba(255,90,95,.35); }
.value.danger { color:var(--danger); }

/* ===== Table ===== */
table { width:100%; border-collapse:collapse; overflow:hidden; border-radius:12px; }
thead th {
  text-align:left;
  font-size:12px;
  color:var(--muted);
  background:var(--brand-gray-700);
  padding:10px;
  border-bottom:1px solid var(--brand-gray-600);
}
tbody td { padding:12px 10px; border-bottom:1px solid var(--brand-gray-600); }
tr:hover td { background:rgba(255,255,255,0.02); }

/* ===== Alerts ===== */
.alert {
  border:1px solid var(--brand-gray-600);
  border-left:4px solid var(--brand-red);
  background:linear-gradient(90deg,rgba(208,22,22,.1),rgba(208,22,22,0));
  padding:12px;
  border-radius:12px;
  margin-bottom:10px;
}
.alert small { color:var(--muted); }
.alert-line {
  font-size:13px;
  color:#c9d1d9;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.cursor-pointer { cursor:pointer; }

/* ===== Heatmap ===== */
.heatmap { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:10px; }
.cell {
  width:60px;
  height:60px;
  border-radius:6px;
  border:1px solid #2e3238;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  font-size:11px;
  font-weight:600;
  color:#e9edf2;
  text-align:center;
  padding:4px;
}
.cell:hover { outline:2px solid #D01616; cursor:pointer; }

.legend { margin-top:10px; font-size:13px; }
.swatch {
  display:inline-block;
  width:14px;
  height:14px;
  border-radius:4px;
  border:1px solid #2e3238;
}
.swatch-low { background:#20312b; }
.swatch-med { background:#473a23; }
.swatch-high { background:#5c2b2b; }
.ml-10 { margin-left:10px; }
.mt-10 { margin-top:10px; }

/* ===== Risk labels ===== */
.risk.high { font-weight:700; color:var(--danger); }
.risk.med { font-weight:700; color:var(--warn); }
.risk.low { font-weight:700; color:var(--ok); }

/* ===== Global Map ===== */
.map-wrap {
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  background:#0f1115;
  overflow:hidden;
}
.map-wrap object {
  width:100%;
  height:100%;
  display:block;
}

/* ===== Buttons & User ===== */
.login-btn {
  display:inline-block;
  padding:8px 12px;
  border-radius:999px;
  background:#D01616;
  border:1px solid #9c0f0f;
  color:#fff;
  font-weight:700;
  text-decoration:none;
  white-space:nowrap;
}
.login-btn:hover { filter:brightness(1.05); }

.user {
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  background:var(--brand-gray-700);
  border:1px solid var(--brand-gray-600);
  cursor:pointer;
}
.avatar {
  width:28px; height:28px;
  background:#fff; color:#000;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-weight:700;
}
.dropdown {
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  background:#1a1c20;
  border:1px solid var(--brand-gray-600);
  border-radius:10px;
  padding:6px 0;
  box-shadow:0 4px 12px rgba(0,0,0,0.4);
  display:none;
  min-width:140px;
  z-index:50;
}
.dropdown a {
  display:block;
  padding:8px 12px;
  color:var(--text);
  text-decoration:none;
  font-size:14px;
}
.dropdown a:hover { background:rgba(255,255,255,0.05); }

/* ===== Grid helpers ===== */
.grid { display:grid; grid-template-columns:repeat(12,1fr); gap:16px; }
.col-span-3 { grid-column: span 3; }
.col-span-5 { grid-column: span 5; }
.col-span-7 { grid-column: span 7; }
.col-span-12 { grid-column: span 12; }

/* ===== Utilities ===== */
.muted { color:var(--muted); }
.pad-10 { padding:10px; }

/* ===== Responsive ===== */
@media (max-width:1100px){
  .app { grid-template-columns:68px 1fr; }
  .brand .title, nav span { display:none; }
  .sidebar { padding:14px 10px; }
}
@media (max-width:880px){ .grid { grid-template-columns:1fr; } }
