/* SecWatch – Oberfläche. Eine Datei für die Web-App (/static/style.css) und den statischen
   Schnappschuss (public/index.html, dort eingebettet). Keine externen Schriften oder Bilder (CSP).

   Leitidee: Warnbeschilderung. Verkehrsfarben (RAL 3020 Rot, 1003 Gelb, 5017 Blau, 6024 Grün),
   DIN-artige Schrift für Überschriften und Zahlen, die Schwere eines Falls als Schild am Rand. */

:root {
  --bg: #eef0f2;
  --panel: #fff;
  --ink: #14181d;
  --muted: #56616d;
  --line: #cfd5db;
  --crit: #c1121c;
  --high: #9a4d00;
  --ok: #00754a;
  --link: #005b8c;
  --sign-red: #c1121c;
  --sign-yellow: #f2a900;
  --sign-grey: #5f6b77;
  --sign-green: #00754a;
  --tint-crit: rgba(193, 18, 28, .07);
  --tint-ok: rgba(0, 117, 74, .08);
  --display: Bahnschrift, "DIN Alternate", "DIN Next", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151a;
    --panel: #1a2027;
    --ink: #e7ebef;
    --muted: #9aa5b1;
    --line: #2d3640;
    --crit: #ff6b6b;
    --high: #ffb14d;
    --ok: #4fc08d;
    --link: #6db7e8;
    --sign-red: #cf2630;
    --sign-yellow: #f2a900;
    --sign-grey: #4c5661;
    --sign-green: #0a7f55;
    --tint-crit: rgba(255, 107, 107, .1);
    --tint-ok: rgba(79, 192, 141, .1);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  overflow-wrap: break-word;
}

main { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
main.narrow { max-width: 32rem; }

h1, h2, h3, .brand, .plate, .count { font-family: var(--display); }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 600; margin: 0 0 .25rem; }
h2 { font-size: 1.25rem; line-height: 1.2; font-weight: 600; margin: 2.75rem 0 .75rem; }
h3 { font-size: 1.25rem; line-height: 1.25; font-weight: 600; margin: 0 0 .35rem; }
p { margin: 0 0 .75rem; max-width: 72ch; }
a { color: var(--link); text-underline-offset: .15em; }
ul { margin: .5rem 0; padding-left: 1.25rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; font-size: .9em; }

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* ---------- Kopfzeile ---------- */
.topnav { background: var(--panel); border-bottom: 1px solid var(--line); }
.topnav .in {
  max-width: 64rem; margin: 0 auto; padding: 0 1rem;
  display: flex; flex-wrap: wrap; gap: 0 1.25rem; align-items: center;
}
.topnav a {
  color: var(--ink); text-decoration: none;
  padding: .8rem 0 calc(.8rem - 3px); border-bottom: 3px solid transparent;
}
.topnav a:hover { border-bottom-color: var(--line); }
.topnav a[aria-current] { border-bottom-color: var(--ink); font-weight: 600; }
.topnav .brand { font-size: 1.25rem; font-weight: 700; margin-right: auto; }
.topnav .who { color: var(--muted); font-size: .9rem; }
.topnav form { margin: 0; }
.topnav button { padding: .25rem .7rem; }
.brandline { font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin: 0 0 1.5rem; }

/* ---------- Lage: die Übersicht in einem Satz ---------- */
.lage { border-left: .5rem solid var(--sign-green); padding: .25rem 0 .25rem 1.25rem; margin: 0 0 2.5rem; }
.lage.alarm { border-left-color: var(--sign-red); }
.lage h1 { font-size: clamp(1.75rem, 4.6vw, 2.9rem); line-height: 1.05; font-weight: 700; margin: 0 0 .6rem; }
.lage .sub { font-size: 1.125rem; margin: 0 0 .35rem; }
.lage .stand { color: var(--muted); font-size: .9rem; margin: 0; }
.lead { color: var(--muted); margin: .25rem 0 1.5rem; }

/* ---------- Listen (Tabellen) ---------- */
.liste { margin: 0 0 1.75rem; }
.liste h2 { margin: 0; padding: .5rem 0; border-top: 4px solid var(--link); display: flex; align-items: baseline; gap: .6rem; }
.liste-us h2 { border-top-color: var(--sign-red); }
.count { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); margin: 0; padding: .5rem 0; }
.tablewrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--line); background: var(--panel); }
.liste .tablewrap { margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .hint { margin: 0; }
.nw { white-space: nowrap; }
.liste td:nth-child(2) { min-width: 13rem; }
table input:not([type=checkbox]), table select { width: 100%; }

/* ---------- Marken ---------- */
.tag { display: inline-block; font-size: .8125rem; font-weight: 600; margin-right: .75rem; white-space: nowrap; }
.t-crit { color: var(--crit); }
.t-high, .t-maybe { color: var(--high); }
.t-new { color: var(--link); }
.t-ok { color: var(--ok); }
.t-us { color: #fff; background: var(--sign-red); padding: 0 .45rem; border-radius: 2px; }

/* ---------- Fall: Schild am Rand, Inhalt daneben ---------- */
article {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr);
  background: var(--panel); border: 1px solid var(--line); margin: 0 0 1rem;
  --plate-bg: var(--sign-yellow); --plate-ink: #14181d;
}
article.kritisch { --plate-bg: var(--sign-red); --plate-ink: #fff; }
article.mittel { --plate-bg: var(--sign-grey); --plate-ink: #fff; }
article.done { --plate-bg: var(--sign-green); --plate-ink: #fff; }
article.done .fall-body { opacity: .8; }
article:target { outline: 3px solid var(--link); outline-offset: 2px; }
.plate {
  background: var(--plate-bg); color: var(--plate-ink);
  padding: .9rem .4rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
.plate { overflow: hidden; min-width: 0; }
.plate b { font-size: 2rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plate span { font-size: .875rem; font-weight: 600; }
.plate small { font-size: .75rem; }
.fall-body { padding: .9rem 1.25rem 1rem; min-width: 0; }
h3 a.self { color: inherit; text-decoration: none; }
h3 a.self:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 .75rem; }
.meta .cves { display: block; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.brief { margin: 0 0 .6rem; }
.us { margin: 0 0 .6rem; padding: .45rem .75rem; border-left: 4px solid var(--sign-red); background: var(--tint-crit); }
.todo { margin: 0 0 .6rem; padding: .45rem .75rem; border-left: 4px solid var(--sign-green); background: var(--tint-ok); }
details { margin-top: .5rem; }
summary { cursor: pointer; color: var(--muted); }
details.all > summary { font-weight: 600; }
dl { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem 1rem; margin: .6rem 0; }
dt { color: var(--muted); }
dd { margin: 0; }

/* ---------- Formulare ---------- */
input, select, button, textarea { font: inherit; }
label { display: block; margin: 0 0 .85rem; font-size: .95rem; }
label > input, label > select { display: block; width: 100%; margin-top: .25rem; }
input:not([type]), input[type=text], input[type=password], input[type=email], select {
  padding: .45rem .6rem; border: 1px solid var(--muted); border-radius: 2px;
  background: var(--panel); color: var(--ink); min-width: 0;
}
button {
  padding: .45rem 1rem; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 600;
}
button:hover { background: var(--bg); }
button:disabled { opacity: .6; cursor: progress; }
button.primary { background: var(--ink); color: var(--panel); }
button.primary:hover { background: var(--link); border-color: var(--link); }
button.danger { border-color: var(--crit); color: var(--crit); }
.act form { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0 .25rem; }
.act input[type=text] { flex: 1 1 14rem; font-size: .9rem; padding: .3rem .5rem; }
.act button { font-size: .9rem; padding: .3rem .8rem; }
.act button[value=resolve], .rowact button[value=resolve] { border-color: var(--ok); color: var(--ok); }
.rowact { white-space: nowrap; }
.rowact > button { font-size: .8125rem; font-weight: 400; padding: .1rem .5rem; }
.teil { border-top: 1px solid var(--line); padding: .9rem 0 .25rem; }
.teil h3 { font-size: 1.0625rem; margin: 0; }
.teile { list-style: none; padding: 0; margin: .4rem 0 .6rem; }
.teile li { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; padding: .3rem 0; border-top: 1px dotted var(--line); }
.teile li:first-child { border-top: 0; }
.teile .hint { margin: 0; flex: 1 1 16rem; }
.teile form, .teil > form { margin: 0; }
.teile button, .teil > form button { font-size: .8125rem; font-weight: 400; padding: .1rem .5rem; }
.rowact form { display: flex; gap: .3rem; margin: 0; }
.rowact button { font-size: .8125rem; font-weight: 400; padding: .1rem .5rem; }
.box { background: var(--panel); border: 1px solid var(--line); padding: 1rem 1.25rem; margin: 0 0 1rem; }
.box h2 { margin: 0 0 .75rem; font-size: 1.125rem; }
.box > :last-child { margin-bottom: 0; }
.notice { padding: .6rem .9rem; margin: 0 0 1rem; border-left: 4px solid var(--line); background: var(--panel); max-width: none; }
.notice.err { border-left-color: var(--sign-red); color: var(--crit); }
.notice.ok { border-left-color: var(--sign-green); }
.notice.warn { border-left-color: var(--sign-yellow); }
.box.notice { border: 1px solid var(--line); border-left: 4px solid var(--sign-green); }
.msg { margin: .5rem 0 0; min-height: 1.2em; }
.msg.err { color: var(--crit); }
.check { display: flex; gap: .5rem; align-items: center; margin: 0; }
.check input { width: auto; margin: 0; }
code.secret {
  display: inline-block; font-size: 1.15rem; letter-spacing: .06em; word-break: break-all;
  padding: .3rem .5rem; background: var(--bg); border: 1px solid var(--line);
}
code.link { word-break: break-all; }
.hint { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }
.rowform { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.rowform label { margin: 0; flex: 1 1 12rem; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.actions form { margin: 0; }
.actions button { padding: .2rem .6rem; font-size: .85rem; font-weight: 400; }
.field { margin: 0 0 1rem; }
.field label { margin-bottom: .25rem; }
.field .check { margin-top: .25rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.25rem; }
pre.out {
  white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line);
  padding: .6rem .75rem; font-size: .82rem; max-height: 24rem; overflow: auto;
}
.sep { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.qr { display: inline-block; background: #fff; padding: .5rem; border: 1px solid var(--line); line-height: 0; margin: 0 0 .5rem; }
.qr svg { width: min(220px, 70vw); height: auto; }

@media (max-width: 600px) {
  article { grid-template-columns: 1fr; }
  .plate { flex-direction: row; justify-content: flex-start; gap: .6rem; padding: .4rem 1rem; }
  .plate b { font-size: 1.4rem; }
  .fall-body { padding: .75rem 1rem 1rem; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: .5rem; }
  .lage { padding-left: .9rem; }
}
