/* Painel da carga BDIT — sistema visual em DESIGN.md (paleta: EDP Brand Guidelines, março de 2023).
   Tokens semânticos no padrão shadcn (--background/--foreground/--card/--muted/--primary/--border/--destructive/--radius). */

:root {
  /* Paleta oficial EDP */
  --edp-marine: #212E3E; --edp-marine-2: #424D5B; --edp-marine-3: #646D78; --edp-marine-4: #90979F;
  --edp-slate: #7C9599; --edp-slate-2: #90A5A8; --edp-slate-3: #A3B5B8; --edp-slate-4: #BECACC;
  --edp-spruce: #143F47; --edp-seaweed: #225E66; --edp-seaweed-4: #91AFB3;
  --edp-cobalt: #263CC8; --edp-cobalt-2: #4759D0; --edp-cobalt-3: #7D8ADE; --edp-cobalt-4: #A8B1E9;
  --edp-violet: #6D32FF; --edp-violet-4: #C5ADFF;
  --edp-ice: #0CD3F8; --edp-electric: #28FF52;
  --edp-red: #E32C2C; --edp-red-tint: #EDD5D3; --edp-yellow: #F2FF00; --edp-yellow-tint: #FFFFA2;
  --edp-black: #222222; --edp-white: #FFFFFF;

  /* Tema claro (padrão) */
  --background: #FFFFFF;
  --surface: #F6F8F9;
  --foreground: #222222;
  --card: #FFFFFF;
  --muted: #EEF2F3;
  --muted-foreground: #646D78;
  --secondary-foreground: #424D5B;
  --primary: #263CC8;
  --primary-hover: #1F33A9;
  --primary-foreground: #FFFFFF;
  --primary-ring: rgba(38, 60, 200, 0.18);
  --border: #DEE4E6;
  --border-strong: #C9D2D5;
  --row-border: #EEF1F3;
  --ring: #263CC8;
  --brand: #212E3E;
  --brand-foreground: #FFFFFF;
  --brand-muted: #BECACC;
  --brand-accent: #28FF52;
  --brand-accent-2: #0CD3F8;
  --ok: #225E66;            --ok-tint: #DCE5E7;
  --info: #263CC8;          --info-tint: #E5E8F8;
  --warning: #222222;       --warning-tint: #FFFFA2;
  --destructive: #E32C2C;   --destructive-tint: #EDD5D3; --destructive-text: #222222;
  --review: #6D32FF;        --review-tint: #EEE6FF;
  --neutral: #424D5B;       --neutral-tint: #EEF2F3;
  --meter-track: #D4D8F4;
  --meter-progress: #7D8ADE;
  --overlay: rgba(33, 46, 62, 0.45);
  --shadow-sm: 0 1px 2px rgba(33, 46, 62, 0.06);
  --shadow-md: 0 6px 20px rgba(33, 46, 62, 0.10);
  --radius: 8px;
  --radius-sm: 6px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --background: #1A2432; --surface: #1F2A38; --foreground: #FFFFFF; --card: #212E3E; --muted: #2E3B4A; --muted-foreground: #A3B5B8;
  --secondary-foreground: #BECACC; --primary: #0CD3F8; --primary-hover: #3DDCF9; --primary-foreground: #222222; --primary-ring: rgba(12, 211, 248, 0.22);
  --border: #3A4756; --border-strong: #4A5867; --row-border: #2E3B4A; --ring: #0CD3F8; --brand: #16202B; --brand-muted: #A3B5B8;
  --ok: #28FF52; --ok-tint: #213F4C; --info: #6DE5FB; --info-tint: #233267; --warning: #F2FF00; --warning-tint: #55622E;
  --destructive: #EE8080; --destructive-tint: #5B2D39; --destructive-text: #FFFFFF; --review: #C5ADFF; --review-tint: #382F78;
  --neutral: #A3B5B8; --neutral-tint: #2E3B4A; --meter-track: #233267; --meter-progress: #4759D0;
  --overlay: rgba(0, 0, 0, 0.55); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4); color-scheme: dark;
}
/* O tema segue só o atributo data-theme (claro por padrão no HTML; o escuro é escolha do botão). */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--background); color: var(--foreground);
  font-family: "Mulish", "FT Base", Arial, sans-serif; font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.brand-inner, .nav-inner, main, .footer-inner { max-width: 1920px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }

/* cartão: superfície com borda e sombra curta (DESIGN.md › Shape) */
.now, .kpi, .flow li, .table-wrap, .chart, .log, .pend-group > .lead-sub + .table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* controles: botão, campo, seleção e interruptor partilham altura (36 px), raio e transição de cor */
.chip, .icon-button, .search, select, .nav a {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

/* ---------- barra da marca ---------- */
.brand { background: var(--brand); color: var(--brand-foreground); }
.brand-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.wordmark { color: var(--brand-foreground); text-decoration: none; font-weight: 700; font-size: 26px; letter-spacing: -0.03em; line-height: 1; padding-bottom: 3px; }
.brand-title { display: flex; flex-direction: column; line-height: 1.2; padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, 0.18); }
.brand-app { font-weight: 600; }
.brand-sub { font-size: 12px; color: var(--brand-muted); }
.brand-status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; padding: 6px 12px 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--edp-slate-2); flex: none; }
.live-dot[data-situacao="em_execucao"] { background: var(--brand-accent); animation: viva 2.4s ease-in-out infinite; }
.live-dot[data-situacao="concluida"] { background: var(--brand-accent); }
.live-dot[data-situacao="entre_rodadas"] { background: var(--brand-accent-2); }
.live-dot[data-situacao="sem_atividade"] { background: var(--edp-yellow); }
.live-text { font-weight: 600; white-space: nowrap; }
.live-meta { color: var(--brand-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes viva { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } .chip, .icon-button, .search, select, .nav a, .toggle input, .toggle input::after { transition: none; } }
.icon-button {
  background: transparent; border: 1px solid transparent; width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; color: inherit;
}
.brand .icon-button { border-color: rgba(255, 255, 255, 0.18); }
.brand .icon-button:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.35); }
main .icon-button, .drawer .icon-button { border-color: var(--border); background: var(--card); color: var(--secondary-foreground); }
main .icon-button:hover, .drawer .icon-button:hover { background: var(--surface); border-color: var(--border-strong); color: var(--foreground); }

/* ---------- navegação ---------- */
.nav { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.nav-inner { display: flex; gap: 4px; overflow-x: auto; }
.nav a {
  position: relative; display: inline-flex; align-items: center; height: 48px; padding: 0 14px; margin: 4px 0 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; text-decoration: none; color: var(--secondary-foreground);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.nav a:first-child { margin-left: -14px; }
.nav a:hover { color: var(--foreground); background: var(--surface); }
.nav a.is-active { color: var(--primary); }
.nav a.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); }

/* ---------- conteúdo ---------- */
main { padding-top: 28px; padding-bottom: 48px; }
.view-head { margin-bottom: 20px; }
.lead-sub { color: var(--secondary-foreground); max-width: 60ch; margin-top: 4px; }
.section-title { margin: 40px 0 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-head .section-title { margin-bottom: 12px; }
.section-link { font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.section-link:hover { text-decoration: underline; }
.aviso-conexao { background: var(--warning-tint); color: var(--warning); border: 1px solid rgba(34, 34, 34, 0.12); padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.empty { color: var(--muted-foreground); padding: 28px 16px; text-align: center; }

/* visão geral */
.overview-top { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 32px; align-items: start; }
.overview-lead { padding: 4px 0; }
.hero { margin: 24px 0 14px; display: flex; align-items: baseline; gap: 12px 16px; flex-wrap: wrap; }
.hero-figure { font-size: 56px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-of { color: var(--secondary-foreground); }
.hero-pct { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--secondary-foreground); font-variant-numeric: tabular-nums; }
.meter { display: flex; height: 12px; border-radius: 6px; background: var(--meter-track); overflow: hidden; }
.meter-fill { height: 100%; background: var(--primary); width: 0; }
.meter-fill + .meter-fill { margin-left: 2px; }
.meter-existente { background: var(--ok); }
.meter-andamento { background: var(--meter-progress); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 0; margin: 12px 0 0; font-size: 14px; color: var(--secondary-foreground); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--sw, var(--neutral)); flex: none; }
.legend b { font-weight: 600; color: var(--foreground); }
.now { padding: 18px 24px 22px; }
.now h2 { margin: 0 -24px 14px; padding: 0 24px 12px; border-bottom: 1px solid var(--border); }
.now-list { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.now-list dt { color: var(--muted-foreground); }
.now-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; max-width: 60ch; }
.now-list .big { font-size: 20px; font-weight: 600; line-height: 1.2; }
.now-list .log-inline { color: var(--secondary-foreground); }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.kpi { padding: 14px 16px 16px; }
.kpi-label { font-size: 14px; color: var(--muted-foreground); }
.kpi-value { font-size: 22px; font-weight: 600; margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; }
.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.flow li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 14px 16px 16px; }
.flow .icon { width: 22px; height: 22px; }
.flow .f-title { font-size: 14px; font-weight: 600; }
.flow .f-num { color: var(--muted-foreground); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; }
.flow .f-detail { font-size: 14px; color: var(--secondary-foreground); margin-top: 2px; overflow-wrap: anywhere; }
.flow .f-state { font-size: 12px; margin-top: 6px; font-weight: 600; }
.flow [data-estado="concluida"] .icon, .flow [data-estado="concluida"] .f-state { color: var(--ok); }
.flow [data-estado="em_andamento"] .icon, .flow [data-estado="em_andamento"] .f-state { color: var(--info); }
.flow [data-estado="pendente"] .icon, .flow [data-estado="pendente"] .f-state { color: var(--neutral); }
.flow [data-estado="indisponivel"] .icon, .flow [data-estado="indisponivel"] .f-state, .flow [data-estado="indisponivel"] .f-detail { color: var(--muted-foreground); }
.flow [data-estado="manual"] .icon, .flow [data-estado="manual"] .f-state { color: var(--review); }
.overview-bottom { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; }
.chart-sub { font-size: 14px; color: var(--muted-foreground); margin-bottom: 12px; max-width: 60ch; }
.chart { padding: 16px 16px 8px; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .bar { fill: var(--primary); }
.chart .bar:hover { fill: var(--primary-hover); }
.chart .axis text { font-size: 12px; fill: var(--muted-foreground); font-family: inherit; }
.chart .axis line { stroke: var(--border); }
.chart .label { font-size: 12px; fill: var(--secondary-foreground); font-family: inherit; }
.tooltip { position: fixed; z-index: 70; background: var(--foreground); color: var(--background); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px; pointer-events: none; max-width: 300px; box-shadow: var(--shadow-md); }

/* ---------- controles ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 0 12px; min-width: 320px; color: var(--muted-foreground); }
.search:hover { border-color: var(--border-strong); }
.search input { border: 0; background: transparent; font: inherit; font-size: 14px; padding: 0; width: 100%; color: var(--foreground); }
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.select-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--secondary-foreground); }
select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 14px; height: 36px; background: var(--card); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 0 36px 0 12px; max-width: 460px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23646D78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px 16px;
}
select:hover { border-color: var(--border-strong); }
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--secondary-foreground); cursor: pointer; user-select: none; }
.toggle input { appearance: none; -webkit-appearance: none; position: relative; width: 36px; height: 20px; margin: 0; border-radius: 999px; background: var(--border-strong); border: 0; cursor: pointer; flex: none; transition: background-color 150ms ease; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 150ms ease; }
.toggle input:checked { background: var(--primary); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle input:hover { filter: brightness(0.96); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--secondary-foreground); box-shadow: var(--shadow-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip:hover { color: var(--foreground); background: var(--surface); border-color: var(--border-strong); }
.chip:active { background: var(--muted); }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.chip.is-on:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.chip .n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--muted); color: var(--secondary-foreground); }
.chip.is-on .n { background: rgba(255, 255, 255, 0.22); color: var(--primary-foreground); }
:root[data-theme="dark"] .chip.is-on .n { background: rgba(0, 0, 0, 0.18); }

/* ---------- tabelas ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 240px); padding: 8px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: -8px; z-index: 1; text-align: left; font-size: 13px; font-weight: 700; color: var(--secondary-foreground); background: var(--card); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; vertical-align: top; border-bottom: 1px solid var(--row-border); }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 12px; }
.table th:last-child, .table td:last-child { padding-right: 12px; }
.table .texto { max-width: 46ch; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: var(--surface); }
.table tr.is-current td { background: var(--info-tint); }
.table-foot { font-size: 14px; color: var(--muted-foreground); margin-top: 10px; }
.table .sub { color: var(--muted-foreground); }
.table .nowrap { white-space: nowrap; }
.table .trunc { max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* estados */
.estado { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-tint); color: var(--neutral); }
.estado .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.estado.sem-icone { padding-left: 9px; }
.estado[data-estado="gravada"], .estado[data-estado="existente"], .estado[data-estado="concluida"], .estado[data-estado="OK"] { background: var(--ok-tint); color: var(--ok); }
.estado[data-estado="em_andamento"], .estado[data-estado="em_execucao"], .estado[data-estado="entre_rodadas"], .estado[data-estado="INFO"] { background: var(--info-tint); color: var(--info); }
.estado[data-estado="erro"], .estado[data-estado="bloqueada"], .estado[data-estado="bloqueado"], .estado[data-estado="ERRO"] { background: var(--destructive-tint); color: var(--destructive-text); }
.estado[data-estado="erro"] .icon, .estado[data-estado="bloqueada"] .icon, .estado[data-estado="bloqueado"] .icon, .estado[data-estado="ERRO"] .icon { color: var(--destructive); }
.estado[data-estado="a_confirmar"], .estado[data-estado="manual"] { background: var(--review-tint); color: var(--review); }
.estado[data-estado="sem_atividade"], .estado[data-estado="AVISO"] { background: var(--warning-tint); color: var(--warning); }
.flag { display: inline-block; margin-left: 8px; font-size: 12px; color: var(--review); }

/* registro */
.log { list-style: none; margin: 0; padding: 6px 0; max-height: calc(100vh - 300px); overflow: auto; font-size: 14px; }
.log li { display: grid; grid-template-columns: 70px 92px minmax(0, 1fr); gap: 12px; padding: 4px 16px; align-items: start; }
.log li:hover { background: var(--surface); }
.log li[data-nivel="AVISO"] { background: var(--warning-tint); }
.log li[data-nivel="ERRO"] { background: var(--destructive-tint); }
.log-hora { font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.log-texto { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100ch; }

/* pendências */
.pend-group { margin-bottom: 40px; }
.pend-group .lead-sub { margin-bottom: 12px; }
.pend-group h2 { display: flex; align-items: baseline; gap: 10px; }
.pend-group h2 .n { font-weight: 400; color: var(--muted-foreground); font-size: 14px; }
.seqs { color: var(--muted-foreground); }

/* painel lateral da torre */
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 39; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(680px, 100vw); background: var(--card); border-left: 1px solid var(--border); z-index: 40; display: flex; flex-direction: column; box-shadow: var(--shadow-md); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 20px; }
.drawer-sub { margin-top: 4px; color: var(--secondary-foreground); font-size: 14px; }
.drawer-body { overflow: auto; padding: 8px 24px 40px; }
.drawer-body h3 { font-size: 14px; font-weight: 700; color: var(--secondary-foreground); margin: 28px 0 8px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shots button { border: 1px solid var(--border); padding: 0; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm); transition: border-color 150ms ease, box-shadow 150ms ease; }
.shots button:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; display: block; }
.shots figure { margin: 0; }
.shots figcaption { font-size: 12px; padding: 6px 8px; color: var(--secondary-foreground); border-top: 1px solid var(--border); background: var(--card); }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { text-align: left; font-weight: 400; color: var(--muted-foreground); padding: 5px 12px 5px 0; width: 42%; vertical-align: top; }
.kv td { padding: 5px 0; overflow-wrap: anywhere; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--row-border); }
.tarefa { padding: 10px 0; font-size: 14px; }
.tarefa + .tarefa { border-top: 1px solid var(--row-border); }
.tarefa .sub { color: var(--muted-foreground); }

/* print ampliado */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(33, 46, 62, 0.92); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox figure { margin: 0; max-width: 100%; }
.lightbox img { max-width: 92vw; max-height: 84vh; display: block; border-radius: var(--radius-sm); background: #FFFFFF; }
.lightbox figcaption { color: #FFFFFF; font-size: 14px; text-align: center; margin-top: 10px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.3); }
.lightbox-close:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--foreground); font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { background: var(--surface); border-color: var(--border-strong); }
.btn:active { background: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--card); border-color: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-hover); }
.btn-primary:disabled:hover { background: var(--primary); border-color: var(--primary); }
.btn-danger { color: var(--destructive); border-color: var(--destructive); background: var(--card); }
.btn-danger:hover { background: var(--destructive-tint); border-color: var(--destructive); }
.btn-danger:disabled:hover { background: var(--card); border-color: var(--destructive); }
.btn-secondary { color: var(--secondary-foreground); }
.btn-block { width: 100%; }

/* ---------- operação ---------- */
.brand-user { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--brand-muted); white-space: nowrap; }
.brand-user .icon { width: 18px; height: 18px; }
.op-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.op-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 24px 22px; }
.op-card h2 { margin: 0 -24px 14px; padding: 0 24px 12px; border-bottom: 1px solid var(--border); }
.op-acoes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.op-msg { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; background: var(--ok-tint); color: var(--ok); }
.op-msg[data-tipo="erro"] { background: var(--destructive-tint); color: var(--destructive-text); }
.op-ajuda { margin: 0; font-size: 14px; }
.op-ajuda dt { font-weight: 600; margin-top: 12px; }
.op-ajuda dt:first-child { margin-top: 0; }
.op-ajuda dd { margin: 4px 0 0; color: var(--secondary-foreground); max-width: 60ch; }
.op-ajuda code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; background: var(--muted); padding: 1px 5px; border-radius: 4px; }

/* ---------- dúvidas do robô ---------- */
.duvidas { display: grid; gap: 16px; }
.duvida-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 24px 20px; }
.duvida-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.duvida-head h3 { font-size: 16px; font-weight: 700; }
.duvida-head h3 a { text-decoration: none; }
.duvida-head h3 a:hover { text-decoration: underline; }
.duvida-texto { margin-top: 8px; color: var(--secondary-foreground); max-width: 80ch; }
.nota { margin-top: 10px; font-size: 14px; color: var(--foreground); max-width: 80ch; padding: 10px 14px; background: var(--review-tint); border-radius: var(--radius-sm); }
.lista-gerais { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--destructive-text); }
.alts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.alt { display: block; position: relative; padding: 14px 16px 14px 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
.alt:hover { border-color: var(--border-strong); background: var(--surface); }
.alt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.alt.is-disabled { opacity: 0.6; cursor: not-allowed; }
.alt input[type="radio"] { position: absolute; left: 16px; top: 17px; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.alt-title { display: block; font-weight: 600; font-size: 14px; }
.alt-values { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; display: grid; gap: 2px; }
.alt-problema { color: var(--destructive-text); font-size: 13px; margin-top: 6px; }
.alt-outros { grid-column: 1 / -1; }
.campos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-top: 10px; }
.campo { display: block; font-size: 14px; color: var(--secondary-foreground); }
.campo > span { display: block; font-weight: 600; margin-bottom: 6px; }
.campo small { display: block; margin-top: 4px; font-size: 12px; color: var(--destructive-text); }
.campo select, .campo input, .motivo { width: 100%; max-width: none; }
.campo input, .motivo { height: 36px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--foreground); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); transition: border-color 150ms ease, box-shadow 150ms ease; }
.campo input:hover, .motivo:hover { border-color: var(--border-strong); }
.campo input:focus, .motivo:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.duvida-acoes { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.duvida-acoes .motivo { flex: 1 1 320px; }
.op-msg[data-tipo="aviso"] { background: var(--warning-tint); color: var(--warning); }
.muted { color: var(--muted-foreground); }
p.empty { padding: 20px 0; text-align: left; }

/* ---------- guia de operação, plano e planilha ---------- */
.guia { background: var(--info-tint); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.guia h2 { font-size: 14px; color: var(--secondary-foreground); margin-bottom: 4px; }
.guia p { max-width: 90ch; }
.guia .op-acoes { margin-top: 12px; }
.op-grid-3 { grid-template-columns: minmax(0, 3fr) minmax(0, 3fr) minmax(0, 2fr); }
.plan-itens { font-size: 14px; color: var(--secondary-foreground); margin-top: 12px; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.file-btn { cursor: pointer; }
.file-name { font-size: 14px; color: var(--secondary-foreground); }
.now-list code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- diálogo de confirmação ---------- */
.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--card); color: var(--foreground); box-shadow: var(--shadow-md); }
.dialog::backdrop { background: var(--overlay); }
.dialog-form { margin: 0; padding: 22px 24px 20px; }
.dialog-form h2 { font-size: 18px; margin-bottom: 8px; }
.dialog-form p { color: var(--secondary-foreground); font-size: 14px; max-width: 60ch; }
.dialog-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- entrada ---------- */
.login-page .login-main { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 28px 28px 24px; margin: 0; }
.login-card h1 { margin-bottom: 6px; }
.login-card .lead-sub { margin-bottom: 20px; font-size: 14px; }
.field { display: block; margin-bottom: 14px; font-size: 14px; color: var(--secondary-foreground); }
.field span { display: block; margin-bottom: 6px; font-weight: 600; }
.field input { width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 15px; color: var(--foreground); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); transition: border-color 150ms ease, box-shadow 150ms ease; }
.field input:hover { border-color: var(--border-strong); }
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.login-erro { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; background: var(--destructive-tint); color: var(--destructive-text); }
.login-card .btn-block { margin-top: 6px; }

/* ---------- rodapé ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 16px; padding-bottom: 16px; font-size: 12px; color: var(--muted-foreground); }
.footer b { font-weight: 600; color: var(--secondary-foreground); }

/* ---------- telas menores ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}
@media (max-width: 1024px) {
  .overview-top { grid-template-columns: 1fr; gap: 28px; }
  .op-grid, .op-grid-3 { grid-template-columns: 1fr; }
  .overview-bottom { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .brand-inner, .nav-inner, main, .footer-inner { padding-left: 16px; padding-right: 16px; }
  .brand-sub, .live-meta, .brand-user { display: none; }
  .brand-inner { gap: 12px; }
  .brand-title { padding-left: 12px; }
  .hero-figure { font-size: 44px; }
  .hero-pct { margin-left: 0; }
  .flow { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1 1 220px; }
  .log li { grid-template-columns: 64px minmax(0, 1fr); }
  .log .estado { display: none; }
  .shots { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .table-wrap { max-height: none; }
}
