/* ══ COCKPIT — shell.css · Reset, Rail, Topbar, View-Rahmen ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* E11 (06.08.): die Seite scrollt NIE horizontal — breite Inhalte scrollen in
     eigenen Containern (.tblscroll/.tblwrap). clip statt hidden: erzeugt keinen
     Scroll-Container, position:sticky (Akte-PDF) bleibt intakt. */
  overflow-x: clip;
}
::selection { background: var(--brass-srf); color: var(--on-brass); }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: var(--fg); }
b { font-weight: 700; }
svg { display: block; }

.mono { font-family: var(--f-mono); letter-spacing: .06em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 2px; }
.rail :focus-visible { outline-color: var(--brass-srf); }

.skip {
  position: fixed; top: -4rem; left: 1rem; z-index: 200;
  background: var(--brass-srf); color: var(--on-brass);
  padding: .6rem 1rem; font-family: var(--f-mono); font-size: .8rem;
  transition: top .2s var(--ease-out);
}
.skip:focus-visible { top: 1rem; }

/* ── Instrumentenleiste (Rail) — das eine dunkle Element ── */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 60;
  display: flex; flex-direction: column; align-items: stretch;
  background: var(--night);
  color: var(--bone-dim);
  padding: .9rem 0 .8rem;
  border-right: 1px solid rgba(234, 229, 217, .08);
}
.rail__mark {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  color: var(--brass-srf);
  padding: .5rem 0 1.1rem;
  margin-bottom: .4rem;
  border-bottom: 1px solid rgba(234, 229, 217, .1);
}
.rail__brand {
  font-family: var(--f-disp); font-weight: 800; font-stretch: 118%;
  font-size: .92rem; letter-spacing: .1em; color: var(--bone);
}
.rail__link {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .72rem 0 .6rem;
  min-height: 60px;
  font-family: var(--f-mono); font-size: var(--fs-micro);
  letter-spacing: .1em; text-transform: uppercase;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.rail__link svg { width: 21px; height: 21px; }
.rail__link:hover { color: var(--bone); background: var(--night-2); }
.rail__link.on { color: var(--brass-srf); }
.rail__link.on::before {                 /* Rauten-Marker an der Kante */
  content: ""; position: absolute; left: -4px; top: 50%;
  width: 8px; height: 8px; background: var(--brass-srf);
  transform: translateY(-50%) rotate(45deg);
}
.rail__badge[hidden] { display: none; }   /* 0 offene Reviews (z. B. offline) — kein 0-Badge */
.rail__badge {
  position: absolute; top: .45rem; right: .85rem;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--st-block); color: #fff;
  font-family: var(--f-mono); font-size: .62rem; font-weight: 700;
  border-radius: 9px;
}
.rail__foot {
  margin-top: auto; text-align: center;
  font-family: var(--f-mono); font-size: .6rem; letter-spacing: .18em;
  color: rgba(234, 229, 217, .38);
}

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; left: var(--rail-w); right: 0; z-index: 50;
  height: var(--top-h);
  display: flex; align-items: center; gap: 1.1rem;
  padding: 0 var(--pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__title {
  font-family: var(--f-disp); font-weight: 800; font-stretch: 116%;
  font-size: 1.02rem; letter-spacing: .04em; white-space: nowrap;
}
.topbar__title b { color: var(--brass); }
.topbar__prod {
  margin-left: .5rem; padding: .14rem .5rem .12rem;
  font-family: var(--f-mono); font-size: .64rem; font-weight: 500;
  letter-spacing: .16em; color: var(--bone);
  background: var(--night); border-radius: 3px;
  vertical-align: 2px;
}
.topbar__search {
  display: flex; align-items: center; gap: .5rem;
  flex: 0 1 340px; margin-left: auto;
  height: 36px; padding: 0 .8rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 18px; color: var(--fg-dim);
}
.topbar__search:focus-within { border-color: var(--brass); }
.topbar__search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  font-family: var(--f-mono); font-size: .78rem; letter-spacing: .04em;
}
.topbar__search input::placeholder { color: var(--fg-dim); opacity: .75; }
.topbar__badge {
  padding: .32rem .7rem .28rem;
  font-family: var(--f-mono); font-size: .64rem; font-weight: 500;
  letter-spacing: .14em; white-space: nowrap;
  color: var(--brass); border: 1px solid color-mix(in srgb, var(--brass) 55%, transparent);
  outline: 1px solid color-mix(in srgb, var(--brass) 22%, transparent); outline-offset: 2px;
  border-radius: 3px; transform: rotate(-.6deg);   /* Stempel-Signatur */
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
/* Live-Modus: das Badge wird zum ruhigen „LIVE"-Signal (grüner Zustand, kein Stempel-Tilt) */
.topbar__badge--live {
  color: var(--st-clear); border-color: color-mix(in srgb, var(--st-clear) 55%, transparent);
  outline-color: color-mix(in srgb, var(--st-clear) 22%, transparent);
  transform: none; letter-spacing: .18em; font-weight: 700;
}
.topbar__badge--live::before {
  content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .5em;
  border-radius: 50%; background: var(--st-clear); vertical-align: 1px;
}
/* Offline: die Live-API ist nicht erreichbar — rotes, ruhiges Signal (kein Demo-Fallback) */
.topbar__badge--off {
  color: var(--st-block); border-color: color-mix(in srgb, var(--st-block) 55%, transparent);
  outline-color: color-mix(in srgb, var(--st-block) 22%, transparent);
  transform: none; letter-spacing: .18em; font-weight: 700;
}
.topbar__clock { font-size: .78rem; color: var(--fg-dim); font-variant-numeric: tabular-nums; min-width: 66px; text-align: right; }

/* ── View-Rahmen ── */
.view {
  margin-left: var(--rail-w);
  padding: calc(var(--top-h) + 1.6rem) var(--pad) 4rem;
  max-width: calc(var(--view-max) + 2 * var(--pad));
  outline: none;
}
/* Ultrawide ohne Dock: Inhalt in der Fläche RECHTS der Rail zentrieren.
   c5-Fix: EINE Achse (margin-left), keine auto-Margins + padding-Formel mehr —
   die c4-Kombination hat die Rail-Kompensation doppelt addiert und den Content
   mit wachsender Viewport-Breite nach rechts geschoben & schmaler gequetscht. */
@media (min-width: 1720px) {
  body:not(.has-dock) .view {
    margin-left: max(var(--rail-w),
      calc((100% - var(--view-max) - 2 * var(--pad) + var(--rail-w)) / 2));
  }
}
.viewpad { padding: 2rem 0; max-width: 60ch; }
.viewpad a { color: var(--brass); text-decoration: underline; text-underline-offset: 3px; }

.vhead { margin-bottom: 1.6rem; }
.vhead__h {
  font-family: var(--f-disp); font-weight: 800; font-stretch: 120%;
  font-size: var(--fs-h1); letter-spacing: -.01em; text-transform: uppercase;
}
.vhead__h span { color: var(--fg-dim); font-weight: 600; font-stretch: 82%; font-size: .72em; letter-spacing: .01em; }
.vhead__h span a { color: var(--brass); }
.vhead__h span a:hover { text-decoration: underline; text-underline-offset: 3px; }
.vhead__sub { color: var(--fg-dim); margin-top: .3rem; max-width: 62ch; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translate(-50%, 1rem); z-index: 120;
  padding: .7rem 1.3rem;
  background: var(--night); color: var(--bone);
  font-family: var(--f-mono); font-size: .76rem; letter-spacing: .05em;
  border-radius: 4px; border: 1px solid rgba(234, 229, 217, .16);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Fehler-Toast (Write-Back fehlgeschlagen) — ersetzt window.alert (Audit B3).
   Bleibt stehen, bis der Nutzer ihn bestätigt oder wiederholt — kein Auto-Hide. ── */
.etoasts {
  position: fixed; top: calc(var(--top-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 300; display: grid; gap: .5rem;
  width: min(480px, calc(100vw - 24px));
}
.etoast {
  display: grid; grid-template-columns: auto 1fr; gap: .4rem .7rem; align-items: start;
  background: var(--paper); color: var(--fg);
  border: 1.5px solid var(--st-block); border-left-width: 6px; border-radius: var(--radius);
  padding: .85rem 1rem; box-shadow: 0 12px 32px rgba(27, 24, 19, .28);
  animation: etoastIn .22s var(--ease-out);
}
@keyframes etoastIn { from { opacity: 0; transform: translateY(-8px); } }
.etoast__ic { color: var(--st-block); margin-top: .05rem; }
.etoast__msg { font-size: .84rem; line-height: 1.45; white-space: pre-line; overflow-wrap: break-word; }
.etoast__actions { grid-column: 2; display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .1rem; }
.etoast__btn {
  min-height: 36px; padding: .4rem .85rem; cursor: pointer;
  font: 700 .7rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--st-block); border-radius: var(--radius);
  background: var(--st-block); color: #fff;
}
.etoast__btn--close { background: transparent; color: var(--st-block); }
.etoast__btn:hover { filter: brightness(.92); }
.etoast__btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

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