/* ==========================================================================
   WTF Sentinel - folha de estilo unica.
   Sem dependencia externa: nenhuma fonte remota, nenhum framework.

   Principio de cor: a interface e cinza; cor e informacao.
     vermelho = ameaca / critico
     ambar    = capacidade / saude degradada  (NAO e ameaca)
     verde    = normal
     azul     = selecao, foco e dado neutro em destaque
   A rampa azul ordinal (--s1..--s9) codifica POSICAO na escada de latencia
   (assinante -> internet), nunca gravidade.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- superficies -------------------------------------------------- */
  --bg:            #0a0c10;  /* plano da pagina, quase preto com tom frio */
  --surface:       #12151b;  /* cartao */
  --surface-2:     #171b23;  /* elevado: cabecalho de tabela, input */
  --surface-3:     #1d2230;  /* hover / selecionado */
  --border:        #242a35;
  --border-strong: #313a4a;
  --grid:          #1e232c;  /* linha de grade, sempre solida e recuada */

  /* --- tinta -------------------------------------------------------- */
  --ink:      #e8ecf2;
  --ink-2:    #a7b0be;
  --muted:    #8b95a5;  /* eixo, rodape tecnico (6.0:1 no cartao) */

  /* --- estado (fixo, nunca tematizado) ------------------------------ */
  --ok:       #0ca30c;
  --warn:     #fab219;
  --serious:  #ec835a;
  --crit:     #d03b3b;
  --accent:   #5598e7;

  --ok-dim:      rgba(12, 163, 12, 0.14);
  --warn-dim:    rgba(250, 178, 25, 0.13);
  --crit-dim:    rgba(208, 59, 59, 0.15);
  --accent-dim:  rgba(85, 152, 231, 0.13);

  /* --- rampa ordinal azul (posicao na escada) ----------------------- */
  --s1: #cde2fb;
  --s2: #b7d3f6;
  --s3: #9ec5f4;
  --s4: #86b6ef;
  --s5: #6da7ec;
  --s6: #5598e7;
  --s7: #3987e5;
  --s8: #2a78d6;
  --s9: #256abf;
  --neutral-series: #737e8f;  /* "fora da nossa rede" - cinza de proposito */

  /* --- tipografia --------------------------------------------------- */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --gap: 14px;
}

/* --------------------------------------------------------------- reset */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  /* nenhuma barra horizontal no body: tabela larga rola no proprio container */
  overflow-x: hidden;
}

body.is-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Numero SEMPRE monoespacado e tabular: coluna de numero tem que alinhar. */
.num, .mono, table.data td.num, .stat-value, .kv-value, .tick {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Foco visivel em tudo que recebe teclado. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.brand-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.brand-mark span { color: var(--accent); }

.brand-slogan {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.topbar-mid {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-left: 6px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.product { font-weight: 600; font-size: 14px; }
.site-name {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sep { color: var(--border-strong); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.who { font-family: var(--mono); color: var(--ink-2); }
.who em { font-style: normal; color: var(--muted); }

.btn-ghost {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }

/* pulso discreto do auto-refresh */
.refresh-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
}
.refresh-dot::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.refresh-dot[data-state="paused"]::before { background: var(--muted); }
.refresh-dot[data-state="loading"]::before { background: var(--accent); }
.refresh-dot[data-state="error"]::before { background: var(--crit); }

/* --------------------------------------------------------------- abas */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab .tab-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  background: var(--surface-3);
  color: var(--ink-2);
}
.tab .tab-badge[data-tone="crit"] { background: var(--crit-dim); color: var(--crit); }
.tab .tab-badge[data-tone="warn"] { background: var(--warn-dim); color: var(--warn); }

/* --------------------------------------------------------- containers */
main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px 18px 56px;
}

.panel[hidden] { display: none; }
.panel.is-refreshing { opacity: 0.55; transition: opacity 120ms linear; }

.grid { display: grid; gap: var(--gap); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ------------------------------------------------------------ cartoes */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* Titulo limpo, sem jargao. O jargao vai pro rodape. */
.card-title { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.card-sub { font-size: 12px; color: var(--muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Rodape tecnico: nome de interface, timestamp, contadores. */
.card-foot {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  line-height: 1.5;
}
.card-foot b { color: var(--ink-2); font-weight: 500; }

.card.is-clickable { cursor: pointer; }
.card.is-clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card.is-selected { border-color: var(--accent); }

/* -------------------------------------------------------- stat tiles */
.statusbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 0;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2px;
}
.stat-value[data-tone="crit"] { color: var(--crit); }
.stat-value[data-tone="warn"] { color: var(--warn); }
.stat-value[data-tone="ok"]   { color: var(--ok); }
.stat-foot {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
}
/* estado sempre com icone + rotulo: cor nunca carrega sozinha o sentido */
.badge::before { font-family: var(--mono); font-size: 10px; }
.badge[data-tone="crit"]    { background: var(--crit-dim);   color: var(--crit);    border-color: rgba(208,59,59,.35); }
.badge[data-tone="crit"]::before { content: "!"; }
.badge[data-tone="warn"]    { background: var(--warn-dim);   color: var(--warn);    border-color: rgba(250,178,25,.30); }
.badge[data-tone="warn"]::before { content: "\25B3"; }
.badge[data-tone="ok"]      { background: var(--ok-dim);     color: var(--ok);      border-color: rgba(12,163,12,.32); }
.badge[data-tone="ok"]::before { content: "\2713"; }
.badge[data-tone="info"]    { background: var(--accent-dim); color: var(--accent);  border-color: rgba(85,152,231,.30); }
.badge[data-tone="info"]::before { content: "i"; }
.badge[data-tone="neutral"] { background: var(--surface-2);  color: var(--ink-2);   border-color: var(--border); }
.badge[data-tone="neutral"]::before { content: ""; }
.badge .badge-n { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ medidor */
.meter {
  display: block;
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: visible;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: 4px 4px 4px 4px;
  background: var(--accent);
  transition: width 200ms ease;
  max-width: 100%;
}
.meter-fill[data-tone="warn"] { background: var(--warn); }
.meter-fill[data-tone="crit"] { background: var(--crit); }
/* estourado: a barra "vaza" pra fora da trilha */
.meter.is-over { box-shadow: 0 0 0 1px rgba(208,59,59,.45); }
.meter.is-over .meter-fill { background: var(--crit); }
.meter-over {
  position: absolute;
  top: -3px;
  right: -10px;
  height: 14px;
  border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--crit) 0 4px, transparent 4px 7px);
}

/* ------------------------------------------------------------ tabelas */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 640px;
}
table.data th {
  position: sticky;
  top: 0;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 1;
}
table.data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.num { text-align: right; white-space: nowrap; }
table.data td.mono { white-space: nowrap; }
table.data caption {
  caption-side: top;
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
}

/* ------------------------------------------------------- form / campos */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 11px; color: var(--muted); }

input[type="text"], input[type="search"], input[type="password"], select {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 13px;
  min-width: 0;
}
input[type="search"] { font-family: var(--mono); }
input::placeholder { color: var(--muted); }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 11px;
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: var(--surface-3); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------- autocomplete */
.search-box { position: relative; flex: 1 1 340px; max-width: 520px; }
.search-box input { width: 100%; }

.suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  margin: 0;
  list-style: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}
.suggestions[hidden] { display: none; }
.suggestions li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
}
.suggestions li:hover, .suggestions li.is-active { background: var(--surface-3); }
.suggestions .s-user { font-family: var(--mono); color: var(--ink); }
.suggestions .s-ip { font-family: var(--mono); color: var(--muted); margin-left: auto; }

/* ------------------------------------------------------------ veredito */
.verdict {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
}
.verdict[data-tone="ok"]   { border-left-color: var(--ok); }
.verdict[data-tone="warn"] { border-left-color: var(--warn); }
.verdict[data-tone="crit"] { border-left-color: var(--crit); }

.verdict-label { font-size: 11px; color: var(--muted); }
.verdict-text {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 4px;
  letter-spacing: -0.015em;
}
.verdict[data-tone="ok"]   .verdict-text { color: var(--ok); }
.verdict[data-tone="warn"] .verdict-text { color: var(--warn); }
.verdict[data-tone="crit"] .verdict-text { color: var(--crit); }
.verdict-who {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}
.verdict-who span b { color: var(--muted); font-weight: 400; }

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.finding {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
}
.finding-icon {
  font-family: var(--mono);
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}
.finding[data-sev="crit"] { border-color: rgba(208,59,59,.4); }
.finding[data-sev="crit"] .finding-icon { color: var(--crit); }
.finding[data-sev="warn"] .finding-icon { color: var(--warn); }
.finding[data-sev="info"] .finding-icon { color: var(--accent); }
.finding-area {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 1px;
}

/* --------------------------------------------------------- graficos */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { display: block; width: 100%; touch-action: pan-y; }
.chart-wrap canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 11.5px;
  box-shadow: 0 10px 24px rgba(0,0,0,.55);
  min-width: 130px;
  transform: translate(-50%, 0);
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-head {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: nowrap;
}
.chart-tip .tip-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
/* chave de linha, nao caixa cheia: menos tinta na densidade do tooltip */
.chart-tip .tip-key { display: block; height: 2px; border-radius: 1px; }
.chart-tip .tip-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.chart-tip .tip-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-key { width: 14px; height: 2px; border-radius: 1px; flex: none; }
.legend-key[data-shape="rect"] { height: 10px; border-radius: 2px; }

/* -------------------------------------------------------- escada/ladder */
.ladder-card { padding-bottom: 8px; }
.ladder-wrap { min-height: 150px; }
.ladder-note {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 6px;
}
.ladder-note b { color: var(--ink); }

details.table-twin { margin-top: 10px; }
details.table-twin > summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 0;
  list-style-position: outside;
}
details.table-twin > summary:hover { color: var(--ink-2); }
details.table-twin > .table-wrap { margin-top: 8px; }

/* ------------------------------------------------------------- estados */
.state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
}
.state[data-kind="error"] { border-color: rgba(208,59,59,.45); color: var(--crit); }
.state[data-kind="error"] .state-detail { color: var(--ink-2); font-family: var(--mono); font-size: 11px; }
.state .spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .state .spinner { animation-duration: 2.4s; }
  .meter-fill { transition: none; }
}

/* faixa de destaque (ex.: orfaos de CGNAT) */
.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  margin-bottom: var(--gap);
}
.callout[data-tone="crit"] { border-color: rgba(208,59,59,.45); background: linear-gradient(var(--crit-dim), var(--crit-dim)), var(--surface); }
.callout[data-tone="warn"] { border-color: rgba(250,178,25,.4); background: linear-gradient(var(--warn-dim), var(--warn-dim)), var(--surface); }
.callout[data-tone="ok"]   { border-color: rgba(12,163,12,.35); }
.callout .callout-icon { font-family: var(--mono); font-weight: 700; font-size: 15px; line-height: 1.3; }
.callout[data-tone="crit"] .callout-icon { color: var(--crit); }
.callout[data-tone="warn"] .callout-icon { color: var(--warn); }
.callout[data-tone="ok"] .callout-icon { color: var(--ok); }
.callout-title { font-weight: 600; margin-bottom: 2px; }
.callout-body { color: var(--ink-2); }
.callout-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.callout-list li {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}

/* ------------------------------------------------- pares chave/valor */
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  font-size: 12px;
  margin: 0;
}
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kv dd[data-tone="crit"] { color: var(--crit); }
.kv dd[data-tone="warn"] { color: var(--warn); }
.kv dd[data-tone="ok"]   { color: var(--ok); }

/* linha de metricas do cartao de interface */
.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-bottom: 10px;
}
.metric { min-width: 0; }
.metric-label { font-size: 10.5px; color: var(--muted); }
.metric-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.metric-value[data-tone="crit"] { color: var(--crit); }
.metric-value[data-tone="warn"] { color: var(--warn); }
.metric-value[data-tone="ok"]   { color: var(--ok); }
.metric-value small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 3px; }

/* --------------------------------------------------------- alertas */
.alert-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: baseline;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.alert-row:last-child { border-bottom: 0; }
.alert-msg { font-size: 13px; min-width: 0; }
.alert-subject {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: block;
}
.alert-when { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.feed-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.feed-head .feed-title { font-weight: 600; font-size: 12.5px; }
.feed-head .feed-desc { font-size: 11.5px; color: var(--muted); }
.feed { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.feed[data-feed="ameaca"] { border-color: rgba(208,59,59,.35); }
.feed[data-feed="ameaca"] .feed-head { background: linear-gradient(var(--crit-dim), var(--crit-dim)), var(--surface-2); }
.feed[data-feed="saude"] .feed-head { background: linear-gradient(var(--warn-dim), var(--warn-dim)), var(--surface-2); }

.section-title {
  font-size: 12px;
  color: var(--muted);
  margin: 20px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.section-title:first-child { margin-top: 0; }

/* ----------------------------------------------------------- login */
.login-card {
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 24px;
}
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .brand-mark { font-size: 20px; }
.login-brand .brand-slogan { display: block; margin-top: 4px; }
.login-product {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.login-product b { color: var(--ink); font-weight: 600; }
.login-card form { display: grid; gap: 12px; }
.login-card input { width: 100%; }
.btn-primary {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 4px;
}
.btn-primary:hover { background: rgba(85,152,231,.22); }
.login-error {
  border: 1px solid rgba(208,59,59,.45);
  background: var(--crit-dim);
  color: var(--crit);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
}
.login-foot {
  margin-top: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

/* ------------------------------------------------- utilitarias (CSP) */
/* A CSP de producao e estrita (style-src 'self'): atributo style= inline e
   BLOQUEADO. Nada de style="..." no HTML nem de setAttribute("style", ...)
   no JS - o que e fixo vira classe aqui; o que e dinamico (largura de barra,
   cor de serie) vai por CSSOM (element.style.setProperty), que a CSP permite. */
.u-gap    { height: 14px; }
.u-gap-sm { height: 8px; }
.u-mt-3   { margin-top: 3px; }
.u-mt-10  { margin-top: 10px; }
.u-ml-auto { margin-left: auto; }
.u-right  { text-align: right; }

/* rotulo clicavel com caixa de selecao embutida */
.toggle { cursor: pointer; user-select: none; }
.toggle input { margin: 0 5px 0 0; vertical-align: -1px; }

/* coluna de ocupacao da tabela de CGNAT */
.col-meter { min-width: 150px; }
.meter-pct {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}
.meter-pct[data-tone="warn"] { color: var(--warn); }
.meter-pct[data-tone="crit"] { color: var(--crit); }
.meter-pct[data-tone="none"] { color: var(--muted); font-style: italic; }

/* ------------------------------------------------------- responsivo */
/* Notebook 1366: cartoes um pouco mais estreitos, menos respiro lateral. */
@media (max-width: 1400px) {
  main { padding: 14px 14px 48px; }
  .grid--cards { grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 13.5px; }
  .topbar { gap: 10px; padding: 9px 12px; }
  .brand-slogan { display: none; }
  .topbar-mid { padding-left: 10px; margin-left: 0; }
  .topbar-right { width: 100%; margin-left: 0; justify-content: space-between; }
  main { padding: 12px 10px 44px; }
  .statusbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--cards, .grid--2 { grid-template-columns: 1fr; }
  .verdict-text { font-size: 21px; }
  .search-box { flex: 1 1 100%; max-width: none; }
  .controls { gap: 8px; }
  .alert-row { grid-template-columns: auto 1fr; }
  .alert-when { grid-column: 2; }
}
