/* Redaktionstisch: ruhige Flächen, eine Leitfarbe, DIN-Schrift (Bahnschrift) für Überschriften und Zahlen.
   Keine externen Schriften oder Dienste (Content-Security-Policy). */
:root {
  color-scheme: light;
  --canvas: #f1f3f9; --surface: #ffffff; --sunken: #f7f8fc;
  --ink: #17203a; --ink-2: #525d78; --muted: #7a849c;
  --line: #e0e4ef; --line-strong: #c5cbdc;
  --brand: #3646c8; --brand-hover: #2b39ac; --brand-soft: #e9ebfb; --on-brand: #ffffff;
  --rail: #17203a; --rail-ink: #b9c0d8; --rail-active: #ffffff; --rail-hover: rgba(255,255,255,.07);
  --good: #0d7a3a; --good-soft: #e2f4e9; --warning: #8a5a00; --warning-soft: #fdf0d2;
  --critical: #b3261e; --critical-soft: #fbe9e7;
  --series: #3646c8; --grid: #e3e6f0; --axis: #bcc3d6; --up: #0d7a3a;
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #0e1322; --surface: #171d31; --sunken: #121829;
    --ink: #e9ecf6; --ink-2: #adb5cd; --muted: #848daa;
    --line: #262e48; --line-strong: #3a4466;
    --brand: #8f9cff; --brand-hover: #a7b1ff; --brand-soft: #232b55; --on-brand: #0e1322;
    --rail: #0a0e1a; --rail-ink: #99a2bf;
    --good: #58cf8a; --good-soft: #143325; --warning: #f2c15c; --warning-soft: #35290f;
    --critical: #ff8f86; --critical-soft: #3a1b1a;
    --series: #8f9cff; --grid: #262e48; --axis: #3a4466; --up: #58cf8a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 30px; margin: 0; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 4px; }
p { margin: 0 0 10px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--sunken); border-radius: 4px; padding: 0 4px; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.lead { color: var(--ink-2); max-width: 70ch; margin: 6px 0 0; }
.meta { color: var(--ink-2); font-size: 13px; margin: 4px 0; }
.empty { color: var(--ink-2); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- Gerüst --------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; text-decoration: none; font: 600 18px var(--display); padding: 0 10px 14px; display: block; }
.rail .new { justify-content: center; margin: 0 0 14px; background: #fff; color: #17203a; border-color: #fff; }
.rail .new:hover { background: #e9ebfb; color: #17203a; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a { display: flex; align-items: center; gap: 12px; color: var(--rail-ink); text-decoration: none; padding: 9px 10px; border-radius: var(--r-s); }
.rail nav a:hover { background: var(--rail-hover); color: var(--rail-active); }
.rail nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.rail nav .count { margin-left: auto; font: 600 12px var(--display); background: #f2c15c; color: #17203a; border-radius: 99px; padding: 0 8px; }
.rail .foot { margin-top: auto; font-size: 13px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; }
main { padding: 32px clamp(16px, 4vw, 48px) 64px; width: 100%; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.back { display: inline-block; font-size: 13px; margin-bottom: 8px; }

.rail .foot form { margin: 0; }
.rail .foot button.logout { width: 100%; justify-content: flex-start; gap: 12px; font: 400 13px var(--body); background: none; border-color: transparent; color: var(--rail-ink); padding: 9px 10px; }
.rail .foot button.logout:hover { background: var(--rail-hover); border-color: transparent; color: var(--rail-active); }

/* --- Anmeldung ------------------------------------------------------------ */
body.login { display: grid; place-items: center; min-height: 100vh; background: var(--rail); }
body.login main { max-width: 380px; padding: 24px 16px; }
body.login h1 { color: #fff; margin-bottom: 20px; }
body.login .panel { display: flex; flex-direction: column; gap: 16px; margin: 0; }
body.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
body.login button { justify-content: center; }

@media (max-width: 860px) {
  .shell { display: block; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .brand { padding: 0 8px 0 0; margin-right: auto; }
  .rail .new { margin: 0; }
  .rail nav { flex-direction: row; width: 100%; overflow-x: auto; }
  .rail nav a { white-space: nowrap; }
  .rail .foot { margin: 0; border: 0; padding: 0; width: 100%; }
}

/* --- Bausteine ------------------------------------------------------------ */
button, .button { font: 600 14px var(--body); cursor: pointer; background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand); border-radius: var(--r-s); padding: 9px 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover, .button.secondary:hover { border-color: var(--brand); color: var(--brand); }
button.quiet { background: none; border-color: transparent; color: var(--ink-2); }
button.quiet:hover { background: var(--critical-soft); border-color: transparent; color: var(--critical); }
button.big, .button.big { font-size: 16px; padding: 12px 24px; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.busy { cursor: progress; }
button.busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.busy::before { animation: none; } }

.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.panel { padding: 20px; margin: 16px 0; }
.panel > :last-child { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.card { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2, .card p { margin: 0; }
.card.muted h2 { color: var(--ink-2); }
.card .big { font: 600 28px var(--display); }
.card .big span { font: 400 13px var(--body); color: var(--ink-2); }
.card .button, .card button { margin-top: auto; align-self: flex-start; }

.badge { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line); }
.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.critical { background: var(--critical-soft); color: var(--critical); border-color: transparent; }
.badge.ready { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

.flash { display: block; padding: 12px 16px; border-radius: var(--r-m); background: var(--good-soft); color: var(--ink); border: 1px solid var(--good); margin: 0 0 14px; overflow-wrap: anywhere; }
.flash.error { background: var(--critical-soft); border-color: var(--critical); }
.flash.warn { background: var(--warning-soft); border-color: var(--warning); }
div.flash ul { margin: 6px 0 0; }

/* Der nächste Schritt: das eine auffällige Element der Startseite. */
.next { background: var(--brand); color: var(--on-brand); border-radius: var(--r-l); padding: 28px clamp(20px, 3vw, 36px); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.next h2 { font-size: 26px; margin: 0 0 4px; }
.next p { margin: 0; max-width: 62ch; opacity: .92; }
.next .button { background: var(--surface); border-color: var(--surface); color: var(--ink); }
.next .button:hover { background: var(--brand-soft); border-color: var(--brand-soft); }

/* Ablauf in drei echten Schritten */
.flow { list-style: none; margin: 16px 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; counter-reset: step; }
.flow li { counter-increment: step; }
.flow a, .flow span.step { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.flow a:hover { border-color: var(--brand); }
.flow a::before, .flow span.step::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); font: 600 14px var(--display); color: var(--ink-2); }
.flow b { font-weight: 600; }
.flow strong { font: 600 24px var(--display); }
.flow li.active > * { border-color: var(--brand); }
.flow li.active > *::before { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.flow li.done > *::before { content: "✓"; background: var(--good-soft); border-color: var(--good); color: var(--good); }
.flow.compact span.step { grid-template-columns: auto 1fr; padding: 9px 14px; }
@media (max-width: 640px) { .flow { grid-template-columns: 1fr; } }

/* Kennzahlen als eine zusammenhängende Leiste */
.tiles { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin: 16px 0; }
.tile { flex: 1 1 170px; background: var(--surface); padding: 16px 20px; display: flex; flex-direction: column; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font: 600 32px/1.25 var(--display); }
.delta { font-size: 12.5px; color: var(--ink-2); }
.delta.up { color: var(--up); }
.delta.down { color: var(--critical); }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.split > .panel { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.thumb { width: 56px; height: 40px; object-fit: cover; border-radius: var(--r-s); background: var(--brand-soft); flex: none; }

.filters { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; margin: 0; }
.filters a { padding: 5px 16px; border-radius: 99px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.filters a:hover { color: var(--brand); }
.filters a[aria-current="page"] { background: var(--brand); color: var(--on-brand); font-weight: 600; }

/* Beiträge als Brett */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.column h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; border-bottom: 3px solid var(--line-strong); padding-bottom: 8px; }
.column h2 span { color: var(--muted); font-size: 15px; }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; text-decoration: none; color: var(--ink); margin-bottom: 12px; }
.post-card:hover { border-color: var(--brand); }
.post-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-card > a { display: block; color: var(--ink); text-decoration: none; }
.post-card > a > div { padding: 12px 14px; }
.post-card footer { border-top: 1px solid var(--line); padding: 4px 8px; display: flex; justify-content: flex-end; }
.post-card footer form, .list form { margin: 0; }
.post-card footer button, .list button.quiet { font-size: 13px; padding: 4px 10px; }
.delete-link { font-size: 13px; color: var(--ink-2); padding: 4px 10px; }
.post-card p { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.placeholder { border: 1px dashed var(--line-strong); border-radius: var(--r-m); padding: 18px; color: var(--ink-2); font-size: 14px; }
@media (max-width: 960px) { .board { grid-template-columns: 1fr; } }

/* --- Formulare ------------------------------------------------------------ */
.upload { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.upload label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.upload label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.upload .panel { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.upload .panel h2, .upload .panel p { margin: 0; }
.upload > button { align-self: flex-start; }
.group { display: flex; flex-direction: column; gap: 14px; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea, select { font: 400 15px/1.5 var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s); padding: 9px 12px; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; }
textarea.hero { font-size: 18px; padding: 16px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
input[type="file"] { font: inherit; font-weight: 400; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-s); background: var(--sunken); width: 100%; }
input[type="file"]::file-selector-button { font: 600 13px var(--body); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--r-s); padding: 6px 12px; margin-right: 12px; cursor: pointer; }
input[readonly], textarea[readonly] { background: var(--sunken); color: var(--ink-2); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.chips label.check { border: 1px solid var(--line-strong); border-radius: 99px; padding: 8px 18px 8px 14px; background: var(--surface); cursor: pointer; }
.chips label.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.chips label.check:has(input:disabled) { opacity: .55; cursor: not-allowed; }
details > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand); padding: 4px 0; }
details[open] > summary { margin-bottom: 12px; }
details.panel > summary { font: 600 17px var(--display); color: var(--ink); padding: 0; }
details .upload { margin-top: 12px; }

/* --- Entwurf: links bearbeiten, rechts Vorschau und Entscheidung ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
.editor .panel:first-child { margin-top: 0; }
.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.side .panel { margin: 0; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .side { position: static; max-height: none; } }
.hooks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hooks li { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 14px; }
.hooks li.chosen { border-color: var(--brand); background: var(--brand-soft); }
.hooks small { display: block; color: var(--ink-2); }
.mock { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; }
.mock header { display: flex; gap: 10px; align-items: center; padding: 12px 14px 8px; }
.mock .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font: 600 17px var(--display); }
.mock .body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 14px 12px; font-size: 14px; max-height: 340px; overflow-y: auto; }
.mock .title { font-weight: 600; padding: 10px 14px 4px; }
.mock img { width: 100%; display: block; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.tabs button { background: none; color: var(--ink-2); border-color: transparent; padding: 5px 12px; }
.tabs button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }
img.preview { max-width: 100%; max-height: 420px; border-radius: var(--r-m); border: 1px solid var(--line); display: block; }
.dirty-note { color: var(--warning); font-weight: 600; font-size: 13px; }

/* --- Daten ---------------------------------------------------------------- */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 12px; align-items: center; padding: 5px 0; }
.bars li:hover, .bars li:focus-visible { background: var(--sunken); }
.bars .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-size: 13px; text-align: right; }
.track { display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--axis); min-width: 0; }
.bar { display: block; height: 16px; background: var(--series); border-radius: 0 4px 4px 0; flex: none; }
.bar.weak { opacity: .4; }
.val { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter { display: inline-block; width: 180px; max-width: 40vw; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.meter .fill { display: block; height: 100%; background: var(--series); border-radius: 4px; }
svg.line { width: 100%; height: auto; display: block; }
svg.line text { fill: var(--muted); font-size: 11px; }
svg.line text.endlabel { fill: var(--ink); font-size: 12px; font-weight: 600; }
svg.line .grid { stroke: var(--grid); stroke-width: 1; }
svg.line .axis { stroke: var(--axis); stroke-width: 1; }
svg.line polyline { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.line .hit { fill: transparent; }
svg.line .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; opacity: 0; }
svg.line .dot.last, svg.line .point:hover .dot, svg.line .point:focus .dot { opacity: 1; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.title { max-width: 340px; overflow-wrap: anywhere; }
td form { margin: 0; }
.cover { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile img { border-radius: 50%; }
.profile form { margin-left: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row form { margin: 0; }
.row select { width: auto; }
.steps li { margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
#tooltip { position: fixed; z-index: 10; max-width: 320px; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: var(--r-s); padding: 6px 10px; font-size: 12.5px; }
@media (max-width: 600px) { .bars li { grid-template-columns: 1fr; gap: 2px; } .bars .name { text-align: left; } .split { grid-template-columns: 1fr; } }

/* Unwiderrufliches Loeschen: bewusst abgesetzt */
details.danger > summary { color: var(--critical); }
button.destroy { background: var(--critical); border-color: var(--critical); color: var(--surface); }
button.destroy:hover { background: var(--critical); border-color: var(--critical); filter: brightness(.9); }
