:root {
  --navy: #0f172a;
  --slate-800: #1e293b;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-100: #f1f5f9;
  --card-bg: #f8fafc;
  --white: #ffffff;
  --risk: #dc2626;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--white);
  color: var(--slate-800);
}

#app {
  display: flex;
  min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.brand-sub { font-size: 11.5px; color: var(--slate-300); }

#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--slate-300);
  transition: background 0.12s ease;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-item.active { background: rgba(59,130,246,0.18); color: var(--white); font-weight: 600; }

.nav-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 14px 10px 4px 10px;
}

.sidebar-footer {
  font-size: 11px;
  color: #64748b;
  padding: 10px 8px 0 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 10px;
}

/* ---------------- Main content ---------------- */
.content { flex: 1; min-width: 0; padding: 28px 36px 60px 36px; }

.topbar h1 { margin: 0 0 4px 0; font-size: 26px; color: var(--navy); }
.topbar-meta { color: var(--slate-500); font-size: 13.5px; max-width: 900px; line-height: 1.5; margin-bottom: 22px; }

.loading { color: var(--slate-500); padding: 40px 0; }

/* ---------------- KPI tiles ---------------- */
.kpi-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.kpi-tile {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 170px;
  flex: 1;
}

.kpi-label { font-size: 11.5px; color: var(--slate-500); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 26px; font-weight: 700; }

/* ---------------- Cards / grid ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.card h3 {
  margin: 0 0 14px 0;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

/* ---------------- Domain list (executive view) ---------------- */
.domain-list { display: flex; flex-direction: column; gap: 10px; }

.domain-row {
  display: grid;
  grid-template-columns: 20px 1fr 90px 100px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.domain-row .swatch { width: 12px; height: 12px; border-radius: 3px; }
.domain-row .score { font-weight: 700; text-align: right; }
.domain-row .level { text-align: right; color: var(--slate-500); font-size: 12px; }

/* ---------------- Metric bars (custom, non-chart) ---------------- */
.metric-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.metric-table td { padding: 9px 4px; font-size: 13px; border-bottom: 1px solid var(--border); }
.metric-table td.val { text-align: right; font-weight: 700; width: 60px; }

/* ---------------- Table (regional signals) ---------------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  background: var(--navy); color: var(--white); text-align: left;
  padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em;
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data-table tr:nth-child(even) td { background: var(--card-bg); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.high { background: #fee2e2; color: #991b1b; }
.badge.medium { background: #ffedd5; color: #9a3412; }
.badge.low { background: #dcfce7; color: #166534; }

.priority-gap { font-size: 12.5px; color: var(--slate-500); margin-top: 4px; }

.chart-wrap { position: relative; }

.note-box {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--slate-500);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  #app { flex-direction: column; }
  .sidebar { width: 100%; }
}
