@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #eef3f9;
  --bg-nav: #ffffff;
  --bg-card: #ffffff;
  --bg-card-alt: #f4f7fc;
  --bg-section: #e6edf5;
  --border: #ccd9e8;
  --border-light: #dde8f2;
  --accent: #1e3a5f;
  --accent-light: #e8f0f9;
  --positive: #16a34a;
  --positive-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --negative: #dc2626;
  --negative-bg: #fef2f2;
  --neutral: #2563eb;
  --neutral-bg: #eff6ff;
  --text-primary: #1e3a5f;
  --text-secondary: #4a6080;
  --text-muted: #8ba3c0;
  --text-label: #6b8ab0;
  --radius: 4px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 14px;
}

/* ── Navigation ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-nav);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.navbar nav { display: flex; gap: 2px; align-items: center; }

.navbar nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.navbar nav a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.navbar nav a.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

.navbar .opr-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--positive-bg);
  color: var(--positive);
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.page-header .subtitle {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-size: 11px;
}

.page-header .updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  float: right;
  margin-top: 4px;
}

/* ── Language Switcher ── */
.lang-switcher { display: flex; gap: 2px; margin-left: 8px; }
.lang-btn {
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-label);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
}
.lang-btn:hover { color: var(--accent); background: var(--accent-light); }
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Section Labels ── */
.section-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-label);
  font-weight: 500;
  margin: 24px 0 10px;
}

.section-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 28px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--neutral);
}

.kpi-card.green { border-left-color: var(--positive); }
.kpi-card.orange { border-left-color: var(--warning); }
.kpi-card.red { border-left-color: var(--negative); }
.kpi-card.blue { border-left-color: var(--neutral); }

.kpi-card .kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-card .kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-card .kpi-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 6px;
}

.kpi-badge.badge-green { background: var(--positive-bg); color: var(--positive); }
.kpi-badge.badge-orange { background: var(--warning-bg); color: var(--warning); }
.kpi-badge.badge-red { background: var(--negative-bg); color: var(--negative); }
.kpi-badge.badge-blue { background: var(--neutral-bg); color: var(--neutral); }

.kpi-card .kpi-source {
  font-size: 10px;
  color: #aabdd4;
  margin-top: 4px;
}

/* ── Chart Cards ── */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.chart-grid.main-split {
  grid-template-columns: 3fr 2fr;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 0.5px solid var(--border);
}

.chart-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chart-card .chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Canvas wrapper: Chart.js needs a position:relative parent with explicit height */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-wrap.tall {
  height: 300px;
}

.chart-wrap.short {
  height: 180px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Radar chart needs square aspect */
.radar-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 320px;
  margin: 0 auto;
}

.radar-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Insight Box ── */
.insight-box {
  background: var(--bg-card-alt);
  border-left: 3px solid var(--neutral);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.insight-box.accent { border-left-color: var(--accent); }

/* ── Framework Box ── */
.framework-box {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-bar button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab-bar button:hover { color: var(--text-secondary); }

.tab-bar button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Summary Cards ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 0.5px solid var(--border);
}

.summary-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.summary-card p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.summary-card.green-left { border-left: 3px solid var(--positive); }
.summary-card.orange-left { border-left: 3px solid var(--warning); }
.summary-card.red-left { border-left: 3px solid var(--negative); }
.summary-card.blue-left { border-left: 3px solid var(--neutral); }

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 12px 0;
}

.data-table th,
.data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.data-table th {
  color: var(--text-label);
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-card-alt);
}

.data-table td { color: var(--text-secondary); }

.data-table .cell-green { color: var(--positive); font-weight: 500; }
.data-table .cell-orange { color: var(--warning); font-weight: 500; }
.data-table .cell-red { color: var(--negative); font-weight: 500; }

/* ── Pipeline Flow ── */
.pipeline-flow {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 16px 0;
  margin-bottom: 16px;
}

.pipeline-node {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 120px;
  text-align: center;
  flex-shrink: 0;
}

.pipeline-node .node-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.pipeline-node .node-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.pipeline-node .node-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 4px;
}

.pipeline-arrow {
  color: var(--text-muted);
  font-size: 18px;
  padding: 0 6px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pipeline-arrow .arrow-label {
  font-size: 9px;
  color: var(--warning);
  white-space: nowrap;
}

/* ── Timeline ── */
.timeline {
  position: relative;
  padding: 16px 0 16px 20px;
  margin: 12px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 12px;
  padding-left: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-primary);
}

.timeline-item.green::before { background: var(--positive); }
.timeline-item.red::before { background: var(--negative); }
.timeline-item.gray::before { background: var(--text-muted); }

.timeline-item .tl-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
}

.timeline-item .tl-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Risk Radar ── */
.radar-wrap canvas {
  max-width: 360px;
  max-height: 360px;
  margin: 0 auto;
  display: block;
}

/* ── Micro-market Cards ── */
.micro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.micro-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 0.5px solid var(--border);
  border-top: 3px solid var(--accent);
}

.micro-card .micro-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-label);
  margin-bottom: 4px;
}

.micro-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.micro-card p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

/* ── Chart Footnote ── */
.chart-footnote {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

/* ── Source Footer ── */
.source-footer {
  background: var(--bg-section);
  padding: 16px 20px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-top: 28px;
  border-radius: var(--radius);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 11px;
  border-top: 1px solid var(--border-light);
  margin-top: 20px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid.two-col,
  .chart-grid.main-split { grid-template-columns: 1fr; }
  .navbar nav a { padding: 4px 8px; font-size: 11px; }
  .navbar .logo { font-size: 11px; }
  .pipeline-flow { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .navbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .navbar nav { flex-wrap: wrap; }
  .container { padding: 16px 12px; }
  .page-header .updated { float: none; }
}
