/* CSIRT.GOV — fundações partilhadas pelo site público e pelo painel.
   Sem tipos de letra nem recursos de terceiros: tudo é servido por esta origem. */

:root {
  --ink: #0e1a14;
  --ink-soft: #33443b;
  --muted: #5b6b62;
  --paper: #f5f7f3;
  --surface: #ffffff;
  --surface-2: #edf1ec;
  --line: #d6ddd7;
  --line-strong: #b5c0b8;
  --green: #00663a;
  --green-strong: #004d2b;
  --green-tint: #e3f0e8;
  --sun: #f5c518;
  --red: #b3261e;
  --red-strong: #8f1d17;
  --red-tint: #fbeae8;
  --night: #0b1410;
  --night-2: #13201a;
  --night-line: #26372e;
  --on-night: #e9efea;
  --on-night-muted: #9fb0a6;

  --sev-critical: #b3261e;  --sev-critical-bg: #fbeae8;
  --sev-high: #b9500a;      --sev-high-bg: #fdeede;
  --sev-medium: #8a6200;    --sev-medium-bg: #fbf3d3;
  --sev-low: #1d6f42;       --sev-low-bg: #e3f0e8;
  --sev-info: #2b5f9e;      --sev-info-bg: #e6eef8;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(14, 26, 20, .06), 0 8px 24px rgba(14, 26, 20, .07);
  --wrap: 1180px;
  --focus: 0 0 0 3px rgba(0, 102, 58, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e9efea; --ink-soft: #c5d1c9; --muted: #98a89e;
    --paper: #0b1410; --surface: #121e18; --surface-2: #19281f;
    --line: #26372e; --line-strong: #3a4e43;
    --green: #45c283; --green-strong: #6fd6a0; --green-tint: #15301f;
    --red: #f0685f; --red-strong: #f58b83; --red-tint: #3a1815;
    --sev-critical: #f58b83; --sev-critical-bg: #3a1815;
    --sev-high: #f5a45f;     --sev-high-bg: #3a2511;
    --sev-medium: #e6c14a;   --sev-medium-bg: #33290c;
    --sev-low: #6fd6a0;      --sev-low-bg: #15301f;
    --sev-info: #8cb8f0;     --sev-info-bg: #14263d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --focus: 0 0 0 3px rgba(69, 194, 131, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e9efea; --ink-soft: #c5d1c9; --muted: #98a89e;
  --paper: #0b1410; --surface: #121e18; --surface-2: #19281f;
  --line: #26372e; --line-strong: #3a4e43;
  --green: #45c283; --green-strong: #6fd6a0; --green-tint: #15301f;
  --red: #f0685f; --red-strong: #f58b83; --red-tint: #3a1815;
  --sev-critical: #f58b83; --sev-critical-bg: #3a1815;
  --sev-high: #f5a45f;     --sev-high-bg: #3a2511;
  --sev-medium: #e6c14a;   --sev-medium-bg: #33290c;
  --sev-low: #6fd6a0;      --sev-low-bg: #15301f;
  --sev-info: #8cb8f0;     --sev-info-bg: #14263d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --focus: 0 0 0 3px rgba(69, 194, 131, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.012em; }
p { margin: 0; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-strong); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }

.kicker { font: 600 .74rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.flag-rule { display: grid; grid-template-columns: repeat(4, 1fr); height: 4px; }
.flag-rule span:nth-child(1) { background: #00843d; }
.flag-rule span:nth-child(2) { background: var(--sun); }
.flag-rule span:nth-child(3) { background: #15181d; }
.flag-rule span:nth-child(4) { background: #c8102e; }

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .62em 1.1em; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 650; font-size: .95rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--green); color: #fff; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--green-strong); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--red-strong); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--green); padding-inline: .5em; }
.btn-quiet:hover { background: var(--green-tint); color: var(--green-strong); }
.btn-sm { padding: .38em .7em; font-size: .84rem; }
.btn-on-night { background: transparent; color: var(--on-night); border-color: rgba(233, 239, 234, .35); }
.btn-on-night:hover { background: rgba(233, 239, 234, .1); color: #fff; }
:root[data-theme="dark"] .btn:not(.btn-ghost):not(.btn-quiet):not(.btn-on-night) { color: #06110b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn:not(.btn-ghost):not(.btn-quiet):not(.btn-on-night) { color: #06110b; }
}

/* ── Formulários ── */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field > label, .field > .label { font-weight: 600; font-size: .88rem; color: var(--ink-soft); }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .error { font-size: .82rem; color: var(--red); font-weight: 600; }
.req { color: var(--red); }
.input, .select, .textarea {
  width: 100%; padding: .6em .75em; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; }
.check input { margin-top: .3em; accent-color: var(--green); width: 1rem; height: 1rem; flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 1.75rem; min-width: 0; }
legend { padding: 0; margin-bottom: 1rem; width: 100%; border-bottom: 1px solid var(--line); padding-bottom: .5rem;
  font: 600 .76rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Etiquetas ── */
.chip { display: inline-flex; align-items: center; gap: .4em; padding: .18em .6em; border-radius: 999px;
  font-size: .76rem; font-weight: 650; line-height: 1.5; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.sev { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; border-radius: 4px; }
.sev::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; }
.sev-critico { color: var(--sev-critical); background: var(--sev-critical-bg); }
.sev-critico::before { border-radius: 1px; transform: rotate(45deg); }
.sev-alto { color: var(--sev-high); background: var(--sev-high-bg); }
.sev-alto::before { border-radius: 1px; }
.sev-medio { color: var(--sev-medium); background: var(--sev-medium-bg); }
.sev-baixo { color: var(--sev-low); background: var(--sev-low-bg); }
.sev-informativo { color: var(--sev-info); background: var(--sev-info-bg); }
.sev-informativo::before { background: transparent; border: 2px solid currentColor; }
.chip-ok { color: var(--sev-low); background: var(--sev-low-bg); }
.chip-warn { color: var(--sev-medium); background: var(--sev-medium-bg); }
.chip-bad { color: var(--sev-critical); background: var(--sev-critical-bg); }
.chip-info { color: var(--sev-info); background: var(--sev-info-bg); }
/* Classificação da informação, à maneira das marcações TLP: texto colorido sobre preto. */
.tlp { font: 700 .7rem/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: .1em .55em;
  border-radius: 3px; background: #000; color: #fff; white-space: nowrap; }
.tlp-uso_interno { color: #33ff00; }
.tlp-confidencial { color: #ffc000; }
.tlp-secreto { color: #ff2b2b; }

/* ── Superfícies ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.notice { display: flex; gap: .75rem; padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); font-size: .93rem; }
.notice-warning { border-color: var(--sev-medium); background: var(--sev-medium-bg); }
.notice-danger { border-color: var(--sev-critical); background: var(--sev-critical-bg); }
.notice-info { border-color: var(--sev-info); background: var(--sev-info-bg); }
.notice-success { border-color: var(--sev-low); background: var(--sev-low-bg); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.spinner { width: 1.1rem; height: 1.1rem; border: 2px solid var(--line-strong); border-top-color: var(--green);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -.2em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabelas ── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font: 600 .72rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: .7rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .clip { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Diálogo e avisos temporários ── */
dialog.dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--surface);
  color: var(--ink); width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow); }
dialog.dialog.wide { width: min(920px, calc(100vw - 2rem)); }
dialog.dialog::backdrop { background: rgba(6, 14, 10, .6); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-head h2 { font-size: 1.1rem; }
.dialog-body { padding: 1.25rem; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--surface); }
.icon-btn { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 1000; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--night); color: var(--on-night);
  box-shadow: var(--shadow); font-size: .92rem; border-left: 4px solid var(--green); animation: rise .2s ease-out; }
.toast-error { border-left-color: #f0685f; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; font-size: .93rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.prose { overflow-wrap: anywhere; }
.prose > * + * { margin-top: .9em; }
.prose h4 { font-size: 1.02rem; }
.prose ul { padding-left: 1.2em; margin-bottom: 0; }
.prose li + li { margin-top: .3em; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .no-print { display: none !important; }
}
