:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e2e8f0;
  --text: #172033;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-2: #2563eb;
  --good: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: linear-gradient(180deg, #f8fbff 0, var(--bg) 320px); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.topbar { height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(14px); z-index: 10; }
.brand { font-weight: 800; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: 13px; margin-left: 12px; }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 72px); }
.sidebar { border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.55); }
.nav-link { padding: 11px 13px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.nav-link:hover { background: #eef4fb; color: var(--text); }
.nav-link.active { background: #e7f2ff; color: #0369a1; }
.content { padding: 34px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .16em; font-weight: 800; }
.status-pill { border: 1px solid #bae6fd; color: #0369a1; background: #f0f9ff; border-radius: 999px; padding: 8px 12px; font-size: 12px; }
.metrics-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(15,23,42,.06); }
.metric-card { padding: 18px; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { font-size: 34px; font-weight: 800; letter-spacing: -.04em; }
.metric-note { color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { padding: 22px; margin-bottom: 18px; overflow: hidden; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 18px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title span { color: var(--muted); font-size: 12px; }
.chart-wrap { min-height: 250px; }
.chart-title { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.chart { width: 100%; height: 220px; overflow: visible; }
.axis { stroke: #dbe3ec; stroke-width: 1; }
.trend-line { fill: none; stroke: var(--accent-2); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart circle { fill: var(--accent); stroke: #ffffff; stroke-width: 4; }
.chart-value { fill: var(--text); font-size: 14px; font-weight: 800; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 50px; align-items: center; gap: 12px; padding: 8px 0; }
.bar-row span { color: var(--muted); font-size: 13px; }
.bar-track { height: 8px; background: #e8eef5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), #38bdf8); border-radius: 999px; }
.empty { color: var(--muted); padding: 18px 0; }
.markdown { color: #334155; line-height: 1.65; }
.markdown h1, .markdown h2, .markdown h3 { color: var(--text); letter-spacing: -.02em; }
.markdown h1 { font-size: 26px; }
.markdown h2 { margin-top: 28px; font-size: 20px; }
.markdown h3 { font-size: 16px; }
.markdown code { background: #f1f5f9; border: 1px solid var(--line); padding: 2px 5px; border-radius: 6px; }
.markdown pre { background: #f8fafc; border: 1px solid var(--line); padding: 14px; border-radius: 10px; overflow-x: auto; }
.markdown a { color: var(--accent); }
.markdown li { margin: 6px 0; }
.report-row, .system-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 4px; border-bottom: 1px solid var(--line); gap: 16px; }
.report-row:last-child, .system-row:last-child { border-bottom: 0; }
.report-row:hover strong { color: var(--accent); }
.report-row div { display: flex; flex-direction: column; gap: 3px; }
.report-row span, .system-row span { color: var(--muted); font-size: 13px; }
.ghost-button, .ghost-link { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 9px; padding: 8px 11px; cursor: pointer; }
.ghost-button:hover, .ghost-link:hover { color: var(--text); border-color: #94a3b8; background: #f8fafc; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: min(430px,100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: 0 24px 70px rgba(15,23,42,.12); }
.login-card h1 { margin: 6px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.login-card p { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.login-form input { width: 100%; background: #fff; border: 1px solid #cbd5e1; color: var(--text); border-radius: 10px; padding: 12px 13px; outline: none; }
.login-form input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.login-form button { border: 0; background: linear-gradient(90deg,#2563eb,#0ea5e9); color: white; font-weight: 800; padding: 12px; border-radius: 10px; cursor: pointer; }
.login-error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: 13px; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .brand-sub { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 72px; z-index: 9; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 9px 12px; background: rgba(255,255,255,.96); }
  .nav-link { white-space: nowrap; }
  .content { padding: 22px 16px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-card { min-height: 115px; }
  .bar-row { grid-template-columns: 110px 1fr 38px; }
}
@media (max-width: 460px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
}
