/* Shared theme for the forecast and anomalies pages: dark, low-contrast chrome, bright data. */
:root {
  --bg: #08090a; --bg-glow: rgba(113, 112, 255, .10);
  --panel: rgba(255, 255, 255, .025); --panel-solid: #101113; --panel-hi: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .07); --line-hi: rgba(255, 255, 255, .12);
  --ink: #f7f8f8; --ink-2: #d0d6e0; --muted: #8a8f98; --faint: #62666d;
  --accent: #7170ff; --accent-soft: rgba(113, 112, 255, .14);
  --d: #4c8dff; --d-2: #7aa7ff; --d-soft: rgba(76, 141, 255, .14);
  --r: #ff5a5f; --r-2: #ff8a6b; --r-soft: rgba(255, 90, 95, .14);
  --ok: #4cc38a;
  --high: #ff6b4a; --high-soft: rgba(255, 107, 74, .14);
  --med: #f2b84b; --med-soft: rgba(242, 184, 75, .13);
  --info: #9aa0ab; --info-soft: rgba(154, 160, 171, .12);
  --warn: var(--high);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 18% -8%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(76, 141, 255, .06), transparent 60%);
  background-attachment: fixed;
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--d-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); background: var(--panel-hi);
       padding: 1px 5px; border-radius: 4px; }

/* ---- top bar ---- */
header.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 24px; background: rgba(8, 9, 10, .72); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; font-size: 15px;
         white-space: nowrap; }
.brand .logo { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--d) 0%, var(--accent) 55%, var(--r) 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset, 0 4px 18px rgba(113,112,255,.35); }
.brand .logo::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: rgba(8,9,10,.85); }
nav.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--panel-hi);
          border: 1px solid var(--line); }
nav.seg a { color: var(--muted); padding: 4px 12px; border-radius: 6px; font-weight: 500; font-size: 13px;
            display: inline-flex; align-items: center; gap: 6px; text-decoration: none; transition: color .15s, background .15s; }
nav.seg a:hover { color: var(--ink); }
nav.seg a.on { color: var(--ink); background: rgba(255,255,255,.08); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
a.dash-link { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 9px; font-size: 13px; font-weight: 500;
               color: var(--ink-2); border: 1px solid var(--line-hi); text-decoration: none; transition: color .15s, background .15s; }
a.dash-link:hover { color: var(--ink); background: var(--panel-hi); }
a.dash-link.on { color: var(--ink); background: var(--accent-soft); border-color: rgba(113,112,255,.5); }
a.dash-link svg { width: 14px; height: 14px; fill: currentColor; opacity: .85; }
.badge:not(:empty), .badge:not([hidden]):not(:empty) { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; color: #fff;
  background: var(--high); box-shadow: 0 0 12px rgba(255,107,74,.5); }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-left: auto;
          min-width: 0; }
.status .live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none;
                box-shadow: 0 0 0 0 rgba(76,195,138,.6); animation: pulse 2.2s infinite; }
.status .live.bad { background: var(--high); animation: none; }
.status .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .err { color: var(--high); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(76,195,138,.55); } 70% { box-shadow: 0 0 0 7px rgba(76,195,138,0); }
                   100% { box-shadow: 0 0 0 0 rgba(76,195,138,0); } }
#simctl:empty { display: none; }
#simctl { display: flex; gap: 6px; }

/* ---- layout ---- */
main { padding: 20px 24px 56px; display: grid; gap: 16px; max-width: 1240px; margin: 0 auto; }
main > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.panel { position: relative; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
         border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
         box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 40px rgba(0,0,0,.25); }
h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 12px; letter-spacing: 0;
     display: flex; align-items: center; gap: 8px; }
h2 .dot { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.sub { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.note { color: var(--faint); font-size: 12px; margin: -6px 0 12px; }
.empty { color: var(--faint); padding: 10px 0; font-size: 13px; }

button, select, input[type=search] {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--panel-hi);
  border: 1px solid var(--line-hi); border-radius: 7px; padding: 5px 10px; outline: none;
  transition: border-color .15s, background .15s; }
button { cursor: pointer; font-weight: 500; }
button:hover, select:hover, input[type=search]:hover { background: rgba(255,255,255,.07); }
select:focus, input[type=search]:focus, button:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select option { background: var(--panel-solid); }
input[type=checkbox] { accent-color: var(--accent); }

/* ---- tables (stack into cards on phones) ---- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12px; padding: 8px 10px;
     border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom: 0; }
td.wrap, td.cands { white-space: normal; }
.dm { color: var(--d-2); font-weight: 600; } .rm { color: var(--r); font-weight: 600; }

/* ---- small parts ---- */
.tag, .sev, .lbl, .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500;
  padding: 1px 7px; border-radius: 5px; white-space: nowrap; line-height: 18px; }
.tag.d { background: var(--d-soft); color: var(--d-2); } .tag.r { background: var(--r-soft); color: var(--r); }
.sev { text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
               box-shadow: 0 0 8px currentColor; }
.sev.high { background: var(--high-soft); color: var(--high); }
.sev.medium { background: var(--med-soft); color: var(--med); }
.sev.info { background: var(--info-soft); color: var(--info); }
.sev.info::before { box-shadow: none; }
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: linear-gradient(90deg, #c4434a, var(--r)); }
.bar > div { background: linear-gradient(90deg, var(--d), var(--d-2)); box-shadow: 0 0 10px rgba(76,141,255,.6); }

@media (max-width: 480px) {
  .brand .name { display: none; }   /* logo + tabs on one row */
}
@media (max-width: 680px) {
  header.top { padding: 10px 14px; gap: 6px 10px; }
  .status { order: 3; width: 100%; margin-left: 0; }
  main { padding: 14px 12px 40px; gap: 12px; }
  .panel { padding: 14px; border-radius: 10px; }
  /* Tables become one card per row; each cell shows its column name from data-label. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 2px;
                   border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0 !important; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--faint);
                                       margin-bottom: 1px; }
  table.stack td.full, table.stack td.head { grid-column: 1 / -1; }
  table.stack td.head { font-size: 15px; }
  table.stack td.head + td.cands { margin-top: -8px; font-size: 12.5px; }
  table.stack td.hide-sm { display: none; }
  tbody tr:hover td { background: none; }
}
