:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --navy: #1a73e8;
  --navy-deep: #174ea6;
  --orange: #e37400;
  --green: #188038;
  --green-soft: #e6f4ea;
  --shadow: 0 1px 2px rgba(60,64,67,.12), 0 1px 3px rgba(60,64,67,.08);
  --radius: 12px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #eef3fb 0%, #f8f9fa 45%, #fff7ed 100%);
}
.auth-card {
  width: min(420px, 92vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-card p { color: var(--muted); font-size: 14px; }
.auth-card label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.auth-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff;
}
.auth-card button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 16px; padding: 10px 16px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--navy); color: #fff; font-weight: 600; font-size: 14px;
}
.auth-card button:hover, .btn:hover { background: var(--navy-deep); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.ok { background: var(--green-soft); color: var(--green); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.err { background: #fce8e6; color: #c5221f; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.side {
  background: #0f172a; color: #e2e8f0; padding: 20px 16px; position: sticky; top: 0; height: 100vh;
}
.side .brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; margin-bottom: 28px; color: #fff; }
.side .brand span { color: #93c5fd; }
.side nav a {
  display: block; color: #cbd5e1; padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; font-size: 14px;
}
.side nav a.active, .side nav a:hover { background: rgba(148,163,184,.15); color: #fff; text-decoration: none; }
.side .meta { margin-top: 28px; font-size: 12px; color: #94a3b8; line-height: 1.5; }

.main { padding: 22px 28px 40px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar h2 { margin: 0; font-size: 22px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px;
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.kpi .value.active { color: var(--orange); }
.kpi .hint { color: var(--muted); font-size: 11px; margin-top: 6px; }

.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); overflow: auto;
}
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; max-width: 28px; background: linear-gradient(180deg, #60a5fa, #1a73e8);
  border-radius: 6px 6px 2px 2px; min-height: 2px;
}
.chart .tick { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

.snippet-box {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px; font-size: 12px;
  word-break: break-all; margin-top: 8px;
}
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.6s infinite; margin-right: 6px;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
