/* Talogy Monitor: painel.
   Linguagem visual: quadro de sinalização de linha férrea. Trilho, estações e lâmpadas; tipografia de placa (DIN).
   Cor só carrega estado, sempre junto de ícone e texto. Sem fonte externa e sem CDN. */

:root {
  color-scheme: light;
  --bg: #e9ede8;
  --surface: #fafbf8;
  --surface-2: #f0f3ee;
  --ink: #15211e;
  --ink-2: #3f4f4a;
  --ink-3: #5d6b66;
  --line: #cdd5ce;
  --line-2: #b3beb6;
  --rail: #2c403a;
  --link: #0b5a8c;
  --focus: #0b5a8c;

  --ok: #1a7a48;        --ok-bg: #dcefe2;        --ok-ink: #0f5631;
  --alarm: #c2281c;     --alarm-bg: #fbe0dc;     --alarm-ink: #96190f;
  --att: #b97a00;       --att-bg: #fbedc8;       --att-ink: #7d4a00;
  --nodata: #6a7680;    --nodata-bg: #e4e8ea;    --nodata-ink: #46525b;
  --off: #8a948f;       --off-bg: transparent;   --off-ink: #56625d;
  --info-bg: #dbe9f4;   --info-ink: #0b4a73;

  --display: Bahnschrift, "DIN Alternate", "DIN 2014", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --code: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --r-s: 3px;
  --r-m: 6px;
  --gap: 1.25rem;
  --side: 14rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1715; --surface: #172220; --surface-2: #1d2a27; --ink: #e5ede9; --ink-2: #b7c4be; --ink-3: #92a09a;
    --line: #2c3b36; --line-2: #3d4e48; --rail: #7a958c; --link: #7fc2ec; --focus: #7fc2ec;
    --ok: #4fc188; --ok-bg: #16352a; --ok-ink: #8fe0b4;
    --alarm: #ff6f5e; --alarm-bg: #3f1b17; --alarm-ink: #ffb0a6;
    --att: #f0b23e; --att-bg: #3a2c0d; --att-ink: #f6cd7c;
    --nodata: #8d9aa5; --nodata-bg: #243039; --nodata-ink: #b6c2cc;
    --off: #7c8a84; --off-ink: #a3b0aa;
    --info-bg: #14303f; --info-ink: #a9d6f2;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1715; --surface: #172220; --surface-2: #1d2a27; --ink: #e5ede9; --ink-2: #b7c4be; --ink-3: #92a09a;
  --line: #2c3b36; --line-2: #3d4e48; --rail: #7a958c; --link: #7fc2ec; --focus: #7fc2ec;
  --ok: #4fc188; --ok-bg: #16352a; --ok-ink: #8fe0b4;
  --alarm: #ff6f5e; --alarm-bg: #3f1b17; --alarm-ink: #ffb0a6;
  --att: #f0b23e; --att-bg: #3a2c0d; --att-ink: #f6cd7c;
  --nodata: #8d9aa5; --nodata-bg: #243039; --nodata-ink: #b6c2cc;
  --off: #7c8a84; --off-ink: #a3b0aa;
  --info-bg: #14303f; --info-ink: #a9d6f2;
}

/* Nível: toda peça que mostra estado lê estas três variáveis. */
.lv-ok        { --lv: var(--ok);     --lv-bg: var(--ok-bg);     --lv-ink: var(--ok-ink); }
.lv-alarm     { --lv: var(--alarm);  --lv-bg: var(--alarm-bg);  --lv-ink: var(--alarm-ink); }
.lv-attention { --lv: var(--att);    --lv-bg: var(--att-bg);    --lv-ink: var(--att-ink); }
.lv-nodata    { --lv: var(--nodata); --lv-bg: var(--nodata-bg); --lv-ink: var(--nodata-ink); }
.lv-off, .lv-none { --lv: var(--off); --lv-bg: transparent;     --lv-ink: var(--off-ink); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 0.9375rem/1.5 var(--body);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-stretch: 88%; font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; text-wrap: balance; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; margin-top: 1.1rem; }
p { margin: 0.4rem 0; max-width: 78ch; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code { font: 0.86em/1.3 var(--code); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 0.05em 0.3em; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-s); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
strong.num, .num strong { font-family: var(--display); font-size: 1.35em; font-weight: 600; }
.txt-alarm { color: var(--alarm-ink); }
.mask { font-family: var(--code); font-size: 0.86em; white-space: nowrap; }
.ic { width: 1em; height: 1em; flex: none; vertical-align: -0.14em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 0.8rem; z-index: 50; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---- Topo fixo ---------------------------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 1.25rem;
  background: var(--rail); color: #f2f6f3; padding: 0 1rem; min-height: 3.25rem;
}
:root[data-theme="dark"] .top { background: #0a100f; border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #0a100f; border-bottom: 1px solid var(--line); } }
.top a { color: inherit; text-decoration: none; }
.brand { font: 600 1.15rem/1 var(--display); font-stretch: 88%; align-self: center; letter-spacing: 0.02em; white-space: nowrap; }
.top-state { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; flex: 1 1 auto; }
.verdict {
  display: inline-flex; align-items: center; gap: 0.45rem; align-self: center; padding: 0.3rem 0.7rem; border-radius: 2rem;
  background: var(--lv-bg); color: var(--lv-ink) !important; font-weight: 600; border: 2px solid var(--lv); margin-right: 0.75rem; white-space: nowrap;
}
.verdict .ic { color: var(--lv); width: 1.15em; height: 1.15em; }
.top-fact { display: flex; flex-direction: column; justify-content: center; padding: 0.3rem 0.8rem; border-left: 1px solid rgba(255,255,255,0.16); line-height: 1.2; }
.top-fact:hover { background: rgba(255,255,255,0.08); }
.top-k { font-size: 0.72rem; opacity: 0.82; }
.top-v { font: 600 1.05rem/1.2 var(--display); }
.top-fact.is-bad .top-v { color: #ffb4a8; }
.top-fact.is-bad .top-v::before { content: "▲ "; font-size: 0.7em; }
.top-fact.is-warn .top-v { color: #f6cd7c; }
.top-tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; font-size: 0.82rem; }
.inline { display: inline; margin: 0; }
.btn-quiet { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,0.3); border-radius: var(--r-m); padding: 0.28rem 0.6rem; font: inherit; cursor: pointer; }
.btn-quiet:hover { background: rgba(255,255,255,0.12); }
.drawer .btn-quiet { border-color: var(--line-2); }
.drawer .btn-quiet:hover { background: var(--surface-2); }
.live { display: inline-flex; align-items: center; gap: 0.35rem; opacity: 0.9; }
.live[hidden] { display: none; }
.live-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #7fe0aa; }
.live.is-paused .live-dot { background: transparent; border: 1.5px solid currentColor; }
.live.is-loading .live-dot { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

.band { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; padding: 0.55rem 1rem; border-bottom: 1px solid var(--line); }
.band .ic { align-self: center; }
.band-alarm { background: var(--alarm-bg); color: var(--alarm-ink); border-left: 6px solid var(--alarm); }
.band-warn { background: var(--att-bg); color: var(--att-ink); border-left: 6px solid var(--att); }
.band-info { background: var(--info-bg); color: var(--info-ink); border-left: 6px solid var(--link); }
.band a { color: inherit; font-weight: 600; }

/* ---- Estrutura ---------------------------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); max-width: 96rem; margin: 0 auto; }
.side { padding: 1.25rem 0.75rem 2rem 1rem; position: sticky; top: 3.25rem; align-self: start; max-height: calc(100vh - 3.25rem); overflow: auto; }
.side-group { margin-bottom: 1.1rem; }
.side h2 { font: 400 0.78rem/1.2 var(--body); color: var(--ink-3); margin: 0 0 0.3rem 0.6rem; font-stretch: normal; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 0.36rem 0.6rem; border-radius: var(--r-m); color: var(--ink-2); text-decoration: none; border-left: 4px solid transparent; }
.side a:hover { background: var(--surface-2); color: var(--ink); }
.side a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; border-left-color: var(--rail); }
main { padding: 1.5rem 1.5rem 4rem; min-width: 0; }
main:focus { outline: none; }

.page-head { margin-bottom: 1.25rem; }
.page-head p { color: var(--ink-2); }
.h-sub { font-family: var(--body); font-stretch: normal; font-weight: 400; font-size: 1.05rem; color: var(--ink-2); }
.crumb { margin: 0 0 0.3rem; font-size: 0.86rem; }
.crumb a::before { content: "‹ "; }
.block { margin-top: 2rem; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
.block-head p { margin: 0; }
.block > h2 { margin-bottom: 0.6rem; }
.note { font-size: 0.88rem; margin-top: 0.75rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.5rem 2.5rem; }
ul.plain { margin: 0.4rem 0; padding-left: 1.1rem; }
ul.plain li { margin: 0.25rem 0; max-width: 78ch; }

/* ---- Selos, botões, formulários ----------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 0.32rem; padding: 0.1rem 0.5rem 0.1rem 0.36rem; border-radius: 2rem;
  background: var(--lv-bg); color: var(--lv-ink); border: 1px solid var(--lv); font-size: 0.8rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.pill .ic { color: var(--lv); }
.pill.lv-nodata { background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(127,127,127,0.16) 4px 6px); }
.pill.lv-off, .pill.lv-none { border-style: dashed; }
.sev { display: inline-block; font-size: 0.74rem; font-weight: 700; padding: 0.08rem 0.4rem; border-radius: var(--r-s); border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.sev-critical { background: var(--alarm); border-color: var(--alarm); color: #fff; }
:root[data-theme="dark"] .sev-critical { color: #1a0906; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sev-critical { color: #1a0906; } }
.sev-high { border-color: var(--alarm); color: var(--alarm-ink); }
.sev-medium { border-color: var(--att); color: var(--att-ink); }
.tag { display: inline-block; font-size: 0.76rem; padding: 0.05rem 0.4rem; border: 1px dashed var(--line-2); border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; margin: 0.5rem 0 1rem; }

.btn {
  display: inline-block; font: 600 0.88rem/1.2 var(--body); padding: 0.5rem 0.85rem; border-radius: var(--r-m); cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-2); text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--rail); color: #f4f8f5; border-color: var(--rail); }
:root[data-theme="dark"] .btn-primary { color: #0c1412; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0c1412; } }
.btn-small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-m); padding: 0.42rem 0.55rem; max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
label { font-weight: 600; font-size: 0.86rem; }
.form-stack { display: grid; gap: 0.35rem; max-width: 24rem; }
.form-stack .btn { justify-self: start; margin-top: 0.35rem; }
.form-stack label { margin-top: 0.3rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 0.6rem 0.9rem; padding: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 1rem; }
.filters label { display: grid; gap: 0.2rem; font-weight: 400; color: var(--ink-2); }
.filters label.check { display: flex; align-items: center; gap: 0.4rem; padding-bottom: 0.45rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
.pop { position: relative; display: inline-block; }
.pop[open] > form { margin-top: 0.4rem; padding: 0.8rem; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-m); min-width: 17rem; }
.flash { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.65rem 0.85rem; border-radius: var(--r-m); margin-bottom: 1rem; border-left: 6px solid; flex-wrap: wrap; }
.flash > .ic { align-self: center; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok); }
.flash-error { background: var(--alarm-bg); color: var(--alarm-ink); border-color: var(--alarm); }
.flash-warn { background: var(--att-bg); color: var(--att-ink); border-color: var(--att); }
.empty { padding: 1.5rem; border: 1.5px dashed var(--line-2); border-radius: var(--r-m); color: var(--ink-2); background: var(--surface); }
.empty h2, .empty h1 { margin-bottom: 0.3rem; color: var(--ink); }
.empty-error { border-color: var(--alarm); }

/* ---- Visão geral: veredito ---------------------------------------------------------------------------------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; padding: 1.6rem 1.75rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 14px solid var(--lv); border-radius: var(--r-m);
}
.hero-kicker { display: flex; align-items: center; gap: 0.4rem; color: var(--ink-2); margin: 0 0 0.5rem; }
.hero-kicker .ic { color: var(--lv); width: 1.3em; height: 1.3em; }
.hero h1 { font-size: clamp(2rem, 3.9vw, 3.5rem); font-stretch: 82%; font-weight: 700; line-height: 1.02; letter-spacing: -0.005em; }
.hero.lv-alarm h1 { color: var(--alarm-ink); }
.hero-sub { margin-top: 0.8rem; color: var(--ink-2); font-size: 1.02rem; max-width: 52ch; }
.answers { margin: 0; display: grid; gap: 0; align-content: start; }
.answers > div { padding: 0.65rem 0; border-top: 1px solid var(--line); }
.answers > div:first-child { border-top: 0; padding-top: 0; }
.answers dt { font: 600 1rem/1.2 var(--display); font-stretch: 88%; color: var(--ink-2); }
.answers dd { margin: 0.2rem 0 0; }
.answer-step { display: block; margin-top: 0.25rem; color: var(--ink-2); }

.watch { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.watch li { display: flex; align-items: center; gap: 0.4rem; }
.watch-k { color: var(--ink-2); font-size: 0.86rem; }

/* ---- O caminho do lead: trilho, estações, lâmpadas ---------------------------------------------------------- */
.line { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.25rem 0.5rem 1rem; }
.lane { padding: 0 0.9rem; border-left: 1px solid var(--line); min-width: 0; }
.lane:first-child { border-left: 0; }
.lane-watch { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.lane-head h3 { margin: 0; font-size: 1.02rem; }
.lane-head p { margin: 0.1rem 0 0.9rem; color: var(--ink-3); font-size: 0.82rem; min-height: 2.4em; }
.track { list-style: none; margin: 0; padding: 0; }
.station { position: relative; padding: 0 0 1.15rem 2.9rem; }
/* o trilho: uma linha vertical que passa pelo centro de cada lâmpada */
.station::before { content: ""; position: absolute; left: calc(1rem - 2px); top: 0; bottom: 0; width: 4px; background: var(--rail); }
.station:first-child::before { top: 1rem; }
.station:last-child::before { bottom: auto; height: 1rem; }
.station:only-child::before { display: none; }
.lane-watch .track { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.8rem; }
.lane-watch .station::before { display: none; }
.lane-watch .lane-head p { min-height: 0; }
.station a { display: block; color: inherit; text-decoration: none; border-radius: var(--r-m); padding: 0.15rem 0.4rem 0.35rem; margin: -0.15rem -0.4rem 0; }
.station a:hover { background: var(--surface-2); }
.lamp {
  position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--lv); color: #fff; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--lv);
}
.lamp .ic { width: 1.05rem; height: 1.05rem; }
:root[data-theme="dark"] .lamp { color: #0c1412; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lamp { color: #0c1412; } }
.lv-nodata > a > .lamp { background: var(--nodata-bg); color: var(--nodata-ink); background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(127,127,127,0.3) 4px 6px); }
.lv-off > a > .lamp { background: var(--surface); color: var(--off-ink); box-shadow: 0 0 0 2px var(--off); }
.lv-attention > a > .lamp { color: #2a1a00; }
.lv-alarm > a > .lamp { box-shadow: 0 0 0 2px var(--alarm), 0 0 0 7px var(--alarm-bg); }
.station-name { display: block; font: 600 1.06rem/1.2 var(--display); font-stretch: 88%; }
.station-n { display: inline-block; min-width: 1.5em; padding: 0 0.3em; text-align: center; border: 1.5px solid var(--line-2); border-radius: var(--r-s); font: 600 0.82em/1.35 var(--display); color: var(--ink-2); margin-right: 0.15em; }
.station-state { display: inline-block; font-weight: 700; font-size: 0.8rem; color: var(--lv-ink); margin-top: 0.15rem; }
.station-line { display: block; font-size: 0.88rem; overflow-wrap: anywhere; }
.station-signal { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; color: var(--ink-3); margin-top: 0.2rem; }
.station-partial { display: inline-block; margin-left: 0.4rem; font-size: 0.74rem; padding: 0 0.35rem; border: 1px dashed var(--nodata); border-radius: var(--r-s); color: var(--nodata-ink); }
.station-age { display: block; font-size: 0.76rem; color: var(--ink-3); margin-top: 0.15rem; }

/* ---- Listas de incidentes e de checks ----------------------------------------------------------------------- */
.inc-list, .check-list, .cond-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.inc-row { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: var(--r-m); padding: 0.6rem 0.85rem; }
.sev-edge-critical { border-left-color: var(--alarm); }
.sev-edge-high { border-left-color: var(--alarm); border-left-style: double; }
.sev-edge-medium { border-left-color: var(--att); }
.sev-edge-low { border-left-color: var(--line-2); }
.inc-row-main { display: flex; gap: 0.6rem; align-items: baseline; text-decoration: none; color: var(--ink); }
.inc-row-main:hover .inc-title { text-decoration: underline; }
.inc-id { font: 600 0.9rem/1.3 var(--display); color: var(--ink-2); white-space: nowrap; }
.inc-title { font-weight: 600; overflow-wrap: anywhere; }
.inc-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; margin-top: 0.3rem; font-size: 0.84rem; color: var(--ink-2); }

.check-row { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: var(--r-m); padding: 0.55rem 0.85rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 1rem; }
.lv-edge-alarm { border-left-color: var(--alarm); }
.lv-edge-attention { border-left-color: var(--att); }
.lv-edge-ok { border-left-color: var(--ok); }
.lv-edge-nodata { border-left-color: var(--nodata); border-left-style: dashed; }
.lv-edge-off { border-left-color: var(--line-2); border-left-style: dotted; }
.check-main { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; }
.check-state { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; justify-content: flex-end; }
.check-sum, .check-meta, .check-ev { grid-column: 1 / -1; margin: 0; overflow-wrap: anywhere; }
.check-meta { font-size: 0.8rem; }
.check-ev summary { cursor: pointer; color: var(--link); font-size: 0.86rem; }
.check-row[hidden] { display: none; }
.cond-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; align-items: start; padding: 0.6rem 0.85rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.cond-list li > div { flex: 1 1 20rem; min-width: 0; }
.counts { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin: 0 0 1rem; padding: 0; }
.counts a { color: inherit; text-decoration: none; }
.counts a:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chips a { padding: 0.25rem 0.7rem; border: 1.5px solid var(--line-2); border-radius: 2rem; text-decoration: none; color: var(--ink-2); font-size: 0.86rem; }
.chips a[aria-current="true"] { background: var(--rail); color: #f4f8f5; border-color: var(--rail); }
:root[data-theme="dark"] .chips a[aria-current="true"] { color: #0c1412; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chips a[aria-current="true"] { color: #0c1412; } }

/* ---- Tabelas ------------------------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.tbl { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.tbl caption { text-align: left; padding: 0.5rem 0.7rem; color: var(--ink-2); font-size: 0.84rem; }
.tbl th, .tbl td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { font-weight: 600; color: var(--ink-2); font-size: 0.8rem; border-bottom: 2px solid var(--line-2); white-space: nowrap; background: var(--surface-2); }
.tbl tbody tr:last-child > * { border-bottom: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.cell-sub { display: block; font-size: 0.8rem; color: var(--ink-3); margin-top: 0.1rem; }
.row-bad > td { background: var(--alarm-bg); }
.ws { color: var(--alarm-ink); background: var(--att-bg); font-weight: 700; padding: 0 0.12em; border-radius: 2px; }
.leg { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.82rem; white-space: nowrap; }
.leg-ok { color: var(--ok-ink); } .leg-ok .ic { color: var(--ok); }
.leg-missing { color: var(--alarm-ink); font-weight: 700; } .leg-missing .ic { color: var(--alarm); }
.leg-ambiguous, .leg-pending { color: var(--att-ink); } .leg-ambiguous .ic, .leg-pending .ic { color: var(--att); }
.leg-nodata, .leg-na { color: var(--ink-3); }
.kv { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 0.25rem 1rem; margin: 0.5rem 0; }
.kv dt { color: var(--ink-3); font-size: 0.86rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .kv { margin: 0; padding-left: 0.6rem; border-left: 2px solid var(--line); }
.details-block { margin-top: 0.6rem; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); padding: 0.5rem 0.8rem; }
.details-block > summary { cursor: pointer; font-weight: 600; }
.details-block[open] > summary { margin-bottom: 0.5rem; }

/* matriz */
.matrix th[scope="row"] { min-width: 14rem; background: var(--surface); position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
.matrix-form { display: block; font-weight: 600; }
.matrix-sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--ink-3); }
.matrix-global > * { background: var(--surface-2); border-bottom: 2px solid var(--line-2); }
.matrix td { white-space: nowrap; padding: 0.3rem 0.4rem; }
.matrix td:last-child { white-space: normal; min-width: 6.5rem; }
.cell { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.22rem 0.5rem; border-radius: var(--r-s); background: var(--lv-bg); color: var(--lv-ink); border: 1px solid transparent; text-decoration: none; font-size: 0.82rem; font-weight: 600; }
.cell .ic { color: var(--lv); }
a.cell:hover { border-color: var(--lv); }
.cell.lv-alarm { border-color: var(--alarm); }
.cell.lv-nodata { background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(127,127,127,0.16) 4px 6px); font-weight: 400; }
.cell.lv-off { font-weight: 400; }
.cell-info { background: none; font-weight: 400; color: var(--ink-2); padding-left: 0; }
.cell-known { font-weight: 400; opacity: 0.8; }

/* ---- Histórico: um quadrado por dia ------------------------------------------------------------------------- */
.heat { border-collapse: collapse; width: 100%; font-size: 0.88rem; min-width: 46rem; }
.heat th, .heat td { padding: 0.28rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.heat thead th { font-weight: 600; color: var(--ink-2); font-size: 0.8rem; white-space: nowrap; }
.heat th[scope="row"] { font-weight: 400; white-space: nowrap; }
.heat th[scope="row"] a { color: inherit; text-decoration: none; }
.heat th[scope="row"] a:hover { text-decoration: underline; }
.heat td.num, .heat th.num { text-align: right; white-space: nowrap; }
.heat-axis { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 0.76rem; }
.heat-row { display: flex; gap: 2px; min-width: 24rem; }
.hc { flex: 1 1 0; height: 1.5rem; border-radius: 2px; background: var(--lv); min-width: 6px; }
.hc.hc-week { margin-left: 4px; }
.hc.lv-ok { background: var(--ok); opacity: 0.55; }
.hc.lv-attention { background: var(--att); }
.hc.lv-alarm { background: var(--alarm); background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(255,255,255,0.45) 3px 5px); }
.hc.lv-nodata { background: var(--nodata-bg); background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(127,127,127,0.35) 3px 5px); }
.hc.lv-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--off); }
.hc.lv-none { background: transparent; box-shadow: inset 0 -2px 0 var(--line); }
.hc:hover { outline: 2px solid var(--ink); outline-offset: 1px; opacity: 1; }

/* barras de duração das rodadas */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 7rem; padding: 0.5rem 0.6rem 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 2px solid var(--line-2); border-radius: var(--r-m) var(--r-m) 0 0; }
.bar { flex: 1 1 0; max-width: 1.5rem; min-width: 3px; background: var(--rail); border-radius: 4px 4px 0 0; }
.bar-attention { background: var(--att); }
.bar-alarm { background: var(--alarm); }
.bar-nodata { background: var(--nodata); }
.bar:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.bars-axis { display: flex; justify-content: space-between; font-size: 0.78rem; margin: 0.2rem 0 0; max-width: none; }
.phases { white-space: normal; }
.phase { display: inline-block; margin: 0 0.5rem 0.1rem 0; font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; }
.phase-bad { color: var(--alarm-ink); font-weight: 700; }
.phase-skip { color: var(--ink-3); font-style: italic; }

/* ---- Incidente ---------------------------------------------------------------------------------------------- */
.inc-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; padding: 1.2rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-left: 14px solid var(--line-2); border-radius: var(--r-m); }
.inc-head.sev-edge-critical, .inc-head.sev-edge-high { border-left-color: var(--alarm); border-left-style: solid; }
.inc-head.sev-edge-medium { border-left-color: var(--att); }
.inc-head-id { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; font: 600 1.05rem/1.2 var(--display); color: var(--ink-2); margin: 0 0 0.4rem; }
.inc-head h1 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
.inc-head-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; color: var(--ink-2); margin-top: 0.5rem; }
.inc-actions { display: grid; gap: 0.5rem; align-content: start; justify-items: start; min-width: 12rem; }
.inc-actions form { margin: 0; }
.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0; margin-top: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.trio > div { padding: 0.9rem 1.2rem; border-left: 1px solid var(--line); min-width: 0; }
.trio > div:first-child { border-left: 0; }
.trio h2 { font-size: 1rem; color: var(--ink-2); margin-bottom: 0.3rem; }
.lead-counts { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; }
.fix { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 2rem; align-items: start; }
.runbook { background: var(--surface); border: 2px solid var(--rail); border-radius: var(--r-m); padding: 1.1rem 1.3rem; }
.runbook h2:not(:first-child) { margin-top: 1.2rem; font-size: 1.05rem; }
.ai { background: transparent; border: 2px dashed var(--line-2); border-radius: var(--r-m); padding: 1.1rem 1.3rem; }
.ai h2 { color: var(--ink-2); }
.ai ul { padding-left: 1.1rem; margin: 0.3rem 0; }
.steps { margin: 0.6rem 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 0.55rem; }
.steps > li { position: relative; padding-left: 2.4rem; counter-increment: step; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -0.05rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; background: var(--rail); color: var(--surface); font: 600 0.9rem/1 var(--display); }
.steps > li.step-warn { counter-increment: none; display: flex; gap: 0.5rem; align-items: baseline; padding: 0.5rem 0.7rem; background: var(--att-bg); color: var(--att-ink); border-radius: var(--r-m); }
.steps > li.step-warn::before { display: none; }
.steps > li.step-warn .ic { align-self: center; color: var(--att); }
.step-text { overflow-wrap: anywhere; }
.step-tools { display: inline-flex; gap: 0.6rem; margin-left: 0.4rem; font-size: 0.82rem; white-space: nowrap; }
.copy { font: inherit; font-size: 0.8rem; background: none; border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 0 0.4rem; color: var(--link); cursor: pointer; }
.copy.is-done { color: var(--ok-ink); border-color: var(--ok); }
.donot { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 0.35rem; }
.donot li { display: flex; gap: 0.5rem; align-items: baseline; color: var(--alarm-ink); }
.donot .ic { align-self: center; color: var(--alarm); flex: none; }
.timeline { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); gap: 0.6rem; padding: 0.38rem 0; border-top: 1px solid var(--line); }
.timeline > li:first-child { border-top: 0; }
.tl-when { color: var(--ink-3); font-size: 0.86rem; white-space: nowrap; }
.tl-what { overflow-wrap: anywhere; }
.tl-text { display: block; color: var(--ink-2); }
.timeline-wide > li.tl-day { display: block; border-top: 0; padding: 1.1rem 0 0.2rem; }
.timeline-wide > li.tl-day h2 { font-size: 1.05rem; color: var(--ink-2); }
.timeline-wide > li { grid-template-columns: 3.6rem minmax(0, 1fr); }
.note-form label { display: block; margin-bottom: 0.2rem; }
.note-row { display: flex; gap: 0.5rem; max-width: 40rem; }
.note-row input { flex: 1; }
.sheet-tab { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: var(--r-m); padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; }
.sheet-tab > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; }
.sheet-title { font: 600 1.05rem/1.2 var(--display); font-stretch: 88%; }
.sheet-meta { font-size: 0.86rem; color: var(--ink-2); }
.sheet-tab .table-wrap { margin-top: 0.5rem; }

/* ---- Gaveta da etapa e dica flutuante ----------------------------------------------------------------------- */
.drawer { border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(34rem, 100vw); max-width: 100vw; background: var(--bg); color: var(--ink); box-shadow: -8px 0 30px rgba(0,0,0,0.25); overflow: auto; }
.drawer::backdrop { background: rgba(10,16,14,0.45); }
.drawer-head { position: sticky; top: 0; display: flex; justify-content: space-between; gap: 1rem; align-items: start; padding: 1rem 1.1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.3rem; }
#drawer-body { padding: 1rem 1.1rem 2rem; }
#drawer-body .check-row { grid-template-columns: minmax(0, 1fr); }
#drawer-body .check-state { justify-content: flex-start; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--bg); padding: 0.3rem 0.55rem; border-radius: var(--r-s); font-size: 0.8rem; max-width: 22rem; white-space: pre-line; }

/* ---- Entrada ------------------------------------------------------------------------------------------------ */
.bare { min-height: 100vh; display: grid; place-items: center; background: var(--rail); }
:root[data-theme="dark"] .bare { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bare { background: var(--bg); } }
.bare-main { width: min(27rem, 100vw); padding: 1.25rem; }
.login, .bare-main > .empty { background: var(--surface); border-radius: var(--r-m); padding: 2rem 1.8rem; border-top: 10px solid var(--att); }
.login h1 { font-size: 2.3rem; font-stretch: 82%; }
.login-lede { color: var(--ink-2); margin-bottom: 1.2rem; }
.login input { width: 100%; }
.login .btn { margin-top: 0.8rem; padding: 0.65rem 1.4rem; }

/* ---- Telas estreitas ---------------------------------------------------------------------------------------- */
@media (max-width: 70rem) {
  .line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lane:nth-child(3) { border-left: 0; }
  .hero, .fix { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 56rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; display: flex; gap: 0.2rem 1rem; overflow-x: auto; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--surface); }
  .side-group { display: flex; align-items: center; gap: 0.2rem; margin: 0; flex: none; }
  .side h2 { display: none; }
  .side ul { display: flex; gap: 0.15rem; }
  .side a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: var(--r-m) var(--r-m) 0 0; }
  .side a[aria-current="page"] { border-bottom-color: var(--rail); background: var(--surface-2); }
  main { padding: 1rem 0.9rem 3rem; }
  .top { position: static; padding: 0.4rem 0.75rem; }
  .top-tools { margin-left: 0; padding: 0.3rem 0; }
  .top-fact { padding: 0.25rem 0.6rem; }
  .inc-head { grid-template-columns: minmax(0, 1fr); padding: 1rem; border-left-width: 8px; }
  .hero { padding: 1.1rem 1rem; border-left-width: 8px; }
  .trio > div { border-left: 0; border-top: 1px solid var(--line); }
  .trio > div:first-child { border-top: 0; }
}
@media (max-width: 38rem) {
  .line { grid-template-columns: minmax(0, 1fr); }
  .lane { border-left: 0; border-top: 1px solid var(--line); padding-top: 1rem; }
  .lane:first-child { border-top: 0; padding-top: 0; }
  .lane-head p { min-height: 0; }
  .lane-watch .track { grid-template-columns: minmax(0, 1fr); }
  .check-row { grid-template-columns: minmax(0, 1fr); }
  .check-state { justify-content: flex-start; }
  .timeline > li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) {
  .lamp, .hc, .bar, .pill, .cell { forced-color-adjust: none; }
}
