/* Controle de Protocolos | Elecnor Brasil — tokens, temas, layout e componentes */

:root,
[data-theme="executivo-claro"] {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #d9e0e8;
  --text: #1d2633;
  --muted: #566273;
  --primary: #04508c;
  --primary-strong: #033c69;
  --primary-soft: #e5edf6;
  --on-primary: #ffffff;
  --accent: #eb7604;
  --accent-soft: #fdefe0;
  --ok: #1a7a39;
  --ok-soft: #e3f3e8;
  --warn: #8f5400;
  --warn-soft: #fff2da;
  --danger: #b3261e;
  --danger-soft: #fbe8e6;
  --review: #6a3e9f;
  --review-soft: #f0e9fa;
  --na: #566273;
  --na-soft: #edf0f3;
  --chart-done: #04508c;
  --chart-pending: #c8d2de;
  --chart-progress: #eb7604;
  --chart-grid: #e4e9ef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 6px rgba(16, 24, 40, .06);
  --focus: 0 0 0 3px rgba(4, 80, 140, .35);
  --logo-dark: inline-block;
  --logo-light: none;
  color-scheme: light;
}

[data-theme="azul-profundo"] {
  --bg: #062b4c;
  --surface: #0b3961;
  --surface-2: #0e426f;
  --border: #215d90;
  --text: #f1f6fb;
  --muted: #b9cadc;
  --primary: #72b6ee;
  --primary-strong: #a3d0f5;
  --primary-soft: #154f82;
  --on-primary: #05233f;
  --accent: #f5922f;
  --accent-soft: #4a3720;
  --ok: #6fd28f;
  --ok-soft: #14472f;
  --warn: #ffc76b;
  --warn-soft: #4a3b1a;
  --danger: #ff8f86;
  --danger-soft: #4d2228;
  --review: #c9a6f5;
  --review-soft: #3b2a5a;
  --na: #b9cadc;
  --na-soft: #1c4a72;
  --chart-done: #72b6ee;
  --chart-pending: #2c5f8f;
  --chart-progress: #f5922f;
  --chart-grid: #1f5383;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .2);
  --focus: 0 0 0 3px rgba(114, 182, 238, .5);
  --logo-dark: none;
  --logo-light: inline-block;
  color-scheme: dark;
}

[data-theme="grafite"] {
  --bg: #1b1f25;
  --surface: #252a32;
  --surface-2: #2c323b;
  --border: #3b424d;
  --text: #eceff3;
  --muted: #aab3bf;
  --primary: #5ea9e8;
  --primary-strong: #8cc3f0;
  --primary-soft: #23384d;
  --on-primary: #0f151b;
  --accent: #f08b25;
  --accent-soft: #3d2e1e;
  --ok: #6cc788;
  --ok-soft: #1f3a2a;
  --warn: #f3bd5e;
  --warn-soft: #3d331d;
  --danger: #f2877e;
  --danger-soft: #42262a;
  --review: #c0a1ee;
  --review-soft: #352b47;
  --na: #aab3bf;
  --na-soft: #303740;
  --chart-done: #5ea9e8;
  --chart-pending: #48515d;
  --chart-progress: #f08b25;
  --chart-grid: #353c46;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
  --focus: 0 0 0 3px rgba(94, 169, 232, .5);
  --logo-dark: none;
  --logo-light: inline-block;
  color-scheme: dark;
}

[data-theme="alto-contraste"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #000000;
  --text: #000000;
  --muted: #1a1a1a;
  --primary: #002d59;
  --primary-strong: #001a33;
  --primary-soft: #d6e4f3;
  --on-primary: #ffffff;
  --accent: #a34700;
  --accent-soft: #ffe7d1;
  --ok: #00561f;
  --ok-soft: #d8f0df;
  --warn: #6b3d00;
  --warn-soft: #ffeac2;
  --danger: #8a0f08;
  --danger-soft: #ffdcd8;
  --review: #4b1d82;
  --review-soft: #ebdcff;
  --na: #1a1a1a;
  --na-soft: #e6e6e6;
  --chart-done: #002d59;
  --chart-pending: #9a9a9a;
  --chart-progress: #a34700;
  --chart-grid: #bdbdbd;
  --shadow: none;
  --focus: 0 0 0 3px #000000;
  --logo-dark: inline-block;
  --logo-light: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", Inter, system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--primary); margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[data-theme="alto-contraste"] :focus-visible { outline: 3px solid #000; outline-offset: 2px; box-shadow: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* Ícones (todos os SVG gerados por icon()) */
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.drop svg.i, .empty svg.i { width: 46px; height: 46px; stroke: var(--primary); stroke-width: 1.5; }
.card-head svg.i { color: var(--primary); }

/* Logo por tema */
.logo-dark { display: var(--logo-dark); }
.logo-light { display: var(--logo-light); }

/* Botões (alvo mínimo de 44 px) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1b1206; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: not-allowed; }
.btn svg, .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }

/* Formulários */
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  min-height: 44px; padding: 8px 12px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[readonly] { background: var(--surface-2); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--primary); }
.field-error { color: var(--danger); font-size: .85rem; }

/* Avisos */
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid; margin: 0 0 12px; }
.notice.info { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.notice.success { background: var(--ok-soft); border-color: var(--ok); }
.notice.warning { background: var(--warn-soft); border-color: var(--warn); }
.notice.danger { background: var(--danger-soft); border-color: var(--danger); }

/* Chips de estado: ícone + texto, nunca só cor */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.st-CONCLUIDA { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.st-EM_EXECUCAO { background: var(--accent-soft); color: var(--warn); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.st-NAO_INICIADA { background: var(--na-soft); color: var(--muted); }
.st-BLOQUEADA { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.st-NAO_APLICAVEL { background: transparent; color: var(--na); border: 1px dashed var(--na); }
.st-EM_REVISAO { background: var(--review-soft); color: var(--review); border-color: color-mix(in srgb, var(--review) 35%, transparent); }
.sev-ALTA { background: var(--danger-soft); color: var(--danger); }
.sev-MEDIA { background: var(--warn-soft); color: var(--warn); }
.sev-INFO { background: var(--primary-soft); color: var(--primary); }

/* Páginas públicas */
.public-wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.public-card { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.public-card.wide { width: min(760px, 100%); }
.public-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 3px solid var(--accent); }
.public-head .muted { margin: 0; }
.public-foot { color: var(--muted); font-size: .85rem; text-align: center; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.checklist li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.legal h2 { margin-top: 1.1rem; }

/* Casca da aplicação */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 60%); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand .logo { height: 34px; width: auto; }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: .98rem; white-space: nowrap; }
.brand-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-right form { margin: 0; }
.user-chip { display: grid; text-align: right; line-height: 1.15; font-weight: 600; font-size: .9rem; }
.user-chip small { color: var(--muted); font-weight: 500; }
.nav-toggle { display: none; }
.sidenav {
  position: fixed; top: 56px; bottom: 0; left: 0; width: 212px; z-index: 20; overflow-y: auto; padding: 12px 10px;
  background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-weight: 600; transition: background-color .15s ease, color .15s ease;
}
.sidenav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 3px 0 0 var(--accent); }
.sidenav .nav-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.main { margin: 56px 0 0 212px; height: calc(100vh - 56px); overflow: auto; padding: 16px 20px; }
.main:focus { outline: none; }
.view { animation: view-in .2s ease; height: 100%; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.page-head select { width: auto; min-height: 38px; padding: 4px 10px; font-size: .9rem; }
.boot-loader { display: flex; gap: 12px; align-items: center; justify-content: center; height: 60vh; color: var(--muted); }

/* Cartões e grade */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-head .spacer { flex: 1; }
.card-note { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }
.grid { display: grid; gap: 12px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { position: relative; overflow: hidden; padding: 12px 14px; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); }
.kpi.accent::before { background: var(--accent); }
.kpi.alert::before { background: var(--danger); }
.kpi .k-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi .k-value { font-size: 1.75rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .82rem; color: var(--muted); }

/* Painel: cabe em 1366x768 sem rolar a página */
.dash { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; min-height: 560px; }
.dash .page-head { margin-bottom: 6px; flex-wrap: nowrap; }
.dash .page-head .updated { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.dash .kpi .k-label { text-transform: none; letter-spacing: 0; font-size: .84rem; }
.dash .page-head h1 { font-size: 1.22rem; }
.dash .kpis { margin-bottom: 10px; }
.dash .kpi { padding: 9px 12px; }
.dash .kpi .k-value { font-size: 1.5rem; }
.dash .card { padding: 10px 14px; }
.dist { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px; align-items: center; flex: 1; min-height: 0; }
.dist .chart-box { min-height: 120px; height: 100%; }
.dist .mini-list { font-size: .8rem; gap: 3px; }
.dist .mini-list li { padding-bottom: 2px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filters select, .filters input { min-height: 38px; width: auto; padding: 4px 10px; font-size: .9rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 38px; padding: 0 12px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; border-right: 1px solid var(--border); transition: background-color .15s ease; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; min-height: 0; }
.dash-grid .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dash-grid .chart-box { min-height: 0; }
.chart-box { position: relative; flex: 1; min-height: 140px; }
.chart-box canvas { position: absolute; inset: 0; }
.phase-list { display: grid; gap: 10px; align-content: space-evenly; flex: 1; }
.phase-row .ph-top { display: flex; justify-content: space-between; font-weight: 600; font-size: .92rem; }
.bar { height: 12px; border-radius: 999px; background: var(--chart-pending); overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--chart-done); transition: width .22s ease; }
.bar.accent > span { background: var(--accent); }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; align-items: center; }
.rank .r-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .bar { grid-column: 1 / -1; height: 5px; margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; }
.two-col > div { min-height: 0; overflow: auto; }
.moves li { display: block; }
.moves li small { display: block; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .86rem; overflow: auto; }
.mini-list li { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* Torres (tela operacional) */
.ops { display: grid; grid-template-columns: 320px 1fr; gap: 12px; height: 100%; min-height: 0; }
.ops-side, .ops-main { min-height: 0; display: flex; flex-direction: column; }
.ops-side .card { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.tower-list { list-style: none; margin: 8px -6px 0; padding: 0; overflow-y: auto; flex: 1; }
.tower-list button {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; cursor: pointer; transition: background-color .12s ease;
}
.tower-list button:hover { background: var(--surface-2); }
.tower-list button[aria-current="true"] { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tower-list .t-code { font-weight: 800; font-size: 1.02rem; }
.tower-list .t-meta { color: var(--muted); font-size: .8rem; grid-column: 1; }
.tower-list .t-pct { font-weight: 700; font-variant-numeric: tabular-nums; align-self: center; grid-row: 1 / span 2; grid-column: 2; }
.tower-list .bar { grid-column: 1 / -1; height: 5px; margin: 4px 0 0; }
.search { position: relative; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.tower-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.tower-head .t-title { font-size: 1.6rem; font-weight: 800; }
.tower-head dl { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.tower-head dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.tower-head dd { margin: 0; font-weight: 700; }
.phase-strip { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 10px; margin: 10px 0 0; }
.next-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 600; }
.act-columns { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; flex: 1; min-height: 0; margin-top: 12px; }
.act-col { display: flex; flex-direction: column; min-height: 0; }
.act-col h3 { display: flex; justify-content: space-between; font-size: .95rem; margin: 0 0 6px; padding: 0 2px; }
.act-list { overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; padding: 2px; }
.act .chip { white-space: normal; text-align: right; justify-self: end; }
.act {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; text-align: left; width: 100%; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.act:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.act:active { transform: scale(.995); }
.act.is-next { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.act .a-name { font-weight: 700; font-size: .92rem; }
.act .a-sub { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.parts { display: inline-flex; gap: 3px; }
.parts b { min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font-size: .72rem; display: inline-grid; place-items: center; background: var(--na-soft); color: var(--muted); border: 1px solid var(--border); }
.parts b.done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.parts b.na { border-style: dashed; background: transparent; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; fill: none; stroke: var(--primary); stroke-width: 1.5; }

/* Painel lateral e modal */
.backdrop { position: fixed; inset: 0; background: rgba(9, 16, 26, .45); z-index: 60; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 61; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .18); display: flex; flex-direction: column; animation: slide-in .2s ease;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; }
.drawer-head .spacer { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px; display: grid; gap: 14px; align-content: start; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal {
  position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28); padding: 20px; animation: pop .18s ease;
}
.modal.wide { width: min(860px, calc(100% - 24px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.confirm-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0; }
.confirm-grid dt { color: var(--muted); font-weight: 600; }
.confirm-grid dd { margin: 0; font-weight: 700; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.comp-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.comp-card.done { border-color: var(--ok); background: var(--ok-soft); }
.comp-card.na { border-style: dashed; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { border-left: 3px solid var(--border); padding: 0 0 0 10px; font-size: .86rem; }
.timeline li.t-correct { border-color: var(--accent); }
.timeline li.t-launch { border-color: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Tabelas com cabeçalho fixo e rolagem própria */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-height: calc(100vh - 230px); }
table.table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .88rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { position: sticky; top: 0; background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); z-index: 1; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 8px; font-size: .9rem; }

/* Abas, etapas, cartões de contagem */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--primary); border-color: var(--accent); }
.count-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.count-card { text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s ease; }
.count-card:hover, .count-card[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 -3px 0 var(--accent); }
.count-card strong { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.count-card span { font-size: .8rem; color: var(--muted); }
.stepper { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; counter-reset: s; }
.stepper li { counter-increment: s; font-size: .72rem; font-weight: 700; color: var(--muted); text-align: center; padding-top: 30px; position: relative; }
.stepper li::before { content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--na-soft); border: 1px solid var(--border); }
.stepper li.done { color: var(--ok); }
.stepper li.done::before { content: "✓"; background: var(--ok-soft); border-color: var(--ok); }
.stepper li.current { color: var(--primary); }
.stepper li.current::before { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.progress { height: 10px; border-radius: 999px; background: var(--na-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s ease; }
.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 28px; text-align: center; display: grid; gap: 8px; justify-items: center; transition: border-color .15s ease, background-color .15s ease; }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }

/* Toast */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; width: min(380px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: toast-in .2s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--accent); }
.toast .spacer { flex: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Esqueletos e carregamento (traço laranja inspirado na logo) */
.skel { position: relative; overflow: hidden; background: var(--na-soft); border-radius: 8px; min-height: 14px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: shimmer 1.2s infinite; }
[data-theme="azul-profundo"] .skel::after, [data-theme="grafite"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.loader { display: inline-block; width: 46px; height: 18px; }
.loader svg { width: 100%; height: 100%; overflow: visible; }
.loader path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 60 140; animation: swoosh 1.1s cubic-bezier(.45, .05, .35, 1) infinite; }
@keyframes swoosh { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
.is-loading { pointer-events: none; }

/* Apresentação Gerencial (16:9, 1920x1080) */
.present { position: fixed; inset: 0; z-index: 80; background: #0b1622; display: flex; flex-direction: column; }
.present-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; background: #0f2236; color: #fff; }
.present-bar .spacer { flex: 1; }
.present-bar select { width: auto; min-height: 38px; padding: 4px 10px; }
.present-bar .btn { background: #fff; color: #0f2236; border-color: #fff; }
.present-bar .btn.accent { background: var(--accent); border-color: var(--accent); }
.present-stage { flex: 1; position: relative; overflow: hidden; }
.slide {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: center center;
  background: var(--bg); color: var(--text); padding: 36px 44px 28px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 20px; font-size: 20px;
}
.slide-head { display: flex; align-items: center; gap: 26px; border-bottom: 4px solid var(--accent); padding-bottom: 16px; }
.slide-head img { height: 76px; width: auto; }
.slide-head h1 { font-size: 40px; margin: 0; }
.slide-head .scope { margin-left: auto; text-align: right; font-size: 19px; color: var(--muted); line-height: 1.35; }
.slide-head .scope strong { color: var(--text); font-size: 22px; }
.slide .kpis { grid-template-columns: repeat(6, 1fr); gap: 16px; margin: 0; }
.slide .kpi { padding: 16px 20px; }
.slide .kpi .k-label { font-size: 15px; }
.slide .kpi .k-value { font-size: 46px; }
.slide .kpi .k-sub { font-size: 16px; }
.slide-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 16px; min-height: 0; }
.slide-grid .card { display: flex; flex-direction: column; min-height: 0; padding: 16px 20px; }
.slide-grid .card-head h3 { font-size: 22px; }
.slide .rank, .slide .mini-list, .slide .phase-row .ph-top { font-size: 18px; }
.slide .card-note, .slide .legend { font-size: 15px; }
.slide-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; border-top: 1px solid var(--border); padding-top: 10px; }
.slide-foot .tag { font-weight: 700; color: var(--accent); }

/* Responsivo */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash { height: auto; }
  .dash-grid { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: 250px; }
  .act-columns { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidenav { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 8px 0 24px rgba(0, 0, 0, .18); }
  .sidenav.open { transform: none; }
  .main { margin-left: 0; padding: 12px; height: auto; min-height: calc(100vh - 56px); overflow: visible; }
  .view { height: auto; }
  .brand-text small, .user-chip small { display: none; }
  .ops { grid-template-columns: 1fr; height: auto; }
  .ops-side .card { max-height: 420px; }
  .act-columns, .dash-grid, .two-col, .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper { grid-template-columns: repeat(5, 1fr); row-gap: 10px; }
  .table-wrap { max-height: none; }
}
@media (max-width: 520px) {
  .brand-text { display: none; }
  .user-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Impressão / PDF: A4 paisagem, só a apresentação */
@media print {
  @page { size: A4 landscape; margin: 6mm; }
  body * { visibility: hidden; }
  .present, .present * { visibility: visible; }
  .present { position: static; background: none; }
  .present-bar { display: none; }
  .present-stage { overflow: visible; }
  /* 1920 px x 0,56 ≈ 1075 px: cabe na largura útil do A4 paisagem (285 mm) */
  .slide { position: static; transform: none !important; zoom: .56; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .toasts, .topbar, .sidenav { display: none !important; }
}
