:root {
  --bg: #0b0633; --bg2: #10072f; --panel: #1d0f55; --panel2: #160c4b; --line: #3b2683;
  --ink: #f7f3ff; --muted: #b9b0dc; --cyan: #1bdcff; --gold: #ffd337; --rose: #ff60a2; --mint: #2fe0a0;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, #2a1170 0%, transparent 60%), linear-gradient(135deg, #100743, #0a052c 55%, #21094f);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
a { color: var(--cyan); }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(420px, 100%); text-align: center; padding: 34px 26px;
  background: linear-gradient(160deg, var(--panel), var(--panel2)); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-logo { border-radius: 18px; border: 1px solid #4e2e99; }
.login h1 { margin: 14px 0 6px; font-size: 28px; font-style: italic; }
.login h1 span { display: block; font-style: normal; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-top: 4px; }
.google-slot { display: flex; justify-content: center; min-height: 48px; margin: 22px 0 8px; }
.error { color: #ff93ad; min-height: 1.4em; margin: 6px 0; }
.fine { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* Dashboard */
.top {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(16,7,47,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand img { border-radius: 12px; border: 1px solid #4e2e99; }
.brand strong { display: block; font-size: 20px; font-style: italic; line-height: 1; }
.brand span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.who { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.pill { padding: 3px 10px; border-radius: 999px; background: #24135f; border: 1px solid var(--line); color: var(--muted); }
.pill.live::before { content: "●"; color: var(--mint); margin-right: 6px; }
.ghost { background: #2a1871; border: 1px solid #6046b8; border-radius: 12px; padding: 7px 12px; }
.ghost:hover { background: #352090; }

.grid {
  display: grid; gap: 16px; padding: 18px 20px 8px; max-width: 1280px; margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.span-2 { grid-column: span 2; }
@media (max-width: 680px) {
  .grid { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .span-2 { grid-column: auto; }
  .top { padding: 10px 16px; }
  .who { width: 100%; justify-content: space-between; }
  .hero strong { font-size: 28px; }
}

.panel {
  background: linear-gradient(160deg, var(--panel), var(--panel2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; min-width: 0;
}
.panel h2 { margin: 0 0 14px; font-size: 17px; }

.hero-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); margin-bottom: 14px; }
.hero { background: #120942; border: 1px solid #2f1d72; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.hero strong { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero:first-child strong { color: var(--mint); }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hint { font-size: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; margin: 0; }
.kv dt, .kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dd { max-width: 60vw; }
.panel h3 { margin: 18px 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv dd.warn { color: var(--rose); }
.kv dd.good { color: var(--mint); }

.meters { display: grid; gap: 12px; margin-bottom: 14px; }
.meter .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.meter .row b { font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 999px; background: #0d0636; border: 1px solid #2f1d72; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), #6f7dff); transition: width .6s ease; }
.bar i.mid { background: linear-gradient(90deg, var(--gold), #ff9c09); }
.bar i.high { background: linear-gradient(90deg, var(--rose), #ff3b6b); }

.charts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.charts figure { margin: 0; }
.charts figcaption { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chart svg { width: 100%; height: 150px; display: block; }
.chart .b { fill: url(#gradBar); }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .v { fill: var(--ink); font-weight: 700; }

.foot { text-align: center; font-size: 12px; padding: 10px 20px 26px; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--panel); border: 1px solid #7050b5; border-radius: 999px; padding: 10px 16px; opacity: 0; transition: opacity .3s; pointer-events: none;
}
#toast.show { opacity: 1; }
