/* ================= Mapa da Licitação — estilos ================= */
:root {
  --bg: #f4f1ea;
  --grid: rgba(70, 60, 40, .09);
  --panel: #ffffff;
  --ink: #1d2230;
  --muted: #5d6474;
  --line: #d9d3c6;
  --edge: #7b8191;
  --edge-soft: #b8bcc6;
  --hl: #e8590c;
  --shadow: 0 1px 2px rgba(20, 20, 30, .08), 0 4px 14px rgba(20, 20, 30, .07);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  /* famílias de nós */
  --c-proc: #475569;  --f-proc: #ffffff;
  --c-dec: #b7791f;   --f-dec: #fff6dc;
  --c-mod: #1d4ed8;   --f-mod: #eaf1ff;
  --c-crit: #15803d;  --f-crit: #e9f8ee;
  --c-modo: #0e7490;  --f-modo: #e5f6f9;
  --c-fase: #4f46e5;  --f-fase: #efeefe;
  --c-inex: #7c3aed;  --f-inex: #f3ecff;
  --c-disp: #c2410c;  --f-disp: #fff0e6;
  --c-dada: #8a4b14;  --f-dada: #f8eedf;
  --c-aux: #0f766e;   --f-aux: #e5f5f2;
  --c-nota: #a16207;  --f-nota: #fff8c5;

  /* grupos */
  --g-plan: 71, 85, 105;
  --g-direta: 190, 70, 40;
  --g-mod: 29, 78, 216;
  --g-crit: 21, 128, 61;
  --g-modo: 14, 116, 144;
  --g-rito: 79, 70, 229;
  --g-aux: 15, 118, 110;
  --g-fim: 60, 60, 70;
}
:root[data-tema="escuro"] {
  --bg: #14161c;
  --grid: rgba(255, 255, 255, .05);
  --panel: #1d2029;
  --ink: #e8e9ee;
  --muted: #a3a8b6;
  --line: #343846;
  --edge: #8e95a6;
  --edge-soft: #4c5262;
  --hl: #ff8a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  --f-proc: #232733; --f-dec: #3a3020; --f-mod: #1b2747; --f-crit: #17321f;
  --f-modo: #13313a; --f-fase: #24224a; --f-inex: #2c2145; --f-disp: #3d2418;
  --f-dada: #362818; --f-aux: #123430; --f-nota: #3a3517;
  --c-proc: #94a3b8; --c-dec: #e0a83a; --c-mod: #6f9bff; --c-crit: #4cc27a;
  --c-modo: #3fc1d9; --c-fase: #8f89ff; --c-inex: #b08cff; --c-disp: #ff8a55;
  --c-dada: #d39a5c; --c-aux: #3fc4b4; --c-nota: #e2c04a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 15px;
}
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------------- Barra superior ---------------- */
.topo {
  position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 56px; flex-wrap: wrap;
}
.marca { position: relative; margin-right: 6px; }
.assunto {
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; text-align: left;
  border: 1px solid transparent; background: none; border-radius: 9px; padding: 4px 26px 4px 6px; margin-left: -6px; cursor: pointer; position: relative;
}
.assunto:hover, .assunto[aria-expanded="true"] { border-color: var(--line); background: var(--panel); }
.assunto::after { content: "▾"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); }
.marca b { font-size: 16px; letter-spacing: -.01em; }
.marca span { font-size: 12px; color: var(--muted); }
.assuntos {
  display: none; position: absolute; top: calc(100% + 6px); left: -6px; z-index: 50; width: min(340px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.assuntos.on { display: block; }
.assuntos a { display: block; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.assuntos a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.assuntos a[aria-current] { background: color-mix(in srgb, var(--hl) 12%, transparent); }
.assuntos a b { display: block; font-size: 14.5px; }
.assuntos a small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.assuntos a.home { font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 4px; }

/* páginas: tela inicial (lista de assuntos) × mapa */
.inicio { display: none; }
body.pg-inicio { overflow: auto; height: auto; }
html:has(body.pg-inicio) { overflow: auto; }
body.pg-inicio > :not(.inicio):not(script) { display: none !important; }
body.pg-inicio .inicio { display: block; max-width: 920px; margin: 0 auto; padding: 48px 16px 64px; }
.inicio h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 8px; }
.inicio header p { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 0 0 26px; max-width: 640px; }
.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.cartao {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; padding: 18px 18px 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.cartao:hover { border-color: var(--hl); transform: translateY(-2px); }
.cartao small { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cartao b { font-size: 20px; letter-spacing: -.01em; }
.cartao .s { font-size: 13.5px; color: var(--muted); }
.cartao p { margin: 6px 0 4px; line-height: 1.5; font-size: 14.5px; }
.cartao .ir { margin-top: auto; font-weight: 700; color: var(--hl); font-size: 14px; }
.esp { flex: 1; }
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 11px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--edge); }
.btn.pri { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ico { width: 36px; justify-content: center; padding: 7px 0; }
.busca { position: relative; }
.busca input {
  width: 260px; max-width: 46vw; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 9px; padding: 8px 10px 8px 32px; font: inherit; font-size: 14px;
}
.busca::before { content: "⌕"; position: absolute; left: 10px; top: 5px; font-size: 18px; color: var(--muted); }
.resultados {
  position: absolute; top: 42px; left: 0; width: 360px; max-width: 90vw; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: none;
}
.resultados.on { display: block; }
.resultados button {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.resultados button:hover, .resultados button.ativo { background: color-mix(in srgb, var(--hl) 12%, transparent); }
.resultados small { display: block; color: var(--muted); font-size: 12px; }
.progresso { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.progresso .barra { width: 90px; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progresso .barra i { display: block; height: 100%; width: 0; background: var(--c-crit); transition: width .3s; }

/* ---------------- Área do mapa ---------------- */
.palco {
  position: fixed; inset: 0; overflow: hidden; cursor: grab; touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
.palco.arrastando { cursor: grabbing; }
.mundo { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.camada-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }

.grupo {
  position: absolute; border-radius: 22px; border: 2px dashed rgba(var(--gc), .35);
  background: rgba(var(--gc), .055);
}
.grupo .gt {
  position: absolute; z-index: 3; left: 18px; top: 14px; display: flex; align-items: center; gap: 12px;
  padding: 4px 16px 4px 4px; border-radius: 40px;
  background: color-mix(in srgb, var(--bg) 92%, rgb(var(--gc)) 8%);
  font-weight: 750; font-size: 21px; color: rgb(var(--gc)); letter-spacing: -.01em; white-space: nowrap;
}
:root[data-tema="escuro"] .grupo .gt { filter: brightness(1.6); }
.grupo .gt i {
  font-style: normal; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(var(--gc)); color: #fff; font-size: 17px;
}

/* nós */
.no {
  position: absolute; border-radius: var(--radius); border: 2px solid var(--c); background: var(--f);
  padding: 9px 12px 10px; box-shadow: var(--shadow); cursor: pointer; user-select: none;
  transition: opacity .2s, box-shadow .2s, transform .15s;
}
.no:hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent), var(--shadow); }
.no .kick { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c); margin-bottom: 3px; }
.no .ttl { font-weight: 750; font-size: 16px; line-height: 1.2; letter-spacing: -.005em; }
.no .sub { font-size: 12.5px; line-height: 1.35; color: var(--muted); margin-top: 4px; }
.no .pe { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.no .pe:empty { display: none; }
.selo { font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 6px; background: var(--c); color: #fff; letter-spacing: .02em; }
.selo.s2026 { background: #c2410c; }
.selo.snovo { background: #be185d; }
.selo.sok { background: var(--c-crit); }
.selo.sart { background: transparent; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); font-weight: 600; }

/* prazos e valores: selos no bloco */
.no .pvs { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.pv-selo { display: flex; align-items: flex-start; gap: 5px; font-size: 11.5px; line-height: 1.3; font-weight: 600; border-radius: 6px; padding: 3px 6px; }
.pv-selo svg { width: 12px; height: 12px; flex: none; margin-top: 1px; }
.pv-selo.prazo { --pv: #1d4ed8; background: color-mix(in srgb, #2563eb 11%, transparent); color: var(--pv); }
.pv-selo.valor { --pv: #15803d; background: color-mix(in srgb, #16a34a 13%, transparent); color: var(--pv); }
:root[data-tema="escuro"] .pv-selo.prazo { --pv: #9db8ff; }
:root[data-tema="escuro"] .pv-selo.valor { --pv: #7ddc9d; }
.legenda .pv-selo { display: inline-flex; }
.so-pv .no:not(.com-pv), .so-pv .rot { opacity: .16; }
.so-pv .aresta, .so-pv .aresta-seta { opacity: .3; }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.t-processo { --c: var(--c-proc); --f: var(--f-proc); }
.t-decisao  { --c: var(--c-dec);  --f: var(--f-dec); border-width: 2.5px; }
.t-decisao .kick::before { content: "◆ "; }
.t-modalidade { --c: var(--c-mod); --f: var(--f-mod); border-width: 3px; }
.t-modalidade .ttl { font-size: 19px; color: var(--c-mod); }
.t-criterio { --c: var(--c-crit); --f: var(--f-crit); }
.t-modo { --c: var(--c-modo); --f: var(--f-modo); }
.t-fase { --c: var(--c-fase); --f: var(--f-fase); }
.t-inex { --c: var(--c-inex); --f: var(--f-inex); border-width: 3px; }
.t-disp { --c: var(--c-disp); --f: var(--f-disp); border-width: 3px; }
.t-dada { --c: var(--c-dada); --f: var(--f-dada); border-width: 3px; }
.t-inex .ttl, .t-disp .ttl, .t-dada .ttl { font-size: 18px; color: var(--c); }
.t-hip-inex { --c: var(--c-inex); --f: var(--panel); border-style: solid; border-width: 1.5px; }
.t-hip-disp { --c: var(--c-disp); --f: var(--panel); border-width: 1.5px; }
.t-aux { --c: var(--c-aux); --f: var(--f-aux); }
.t-nota { --c: var(--c-nota); --f: var(--f-nota); border-style: dashed; }
.t-nota .kick::before { content: "⚠ "; }
.t-portal { --c: var(--c-disp); --f: var(--panel); border-style: dashed; border-radius: 40px; }
.t-inicio, .t-fim { --c: var(--ink); --f: var(--ink); color: var(--bg); border-radius: 28px; text-align: center; }
.t-inicio .kick, .t-fim .kick { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.t-inicio .sub, .t-fim .sub { color: color-mix(in srgb, var(--bg) 78%, transparent); }
.t-inicio .ttl, .t-fim .ttl { font-size: 19px; }
.no.destaque { border-width: 3px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 14%, transparent), var(--shadow); }
.no.destaque .ttl { font-size: 18px; }

/* estado de seleção / destaque */
.foco .no, .foco .rot { opacity: .2; }
.foco .grupo { opacity: .55; }
.foco .no.viz, .foco .rot.viz { opacity: 1; }
.foco .no.sel { opacity: 1; box-shadow: 0 0 0 5px var(--hl), var(--shadow); }
.no.achado { box-shadow: 0 0 0 4px #facc15, var(--shadow); }
.no.estudado::after {
  content: "✓"; position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c-crit); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--bg);
}
.no.pulsa { animation: pulsa 1.2s ease-out 2; }
@keyframes pulsa { 0% { box-shadow: 0 0 0 0 var(--hl); } 100% { box-shadow: 0 0 0 22px transparent; } }

/* arestas */
.aresta { fill: none; stroke: var(--edge); stroke-width: 2; stroke-linejoin: round; transition: opacity .2s, stroke .2s; }
.aresta.tracejada { stroke-dasharray: 7 6; }
.aresta.fina { stroke: var(--edge-soft); stroke-width: 1.4; }
.foco .aresta { opacity: .12; }
.foco .aresta.viz { opacity: 1; stroke: var(--hl); stroke-width: 3; }
.aresta-seta { fill: var(--edge); stroke: none; transition: opacity .2s, fill .2s; }
.aresta-seta.fina { fill: var(--edge-soft); }
.foco .aresta-seta { opacity: .12; }
.foco .aresta-seta.viz { opacity: 1; fill: var(--hl); }
.rot {
  position: absolute; font-size: 12px; font-weight: 650; line-height: 1; padding: 4px 8px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); white-space: nowrap;
  display: flex; align-items: center; justify-content: center; transition: opacity .2s;
}

/* ---------------- Painel de detalhes ---------------- */
.painel {
  position: fixed; z-index: 40; top: 64px; right: 10px; bottom: 10px; width: min(500px, calc(100vw - 20px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transform: translateX(calc(100% + 20px)); transition: transform .25s ease;
}
.painel.on { transform: none; }
.painel .cab { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); position: relative; }
.painel .cab .kick { font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--c); }
.painel .cab h2 { margin: 4px 36px 4px 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.painel .cab p { margin: 0; color: var(--muted); font-size: 14px; }
.painel .cab .x { position: absolute; right: 12px; top: 12px; }
.painel .corpo { overflow: auto; padding: 6px 18px 24px; line-height: 1.55; font-size: 15px; }
.painel h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.painel h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.painel ul, .painel ol { padding-left: 20px; margin: 6px 0; }
.painel li { margin: 3px 0; }
.painel p { margin: 8px 0; }
.painel h4 { font-size: 15px; margin: 18px 0 6px; color: var(--c); }
.lei {
  margin: 8px 0; padding: 10px 12px; border-left: 4px solid var(--c, var(--c-proc)); border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--c, var(--c-proc)) 7%, transparent); font-family: var(--serif); font-size: 15.5px;
}
.lei b { font-family: var(--font); font-size: 12px; letter-spacing: .03em; display: block; margin-bottom: 3px; color: var(--c); }
.prova li { list-style: none; margin-left: -20px; padding: 8px 10px 8px 34px; position: relative; border-radius: 10px;
  background: color-mix(in srgb, #facc15 14%, transparent); margin-bottom: 6px; }
.prova li::before { content: "⚠"; position: absolute; left: 11px; top: 7px; color: #b45309; }
.memo { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--c-fase) 10%, transparent); font-weight: 600; }
.conexoes button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 5px 10px; margin: 3px 4px 3px 0;
  cursor: pointer; font-size: 13px;
}
.conexoes button:hover { border-color: var(--hl); }
.conexao { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--c-aux) 10%, transparent); }
.fontes { margin-top: 22px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, transparent); }
.fontes b { display: block; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.fontes a { display: block; padding: 4px 0; text-decoration: none; color: var(--c-mod); font-weight: 600; }
.fontes a:hover { text-decoration: underline; }
.fontes small { color: var(--muted); display: block; margin-top: 6px; font-size: 12px; }
.marcar { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line); cursor: pointer; }
.marcar input { width: 18px; height: 18px; accent-color: var(--c-crit); }
.saltar { margin-top: 10px; }
.tab { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 8px 0; }
.tab th, .tab td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.tab th { background: color-mix(in srgb, var(--ink) 5%, transparent); font-size: 12.5px; }
.tab.big { font-size: 14px; }
.novo { background: #be185d; color: #fff; border-radius: 5px; padding: 1px 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
/* prazos e valores: lista do painel e da aba de Resumos */
.pv-lista { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin: 6px 0; }
.pv-linha {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) minmax(0, 42%); grid-template-areas: "ic it vl" "ic fn vl";
  column-gap: 10px; row-gap: 2px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.4;
}
.pv-linha:first-child { border-top: 0; }
.pv-linha .ic { grid-area: ic; margin-top: 2px; }
.pv-linha .ic svg { width: 15px; height: 15px; display: block; }
.pv-linha.prazo .ic { color: #2563eb; }
.pv-linha.valor .ic { color: #16a34a; }
.pv-linha .it { grid-area: it; }
.pv-linha .fn { grid-area: fn; font-size: 12px; color: var(--muted); }
.pv-linha .vl { grid-area: vl; font-weight: 700; }
.pv-linha .vl small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.pv-sec { font-size: 15px; margin: 22px 0 4px; }
.pv-no { margin: 12px 0 2px; font-size: 14px; }
.pv-no button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--c-mod); cursor: pointer; }
.pv-no button:hover { text-decoration: underline; }
.aviso { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #facc15 16%, transparent); }
.alerta-prova {
  margin: 10px 0 12px; padding: 10px 12px 10px 14px; border-radius: 10px; border: 1px solid #dc2626; border-left-width: 5px;
  background: color-mix(in srgb, #dc2626 10%, transparent);
}
.alerta-prova b:first-child { display: block; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: #dc2626; margin-bottom: 2px; }
:root[data-tema="escuro"] .alerta-prova { border-color: #f87171; }
:root[data-tema="escuro"] .alerta-prova b:first-child { color: #f87171; }

/* ---------------- Trilha guiada ---------------- */
.trilha {
  position: fixed; z-index: 45; left: 50%; bottom: 16px; transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 8px 8px 8px 16px; display: flex; gap: 10px;
  align-items: center; box-shadow: var(--shadow); transition: transform .25s; max-width: calc(100vw - 24px);
}
.trilha.on { transform: translate(-50%, 0); }
.trilha .txt { font-size: 14px; min-width: 0; }
.trilha .txt small { display: block; opacity: .7; font-size: 12px; }
.trilha .txt span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; font-weight: 650; }
.com-trilha .painel .corpo { padding-bottom: 96px; }
.trilha .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }

/* ---------------- Minimapa / zoom / legenda ---------------- */
.mini {
  position: fixed; z-index: 25; left: 12px; bottom: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; cursor: pointer;
}
.mini canvas { display: block; border-radius: 8px; }
.zoom { position: fixed; z-index: 25; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoom .btn { width: 40px; height: 40px; justify-content: center; padding: 0; font-size: 18px; box-shadow: var(--shadow); }
.legenda {
  position: fixed; z-index: 26; left: 12px; top: 68px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 13px; display: none; width: 270px;
}
.legenda.on { display: block; }
.legenda .it { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.legenda .sw { width: 26px; height: 16px; border-radius: 5px; border: 2px solid var(--c); background: var(--f); flex: none; }
.legenda .ln { width: 26px; height: 0; border-top: 2px solid var(--edge); flex: none; }
.legenda .ln.d { border-top-style: dashed; }
.legenda .ln.f { border-top-color: var(--edge-soft); border-top-width: 1.5px; }

/* ---------------- Modal de resumos / ajuda ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 18, .45); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.on { display: flex; }
.modal .caixa {
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); width: min(980px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
}
.modal .mcab { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal .mcab h2 { margin: 0; font-size: 19px; flex: 1; }
.abas { display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; }
.abas button { border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.abas button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.modal .mcorpo { padding: 12px 18px 22px; overflow: auto; line-height: 1.55; }
.linha li { margin: 8px 0; }

/* diagrama auxiliares × tipos (aba de Resumos) */
.diag { overflow-x: auto; margin: 10px 0; }
.diag svg { display: block; width: 100%; min-width: 600px; height: auto; font-family: var(--font); }
.diag .cab { font-size: 11.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; fill: var(--muted); }
.diag .cx { stroke-width: 2; }
.diag .c-proc { stroke: var(--c-proc); fill: var(--f-proc); }
.diag .c-mod { stroke: var(--c-mod); fill: var(--f-mod); }
.diag .c-disp { stroke: var(--c-disp); fill: var(--f-disp); }
.diag .c-inex { stroke: var(--c-inex); fill: var(--f-inex); }
.diag .c-aux { stroke: var(--c-aux); fill: var(--f-aux); }
.diag .tx { font-size: 14px; font-weight: 650; fill: var(--ink); }
.diag .lg { fill: none; stroke-width: 2; }
.diag .srp { --l: var(--c-mod); }
.diag .cred { --l: var(--c-inex); }
.diag .ger { --l: var(--c-aux); }
.diag .nao { --l: #dc2626; }
.diag .lg { stroke: var(--l); }
.diag .lg.nao { stroke-dasharray: 6 5; }
.diag .pt { fill: var(--l); }
.diag .num circle { fill: var(--panel); stroke: var(--l); stroke-width: 2; }
.diag .num text { font-size: 12px; font-weight: 800; fill: var(--l); }
.notas-diag { list-style: none; padding: 0; margin: 8px 0; }
.notas-diag li { position: relative; padding: 6px 0 6px 34px; border-bottom: 1px solid var(--line); }
.notas-diag li::before {
  content: attr(data-n); position: absolute; left: 0; top: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--c-aux); color: var(--c-aux); font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.notas-diag li.srp::before { border-color: var(--c-mod); color: var(--c-mod); }
.notas-diag li.cred::before { border-color: var(--c-inex); color: var(--c-inex); }
.notas-diag li.nao::before { border-color: #dc2626; color: #dc2626; }
.ajuda ol li { margin: 6px 0; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; background: var(--bg); }

.carregando { position: fixed; inset: 0; display: grid; place-items: center; z-index: 70; background: var(--bg); font-size: 16px; color: var(--muted); }
.carregando.fora { display: none; }

@media (max-width: 760px) {
  .marca span { display: none; }
  .busca input { width: 150px; }
  .btn .rotulo { display: none; }
  .progresso { display: none; }
  .painel { top: auto; right: 0; left: 0; bottom: 0; width: 100%; height: 62vh; border-radius: 18px 18px 0 0; transform: translateY(105%); }
  .painel.on { transform: none; }
  .mini { display: none; }
  .trilha .txt span { max-width: 52vw; }
}
@media print {
  .topo, .painel, .mini, .zoom, .trilha, .legenda { display: none !important; }
}
