/* Torre do CD — Cantu Alimentos (protótipo, dados fictícios)
   Marca: verde #1A5E2B / #063B2A / #009F23, laranja #FD7D00, texto #202020, fundo #F2F2F2.
   Status NÃO usa as cores da marca: ok = azul-petróleo, atenção = âmbar, crítico = vermelho, sempre com ícone + texto. */

:root {
  --brand: #1A5E2B;
  --brand-deep: #063B2A;
  --brand-vivid: #009F23;
  --brand-accent: #FD7D00;
  --on-brand: #FFFFFF;
  --on-brand-2: #CFE3D4;

  --bg: #F2F2F2;
  --surface: #FFFFFF;
  --surface-2: #F7F7F4;
  --surface-press: #ECEFEB;
  --ink: #202020;
  --ink-2: #474C49;
  --ink-3: #5E6360;
  --line: #E0E2DE;
  --line-strong: #C4C8C3;

  --ok: #0B6A6A;      --ok-bg: #E2F1F0;
  --warn: #855000;    --warn-mark: #D48F00; --warn-bg: #FFF2D2;
  --crit: #B3261E;    --crit-bg: #FCE9E7;

  --data: #2E7A44;
  --data-soft: #8CC09A;
  --data-track: #E8EDE8;
  --ord-1: #8CC09A; --ord-2: #559E68; --ord-3: #2E7A44; --ord-4: #124D24;
  --band: rgba(11, 106, 106, .12);
  --focus: #0B57D0;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 32, 22, .06), 0 4px 14px rgba(16, 32, 22, .06);
  --sheet-shadow: 0 -8px 30px rgba(10, 25, 16, .22);

  --f-sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-slab: "Roboto Slab", Georgia, "Times New Roman", serif;

  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #145024; --brand-deep: #063B2A; --on-brand-2: #BFD9C6;
    --bg: #0D1712; --surface: #14231B; --surface-2: #192B21; --surface-press: #20362A;
    --ink: #E8EEEA; --ink-2: #C0CBC4; --ink-3: #9AA9A0;
    --line: #25392D; --line-strong: #36503F;
    --ok: #5CC8BE; --ok-bg: #11312E;
    --warn: #F2B544; --warn-mark: #F2B544; --warn-bg: #36290C;
    --crit: #FF8A80; --crit-bg: #3C1714;
    --data: #5BAE70; --data-soft: #378A50; --data-track: #1F3327;
    --ord-1: #246638; --ord-2: #378A50; --ord-3: #5BAE70; --ord-4: #97D2A4;
    --band: rgba(92, 200, 190, .14);
    --focus: #8AB4F8;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #145024; --brand-deep: #063B2A; --on-brand-2: #BFD9C6;
  --bg: #0D1712; --surface: #14231B; --surface-2: #192B21; --surface-press: #20362A;
  --ink: #E8EEEA; --ink-2: #C0CBC4; --ink-3: #9AA9A0;
  --line: #25392D; --line-strong: #36503F;
  --ok: #5CC8BE; --ok-bg: #11312E;
  --warn: #F2B544; --warn-mark: #F2B544; --warn-bg: #36290C;
  --crit: #FF8A80; --crit-bg: #3C1714;
  --data: #5BAE70; --data-soft: #378A50; --data-track: #1F3327;
  --ord-1: #246638; --ord-2: #378A50; --ord-3: #5BAE70; --ord-4: #97D2A4;
  --band: rgba(92, 200, 190, .14);
  --focus: #8AB4F8;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--f-sans);
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(26, 94, 43, .25); }
:root[data-theme="dark"] ::selection { background: rgba(91, 174, 112, .35); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i--s { width: 18px; height: 18px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); }
.skip:focus { top: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Estrutura ---------- */
.app { min-height: 100vh; }
.rail { display: none; }
.shell { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 16px 16px 28px; outline: none; }
.foot { padding: 0 16px 24px; max-width: 1360px; margin: 0 auto; width: 100%; }
.foot p { font-size: 13px; color: var(--ink-3); max-width: 70ch; }

/* Cabeçalho verde da marca */
.top { background: var(--brand); color: var(--on-brand); padding: 10px 16px 12px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
.top__row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.top__brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; margin-right: auto; min-height: 44px; align-items: center; }
.wordmark { font: 500 24px/1 var(--f-slab); letter-spacing: -.01em; position: relative; padding-right: 9px; }
.wordmark::after { content: ""; position: absolute; right: 0; top: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-accent); }
.top__site, .rail__site { font-size: 14px; color: var(--on-brand-2); }
.fict { font-size: 12px; line-height: 1.2; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.45); color: var(--on-brand); white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; }
.top .icon-btn:hover { background: rgba(255,255,255,.12); }
.top :focus-visible { outline-color: #fff; }

.top__ctx { display: flex; gap: 8px; align-items: center; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.top__ctx::-webkit-scrollbar { display: none; }
.ctx-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: var(--on-brand); cursor: pointer; white-space: nowrap; font-size: 15px; }
.ctx-btn:hover { background: rgba(255,255,255,.16); }
.ctx-btn b { font-weight: 500; }
.ctx-btn .i { width: 18px; height: 18px; }
.stamp { margin-left: auto; font-size: 13px; color: var(--on-brand-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #7FE0A0; box-shadow: 0 0 0 3px rgba(127,224,160,.25); }
.stamp--past .live-dot { background: transparent; box-shadow: none; border: 1.5px solid var(--on-brand-2); }

.offline { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--warn-bg); color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
.offline[hidden] { display: none; }
.offline .i { color: var(--warn); }
.offline button { margin-left: auto; }

/* Barra inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar ul { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0; padding: 0; list-style: none; height: var(--tabbar-h); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; text-decoration: none; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.tab[aria-current="page"] { color: var(--brand); }
:root[data-theme="dark"] .tab[aria-current="page"] { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-current="page"] { color: var(--ink); } }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-vivid); }
.badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--crit); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; border: 2px solid var(--surface); }
:root[data-theme="dark"] .badge { color: #2B0B08; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: #2B0B08; } }

/* ---------- Tipografia de tela ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.h1 { font: 500 26px/1.15 var(--f-slab); letter-spacing: -.015em; }
.h2 { font: 500 18px/1.3 var(--f-sans); letter-spacing: -.005em; }
.h3 { font: 500 16px/1.35 var(--f-sans); }
.sub { color: var(--ink-2); font-size: 15px; }
.meta { color: var(--ink-3); font-size: 13px; line-height: 1.4; }
.section { margin-top: 26px; }
.section > .h2 { margin-bottom: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--brand); font-weight: 500; font-size: 15px; cursor: pointer; text-decoration: none; }
:root[data-theme="dark"] .link-btn { color: #8FD1A0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link-btn { color: #8FD1A0; } }
.link-btn .i { width: 18px; height: 18px; }

/* Frase-resumo do dia (o momento de marca) */
.brief { font: 500 20px/1.38 var(--f-slab); letter-spacing: -.01em; max-width: 34ch; margin: 2px 0 16px; }
.brief strong { font-weight: 500; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--crit); }

/* ---------- Superfícies ---------- */
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel--pad { padding: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 12px 16px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; text-decoration: none; cursor: pointer; }
.list > li:first-child > .row { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row:active { background: var(--surface-press); }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 500; }
.row__aside { text-align: right; flex: none; }
.row .i--chev { color: var(--ink-3); width: 18px; height: 18px; }
.list > li:first-child > .row { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.list > li:last-child > .row { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }

/* Status: ícone + palavra, nunca só cor */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; line-height: 1.2; padding: 3px 8px 3px 6px; border-radius: 999px; white-space: nowrap; }
.st .i { width: 16px; height: 16px; stroke-width: 2; }
.st--ok { color: var(--ok); background: var(--ok-bg); }
.st--warn { color: var(--warn); background: var(--warn-bg); }
.st--crit { color: var(--crit); background: var(--crit-bg); }
.st--neutral { color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }
.st--done { color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }

/* ---------- KPIs da 1ª dobra ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 124px; padding: 12px 14px 12px; border: 0; background: none; text-align: left; cursor: pointer; text-decoration: none; border-top: 1px solid var(--line); }
.kpi:nth-child(odd) { border-right: 1px solid var(--line); }
.kpi:nth-child(-n+2) { border-top: 0; }
.kpi:hover { background: var(--surface-2); }
.kpi__name { font-size: 14px; color: var(--ink-2); line-height: 1.25; }
.kpi__val { font: 500 30px/1.05 var(--f-sans); letter-spacing: -.02em; }
.kpi__val small { font-size: 16px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.kpi__meta { font-size: 13px; color: var(--ink-3); }
.kpi--crit .kpi__val { color: var(--crit); }
.kpi .spark { display: block; width: 100%; height: 26px; margin-top: 2px; }

/* Alerta P1 */
.p1 { margin-top: 14px; background: var(--crit-bg); border-radius: var(--r-lg); padding: 14px 16px 12px; }
.p1__head { display: flex; gap: 10px; align-items: flex-start; }
.p1__head .i { color: var(--crit); width: 26px; height: 26px; margin-top: 1px; }
.p1__title { font: 500 18px/1.3 var(--f-sans); }
.p1__impact { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.p1__do { margin-top: 10px; font-size: 15px; }
.p1__do b { font-weight: 500; }
.p1 .btns { margin-top: 12px; }
.p1-more { margin-top: 8px; }

/* Botões */
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 15px; cursor: pointer; text-decoration: none; transition: background-color .15s ease, transform .1s ease; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 18px; height: 18px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-deep); }
:root[data-theme="dark"] .btn--primary { background: #2E7A44; border-color: #2E7A44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--primary { background: #2E7A44; border-color: #2E7A44; } }
.btn--danger { background: var(--crit); border-color: var(--crit); color: #fff; }
:root[data-theme="dark"] .btn--danger { color: #2B0B08; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--danger { color: #2B0B08; } }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Chips de filtro e abas */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; display: grid; place-items: center; min-height: 44px; padding: 0 14px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 15px; white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .tabs a[aria-current="page"] { background: #2E7A44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs a[aria-current="page"] { background: #2E7A44; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .8; }

/* Métricas de cabeçalho de tela */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.stat { background: var(--surface); padding: 12px 14px; min-height: 92px; display: flex; flex-direction: column; gap: 3px; }
.stat__label { font-size: 14px; color: var(--ink-2); line-height: 1.25; }
.stat__val { font: 500 24px/1.1 var(--f-sans); letter-spacing: -.015em; }
.stat__val small { font-size: 14px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.stat .st { align-self: flex-start; margin-top: auto; }

/* ---------- Painel das 5h (assinatura) ---------- */
.depart { padding: 14px 16px 12px; }
.depart__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.depart svg { display: block; width: 100%; height: auto; margin-top: 6px; overflow: visible; }
.depart__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--data); }
.lg i.sq { border-radius: 2px; background: transparent; border: 2px solid var(--crit); }
.lg i.ln { width: 2px; height: 12px; border-radius: 0; background: var(--ink); }
.lg i.ord1 { background: var(--ord-1); border-radius: 2px; } .lg i.ord2 { background: var(--ord-2); border-radius: 2px; }
.lg i.ord3 { background: var(--ord-3); border-radius: 2px; } .lg i.ord4 { background: var(--ord-4); border-radius: 2px; }
.lg i.band { border-radius: 2px; background: var(--band); border: 1px dashed var(--ok); }

/* Gráficos */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--f-sans); font-size: 12px; fill: var(--ink-3); }
.chart .lbl { fill: var(--ink); font-size: 13px; }
.chart .lbl-strong { fill: var(--ink); font-size: 13px; font-weight: 500; }
.chart .val { fill: var(--ink); font-size: 13px; font-weight: 500; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .meta-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .series { fill: none; stroke: var(--data); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series--crit { stroke: var(--crit); }
.chart .bar { fill: var(--data); }
.chart .bar--hi { fill: var(--crit); }
.chart .track { fill: var(--data-track); }
.chart .band { fill: var(--band); }
.chart .band-edge { stroke: var(--ok); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .now { stroke: var(--ink); stroke-width: 1.5; }
.chart .dot-ok { fill: var(--data); }
.chart .dot-late { fill: var(--surface); stroke: var(--crit); stroke-width: 2.2; }
.chart .dot-hi { fill: var(--crit); stroke: var(--surface); stroke-width: 2; }
.chart .late-lbl { fill: var(--crit); font-weight: 500; font-size: 12px; }
.chart .now-lbl { fill: var(--ink); font-weight: 500; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart-wrap { position: relative; }
.chart-wrap:focus-visible { outline-offset: 4px; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface); padding: 7px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; box-shadow: var(--shadow); max-width: 240px; }
.tip b { font-weight: 500; }
.tbl-toggle { margin-top: 4px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.dtable th, .dtable td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); }
.dtable th { font-weight: 500; color: var(--ink-2); }
.dtable td.n, .dtable th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* Câmaras: termômetros */
.cams { display: grid; gap: 12px; }
.cam { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; padding: 14px 16px 12px; text-decoration: none; }
.cam:hover { background: var(--surface-2); }
.cam--crit { background: var(--crit-bg); }
.cam--crit:hover { background: var(--crit-bg); filter: brightness(.98); }
.cam__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cam__name { font-weight: 500; line-height: 1.3; }
.cam__prod { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.cam__temp { font: 500 30px/1 var(--f-sans); letter-spacing: -.02em; text-align: right; white-space: nowrap; }
.cam__temp small { font-size: 15px; font-weight: 400; color: var(--ink-2); }
.cam--crit .cam__temp { color: var(--crit); }
.cam__strip { margin-top: 10px; }
.cam__foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.cam__alarm { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 14px; color: var(--crit); font-weight: 500; }

/* Docas */
.docks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dock { min-height: 72px; border-radius: 10px; padding: 8px 6px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1.25; color: var(--ink-2); text-align: left; cursor: pointer; }
.dock b { font-size: 14px; font-weight: 500; color: var(--ink); }
.dock--busy { background: var(--ok-bg); border-color: transparent; }
.dock--wait { background: var(--warn-bg); border-color: transparent; }
.dock--alarm { background: var(--crit-bg); border: 2px solid var(--crit); color: var(--crit); font-weight: 500; }
.dock--off { background: transparent; border: 1.5px dashed var(--line-strong); }

/* Alertas */
.alerts { display: grid; gap: 10px; }
.alert { padding: 14px 16px; }
.alert__head { display: flex; gap: 10px; align-items: flex-start; }
.alert__title { font-weight: 500; font-size: 16px; line-height: 1.35; }
.alert__area { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.alert dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 10px 0 0; font-size: 14px; }
.alert dt { color: var(--ink-3); }
.alert dd { margin: 0; color: var(--ink); }
.alert .btns { margin-top: 12px; }
.alert--done { opacity: .78; }
.alert-owner { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.prio-group + .prio-group { margin-top: 22px; }
.prio-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* Barras simples em HTML (ocupação, turnos) */
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--data-track); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; background: var(--data); border-radius: 5px; }
.meter--crit > span { background: var(--crit); }
.meter--warn > span { background: var(--warn-mark); }
.meter__target { position: absolute; top: -3px; bottom: -3px; border-left: 1.5px dashed var(--ink-2); border-right: 1.5px dashed var(--ink-2); background: var(--band); }

/* Folha (bottom sheet / painel lateral) */
.sheet-layer { position: fixed; inset: 0; z-index: 50; }
.sheet-layer[hidden] { display: none; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(8, 20, 13, .45); animation: fade .18s ease-out; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: var(--sheet-shadow); padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); animation: rise .28s cubic-bezier(.2, .8, .2, 1); outline: none; }
.sheet__grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 6px; }
.sheet__head { display: flex; align-items: flex-start; gap: 8px; position: sticky; top: -8px; background: var(--bg); padding: 6px 0 10px; z-index: 2; }
.sheet__head .h2 { flex: 1; padding-top: 10px; font: 500 20px/1.3 var(--f-slab); }
.sheet .section { margin-top: 18px; }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* Formulários */
.field { display: grid; gap: 6px; margin-top: 14px; }
.field label, .field legend { font-weight: 500; font-size: 15px; }
.field select, .field textarea, .field input[type="text"] { min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
.field textarea { min-height: 96px; resize: vertical; }
.field .err { color: var(--crit); font-size: 14px; display: flex; gap: 6px; align-items: center; }
.field [aria-invalid="true"] { border-color: var(--crit); border-width: 2px; }
.field .help { font-size: 13px; color: var(--ink-3); }
fieldset.field { border: 0; padding: 0; margin: 14px 0 0; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); }
.opt:has(input:checked) { border: 2px solid var(--brand); padding: 7px 13px; }
:root[data-theme="dark"] .opt:has(input:checked) { border-color: #5BAE70; }
.opt small { display: block; color: var(--ink-3); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* Chamada simulada */
.call { text-align: center; padding: 18px 0 6px; }
.call__ring { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.call__ring .i { width: 34px; height: 34px; }
.call--live .call__ring { animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(11,106,106,.35); } 100% { box-shadow: 0 0 0 18px rgba(11,106,106,0); } }

/* Toast */
.toast-zone { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: 100%; padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: 15px; animation: rise .22s ease-out; }
.toast .i { color: #7FE0A0; }
:root[data-theme="dark"] .toast .i { color: var(--ok); }
.toast span { flex: 1; }
.toast button { min-height: 44px; padding: 0 12px; background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Esqueleto de carregamento */
.skel { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Vazio */
.empty { text-align: center; padding: 34px 20px; }
.empty .i { width: 40px; height: 40px; color: var(--ok); margin-bottom: 10px; }
.empty p { color: var(--ink-2); max-width: 36ch; margin: 6px auto 0; }

.shortcuts { display: grid; grid-template-columns: 1fr; gap: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.kv:first-child { border-top: 0; }
.kv span:first-child { color: var(--ink-2); }
.kv b { font-weight: 500; text-align: right; }
.note { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-top: 10px; border: 1px solid var(--line); }
.grid2 { display: grid; gap: 12px; }
.past-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--line-strong); font-size: 14px; color: var(--ink-2); margin-bottom: 14px; }

/* ---------- Telas largas ---------- */
@media (min-width: 720px) {
  .main { padding: 24px 28px 36px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .cams { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; gap: 16px; }
  .alerts--wide { grid-template-columns: 1fr 1fr; }
  .sheet { left: auto; top: 0; bottom: 0; width: min(480px, 100%); max-height: none; border-radius: 20px 0 0 20px; animation: slidein .26s cubic-bezier(.2,.8,.2,1); }
  .sheet__grab { display: none; }
  @keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}

@media (min-width: 1024px) {
  .shell { padding-bottom: 0; margin-left: 232px; }
  .tabbar { display: none; }
  .toast-zone { bottom: 20px; left: 252px; }
  .rail { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--brand-deep); color: #fff; padding: 18px 12px; z-index: 25; }
  .rail__brand { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px 22px; }
  .rail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .rail__list a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px; color: #D8E8DC; text-decoration: none; font-weight: 500; font-size: 15px; }
  .rail__list a:hover { background: rgba(255,255,255,.07); }
  .rail__list a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
  .rail__list a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-accent); }
  .rail__list .badge { position: static; margin-left: auto; border: 0; }
  .rail__list .sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 12px; }
  .rail :focus-visible { outline-color: #fff; }
  .rail__sig { margin-top: auto; padding: 12px; font: 400 13px/1.4 var(--f-slab); color: #A9C7B2; }
  .top { padding: 12px 28px; }
  .top__brand { display: none; }
  .top__more { display: none; }
  .top__row { position: absolute; right: 28px; top: 12px; min-height: 44px; }
  .top__ctx { margin-top: 0; padding-right: 220px; }

  .today { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px 24px; align-items: start; }
  .today__left, .today__right { min-width: 0; }
  .today .section:first-child { margin-top: 0; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(odd) { border-right: 0; }
  .kpi { border-right: 1px solid var(--line); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(-n+3) { border-top: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpi:nth-child(3) { border-top: 0; }
  .cams { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .brief { font-size: 24px; max-width: 40ch; }
  .h1 { font-size: 30px; }
}
@media (min-width: 1024px) and (max-width: 1199px) { .cams { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .st, .dock, .kpi, .btn { border: 1px solid CanvasText; }
}

/* Barras horizontais e barra empilhada */
.hbars { display: grid; gap: 12px; }
.hbar__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; font-size: 14px; }
.hbar__label { color: var(--ink); line-height: 1.3; }
.hbar__label .meta { display: block; }
.hbar__val { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.hbar__val--hi { color: var(--crit); }
.hbar + .kv, .hbar + .hbar { margin-top: 10px; }
.stack__bar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; }
.stack__seg { min-width: 4px; }
.stack__legend { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.stack__legend li { display: flex; align-items: center; gap: 8px; }
.stack__legend i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.stack__legend span { flex: 1; color: var(--ink-2); }
.stack__legend b { font-weight: 500; font-variant-numeric: tabular-nums; }
details.tbl-toggle summary { list-style: none; }
details.tbl-toggle summary::-webkit-details-marker { display: none; }

/* Ajustes da 1ª autocrítica (prints 390/1280) */
.wide { display: none; }
@media (min-width: 600px) { .wide { display: inline; } }
.ctx-theme { display: none; }
@media (min-width: 1024px) { .ctx-theme { display: inline-flex; } }
.top__site { white-space: nowrap; }
.icon-btn { flex: none; }
.wordmark { display: inline-block; align-self: flex-start; }
h1[tabindex="-1"]:focus { outline: none; }
.kpi__meta { font-size: 13px; color: var(--ink-3); line-height: 1.3; }
.kpi__foot { justify-content: flex-start; padding-top: 6px; }
.kpi { min-height: 132px; }
.stat__val small { white-space: nowrap; }
.meter { overflow: visible; }
.meter > span { border-radius: 5px; }
.alert__link { display: flex; align-items: center; min-height: 44px; text-decoration: none; margin: -6px 0; }
.alert__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.sheet h2:focus { outline: none; }
.dock { text-decoration: none; }
.dock span { overflow-wrap: anywhere; }
.kv--ev b { font-weight: 400; text-align: left; flex: 1; display: flex; gap: 6px; align-items: flex-start; }
.kv--ev span { flex: none; width: 5.5em; }
.today .p1 { margin-top: 0; margin-bottom: 14px; }
.p1-more { margin-top: -6px; margin-bottom: 14px; }
.hello { font: 500 14px/1.3 var(--f-sans, Roboto, sans-serif); color: var(--ink-2, inherit); margin: 0 0 4px; }
