/* Quadro D.A.V.I. — estilos
   Mesmo sistema visual dos artifacts originais (IBM Plex, azul de destaque, cores por estado),
   com tema claro e escuro. Fontes servidas pela própria aplicação. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fontes/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fontes/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fontes/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 600; font-display: swap; src: url("/fontes/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 700; font-display: swap; src: url("/fontes/ibm-plex-sans-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/fontes/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fontes/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #F2F5F9;
  --surface: #FFFFFF;
  --surface-2: #E9EEF5;
  --sunken: #F6F8FB;
  --ink: #152033;
  --muted: #566377;
  --line: #D5DCE7;
  --line-map: #C6D0DC;
  --line-strong: #7F90A6;
  --accent: #1B55B8;
  --accent-ink: #FFFFFF;
  --ok: #17794A;    --ok-bg: #E2F3EA;
  --demo: #8A5A00;  --demo-bg: #FBEFD3;
  --run: #1B55B8;   --run-bg: #E2EBFA;
  --todo: #4A5668;  --todo-bg: #E7EBF1;
  --block: #B3342D; --block-bg: #FBE4E2;
  --shadow: 0 10px 30px rgba(21, 32, 51, 0.16), 0 2px 6px rgba(21, 32, 51, 0.08);
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --z-topo: 20;
  --z-toast: 30;
  --z-dialogo: 50;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1520; --surface: #161F2D; --surface-2: #1D2839; --sunken: #111925; --ink: #E7EDF5; --muted: #9AA7BA; --line: #2B374A;
    --line-map: #2E3B4F; --line-strong: #6C7D94;
    --accent: #7FAEFF; --accent-ink: #0E1520;
    --ok: #5FD39A;    --ok-bg: #12301F;
    --demo: #F0BD5A;  --demo-bg: #3A2C0C;
    --run: #7FAEFF;   --run-bg: #14294D;
    --todo: #A9B4C4;  --todo-bg: #232D3C;
    --block: #FF8F88; --block-bg: #3E1A19;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1520; --surface: #161F2D; --surface-2: #1D2839; --sunken: #111925; --ink: #E7EDF5; --muted: #9AA7BA; --line: #2B374A;
  --line-map: #2E3B4F; --line-strong: #6C7D94;
  --accent: #7FAEFF; --accent-ink: #0E1520;
  --ok: #5FD39A;    --ok-bg: #12301F;
  --demo: #F0BD5A;  --demo-bg: #3A2C0C;
  --run: #7FAEFF;   --run-bg: #14294D;
  --todo: #A9B4C4;  --todo-bg: #232D3C;
  --block: #FF8F88; --block-bg: #3E1A19;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
}
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- topo */
.topo {
  position: sticky; top: 0; z-index: var(--z-topo);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  padding-top: max(8px, env(safe-area-inset-top, 0px));
}
.topo-in { max-width: 1500px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.marca { font-family: var(--font-head); font-weight: 700; font-size: 17px; white-space: nowrap; margin-right: 4px; }
.nav { display: flex; gap: 2px; order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .nav { order: 0; flex-basis: auto; } }
.nav-b {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px 9px;
  cursor: pointer; font-weight: 500; color: var(--muted); white-space: nowrap; min-height: 40px;
}
.nav-b:hover { color: var(--ink); }
.nav-b[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.topo-dir { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.pessoas { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pessoa {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 2px 9px 2px 2px; font-size: 12.5px; max-width: 160px; min-width: 0;
}
.pessoa .av {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--cor, var(--accent)); color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
}
.pessoa .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pessoa.eu { border-color: var(--line-strong); }
.pessoas .mais { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
@media (max-width: 640px) {
  .pessoa { padding: 2px; }
  .pessoa .nm { display: none; }
}
.ligacao { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ligacao::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--demo); }
.ligacao[data-estado="ligado"]::before { background: var(--ok); }
.ligacao[data-estado="desligado"]::before { background: var(--block); }
@media (max-width: 640px) { .ligacao .txt { display: none; } }
.ibtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.ibtn:hover { border-color: var(--line-strong); }

/* ------------------------------------------------------------ páginas */
.pagina {
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.wrap { max-width: 1480px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wrap.mapa-w { max-width: 1500px; gap: 14px; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: 30px; line-height: 1.1; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); margin: 4px 0 0; max-width: 72ch; }
.upd { margin: 6px 0 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.upd strong { color: var(--ink); font-weight: 500; }
.carregar { color: var(--muted); padding: 40px 0; text-align: center; }

.warn {
  background: var(--demo-bg); color: var(--demo);
  border: 1px solid var(--demo); border-radius: 8px;
  padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start;
}
.warn.info { background: var(--run-bg); color: var(--run); border-color: var(--run); }
.warn.erro { background: var(--block-bg); color: var(--block); border-color: var(--block); }
.warn p { margin: 0; max-width: 90ch; }
.warn svg { flex: none; margin-top: 2px; }

/* ------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 12px; min-height: 32px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primario:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--block); color: var(--block); }
.btn.icon { width: 34px; padding: 0; font-size: 18px; line-height: 1; min-height: 34px; }
@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .ibtn { transition: border-color .15s ease-out, background-color .15s ease-out; }
  .btn:active, .ibtn:active, .chip:active { transform: scale(0.97); }
}
@media (pointer: coarse) {
  .btn, .sel, .chip { min-height: 40px; }
  .ibtn { width: 42px; height: 42px; }
}

/* ============================================================== KANBAN */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tile .num { font-family: var(--font-head); font-weight: 700; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .lbl { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tile[data-k="concluido"] .num { color: var(--ok); }
.tile[data-k="demo"] .num { color: var(--demo); }
.tile[data-k="curso"] .num { color: var(--run); }
.tile[data-k="fazer"] .num { color: var(--todo); }
.tile[data-k="bloqueado"] .num { color: var(--block); }
.tile.total .num { color: var(--ink); }

.bar { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 11px; cursor: pointer; font-size: 13px; min-height: 30px;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .cnt { font-variant-numeric: tabular-nums; opacity: .75; margin-left: 4px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tools label { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.sel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-height: 32px; }
.status { color: var(--muted); font-size: 12.5px; margin-left: auto; min-width: 0; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 12px; align-items: start; }
@media (min-width: 1180px) { .board { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.col { background: var(--surface-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 120px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.col-head h2 { font-family: var(--font-head); font-size: 16px; margin: 0; flex: 1; min-width: 0; }
.col-head .cnt-col { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; padding: 1px 8px; border-radius: 999px; }
.col-head .mais { width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent; background: none; cursor: pointer; display: inline-grid; place-items: center; color: var(--muted); }
.col-head .mais:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
@media (pointer: coarse) { .col-head .mais { width: 40px; height: 40px; } }
.col[data-k="concluido"] .cnt-col { background: var(--ok-bg); color: var(--ok); }
.col[data-k="demo"] .cnt-col { background: var(--demo-bg); color: var(--demo); }
.col[data-k="curso"] .cnt-col { background: var(--run-bg); color: var(--run); }
.col[data-k="fazer"] .cnt-col { background: var(--todo-bg); color: var(--todo); }
.col[data-k="bloqueado"] .cnt-col { background: var(--block-bg); color: var(--block); }
.col-hint { color: var(--muted); font-size: 12px; margin: -6px 2px 2px; }
.lane { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 8px 2px 0; font-weight: 600; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 4px; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; display: flex; flex-direction: column; gap: 7px; min-width: 0; position: relative; }
.card[draggable="true"] { cursor: grab; }
.card.drag { opacity: .45; }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.card p { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.card.editando { border-color: var(--cor, var(--accent)); box-shadow: 0 0 0 1px var(--cor, var(--accent)); }
.card.novo { animation: realce 1.6s ease-out; }
@keyframes realce { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .card.novo { animation: none; } }
.quem-edita {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  color: #fff; background: var(--cor, var(--accent)); border-radius: 4px; padding: 1px 7px;
}
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11.5px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.tag.fase { color: var(--ink); }
.tag.dep { color: var(--block); border-color: var(--block); }
.tag.feito { color: var(--ok); border-color: var(--ok); }
.meta { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-width: 0; flex-wrap: wrap; }
.ref { font-family: var(--font-mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.acoes-card { display: flex; align-items: center; gap: 6px; }
.move { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.move .sel { padding: 3px 6px; min-height: 28px; font-size: 12.5px; max-width: 150px; }
.editar-b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted); }
.editar-b:hover { color: var(--ink); border-color: var(--line-strong); }
@media (pointer: coarse) { .move .sel { min-height: 40px; } .editar-b { width: 40px; height: 40px; } }
.foot { color: var(--muted); font-size: 12.5px; max-width: 90ch; }
@media (prefers-reduced-motion: no-preference) { .card { transition: border-color .15s; } .card:hover { border-color: var(--muted); } }

/* ========================================================== MAPA MENTAL */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-map); flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; cursor: pointer; font-weight: 500; color: var(--muted); margin-bottom: -1px; min-height: 40px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .btn { min-height: 34px; }
.summary { color: var(--muted); font-size: 13px; margin-left: auto; min-width: 0; }
.summary strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg svg { flex: none; }
.lg .lg-ramo { fill: var(--ink); }
.lg .lg-mais { fill: var(--surface); font-size: 14px; font-weight: 600; text-anchor: middle; font-family: var(--font-body); }
.lg .lg-linha { stroke: var(--line-strong); stroke-width: 2; fill: none; }
.lg .lg-actor { fill: var(--surface-2); stroke: var(--accent); stroke-width: 1.8; }
.lg .lg-dados { fill: var(--surface-2); stroke: var(--ink); stroke-width: 1.8; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 980px) { .stage { grid-template-columns: minmax(0, 1fr) 320px; } }
.canvas {
  position: relative; background: var(--surface); border: 1px solid var(--line-map); border-radius: 10px;
  height: clamp(400px, 70vh, 780px); overflow: hidden; min-width: 0;
}
.canvas svg.desenho { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.canvas svg.desenho.drag { cursor: grabbing; }
.hint { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 88%, transparent); padding: 2px 8px; border-radius: 4px; pointer-events: none; max-width: calc(100% - 20px); }
.panel { background: var(--surface); border: 1px solid var(--line-map); border-radius: 10px; padding: 14px 16px; min-width: 0; max-height: clamp(400px, 70vh, 780px); overflow: auto; }
@media (max-width: 979px) { .panel { max-height: none; } }
.panel h2 { font-family: var(--font-head); font-size: 20px; line-height: 1.15; margin: 0 0 8px; text-wrap: balance; overflow-wrap: anywhere; }
.panel p { margin: 0 0 10px; overflow-wrap: anywhere; }
.panel ul { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.panel .acoes { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.pill.c, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.p, .pill.todo { background: var(--demo-bg); color: var(--demo); }
.pill.b, .pill.block { background: var(--block-bg); color: var(--block); }
.pill.plan { background: var(--surface-2); color: var(--muted); }
.pill.now { background: var(--surface-2); color: var(--ink); }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 10px; margin: 0 0 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.counts span { border-radius: 999px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; margin: 0; }
.aviso-edicao { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #fff; background: var(--cor, var(--accent)); border-radius: 6px; padding: 4px 9px; margin: 0 0 10px; }

/* desenho */
svg.desenho text { font-family: var(--font-body); fill: var(--ink); }
.t-head { font-family: var(--font-head); font-weight: 700; }
svg.desenho .t-muted { fill: var(--muted); }
.edge { fill: none; stroke: var(--line-strong); stroke-width: 1.7; }
.edge.main { stroke-width: 3.2; }
.edge.plan { stroke-dasharray: 6 5; }
.edge.dim { stroke: var(--line-map); }
svg.desenho .elabel { font-size: 11.5px; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.mk path { fill: var(--line-strong); }
.hit { cursor: pointer; }
.hit:focus { outline: none; }
.hit:focus-visible rect.shape, .hit:focus-visible circle.shape { stroke: var(--accent); stroke-width: 3; }
.leaf rect.shape { stroke-width: 1.6; }
.leaf.c rect.shape { fill: var(--ok-bg); stroke: var(--ok); }
.leaf.p rect.shape { fill: var(--demo-bg); stroke: var(--demo); }
.leaf.b rect.shape { fill: var(--block-bg); stroke: var(--block); }
.leaf.sel rect.shape { stroke-width: 3.2; }
svg.desenho .leaf .who { font-size: 11px; font-weight: 600; fill: var(--block); }
svg.desenho .leaf.p .who { fill: var(--demo); }
.leaf rect.edita { fill: none; stroke-width: 2.4; stroke-dasharray: 5 3; }
svg.desenho .etiqueta text { fill: #fff; font-size: 10.5px; font-weight: 600; }
.ic-ok { fill: var(--ok); } .ic-todo { stroke: var(--demo); fill: none; stroke-width: 1.8; } .ic-todo-f { fill: var(--demo); } .ic-block { fill: var(--block); }
.ic-w { stroke: var(--surface); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-wf { fill: var(--surface); }
.branch rect.shape { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.branch.sel rect.shape { stroke: var(--accent); stroke-width: 3.2; }
.branch .tg { fill: var(--ink); stroke: none; }
svg.desenho .branch .tgt { fill: var(--surface); font-size: 17px; font-weight: 600; text-anchor: middle; }
.center circle.shape { fill: var(--accent); stroke: none; }
svg.desenho .center text { fill: var(--accent-ink); text-anchor: middle; }
.no rect.shape { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.6; }
.no.actor rect.shape { stroke: var(--accent); stroke-width: 2; fill: var(--surface-2); }
.no.dados rect.shape { stroke: var(--ink); stroke-width: 2; fill: var(--surface-2); }
.no.plan rect.shape { stroke-dasharray: 6 5; fill: var(--surface); }
.no.sel rect.shape { stroke: var(--accent); stroke-width: 3.2; }
.no.group rect.shape { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.4; }
.no.group.plan rect.shape { stroke-dasharray: 6 5; }
svg.desenho .no.group text.gt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
svg.desenho .coltitle { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .leaf, .branch { animation: pop .18s ease-out; } @keyframes pop { from { opacity: 0; } to { opacity: 1; } } }

/* ============================================================= HISTÓRICO */
.filtros { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.filtros label { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.filtros input[type="search"] { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; min-height: 32px; min-width: 0; width: 220px; max-width: 100%; }
.dia { font-family: var(--font-head); font-size: 15px; font-weight: 600; margin: 10px 0 0; color: var(--muted); }
.lista-hist { display: flex; flex-direction: column; gap: 8px; }
.alt { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; }
.alt.conf { border-color: var(--demo); }
.alt .hora { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.alt .frase { margin: 0; overflow-wrap: anywhere; }
.alt .frase strong { font-weight: 600; }
.alt .det { grid-column: 2 / 3; font-size: 13px; color: var(--muted); }
.alt .det summary { cursor: pointer; width: max-content; max-width: 100%; }
.alt .det summary:hover { color: var(--ink); }
.alt .lado { grid-column: 3; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.alt .badges { display: flex; gap: 5px; flex-wrap: wrap; grid-column: 2; }
.badge { font-size: 11.5px; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.conf { color: var(--demo); border-color: var(--demo); background: var(--demo-bg); white-space: normal; }
.badge.rep { color: var(--run); border-color: var(--run); }
.difs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 2px; }
.difs dt { color: var(--muted); }
.difs dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.difs del { color: var(--block); text-decoration-thickness: 1px; }
.difs ins { color: var(--ok); text-decoration: none; }
@media (max-width: 640px) {
  .alt { grid-template-columns: minmax(0, 1fr); }
  .alt .hora, .alt .det, .alt .badges { grid-column: 1; }
  .alt .lado { grid-column: 1; grid-row: auto; align-items: flex-start; }
}

/* ============================================================ DIÁLOGO */
dialog.editor {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow);
}
dialog.editor::backdrop { background: rgba(14, 21, 32, 0.45); }
@media (prefers-reduced-motion: no-preference) {
  dialog.editor[open] { animation: entrar .18s cubic-bezier(.2, .8, .2, 1); }
  @keyframes entrar { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
}
.form { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 16px; }
.form h2 { font-family: var(--font-head); font-size: 22px; margin: 0; line-height: 1.15; }
.form .campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form .campo > span { font-size: 13px; font-weight: 500; }
.form .campo small { color: var(--muted); font-size: 12px; }
.form input[type="text"], .form input[type="password"], .form textarea, .form select {
  background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 40px; width: 100%;
}
.form input:focus-visible, .form textarea:focus-visible, .form select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.form .grelha { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.form .erro-campo { color: var(--block); font-size: 12.5px; margin: 0; }
.form .rodape { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2px; }
.form .rodape .esq { margin-right: auto; }
.form .meta-reg { color: var(--muted); font-size: 12px; margin: -6px 0 0; }
@media (max-width: 560px) {
  dialog.editor { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
}

/* ============================================================== AVISOS */
.toasts { position: fixed; z-index: var(--z-toast); right: 16px; bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--cor, var(--accent)); border-radius: 8px; padding: 9px 12px; box-shadow: var(--shadow); font-size: 13px; pointer-events: auto; overflow-wrap: anywhere; }
.toast.erro { border-left-color: var(--block); }
.toast.conf { border-left-color: var(--demo); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: subir .2s ease-out; }
  @keyframes subir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* ============================================================== ENTRAR */
.entrar-pag { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.entrar-caixa { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.entrar-caixa h1 { font-size: 28px; }
.entrar-caixa .sub { margin: 0; }
.entrar-caixa .form { padding: 0; }
.entrar-caixa .btn.primario { min-height: 44px; font-size: 15px; }
.entrar-caixa .nota-seg { color: var(--muted); font-size: 12.5px; margin: 0; }
