/*
 * Christian Cockpit V2 — Stylesheet
 * =================================
 * Hybrid-Design: Header und Sidebar in dunklem Navy, Arbeitsfläche hell
 * (Off-White), Karten weiß. Akzente Navy und Orange; Teal/Grün ist
 * ausschließlich der Status-/Online-Anzeige vorbehalten.
 *
 * Aufbau: Tokens → Layout → Header → Sidebar → Hero → Schnellstart →
 *         Kennzahlen → Karten → Bausteine → Panels → Responsive
 */

:root {
  /* Chrome (Header, Sidebar) */
  --navy:      #0D1B2A;
  --navy-soft: #16283b;
  --navy-lift: #1E3552;
  --navy-line: rgba(255,255,255,.10);

  /* Arbeitsfläche */
  --surface:   #F3F5F8;
  --card:      #FFFFFF;
  --line:      #E2E7EE;
  --line-soft: #EDF1F5;

  /* Text auf hellem Grund */
  --ink:       #14212F;
  --ink-2:     #46586B;
  --ink-3:     #7D8CA0;

  /* Text auf Navy */
  --on-navy:   #EEF2F6;
  --on-navy-2: #93A6BA;

  /* Akzente */
  --orange:    #E87722;
  --orange-dk: #C45F10;
  --orange-bg: #FDF0E4;

  /* Status — nur hierfür Grün/Teal */
  --ok:        #15855F;
  --ok-bg:     #E4F4EE;
  --warn:      #B4690E;
  --warn-bg:   #FBF0DF;
  --bad:       #B23127;
  --bad-bg:    #FBEAE8;
  --idle:      #71829A;
  --idle-bg:   #EDF1F5;

  --sidebar:   212px;
  --content:   1660px;
  --radius:    14px;

  --shadow-sm: 0 1px 2px rgba(16,32,52,.06), 0 1px 3px rgba(16,32,52,.04);
  --shadow-md: 0 2px 4px rgba(16,32,52,.05), 0 6px 16px rgba(16,32,52,.07);
  --shadow-lg: 0 4px 10px rgba(16,32,52,.07), 0 14px 34px rgba(16,32,52,.10);

  --font: 'Segoe UI', Calibri, system-ui, -apple-system, Arial, sans-serif;
  --font-head: Bahnschrift, 'Segoe UI Semibold', 'Segoe UI', var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(232,119,34,.22); }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 5px;
}

/* ─────────────────────────── Layout ─────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
  /* Die Sidebar klebt (sticky) und ist nur einen Viewport hoch. Damit die
     Navy-Spalte auf langen Seiten nicht unten hell ausläuft, trägt das Raster
     den Farbverlauf. */
  background: linear-gradient(to right, var(--navy) 0 var(--sidebar), var(--surface) var(--sidebar));
}

/* ─────────────────────────── Header ─────────────────────────── */

.topbar {
  grid-column: 1 / -1;
  background: var(--navy);
  color: var(--on-navy);
  border-bottom: 1px solid rgba(0,0,0,.2);
  padding: 0 22px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Branding: „CHRISTIAN AUST" ist die Marke, „COCKPIT" die Anwendung. */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: calc(var(--sidebar) - 22px);
  flex-shrink: 0;
  min-width: 0;
  text-decoration: none;
}
.brand-mark {
  /* Dark-Variante des Signets (C orange, A hell) — steht ohne Kachel direkt
     auf dem Navy-Header. */
  height: 34px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}
.brand-text { min-width: 0; }
.brand-name {
  font-family: var(--font-head);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .13em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-app {
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--orange);
  font-weight: 600;
  line-height: 1.3;
}

/* Suche */
.search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.search-input {
  width: 100%;
  height: 36px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--navy-line);
  border-radius: 9px;
  padding: 0 12px 0 34px;
  color: var(--on-navy);
  font-size: 13.5px;
  outline: none;
  transition: background .12s, border-color .12s;
}
.search-input::placeholder { color: var(--on-navy-2); }
.search-input:focus { background: rgba(255,255,255,.12); border-color: rgba(232,119,34,.6); }
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--on-navy-2);
  font-size: 13px;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 44px; left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 60;
}
.search-results[hidden] { display: none; }
.search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}
.search-hit:hover, .search-hit--active { background: var(--line-soft); }
.search-hit-icon { font-size: 17px; flex-shrink: 0; }
.search-hit-body { min-width: 0; flex: 1; }
.search-hit-name { font-size: 13.5px; font-weight: 600; }
.search-hit-meta { font-size: 11.5px; color: var(--ink-3); }
.search-hit-go { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.search-empty { padding: 12px; font-size: 13px; color: var(--ink-3); }

/* Rechte Seite */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-shrink: 0;
}
.clock-date { font-size: 12px; color: var(--on-navy-2); line-height: 1.2; }
.clock-time {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: .02em;
}
.clock { text-align: right; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  /* Ebenfalls ohne weiße Kachel — dezenter Kreis auf dem Navy. */
  background: rgba(255,255,255,.07);
  border: 1px solid var(--navy-line);
  padding: 5px;
  flex-shrink: 0;
  object-fit: contain;
}

/* ─────────────────────────── Sidebar ─────────────────────────── */

.rail {
  background: var(--navy);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  z-index: 40;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--on-navy-2);
  border-left: 3px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.nav-item:hover { color: var(--on-navy); background: rgba(255,255,255,.06); }
.nav-item--on {
  color: #fff;
  background: var(--navy-soft);
  border-left-color: var(--orange);
}
.nav-icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-label {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-foot {
  margin-top: auto;
  padding: 12px 14px 4px;
  border-top: 1px solid var(--navy-line);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--on-navy-2);
  letter-spacing: .04em;
}
.rail-foot strong { display: block; color: var(--on-navy); font-weight: 600; letter-spacing: .1em; font-size: 10px; }

/* ─────────────────────────── Inhaltsfläche ─────────────────────────── */

.view {
  padding: 26px 34px 72px;
  max-width: var(--content);
  width: 100%;
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 32px 0 15px;
}
.section-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .01em;
}
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
  order: 1;
}
.section-head > :last-child:not(.section-title) { order: 2; }

.lead { color: var(--ink-2); font-size: 14px; max-width: 82ch; margin-bottom: 16px; }
.lead--small { font-size: 13px; margin-top: -8px; }
.empty { color: var(--ink-3); font-size: 13.5px; padding: 16px 2px; }

.local-hint {
  display: none;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 9px;
  padding: 10px 13px;
  margin-bottom: 16px;
}

/* ─────────────────────────── Hero ─────────────────────────── */

.hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 268px;
  display: flex;
  align-items: center;
  padding: 38px 44px;
  box-shadow: var(--shadow-md);
  background: var(--navy);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../assets/images/bangkok-sunset.jpg');
  background-size: cover;
  /* Der Hero ist ein breiter, flacher Streifen. Bei 'cover' bleibt davon nur
     ein schmales Band des Bildes übrig — dieser Wert legt es auf Himmel und
     Skyline-Silhouette statt auf die Uferbebauung darunter. */
  background-position: center 38%;
}
.hero::after {
  /* Leseoverlay: links dunkel, rechts offen — Skyline bleibt sichtbar. */
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(9,17,28,.90) 0%, rgba(9,17,28,.74) 34%, rgba(9,17,28,.30) 62%, rgba(9,17,28,.14) 100%);
}
.hero-body { position: relative; z-index: 1; max-width: 60ch; }
.hero-greeting {
  color: #F5B27C;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-head);
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 600;
  color: #fff;
  line-height: 1.14;
  margin: 9px 0 12px;
  text-shadow: 0 2px 14px rgba(0,0,0,.4);
}
.hero-title em { font-style: normal; color: var(--orange); }
.hero-sub {
  color: rgba(255,255,255,.86);
  font-size: 15px;
  line-height: 1.6;
  max-width: 52ch;
  text-shadow: 0 1px 10px rgba(0,0,0,.45);
}
.hero-place {
  position: absolute;
  right: 22px; bottom: 16px;
  z-index: 1;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}

/* ─────────────────────────── Schnellstart ─────────────────────────── */

.starters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.starter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 178px;
  padding: 20px 21px;
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform .14s, box-shadow .14s;
  overflow: hidden;
}
.starter:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.starter--disabled { opacity: .72; cursor: default; }
.starter--disabled:hover { transform: none; box-shadow: var(--shadow-md); }

/* Vier festgelegte Kartenwelten */
.starter--navy   { background: linear-gradient(155deg, #14293E, #0C1A28); color: #fff; }
.starter--teal   { background: linear-gradient(155deg, #17795B, #0F5B44); color: #fff; }
.starter--orange { background: linear-gradient(155deg, #E8823A, #C45F10); color: #fff; }
.starter--light  { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

.starter-icon { font-size: 27px; line-height: 1; }
.starter-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}
.starter-desc { font-size: 12.5px; line-height: 1.5; opacity: .82; }
.starter-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}
.starter-go { font-size: 19px; line-height: 1; opacity: .8; transition: transform .14s; }
.starter:hover .starter-go { transform: translateX(3px); }
.starter-note { font-size: 11.5px; opacity: .8; }

/* Statuspunkt auf dunklen Schnellstartkarten */
.starter--navy .health-label,
.starter--teal .health-label,
.starter--orange .health-label { color: rgba(255,255,255,.9); }
.starter--navy .health--ok .health-dot,
.starter--teal .health--ok .health-dot,
.starter--orange .health--ok .health-dot { background: #6EE7B7; box-shadow: 0 0 0 3px rgba(110,231,183,.22); }

/* ─────────────────────────── Kennzahlen ─────────────────────────── */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.kpi-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.12;
  color: var(--ink);
}
.kpi-label { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; font-weight: 500; }
.kpi-note { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.kpi--warn { border-color: rgba(232,119,34,.45); background: var(--orange-bg); }
.kpi--warn .kpi-value { color: var(--orange-dk); }

/* ─────────────────────────── Karten ─────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .14s, transform .14s, border-color .14s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #D3DBE5; }
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent, var(--orange));
}

/* Kartentypen bleiben unterscheidbar. */
.card--infra    { background: #FAFBFC; }
.card--mandate  { border-left: 3px solid var(--orange); }
.card--local    { background: #FBFCFD; border-style: dashed; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-icon { font-size: 23px; line-height: 1.1; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }

.badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .07em;
  border-radius: 5px;
  padding: 3px 7px;
  white-space: nowrap;
}
.badge--live    { background: var(--ok-bg);     color: var(--ok); }
.badge--bau     { background: var(--orange-bg); color: var(--orange-dk); }
.badge--planung { background: #ECEDFB;          color: #4A45A8; }
.badge--pflege  { background: #E6F2F8;          color: #16607C; }
.badge--archiv  { background: var(--idle-bg);   color: var(--idle); }
.badge--local   { background: var(--navy);      color: #fff; }

.card-name {
  font-family: var(--font-head);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  hyphens: auto;
}
.card-desc { font-size: 13px; color: var(--ink-2); line-height: 1.5; }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; font-size: 12px; }
.card-hosting { color: var(--ink-3); }
.card-urlnote {
  font-size: 12px;
  color: var(--orange-dk);
  background: var(--orange-bg);
  border-radius: 6px;
  padding: 5px 9px;
  align-self: flex-start;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--line-soft);
  border-radius: 4px;
  padding: 3px 7px;
  overflow-wrap: anywhere;
}

.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

/* ─────────────────────────── Erreichbarkeit ─────────────────────────── */

.health { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); flex-shrink: 0; }
.health-label { font-size: 12px; color: var(--ink-3); font-weight: 500; }

.health--ok   .health-dot { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-bg); }
.health--ok   .health-label { color: var(--ok); }
.health--bad  .health-dot { background: var(--bad);  box-shadow: 0 0 0 3px var(--bad-bg); }
.health--bad  .health-label { color: var(--bad); }
.health--warn .health-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.health--warn .health-label { color: var(--warn); }

/* ─────────────────────────── Buttons ─────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--line-soft); border-color: #D3DBE5; color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn--primary:hover { background: var(--navy-soft); border-color: var(--navy-soft); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--line-soft); color: var(--ink); }

/* ─────────────────────────── Filter ─────────────────────────── */

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.filter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 15px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .12s;
}
.filter:hover { border-color: #C9D3DF; color: var(--ink); }
.filter--on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ─────────────────────────── Phasen ─────────────────────────── */

.phases { display: flex; gap: 3px; margin-top: 2px; }
.phase {
  flex: 1;
  min-width: 0;
  background: var(--line-soft);
  border: none;
  border-radius: 5px;
  padding: 6px 2px 5px;
  cursor: pointer;
  color: var(--ink-3);
  border-top: 2px solid #D8E0E9;
  transition: all .12s;
}
.phase:hover { background: #E4EAF1; color: var(--ink); }
.phase--done { border-top-color: var(--orange); color: var(--ink-2); }
.phase--current { background: var(--orange-bg); border-top-color: var(--orange); color: var(--orange-dk); font-weight: 600; }
.phase-label {
  font-size: 9.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─────────────────────────── Panels, To-dos, Notiz ─────────────────────────── */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  font-family: var(--font-head);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .01em;
}
.panel-foot { font-size: 11.5px; color: var(--ink-3); }
.panel .panel { background: #FAFBFC; box-shadow: none; }

.note {
  width: 100%;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  min-height: 132px;
  line-height: 1.65;
  font-size: 13.5px;
  color: var(--ink);
}
.note:focus { border-color: var(--orange); background: #fff; }
.note::placeholder { color: var(--ink-3); }

.todo-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.todo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 7px;
  font-size: 13.5px;
}
.todo:hover { background: var(--line-soft); }
.todo--done .todo-text { color: var(--ink-3); text-decoration: line-through; }
.todo-empty { font-size: 13px; color: var(--ink-3); padding: 6px; }

.todo-check {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1.5px solid #C6D0DC;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.todo-check:hover { border-color: var(--orange); }
.todo--done .todo-check { background: var(--ok); border-color: var(--ok); }

.todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-source {
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--line-soft);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  align-self: center;
}

.todo-del {
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 18px; line-height: 1;
  padding: 0 4px; opacity: 0; transition: opacity .12s, color .12s;
}
.todo:hover .todo-del, .todo-del:focus-visible { opacity: 1; }
.todo-del:hover { color: var(--bad); }

.todo-form { display: flex; gap: 7px; }
.todo-input {
  flex: 1;
  min-width: 0;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
  font-size: 13.5px;
}
.todo-input:focus { border-color: var(--orange); background: #fff; }
.todo-input::placeholder { color: var(--ink-3); }

/* ─────────────────────────── To-do-Panel (Drawer) ─────────────────────────── */

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 46px rgba(16,32,52,.16);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
/* `display:flex` schlägt sonst die UA-Regel für [hidden] — das Panel bliebe
   unsichtbar über dem Inhalt liegen und würde Klicks abfangen. */
.drawer[hidden] { display: none; }

.drawer-bar {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.drawer-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-title {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
}


/* ─────────────────────────── Leitstelle (V2.1) ─────────────────────────── */

/* Statuschip — dasselbe Vokabular überall, siehe js/status.js */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip--ok      { background: var(--ok-bg);   color: var(--ok);     border-color: rgba(21,133,95,.22); }
.chip--warn    { background: var(--warn-bg); color: var(--warn);   border-color: rgba(180,105,14,.24); }
.chip--bad     { background: var(--bad-bg);  color: var(--bad);    border-color: rgba(178,49,39,.24); }
.chip--neutral { background: var(--idle-bg); color: var(--idle);   border-color: var(--line); }
.chip--lg { font-size: 13px; padding: 5px 14px 5px 11px; }
.chip-cov { opacity: .72; font-weight: 500; padding-left: 3px; }
.chip-cov::before { content: '· '; }

/* Kernsysteme-Leiste auf Home: eine flache Zeile je System */
.core-strip { display: flex; flex-direction: column; gap: 8px; }
.core-row {
  display: grid;
  grid-template-columns: 24px minmax(150px, 1.1fr) auto minmax(120px, .8fr) auto auto;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 16px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.core-row:hover { border-color: #D3DBE5; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.core-icon { font-size: 19px; }
.core-name { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.core-when { font-size: 12px; color: var(--ink-3); }
.core-need {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  justify-self: end; white-space: nowrap;
}
.core-need--on { color: var(--orange-dk); }
.core-go { font-size: 12.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap; justify-self: end; }
.core-row:hover .core-go { color: var(--orange-dk); }

/* Kopf der Detailansicht */
.sys-head { margin-bottom: 6px; }
.sys-back {
  display: inline-block; font-size: 12.5px; color: var(--ink-2);
  text-decoration: none; margin-bottom: 12px;
}
.sys-back:hover { color: var(--orange-dk); }
.sys-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sys-icon { font-size: 26px; }
.sys-name { font-family: var(--font-head); font-size: 26px; font-weight: 600; color: var(--ink); }
.sys-desc { color: var(--ink-2); font-size: 14px; margin-top: 8px; max-width: 80ch; }

.sys-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.sys-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sys-fact-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.sys-fact-value { font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
a.sys-fact-value { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a.sys-fact-value:hover { text-decoration-color: var(--orange); }
.sys-fact-value--warn { color: var(--orange-dk); font-weight: 600; }

/* Signale */
.signals { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.signal {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 11px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 7px;
  box-shadow: var(--shadow-sm);
}
.signal--ok   { border-left-color: var(--ok); }
.signal--warn { border-left-color: var(--warn); }
.signal--bad  { border-left-color: var(--bad); }
.signal--neutral { border-left-color: #C6D0DC; }
.signal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.signal-label { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--ink); }
.signal-detail { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.signal-reason { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.signal-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink-3); }
.signal-link { color: var(--ink-2); text-decoration: none; }
.signal-link:hover { color: var(--orange-dk); }

/* Panels: Kopfzeile mit Chip, Schlüssel-Wert-Listen */
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-note { font-size: 12.5px; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 16px; font-size: 13px; }
.kv--wide { grid-template-columns: minmax(150px, auto) 1fr; }
.kv dt { color: var(--ink-3); font-size: 12px; }
.kv dd { color: var(--ink); overflow-wrap: anywhere; }
.kv dd.kv-empty { color: var(--ink-3); font-style: italic; }

/* Fachliche Statuskette */
.chain { list-style: none; display: flex; flex-direction: column; gap: 0; }
.chain-step {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; position: relative; font-size: 13px; color: var(--ink-3);
}
.chain-step:not(:last-child)::before {
  content: ''; position: absolute; left: 4px; top: 22px; bottom: -4px;
  width: 1px; background: var(--line);
}
.chain-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid #C6D0DC; background: var(--card);
  flex-shrink: 0; z-index: 1;
}
.chain-label { overflow-wrap: anywhere; }

/* Aktionen */
.action-list { display: flex; flex-direction: column; gap: 12px; }
.action { display: flex; flex-direction: column; gap: 5px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.action:last-child { border-bottom: none; padding-bottom: 0; }
.action-main { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.action-hint { font-size: 12.5px; color: var(--ink-2); }
.action-req { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.action--off .action-hint { color: var(--ink-3); }

/* Aktivitätsverlauf */
.events { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.event { display: flex; gap: 10px; align-items: flex-start; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--idle); }
.event-dot--ok { background: var(--ok); }
.event-dot--warn { background: var(--warn); }
.event-dot--bad { background: var(--bad); }
.event-body { min-width: 0; }
.event-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.event-summary { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.event-meta { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ─────────────────────────── Responsive ─────────────────────────── */

/* Laptop */
@media (max-width: 1400px) {
  .view { padding: 24px 26px 72px; }
  .starters { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}

/* Tablet */
@media (max-width: 1024px) {
  :root { --sidebar: 74px; }
  .brand { width: auto; }
  .brand-text { display: none; }
  .nav-item { flex-direction: column; gap: 3px; padding: 10px 4px; border-left: none; border-top: 3px solid transparent; }
  .nav-item--on { border-left-color: transparent; border-top-color: var(--orange); }
  .nav-label { font-size: 9px; letter-spacing: .02em; max-width: 100%; }
  .nav-icon { font-size: 18px; width: auto; }
  .rail-foot { display: none; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .core-row { grid-template-columns: 22px 1fr auto; row-gap: 6px; }
  .core-when, .core-need { grid-column: 2 / -1; }
  .core-go { display: none; }
  .hero { padding: 32px 30px; min-height: 236px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); }
}

/* Smartphone: Sidebar wandert nach unten, lokale Inhalte verschwinden. */
@media (max-width: 768px) {
  .nur-lokal { display: none !important; }
  .local-hint { display: block; }

  .shell { grid-template-columns: 1fr; background: var(--surface); }

  .topbar { height: auto; padding: 9px 13px; gap: 10px; flex-wrap: wrap; }
  .brand { order: 1; }
  .topbar-right { order: 2; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .clock-date { display: none; }
  .avatar { width: 30px; height: 30px; }

  .rail {
    position: fixed;
    top: auto; bottom: 0; left: 0; right: 0;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 5px 3px calc(5px + env(safe-area-inset-bottom, 0px));
    gap: 0;
    border-top: 1px solid rgba(0,0,0,.3);
    box-shadow: 0 -4px 18px rgba(9,17,28,.22);
  }
  .nav-item { flex: 1; min-width: 0; border-radius: 8px; padding: 8px 2px; }
  .nav-item--on { background: var(--navy-soft); }
  .nav-label { font-size: 8.5px; letter-spacing: 0; }
  .rail-foot { display: none; }

  .view { padding: 18px 14px 96px; }
  .hero { padding: 26px 22px 42px; min-height: 208px; border-radius: 14px; }
  /* Auf Mobil steht der Text über die volle Breite — das seitliche Overlay
     reicht dann nicht, es braucht durchgehend mehr Deckung. */
  .hero::after {
    background: linear-gradient(165deg, rgba(9,17,28,.90) 0%, rgba(9,17,28,.78) 52%, rgba(9,17,28,.58) 100%);
  }
  .hero-sub { font-size: 14px; }
  .hero-place { right: 14px; bottom: 12px; font-size: 10.5px; }

  .starters { grid-template-columns: 1fr; }
  .starter { min-height: 0; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .core-row { grid-template-columns: 22px 1fr; row-gap: 7px; padding: 12px 14px; }
  .core-row > .chip { grid-column: 2; justify-self: start; }
  .core-when, .core-need { grid-column: 2; justify-self: start; }
  .signals { grid-template-columns: 1fr; }
  .sys-name { font-size: 21px; }
  .sys-facts { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }

  .drawer { width: 100vw; bottom: 56px; }
  .todo-del { opacity: 1; }
  .phase-label { font-size: 8.5px; }
  .search-results { max-height: 50vh; }
}

@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr; }
  .nav-label { display: none; }
  .nav-item { padding: 11px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
