/* CyproSOAR UI: panel board (design-system/cyprosoar/MASTER.md).
   A dark header band, then every section as a titled panel: white surface, 1 px border, a caption
   bar, square corners, no shadows. Grey ground. The accent is reserved for the one primary action
   per page, links and focus; severity is a square marker plus the word. System font stack because
   the CSP (default-src 'self') forbids web fonts. Text/ground pairs are 4.5:1 or better in both
   modes. */
:root {
  color-scheme: light dark;
  --ground: #eef0f3;
  --surface: #ffffff;
  --surface-head: #f5f7fa;
  --ink: #1b2430;
  --ink-muted: #5b6675;
  --border: #cfd6df;
  --band: #1b2430;
  --band-ink: #ffffff;
  --band-muted: #aab4c1;
  --accent: #0b57a4;
  --accent-hover: #094887;
  --on-accent: #ffffff;
  --danger: #9f1239;
  --sev-critical: #9f1239;
  --sev-high: #c2410c;
  --sev-medium: #a16207;
  --sev-low: #15803d;
  --sev-info: #5b6675;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1419;
    --surface: #161d26;
    --surface-head: #1b232e;
    --ink: #e6edf3;
    --ink-muted: #a9b6c3;
    --border: #2a3441;
    --band: #0b1016;
    --band-ink: #e6edf3;
    --band-muted: #8b98a8;
    --accent: #6cb4ff;
    --accent-hover: #8fc6ff;
    --on-accent: #0b1a2b;
    --danger: #ff9b9b;
    --sev-critical: #ff9b9b;
    --sev-high: #ffb4a0;
    --sev-medium: #f0c674;
    --sev-low: #7fd1a8;
    --sev-info: #a9b6c3;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1 { font-size: 1.375rem; font-weight: 600; line-height: 1.25; margin: 0; }
p { margin: 0 0 var(--space-4); }
a { color: var(--accent); text-underline-offset: 3px; }
code { font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.9375rem; }
.muted { color: var(--ink-muted); }
th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
label, .facts dt {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.skip-link { position: absolute; left: var(--space-2); top: -100px; padding: var(--space-2) var(--space-3); background: var(--surface); color: var(--ink); border: 2px solid var(--accent); z-index: 10; }
.skip-link:focus { top: var(--space-2); }

/* Header band: brand, navigation, account on one dark strip on every page. */
.band { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-4); background: var(--band); color: var(--band-ink); min-height: 48px; }
.band .brand { color: var(--band-ink); font-weight: 600; text-decoration: none; font-size: 1.0625rem; }
.band nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; }
.band nav a { color: var(--band-muted); text-decoration: none; padding: var(--space-1) 0; }
.band nav a[aria-current="page"], .band nav a:hover { color: var(--band-ink); }
.band .who { color: var(--band-muted); overflow-wrap: anywhere; }
.band .button { min-height: 34px; padding: var(--space-1) var(--space-3); border-color: var(--band-muted); color: var(--band-ink); }
.band .button:hover { background: rgba(255, 255, 255, 0.08); }

/* Page column and the stand-alone (sign-in, error) centring. */
.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: var(--space-4); display: grid; gap: var(--space-3); }
/* A wide table scrolls inside its panel; the page itself never scrolls horizontally at 375 px. */
.page > * { min-width: 0; }
.panel { overflow-x: auto; position: relative; }  /* relative: the sr-only labels in a table stay inside the panel's scroll box */
.page-title { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: baseline; justify-content: space-between; padding: var(--space-2) 0; }
.centered { flex: 1; display: grid; place-items: center; padding: var(--space-4); }
.centered .panel { width: 100%; max-width: 26rem; }

/* Panels: the unit of every page. Caption bar, then body. */
.panel { background: var(--surface); border: 1px solid var(--border); }
.panel-head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); background: var(--surface-head); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); min-height: 36px; }
.panel-head h1, .panel-head h2 { font: inherit; margin: 0; color: inherit; }
.panel-body { padding: var(--space-4); }
.panel-body > :last-child { margin-bottom: 0; }

/* Forms: visible label above, bordered field, 44 px tall; the error reddens the border. */
.field { margin-bottom: var(--space-4); }
input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  width: 100%;
  margin-top: var(--space-1);
}
input:hover { border-color: var(--ink-muted); }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
input:focus-visible, .button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.required { color: var(--danger); margin-left: 2px; }
.help { color: var(--ink-muted); font-size: 0.9375rem; margin: var(--space-4) 0 0; }

/* Buttons: one filled primary per page; everything else is an outline. */
.button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--ink-muted);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease, color 150ms ease;
}
.button:hover { background: var(--surface-head); }
.button-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button-block { width: 100%; }

/* Alerts: a danger-coloured message with the icon, bordered, never a tinted box. */
.alert { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); border: 1px solid var(--danger); margin-bottom: var(--space-4); }
.alert-error { color: var(--danger); }
.alert .icon { flex: none; margin-top: 3px; }

/* Definition rows inside a panel: label column, value column, hairline per row. */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0; }
.facts dt, .facts dd { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); margin: 0; }
.facts dt { padding-top: calc(var(--space-3) + 4px); }
.facts dd { overflow-wrap: anywhere; }
.facts dt:nth-last-of-type(1), .facts dd:last-of-type { border-bottom: 0; }
.tag { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid currentColor; padding: 1px var(--space-2); margin-left: var(--space-2); }

/* Tables inside panels: uppercase header on the caption ground, hairlines between rows. */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: var(--space-2) var(--space-3); background: var(--surface-head); border-bottom: 1px solid var(--border); }
.table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-head); }
.table .actions { white-space: nowrap; }
.table .actions form { display: inline-flex; gap: var(--space-2); align-items: center; margin-right: var(--space-2); }
.inline-form { display: inline-flex; gap: var(--space-2); align-items: center; }
.button-small { min-height: 32px; padding: var(--space-1) var(--space-3); font-size: 0.875rem; }
.input-small, select.input-small { min-height: 32px; width: auto; margin: 0; padding: var(--space-1) var(--space-2); font-size: 0.875rem; }
select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 0; padding: var(--space-2) var(--space-3); min-height: 44px; width: 100%; margin-top: var(--space-1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3) var(--space-4); align-items: end; }
.form-row .field { margin: 0; }
.form-row + fieldset.field { margin-top: var(--space-4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* The platform-entry banner (D17): persistent, under the band, never dismissable. */
.banner { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-4); background: var(--surface-head); border-bottom: 2px solid var(--sev-medium); color: var(--ink); }

/* Enrollment steps and the one-time recovery code list. */
.steps { padding-left: var(--space-6); margin: 0 0 var(--space-4); }
.steps li { margin-bottom: var(--space-3); }
.secret { font-size: 1.125rem; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.codes { columns: 2; padding-left: var(--space-6); margin: 0 0 var(--space-6); }
.codes li { break-inside: avoid; padding: var(--space-1) 0; }
.help form, form.help { display: inline; }

/* Severity: a square marker and the word, never colour alone. */
.sev::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: currentColor; vertical-align: 0; }
.sev-critical { color: var(--sev-critical); }
.sev-high { color: var(--sev-high); }
.sev-medium { color: var(--sev-medium); }
.sev-low { color: var(--sev-low); }
.sev-info { color: var(--sev-info); }

@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .facts dt { border-bottom: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Incident pages: free text, comment bodies, the timeline list and tag chips. */
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 0; padding: var(--space-2) var(--space-3); width: 100%; margin-top: var(--space-1); resize: vertical; }
textarea:hover { border-color: var(--ink-muted); }
textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.raw { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.875rem; }
.comment { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: 0; }
.comment p { margin-bottom: var(--space-1); }
.prose > :last-child { margin-bottom: 0; }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.prose blockquote { margin: 0 0 var(--space-4); padding-left: var(--space-3); border-left: 2px solid var(--border); color: var(--ink-muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 11rem minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.875rem; color: var(--ink-muted); }
.timeline .what { overflow-wrap: anywhere; }
.chips { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.chips li { display: inline-flex; align-items: center; gap: var(--space-2); }
.chips .tag { margin-left: 0; }
@media (max-width: 640px) {
  .timeline li { grid-template-columns: 1fr; gap: var(--space-1); }
}

/* Overview: label-over-number cells separated by vertical hairlines (MASTER.md), never tiles. */
.overview { display: flex; flex-wrap: wrap; margin: 0; border-bottom: 1px solid var(--border); }
.overview:last-child { border-bottom: 0; }
.overview > div { flex: 1 1 7rem; padding: var(--space-3) var(--space-4); border-right: 1px solid var(--border); }
.overview > div:last-child { border-right: 0; }
.overview dt { margin-bottom: var(--space-1); }
.overview dd { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.25; }
.guide { margin: 0 0 var(--space-4); white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.875rem; padding: var(--space-3); border: 1px solid var(--border); }

/* Checkbox rows (scopes): the label keeps the uppercase caption style, the row does not. */
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--space-4); }
fieldset.field legend { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); padding: 0; margin-bottom: var(--space-2); }
label.check { display: flex; gap: var(--space-2); align-items: baseline; font-size: 1rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); padding: var(--space-1) 0; }
label.check input { width: auto; min-height: 0; margin: 0; }
