/* Dashboard CMP. Moldura: menu lateral + conteúdo. Cores só por tokens; o modo escuro redefine-os.
   Estados (passa / falha / sem dados / por avaliar) têm cores fixas para as marcas dos gráficos (--mark-*),
   escolhidas para se distinguirem também com daltonismo vermelho-verde, e vão sempre com ícone ou texto. */
:root {
  color-scheme: light;
  --bg: #f6f6f3; --surface: #fcfcfb; --surface-2: #f1f0ec; --side: #ffffff;
  --text: #1a1a18; --muted: #6b6963; --line: #e4e3dd; --line-strong: #cfcdc5;
  --accent: #1f6bc7; --on-accent: #ffffff; --accent-wash: #e8f1fc; --accent-ink: #1c5cab;
  --pass: #0d7a52; --pass-bg: #e3f6ee; --fail: #b42323; --fail-bg: #fbeaea;
  --warn: #8a5a00; --warn-bg: #fdf3dc; --idle: #52514e; --idle-bg: #efeee9;
  --mark-pass: #1baf7a; --mark-fail: #d03b3b; --mark-warn: #fab219; --mark-idle: #c3c2b7; --mark-critical: #8f1c1c;
  --track: #e4e3dd; --grid: #e9e8e2;
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.05);
  --pop-shadow: 0 10px 28px rgba(20, 20, 18, 0.14);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f0f0e; --surface: #1a1a19; --surface-2: #232321; --side: #141413;
    --text: #f0efec; --muted: #a3a198; --line: #2f2f2c; --line-strong: #44443f;
    --accent: #6aa5ee; --on-accent: #0b0b0b; --accent-wash: #16263b; --accent-ink: #86b6ef;
    --pass: #5fd3a5; --pass-bg: #14302a; --fail: #f08585; --fail-bg: #3a1e1e;
    --warn: #f2c56b; --warn-bg: #3a2f14; --idle: #c3c2b7; --idle-bg: #2a2a27;
    --mark-idle: #5d5c58; --mark-critical: #f07a7a;
    --track: #2f2f2c; --grid: #2a2a27;
    --shadow: none; --pop-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px;
  -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; color: inherit; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---- moldura: menu lateral + conteúdo ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.shell:has(> .side[hidden]) { grid-template-columns: minmax(0, 1fr); }
.shell:has(> .side[hidden]) main, .shell:has(> .side[hidden]) footer { margin-inline: auto; }
.shell:has(#login:not([hidden])) footer { text-align: center; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px 14px; display: flex;
  flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 4px; min-width: 0; }
.brand-logo { display: block; height: 36px; width: auto; max-width: 196px; object-fit: contain; }
.brand-mark { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.02em; }
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font-size: 0.95rem; line-height: 1.2; }
.brand-text span { color: var(--muted); font-size: 0.8rem; }
.org { display: grid; gap: 4px; padding: 0 8px; font-size: 0.8rem; color: var(--muted); }
.org select { font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 12px 0 4px; padding: 0 10px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); }
.nav-label:first-child { margin-top: 0; }
.tabs button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 500; }
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.tabs .badge { margin-left: auto; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: grid; gap: 8px;
  font-size: 0.88rem; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; }
.side-foot .link { justify-self: start; color: var(--muted); text-decoration: none; }
.side-foot .link:hover { color: var(--text); }
.content { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1320px; padding: 20px 32px 16px; }
.topbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.topbar-org { font-weight: 600; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .detail { color: var(--muted); font-size: 0.85rem; }
footer { max-width: 1320px; padding: 8px 32px 28px; font-size: 0.82rem; color: var(--muted); }

/* ---- botões e menu ---- */
.btn, .button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 500;
  text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary, .button { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover, .button:hover { filter: brightness(1.07); }
.link { border: 0; background: none; color: var(--accent-ink); padding: 0; text-decoration: underline;
  text-underline-offset: 3px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; display: grid; gap: 2px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--pop-shadow); }
.menu-pop button, .menu-pop a { display: block; padding: 8px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); text-align: left; text-decoration: none; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); }

/* ---- títulos, texto e blocos comuns ---- */
section { margin-bottom: 28px; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 1.07rem; margin: 0 0 10px; letter-spacing: -0.005em; }
.hint { margin: 0 0 12px; font-size: 0.9rem; max-width: 80ch; color: var(--muted); }
.detail { color: var(--muted); }
.notice { padding: 10px 14px; background: var(--idle-bg); border-radius: 8px; margin: 0 0 12px; }
.notice.error { background: var(--fail-bg); color: var(--fail); }
#status { margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head .aside { margin-left: auto; color: var(--muted); font-size: 0.86rem; }
.help { position: relative; }
.help > summary { list-style: none; cursor: pointer; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--muted); color: var(--muted); display: grid; place-items: center; font-size: 0.72rem;
  font-weight: 700; font-family: Georgia, serif; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: "i"; }
.help > summary:hover, .help[open] > summary { border-color: var(--text); color: var(--text); }
.help > p, .help > div { position: absolute; left: -8px; top: 28px; z-index: 15; width: min(400px, 80vw); margin: 0;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--muted); font-size: 0.88rem; box-shadow: var(--pop-shadow); }
progress { width: 100%; height: 8px; margin-top: 4px; accent-color: var(--accent); }

/* etiquetas de estado: cor + símbolo, nunca só cor */
.counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem;
  font-weight: 600; white-space: nowrap; background: var(--idle-bg); color: var(--idle); }
.badge.pass { background: var(--pass-bg); color: var(--pass); }
.badge.fail { background: var(--fail-bg); color: var(--fail); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.pass::before { content: "✓"; }
.badge.fail::before { content: "✕"; font-size: 0.85em; }
.badge.warn::before { content: "!"; }
.tabs .badge::before { content: none; }

/* tabelas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.code { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
td.message { color: var(--muted); max-width: 46ch; overflow-wrap: anywhere; }
td.outcome { max-width: 60ch; overflow-wrap: anywhere; }
details summary { cursor: pointer; }
details[open] summary { font-weight: 600; margin-bottom: 6px; }
details ol { margin: 4px 0 8px; padding-left: 20px; }
details li { margin-bottom: 4px; }
details p { margin: 6px 0; }
.detail-title { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.technical { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 12px; font-size: 0.88rem; }
.filters button:hover { background: var(--surface-2); }
.filters button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink);
  font-weight: 600; }
#not-executed { margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
h2.sub { margin: 16px 0 6px; font-size: 0.95rem; }
h3.framework { font-size: 0.95rem; margin: 16px 0 6px; }
.events { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
.events li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events .code { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
td .detail, .events .detail { color: var(--muted); font-size: 0.85rem; }

/* formulários */
.manage-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; min-width: 220px; }
.manage-form select, .manage-form input, .manage-form textarea { font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 8px; }
.manage-form textarea { resize: vertical; }
.manage-form button, .install-card button { align-self: flex-start; border: 1px solid var(--accent); background: var(--accent);
  color: var(--on-accent); border-radius: 7px; padding: 5px 12px; font-weight: 600; }
.manage-form button:disabled, .install-card button:disabled { opacity: 0.6; cursor: default; }
.manage-form.risk { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.manage-form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; }
details.manage-form > summary { font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field-label { font-size: 0.85rem; color: var(--muted); }
.check { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: baseline; }
.check .detail { grid-column: 2; }
.toggle { display: inline-flex; gap: 6px; align-items: center; margin: 12px 0; font-size: 0.92rem; color: var(--muted); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0; font-size: 0.92rem; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

/* blocos que abrem e fecham */
details.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
details.block > summary { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 13px 16px;
  list-style: none; cursor: pointer; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::before { content: ""; width: 7px; height: 7px; margin: 0 2px 0 2px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(-45deg);
  transition: transform 0.15s; align-self: center; }
details.block[open] > summary::before { transform: translateY(-3px) rotate(45deg); }
details.block > summary:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: var(--radius); }
details.block[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  font-weight: normal; margin: 0; }
.block-title { font-weight: 600; font-size: 1rem; }
.block-sum { color: var(--muted); font-size: 0.88rem; }
.block-body { padding: 14px 16px 16px; display: grid; gap: 12px; min-width: 0; }
.block-body > section, .block-body .hint { margin: 0; }
.new-incident { margin-bottom: 8px; }
.new-incident > summary { font-weight: 600; color: var(--accent-ink); }
.new-incident .manage-form { max-width: 640px; }
.print-only { display: none; }

/* cabeçalho dos separadores: título e, atrás do ⓘ, a explicação */
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.title-row h1 { margin: 0; }
.overview .title-row { margin-bottom: 0; }
/* cartões de resumo que abrem o bloco correspondente */
.tiles { margin-bottom: 4px; }
button.tile { font: inherit; color: inherit; text-align: left; cursor: pointer; border-top: 3px solid var(--line); }
button.tile:hover { border-color: var(--line-strong); }
button.tile.fail { border-top-color: var(--mark-fail); }
button.tile.warn { border-top-color: var(--mark-warn); }
button.tile.pass { border-top-color: var(--mark-pass); }
button.tile .kpi-value { font-size: 1.7rem; }

/* ---- login ---- */
.login { max-width: 460px; margin: 10vh auto 0; padding: 28px; display: grid; gap: 10px; }
.login .brand { padding: 0; }
.login h1 { margin: 8px 0 0; }
.login p { margin: 0; color: var(--muted); }
.login .button { justify-self: start; margin-top: 8px; }

/* ---- Conformidade: cabeçalho e indicadores ---- */
.page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: 4px; }
.meta { margin: 0; color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 0.86rem; font-weight: 500; }
.kpi-value { font-size: 1.95rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.kpi-value small { font-size: 0.95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-sub { color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.seg { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--track); }
.seg > span { display: block; flex: 1 1 0; min-width: 3px; }
.seg .pass { background: var(--mark-pass); }
.seg .fail { background: var(--mark-fail); }
.seg .warn { background: var(--mark-warn); }
.seg .idle { background: var(--mark-idle); }
.seg .critical { background: var(--mark-critical); }
.legend { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 0.84rem; color: var(--muted); }
.legend .key::before, .chart-tip .key::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px;
  vertical-align: 0; background: var(--mark-idle); }
.legend .key.pass::before, .chart-tip .key.pass::before { background: var(--mark-pass); }
.legend .key.fail::before, .chart-tip .key.fail::before { background: var(--mark-fail); }
.legend .key.warn::before, .chart-tip .key.warn::before { background: var(--mark-warn); }

/* sem dados: faixa de alerta */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius);
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--mark-warn) 45%, transparent); }
.alert.error { background: var(--fail-bg); border-color: color-mix(in srgb, var(--mark-fail) 40%, transparent); }
.alert > svg.icon { margin-top: 2px; color: var(--warn); }
.alert.error > svg.icon { color: var(--fail); }
.alert-body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.alert h2 { font-size: 0.95rem; margin: 0; }
.alert-line { margin: 0; }
.alert.error .alert-line.error { color: var(--fail); font-weight: 600; }
.alert-more > summary { font-size: 0.88rem; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.alert-more[open] > summary { font-weight: 600; }
.alert .events li { border-bottom-color: color-mix(in srgb, var(--mark-warn) 30%, transparent); }

/* frameworks: as três medidas lado a lado, com o mesmo peso */
.fw-section { container-type: inline-size; }
.fw-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@container (min-width: 720px) {
  .fw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fw-grid > .fw:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .fw-grid > .fw:last-child:nth-child(odd) .measures { max-width: 640px; }
}
@container (min-width: 1140px) {
  .fw-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fw-grid > .fw:last-child:nth-child(odd) { grid-column: auto; }
  .fw-grid > .fw:last-child:nth-child(odd) .measures { max-width: none; }
}
.fw { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.fw-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fw-head h3 { margin: 0; font-size: 1.07rem; }
.fw-head span { color: var(--muted); font-size: 0.84rem; }
.measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.measure { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 6px;
  border-radius: 8px; background: var(--surface-2); min-width: 0; }
.measure .name { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.measure .cap { font-size: 0.8rem; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.donut { flex: none; width: 76px; height: 76px; }
.donut .ring-track { fill: none; stroke: var(--track); stroke-width: 7; }
.donut .ring-empty { fill: none; stroke: var(--track); stroke-width: 7; stroke-dasharray: 3 4; }
.donut .ring { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.donut .ring-text { fill: var(--text); font-size: 15px; font-weight: 650; font-family: inherit; }
.donut .ring-text.none { fill: var(--muted); font-weight: 500; }
.fw .notice { margin: 0; }
.fw .counts { margin: 0; }

/* domínios */
.domain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.domain-tile { display: grid; gap: 9px; text-align: left; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; cursor: pointer; box-shadow: var(--shadow); }
.domain-tile:hover { border-color: var(--line-strong); }
.domain-tile[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.domain-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.domain-name { font-weight: 600; }
.domain-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 0.84rem; color: var(--muted); }
.domain-detail { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: grid; gap: 14px; }
.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.detail-head h2 { margin: 0; }
.control-block { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.control-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.control-head .code, .check-line .code { font-family: var(--mono); font-size: 0.85rem; }
.check-list { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 8px; }
.check-line { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.check-list .outcome, .check-list .message { font-size: 0.9rem; color: var(--muted); padding-left: 2px; overflow-wrap: anywhere; }

/* evolução */
.trend { padding: 16px 18px 12px; }
.chart-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.chart-top h2 { margin: 0; }
.chart-top .detail { font-size: 0.86rem; }
.chart-top .legend { margin-left: auto; }
.trend-plot { position: relative; }
.trend-chart { display: block; width: 100%; height: 220px; }
.trend-chart .bar-pass { fill: var(--mark-pass); }
.trend-chart .bar-fail { fill: var(--mark-fail); }
.trend-chart .bar-warn { fill: var(--mark-warn); }
.trend-chart .gridline { stroke: var(--grid); stroke-width: 1; }
.trend-chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.trend-chart .axis-label { fill: var(--muted); font-size: 11px; font-family: inherit; }
.trend-chart .hit { fill: transparent; }
.trend-chart g.col:hover .hit, .trend-chart g.col:focus .hit { fill: var(--surface-2); }
.trend-chart g.col:focus { outline: none; }
.chart-tip { position: absolute; z-index: 10; pointer-events: none; min-width: 180px; padding: 8px 10px; font-size: 0.84rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: var(--pop-shadow); }
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }

/* findings mais graves */
.table-card { padding: 0; overflow: hidden; }
.table-card table td, .table-card table th { padding: 10px 16px; }
.table-card .code { display: block; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 600; white-space: nowrap; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.sev.CRITICAL { color: var(--mark-critical); }
.sev.HIGH { color: var(--fail); }
.sev.MEDIUM { color: var(--warn); }
.sev.LOW, .sev.INFO { color: var(--idle); }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.card-foot .link { text-decoration: none; font-weight: 600; }
section.compliance-block { margin-bottom: 10px; }

/* identidade da organização */
.branding-list { display: grid; gap: 14px; }
.branding-row { border-top: 1px solid var(--line); padding-top: 10px; }
.branding-preview { max-height: 60px; max-width: 260px; object-fit: contain; padding: 6px; border: 1px dashed var(--line);
  border-radius: 6px; background: #ffffff; }
.branding-preview.dark { background: #1a1a19; }

/* ---- incidentes ---- */
details.incident { margin-bottom: 10px; }
details.incident > summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
details.incident > summary .code { font-family: var(--mono); }
details.incident[open] > summary { margin-bottom: 10px; }
details.incident h3.sub { font-size: 0.95rem; margin: 16px 0 6px; }

/* ---- administração ---- */
.roles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.check-inline { display: inline-flex; gap: 4px; align-items: center; font-size: 0.88rem; white-space: nowrap; }
pre.output { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  max-height: 420px; overflow: auto; font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
#admin-integration-buttons button:disabled { opacity: 0.6; cursor: default; }
.roles-help { margin-top: 12px; font-size: 0.92rem; }
.role-help { margin: 8px 0; }
.role-help ul { margin: 4px 0 0; padding-left: 20px; color: var(--muted); }
#admin-users-table td .manage-form { min-width: 200px; }
.install-card { margin-bottom: 12px; }
.install-card .field { margin: 6px 0; max-width: 640px; }
.install-card input[type="text"], .install-card input[type="password"] { font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 8px; }
.target-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.target-row input { min-width: 140px; }
.secrets { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
#panel-admin { display: grid; gap: 22px; }
.admin-group { display: grid; gap: 8px; }
.group-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 2px; }
section.admin-block { margin: 0; }
#panel-admin > section { margin-bottom: 0; }
#admin-setup > summary { font-weight: 600; }
#admin-setup > :not(summary) { margin: 12px 16px; }
#admin-setup .events li { gap: 6px 10px; }

/* ---- registo de informação dos prestadores TIC ---- */
.overview { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.overview h1 { margin: 0 0 4px; }
.overview .hint { margin: 0; }
#panel-register > section { display: grid; gap: 12px; }
.reg-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; margin: 4px 0; display: grid;
  gap: 6px; }
.reg-group legend { font-weight: 600; font-size: 0.92rem; padding: 0 4px; }
.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
.reg-grid .field input, .reg-grid .field select { min-width: 0; width: 100%; }
.reg-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.reg-chain-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
details.reg-card > summary .code { font-family: var(--mono); }
details.reg-card.retired { opacity: 0.7; }
.dep-tree { margin: 4px 0; padding-left: 18px; }
.dep-tree li { margin: 3px 0; }
.dep-tree .badge { margin-left: 6px; }

/* ---- registo de riscos: mapa de calor 5x5 (probabilidade nas linhas, impacto nas colunas) ---- */
.risk-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.risk-map-box { margin: 0; padding: 16px 18px; }
.risk-map-box figcaption { font-size: 0.86rem; color: var(--muted); margin-bottom: 10px; max-width: 360px; }
.risk-map-box figcaption strong { color: var(--text); }
.risk-side { padding: 16px 18px; }
.risk-side h2 { font-size: 0.95rem; }
.risk-side .counts { flex-direction: column; align-items: flex-start; gap: 8px; }
.heatmap { display: grid; grid-template-columns: auto repeat(5, 56px); gap: 4px; align-items: center; }
.heatmap .axis { font-size: 0.75rem; color: var(--muted); text-align: center; }
.heatmap button { height: 46px; border: 1px solid transparent; border-radius: 4px; font: inherit; font-weight: 600;
  cursor: pointer; color: var(--text); }
.heatmap button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap .lvl-LOW { background: var(--pass-bg); }
.heatmap .lvl-MEDIUM { background: var(--warn-bg); }
.heatmap .lvl-HIGH { background: var(--fail-bg); }
.heatmap .lvl-CRITICAL { background: var(--mark-fail); color: #fff; }
.heatmap button.empty { opacity: 0.45; font-weight: normal; }
.badge.lvl-CRITICAL { background: var(--mark-fail); color: #fff; }
.risk-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }

/* ---- ecrãs estreitos: o menu lateral passa a barra no topo ---- */
@media (max-width: 760px) { .risk-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-text span, .side-foot .who, .nav-label { display: none; }
  .org { padding: 0; }
  .tabs { flex-direction: row; order: 5; width: 100%; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .tabs button { width: auto; white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  main { padding: 16px 16px 12px; }
  footer { padding: 8px 16px 24px; }
}
@media (max-width: 600px) {
  .measures { gap: 6px; }
  .donut { width: 64px; height: 64px; }
  dl.info { grid-template-columns: 1fr; }
  dl.info dd { margin-bottom: 6px; }
  .table-card .hide-sm { display: none; }
}

/* ---- relatório impresso ---- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #333; --line: #999; --line-strong: #999;
    --accent: #000; --on-accent: #fff; --accent-ink: #000;
    --pass: #0b5d34; --pass-bg: #fff; --fail: #8f1c16; --fail-bg: #fff; --warn: #6b4500; --warn-bg: #fff;
    --idle: #333; --idle-bg: #fff; --shadow: none; }
  html { font-size: 11px; }
  body { background: #fff; }
  .shell { display: block; }
  .side, .topbar, .filters, footer, #status, #login, td.manage, #manage-head, progress, .help, .card-foot,
  #top-findings-section, .chart-tip { display: none !important; }
  .print-only { display: block; }
  #report-cover { page-break-after: always; break-after: page; }
  #report-cover h1 { font-size: 1.8rem; margin-top: 30vh; }
  .cover-main { font-size: 1.3rem; font-weight: 600; }
  main { max-width: none; padding: 0; }
  section { break-inside: auto; }
  h1, h2, h3 { break-after: avoid; }
  tr, .card, li, .domain-tile, .kpi { break-inside: avoid; }
  .card, .table-wrap, details.block { border-color: #999; box-shadow: none; }
  .table-wrap { overflow: visible; }
  .badge { border: 1px solid currentColor; }
  td.message, td.outcome { max-width: none; }
  details summary { list-style: none; font-weight: 600; }
  details.block > summary::before { content: none; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .legend .key::before { border: 1px solid #000; }
  #domain-detail { display: none !important; }
  #incident-new, details.incident .manage-form, .toggle { display: none !important; }
  body:has(#tab-incidents:not([hidden])) #panel-incidents[hidden], #panel-compliance[hidden] { display: block !important; }
  #panel-incidents { break-before: page; }
  #panel-admin { display: none !important; }
  #panel-register .manage-form, #register-export, #panel-risks .manage-form, #risks-new { display: none !important; }
}
