/* diEDok – Weboberfläche. Farben aus Logo/Favicon: Signalrot + Anthrazit. */
:root {
  --red: #db271d;
  --red-dark: #b01e16;
  --red-soft: #fdecea;
  --ink: #181a20;
  --ink-2: #23262e;
  --ink-3: #2f333d;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --line: #dfe2e8;
  --line-strong: #c9ced7;
  --text: #1c1f25;
  --muted: #5f6673;
  --ok: #1d7a47;
  --ok-soft: #e6f4ec;
  --warn: #9a6400;
  --warn-soft: #fff4dc;
  --test: #f2b705;
  --focus: #2563eb;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--paper); }
a { color: var(--red-dark); }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Gerüst ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #c9ccd3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--ink-3); }
.brand img { width: 118px; height: auto; display: block; }
.brand .env { font-size: .7rem; font-weight: 700; background: var(--test); color: #1c1600; border-radius: 4px; padding: .1rem .4rem; }
.nav { padding: .75rem .6rem 1rem; flex: 1; }
.nav-group { margin-top: 1rem; }
.nav-group:first-child { margin-top: 0; }
.nav-title { font-size: .78rem; color: #8b909b; padding: 0 .65rem .3rem; }
.nav a { display: flex; align-items: center; gap: .6rem; color: #e3e5ea; text-decoration: none; padding: .45rem .65rem; border-radius: 6px; font-size: .94rem; position: relative; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-3); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -.6rem; top: .35rem; bottom: .35rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-foot { padding: .9rem 1.25rem 1.2rem; border-top: 1px solid var(--ink-3); font-size: .85rem; }
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot form { margin-top: .5rem; }
.linkbtn { background: none; border: 0; color: #c9ccd3; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.linkbtn:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.context { background: var(--ink-2); color: #fff; padding: .5rem 2rem; font-size: .9rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.context.impersonating { background: var(--red-dark); }
.context form { margin: 0 0 0 auto; }
.context .btn { background: #fff; color: var(--red-dark); border-color: #fff; }
.demo-bar { background: var(--warn-soft); color: var(--warn); padding: .5rem 2rem; font-size: .9rem; border-bottom: 1px solid #f0d9a8; }
.content { padding: 1.75rem 2rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .lead { color: var(--muted); margin: .15rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Bausteine ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.panel > h2:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }

.figures { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.25rem; overflow: hidden; flex-wrap: wrap; }
.figure { flex: 1 1 160px; padding: 1rem 1.25rem; border-right: 1px solid var(--line); }
.figure:last-child { border-right: 0; }
.figure .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure .label { color: var(--muted); font-size: .88rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-size: .92rem; font-weight: 600; line-height: 1.2;
  padding: .55rem .95rem; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-danger { color: var(--red-dark); border-color: #efb4af; }
.btn-danger:hover { background: var(--red-soft); color: var(--red-dark); border-color: var(--red); }
.btn-sm { padding: .3rem .6rem; font-size: .84rem; font-weight: 500; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--paper); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

.alert { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert-ok { background: var(--ok-soft); border-color: #b9e0c9; color: #135a33; }
.alert-error { background: var(--red-soft); border-color: #f2bbb6; color: #8f1a13; }
.alert-info { background: #eef3fb; border-color: #c8d7f0; color: #23426e; }
.alert-warn { background: var(--warn-soft); border-color: #f0d9a8; color: #7a5000; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); border-color: #b9e0c9; color: var(--ok); }
.badge-red { background: var(--red-soft); border-color: #f2bbb6; color: var(--red-dark); }
.badge-warn { background: var(--warn-soft); border-color: #f0d9a8; color: var(--warn); }
.type-chip { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.type-chip i { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; background: var(--c, #999); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.25rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .84rem; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.is-cancelled td { color: var(--muted); text-decoration: line-through; }
tr.is-cancelled td.keep { text-decoration: none; }
.row-link { color: inherit; text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--red-dark); text-decoration: underline; }
td.edge { padding: 0; width: 4px; background: var(--c, transparent); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text); }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid rgba(37, 99, 235, .2); outline-offset: 0; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin-bottom: .5rem; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--red); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem 1rem; align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 130px; }
.filters .grow { flex: 1 1 220px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .35rem; }
details.inline-form > summary { cursor: pointer; list-style: none; display: inline-flex; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] > summary { margin-bottom: .75rem; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .1rem .75rem; max-height: 220px; overflow: auto; padding: .4rem .5rem; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.multi .check { margin: .15rem 0; font-size: .9rem; }

/* ---------- Einsatzdetail ---------- */
.mission-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border-left: 6px solid var(--c, var(--red)); padding-left: 1rem; margin-bottom: 1.25rem; }
.mission-head .kicker { color: var(--muted); font-size: .92rem; }
.mission-head h1 { font-size: 1.8rem; }
dl.facts { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Statuszeiten als Zeitleiste (FMS-Status) */
.timeline { list-style: none; margin: .5rem 0 .25rem; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); position: relative; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 1.05rem; height: 3px; background: var(--line); border-radius: 3px; }
.timeline li { position: relative; padding-top: 1.9rem; text-align: center; min-width: 0; }
.timeline li::before { content: ""; position: absolute; top: .7rem; left: 50%; width: .8rem; height: .8rem; margin-left: -.4rem; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-strong); }
.timeline li.set::before { border-color: var(--red); background: var(--red); }
.timeline .t { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; display: block; }
.timeline .s { font-size: .78rem; color: var(--muted); display: block; line-height: 1.25; padding: 0 .2rem; }
.timeline li.unset .t { color: var(--line-strong); }
.toggles { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ---------- Statistik ---------- */
.bars { display: grid; gap: .35rem; }
.bar { display: grid; grid-template-columns: minmax(110px, 28%) 1fr 3.5rem; gap: .6rem; align-items: center; font-size: .9rem; }
.bar .track { background: var(--paper); border-radius: 4px; height: 1.1rem; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--c, var(--red)); border-radius: 4px; min-width: 2px; }
.bar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-strong); }
.chart .col { fill: var(--red); }
.chart .col:hover { fill: var(--red-dark); }
.chart text { font-size: 11px; fill: var(--muted); }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); background: var(--surface); }
.auth-art { background: var(--ink); color: #c9ccd3; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; position: relative; overflow: hidden; }
.auth-art img { width: 210px; height: auto; }
.auth-art .claim { font-size: 1.6rem; line-height: 1.3; color: #fff; max-width: 22ch; font-weight: 600; }
.auth-art .stripes { position: absolute; right: -60px; bottom: -40px; width: 360px; height: 220px; transform: rotate(-24deg);
  background: repeating-linear-gradient(90deg, var(--red) 0 34px, transparent 34px 68px); opacity: .9; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 3rem 2.5rem; }
.auth-form h1 { margin-bottom: .35rem; }
.auth-form form { margin-top: 1.25rem; }
.auth-form .btn-primary { width: 100%; padding: .7rem; margin-top: .4rem; }
.plain { max-width: 560px; margin: 4rem auto; padding: 0 1.25rem; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; }
  .topbar { display: flex; align-items: center; gap: .75rem; background: var(--ink); color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 5; }
  .topbar img { width: 92px; }
  .topbar button { background: none; border: 1px solid var(--ink-3); color: #fff; border-radius: 6px; padding: .35rem .55rem; font: inherit; }
  .content { padding: 1.25rem 1rem 2.5rem; }
  .context, .demo-bar { padding: .5rem 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 1.5rem; min-height: 180px; }
  .auth-art .claim { font-size: 1.2rem; }
  .figure { border-right: 0; border-bottom: 1px solid var(--line); }
  .timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: .75rem; }
  .timeline::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .context, .demo-bar, .actions, .filters, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .panel, .table-wrap { border-color: #bbb; }
}
.foot-link { color: #c9ccd3; }
.foot-link:hover { color: #fff; }

/* ---------- Newsletter ---------- */
.mail-preview { border: 1px solid var(--line); border-radius: var(--radius); background: #f3f4f6; max-height: 520px; overflow: auto; }
.code-block { font-family: var(--mono); font-size: .8rem; background: #f3f4f6; border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; white-space: pre-wrap; word-break: break-all; }

/* Zwei-Faktor-Anmeldung */
.plain-wide { max-width: 680px; }
.otp-input { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .18em; max-width: 12rem; text-align: center; }
.mfa-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.mfa-steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; display: grid; gap: .4rem; }
.mfa-steps > li::before { content: counter(step); position: absolute; left: 0; top: -.1rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.mfa-qr svg { width: 220px; height: 220px; display: block; border: 1px solid var(--line); border-radius: 8px; }
.mfa-secret { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.mfa-secret code { font-family: var(--mono); font-size: .95rem; background: #f3f4f6; border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; word-break: break-all; }
.mfa-codes { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .4rem; }
.mfa-codes code { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .05em; }
@media print { .mfa-codes + .btn, .mfa-codes ~ .btn, .plain > p:last-child { display: none; } }
