:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5;
    --s2: #d95926;
    --good-text: #0ca30c;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }

header.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; }
.brand span { color: var(--good-text); }
nav { display: flex; gap: 4px; }
nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500;
}
nav a:hover { background: var(--page); }
nav a.active { background: var(--page); color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.chip {
  font-size: 12.5px; color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}

main { max-width: 1120px; margin: 0 auto; padding: 24px 28px 64px; }
h1 { font-size: 21px; margin: 8px 0 4px; }
h2 { font-size: 16px; margin: 32px 0 12px; }
.sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.tile .label { font-size: 12.5px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 650; margin-top: 2px; }
.tile .value small { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.tile.alert-tile .value { color: var(--critical); }
.tile .note { font-size: 12px; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; margin-top: 12px;
}

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border);
  border-left: 4px solid var(--critical); border-radius: 10px;
  background: var(--surface); margin-top: 10px;
}
.alert.amber { border-left-color: var(--warning); }
.alert .icon { font-size: 18px; line-height: 1.3; }
.alert .title { font-weight: 600; }
.alert .detail { color: var(--ink-2); font-size: 13.5px; }
.alert .rule {
  font-size: 11px; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--muted);
}

.gh-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.gh-cell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-height: 58px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.gh-cell:hover { border-color: var(--axis); }
.gh-cell .code { font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.gh-cell .crop { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--good); }
.dot.red { background: var(--critical); }
.dot.amber { background: var(--warning); }
.dot.resting { background: var(--axis); }
.gh-cell.red { border-color: var(--critical); }
.gh-cell.amber { border-color: var(--warning); }
.legend-row { display: flex; gap: 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--grid); padding: 6px 10px;
}
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--grid); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grid);
  font-size: 14px; align-items: baseline;
}
.timeline li:last-child { border-bottom: none; }
.timeline .date { color: var(--muted); font-size: 12.5px; flex: none; width: 92px; font-variant-numeric: tabular-nums; }
.timeline .src {
  margin-left: auto; font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; flex: none;
}
.timeline .src.whatsapp { color: var(--good-text); border-color: var(--good-text); }

.viz-tooltip {
  position: fixed; pointer-events: none; z-index: 10;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  display: none;
}
.viz-tooltip .t-label { color: var(--muted); font-size: 11.5px; }
.viz-tooltip .t-value { font-weight: 600; }

.login-wrap { max-width: 360px; margin: 12vh auto; }
.login-wrap input {
  width: 100%; padding: 10px 12px; margin-top: 10px;
  border: 1px solid var(--axis); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 15px;
}
.login-wrap button {
  width: 100%; margin-top: 14px; padding: 10px;
  background: var(--s1); color: #fff; font-weight: 600; font-size: 15px;
  border: none; border-radius: 8px; cursor: pointer;
}
.login-error { color: var(--critical); font-size: 13.5px; margin-top: 10px; }

.summary-computed { font-size: 11px; color: var(--good-text); }
@media (max-width: 760px) {
  .gh-grid { grid-template-columns: repeat(4, 1fr); }
  main { padding: 16px; }
}
