/* ============================================================
   Aktenheld – Modernes, seriöses Legal-Tech-Design
   ============================================================ */
:root {
  /* Farbsystem – ruhig, professionell, vertrauenswürdig */
  --ink-900: #0b1220;
  --ink-700: #1f2a3d;
  --ink-500: #475569;
  --ink-400: #64748b;
  --ink-300: #94a3b8;

  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --line: #e6eaf0;
  --line-soft: #eef2f7;

  /* Marken-Akzent: tiefes Juristen-Blau + dezentes Gold */
  --brand-900: #0a2540;
  --brand-700: #143a5e;
  --brand-600: #1d4e89;
  --brand-500: #2563eb;
  --brand-50: #eef4ff;
  --gold: #b8893a;
  --gold-soft: #f4ecdd;

  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --ok-soft: #ecfdf3;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(11, 18, 32, .06);
  --shadow-sm: 0 2px 8px rgba(11, 18, 32, .06);
  --shadow-md: 0 8px 24px rgba(11, 18, 32, .08);
  --shadow-lg: 0 20px 50px rgba(11, 18, 32, .14);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-700);
  background:
    radial-gradient(1200px 600px at 100% -10%, #eaf1fb 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 0%, #f3eee3 0%, transparent 45%),
    var(--surface-3);
  line-height: 1.5;
}

/* ----------------------------- Topbar ----------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(100deg, var(--brand-900) 0%, var(--brand-700) 60%, var(--brand-600) 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.16);
  font-size: 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .2px;
}
.tagline { margin: 3px 0 0; font-size: 12.5px; color: rgba(255,255,255,.72); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 7px 12px; border-radius: 999px; font-weight: 600;
  border: 1px solid transparent;
}
.badge-offline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }
.badge-online  { background: var(--ok-soft); color: var(--ok); }

/* ----------------------------- Layout ----------------------------- */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
}

/* ----------------------------- Panels ----------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head input[type="search"] { width: 140px; padding: 8px 11px; }

/* --------------------------- Formulare ---------------------------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; color: var(--ink-500); font-weight: 600;
}
input, textarea, select {
  font: inherit; font-size: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-900);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-300); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 34px;
}

/* ----------------------------- Buttons ---------------------------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
  color: #fff; box-shadow: var(--shadow-xs);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(20, 58, 94, .28); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-700); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-300); }
.btn-danger { background: var(--surface); border-color: #f3c6c6; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-warning { background: #fff8e1; border-color: #f0c040; color: #856404; }
.btn-warning:hover { background: #f0c040; color: #fff; }
.link { background: none; border: none; color: var(--brand-600); cursor: pointer; font: inherit; font-weight: 600; padding: 0; text-decoration: underline; }

/* Topbar-Button heller */
.topbar .btn-ghost {
  background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff;
}
.topbar .btn-ghost:hover { background: rgba(255,255,255,.18); }

/* -------------------------- Aktenliste ---------------------------- */
.akten-liste { display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.gruppe-buchstabe {
  font-size: 11px; font-weight: 800; color: var(--gold);
  letter-spacing: .12em;
  padding: 12px 6px 4px; position: sticky; top: 0; background: var(--surface);
  z-index: 1;
}
.akte-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.akte-item:hover { background: var(--surface-2); }
.akte-item.active {
  background: var(--brand-50);
  border-color: #cfe0fb;
  box-shadow: inset 3px 0 0 var(--brand-600);
}
.akte-item .name { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.akte-item .count {
  font-size: 11px; color: var(--ink-400);
  background: var(--surface-3); border-radius: 999px; padding: 3px 9px; font-weight: 600;
}

/* ----------------------------- Inhalt ----------------------------- */
.content { min-height: 60vh; }
.hidden { display: none !important; }
.muted { color: var(--ink-400); }

/* --------------------------- Empty state -------------------------- */
.empty { display: flex; justify-content: center; padding-top: 5vh; }
.empty-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px 40px; max-width: 560px; text-align: center;
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.empty-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand-700), var(--brand-500), var(--gold));
}
.empty-emoji {
  display: inline-grid; place-items: center;
  width: 76px; height: 76px; border-radius: 20px;
  background: var(--brand-50); font-size: 38px; margin-bottom: 6px;
}
.empty-card h2 { margin: 14px 0 10px; font-family: var(--font-serif); font-weight: 600; font-size: 26px; color: var(--ink-900); }
.empty-card > p { color: var(--ink-500); font-size: 15px; max-width: 44ch; margin: 0 auto; }
.feature-list { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
@media (max-width: 520px) { .feature-list { grid-template-columns: 1fr; } }
.feature-list li {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; font-weight: 500;
}

/* ----------------------------- Detail ----------------------------- */
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.detail-head h2 { margin: 0 0 4px; font-family: var(--font-serif); font-weight: 600; font-size: 24px; color: var(--ink-900); }

.tabs { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-500);
  padding: 10px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px;
  transition: all .14s ease;
}
.tab:hover { border-color: var(--ink-300); color: var(--ink-700); }
.tab.active {
  background: var(--brand-900); color: #fff; border-color: var(--brand-900);
  box-shadow: var(--shadow-xs);
}

.tab-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
}

/* --------------------------- Dropzone ----------------------------- */
.dropzone {
  border: 1.5px dashed #cbd5e1; border-radius: var(--radius); padding: 36px; text-align: center;
  background: var(--surface-2); transition: background .15s ease, border-color .15s ease;
}
.dropzone p { margin: 0 0 6px; font-weight: 500; color: var(--ink-700); }
.dropzone.drag { background: var(--brand-50); border-color: var(--brand-500); }
.doc-liste { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.doc-liste li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px;
  box-shadow: var(--shadow-xs);
}
.doc-liste .doc-name { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.doc-liste .doc-meta { font-size: 12px; color: var(--ink-400); }
.doc-liste .btn-danger { padding: 7px 12px; font-size: 13px; }

/* ------------------------ Ergebnis / Brief ------------------------ */
.ergebnis {
  margin-top: 18px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; line-height: 1.6;
}
.ergebnis h3 { margin-top: 0; font-family: var(--font-serif); font-weight: 600; font-size: 19px; color: var(--ink-900); }
.tag {
  display: inline-block; background: var(--brand-50); color: var(--brand-700);
  border: 1px solid #d7e3fb; border-radius: 999px; padding: 4px 12px; font-size: 12.5px;
  font-weight: 600; margin: 3px 5px 3px 0;
}
.brief {
  margin-top: 18px; background: #fffef9; border: 1px solid var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius); padding: 28px 30px; line-height: 1.7;
  white-space: pre-wrap;
  font-family: "Fraunces", Georgia, serif; font-size: 15px; color: var(--ink-900);
  box-shadow: var(--shadow-sm);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ----------------------------- KI-Bereich (Details/Summary) ----------------------------- */
.ki-bereich {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  margin-top: 1.5rem;
  background: var(--bg);
}
.ki-bereich summary.ki-bereich-titel {
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 10px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  background: var(--surface);
}
.ki-bereich summary.ki-bereich-titel::-webkit-details-marker { display: none; }
.ki-bereich[open] summary.ki-bereich-titel { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.ki-bereich-body { padding: 16px; }

/* ----------------------------- Dialog ----------------------------- */
dialog {
  border: none; border-radius: var(--radius-lg); padding: 30px; max-width: 480px;
  box-shadow: var(--shadow-lg); color: var(--ink-700);
}
dialog::backdrop { background: rgba(11, 18, 32, .55); backdrop-filter: blur(2px); }
dialog h2 { margin-top: 0; font-family: var(--font-serif); font-weight: 600; color: var(--ink-900); }
dialog ul { padding-left: 18px; }
dialog li { margin-bottom: 6px; }

/* ----------------------------- Scrollbar -------------------------- */
.akten-liste::-webkit-scrollbar { width: 8px; }
.akten-liste::-webkit-scrollbar-thumb { background: #d8dee8; border-radius: 8px; }
.akten-liste::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* ============================================================
   Erweiterungen: Zähler, Jahres-Gruppen, KI-Arbeitsbereich
   ============================================================ */

/* Kopfbereich rechts */
.detail-head-right { display: flex; align-items: center; gap: 12px; }
.badge-count {
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid #e8d8b8; font-weight: 700;
}

/* ----------------------- Dokumente nach Jahr ---------------------- */
.jahr-gruppen { margin-top: 18px; display: flex; flex-direction: column; gap: 22px; }
.jahr-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 8px; margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
}
.jahr-titel {
  font-family: var(--font-serif); font-weight: 600; font-size: 20px; color: var(--brand-900);
  letter-spacing: .5px;
}
.jahr-count {
  font-size: 12px; color: var(--ink-400); background: var(--surface-3);
  border-radius: 999px; padding: 3px 11px; font-weight: 600;
}

/* --------------------------- Prompt-Box --------------------------- */
.prompt-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 20px;
}
.prompt-label { font-size: 13px; font-weight: 700; color: var(--ink-700); display: block; margin-bottom: 8px; }
.prompt-box textarea { width: 100%; }
.small { font-size: 12px; }

/* ------------------------- Button-Gruppen ------------------------- */
.btn-gruppe { margin-bottom: 18px; }
.gruppe-titel {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-400); margin: 0 0 10px;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-action {
  background: var(--surface); border: 1px solid var(--line);
  color: var(--brand-700); font-weight: 600; padding: 11px 18px;
  box-shadow: var(--shadow-xs);
}
.btn-action:hover { border-color: var(--brand-500); background: var(--brand-50); }
.btn-create {
  background: linear-gradient(180deg, #fbfaf6, #f6efe1);
  border-color: #e8d8b8; color: #6b4f1d;
}
.btn-create:hover { border-color: var(--gold); background: var(--gold-soft); }

/* ---------------------------- Fieldsets --------------------------- */
.fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 0;
}
.fieldset legend {
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-700); padding: 0 8px;
}
.fieldset label { margin-top: 10px; }
.fieldset .grid-2 { margin-top: 4px; }

/* ============================================================
   Kanzlei-Erweiterungen: Erkennung, AZ, Signatur, Dialoge
   ============================================================ */

/* Aktenzeichen-Chip im Detailkopf */
.az-chip {
  display: inline-block; background: var(--brand-900); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 6px; margin-right: 8px;
}

/* Sidebar: Name + AZ untereinander */
.akte-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.az-mini { font-size: 11px; color: var(--brand-600); font-weight: 600; }

/* Detailkopf rechts: mehrere Buttons */
.detail-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --------------------- Automatisch erkannt ----------------------- */
.erkannt-panel {
  margin-top: 18px; background: linear-gradient(180deg, #f4f9ff, #eef4ff);
  border: 1px solid #d7e3fb; border-radius: var(--radius); padding: 18px;
}
.erkannt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.erkannt-head h3 { margin: 0; font-size: 15px; font-family: var(--font-serif); font-weight: 600; color: var(--brand-900); }
.erkannt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.erkannt-spalte h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-400); }

.ok-flag { color: var(--ok); font-weight: 600; }

/* --------------------------- Signatur ---------------------------- */
.sig-vorschau {
  font-family: "Dancing Script", cursive; font-size: 30px; color: var(--brand-900);
  border-bottom: 1.5px solid var(--ink-300); padding: 4px 6px 8px; margin-top: -4px;
}
.checkbox-row { flex-direction: row !important; align-items: center; gap: 10px; font-weight: 500; color: var(--ink-700); }
.checkbox-row input { width: 16px; height: 16px; }
.dialog-hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }

dialog .stack { min-width: 340px; }
@media (max-width: 480px) { dialog .stack { min-width: auto; } }

/* Neu-auslesen-Zeile */
.rescan-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* OCR / Status / Warnungen */
.warn-flag { color: #b45309; font-weight: 600; }
.upload-status {
  margin-top: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  font-size: 13.5px; font-weight: 600;
}

/* Teilen / Passwort / Import */
.pw-feld { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input {
  flex: 1; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px; letter-spacing: .5px; background: #fff; font-weight: 600; color: var(--brand-900);
}
.pw-row .btn { padding: 9px 12px; }
.import-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* === Login-Overlay (Server-Modus) === */
.login-overlay {
  position: fixed; inset: 0; background: rgba(10,37,64,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; backdrop-filter: blur(4px);
}
.login-overlay.versteckt { display: none; }
.login-box {
  background: #fff; border-radius: 16px; padding: 48px 40px;
  width: min(400px, 90vw); box-shadow: 0 24px 64px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-box h2 { font-family: 'Fraunces', serif; font-size: 1.8rem; color: var(--brand-900); margin: 0 0 4px; }
.login-sub { color: var(--text-2); margin: 0 0 24px; }
.login-box .stack { text-align: left; }
.fehler-text { color: #c0392b; font-size: .85rem; min-height: 1.2em; margin: 0; }

/* === User-Info in Topbar === */
.user-info { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--brand-900); }
.btn-sm { padding: 6px 10px; font-size: .8rem; }

/* === KI-Ausgabe === */
.ki-loading { padding: 24px; text-align: center; color: var(--text-2); font-style: italic; }
.ki-ergebnis { white-space: pre-wrap; font-family: inherit; font-size: .9rem; line-height: 1.6; }
.ki-fehler { color: #c0392b; padding: 12px; background: #fdecea; border-radius: 8px; }

/* === KI-Analyse Ergebnis === */
.ki-ergebnis-text {
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 16px;
  font-size: .92rem;
  line-height: 1.7;
  margin-top: 8px;
}

/* === Streaming Cursor === */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* === Aufgaben & Protokolle === */
.aufgaben-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.aufgaben-head h3 { margin: 0; font-size: 1.1rem; color: var(--brand-900); }
.aufgaben-liste { display: flex; flex-direction: column; gap: 20px; }

.aufgabe-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.aufgabe-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.aufgabe-titel { margin: 0; font-size: 1rem; color: var(--brand-900); }
.personen-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.schritte-liste { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.schritt-item {
  background: var(--surface-2, #f8f9fb);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 3px solid var(--line);
}
.schritt-item:has(.status-fertig) { border-left-color: #27ae60; }
.schritt-item:has(.status-fehler) { border-left-color: #c0392b; }
.schritt-item:has(.status-laufend) { border-left-color: #f39c12; }

.schritt-kopf {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.schritt-nr {
  background: var(--brand-900); color: #fff;
  border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.schritt-beschreibung { flex: 1; font-size: .92rem; color: var(--text-1); }
.schritt-status { font-size: 1rem; }

.schritt-ergebnis-container { margin-top: 8px; }
.schritt-ergebnis {
  white-space: pre-wrap; font-family: inherit; font-size: .88rem;
  line-height: 1.65; background: #fff; border-radius: 6px;
  padding: 12px; border: 1px solid var(--line); margin: 0 0 8px;
  max-height: 400px; overflow-y: auto;
}
.schritt-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.schritt-loading {
  padding: 12px; color: var(--text-2); font-style: italic;
  display: flex; align-items: center; gap: 6px;
}
.schritt-hinzufuegen { display: flex; gap: 8px; margin-top: 4px; }
.schritt-input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: .9rem;
}
.status-offen { color: #95a5a6; }
.status-laufend { color: #f39c12; }
.status-fertig { color: #27ae60; }
.status-fehler { color: #c0392b; }

.cursor-blink { animation: blink .9s step-end infinite; }

.btn-danger {
  background: #c0392b; color: #fff; border: none;
}
.btn-danger:hover { background: #a93226; }

/* ===================================================
   FRISTEN
   =================================================== */
.fristen-liste { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

.frist-card {
  background: var(--bg-card, #fff);
  border: 1px solid #dde2ec;
  border-left: 5px solid #4f8ef7;
  border-radius: 8px;
  padding: 14px 16px;
  transition: box-shadow .15s;
}
.frist-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.frist-card.ampel-rot  { border-left-color: #e53e3e; background: #fff5f5; }
.frist-card.ampel-orange { border-left-color: #dd6b20; background: #fffaf0; }
.frist-card.ampel-gruen  { border-left-color: #38a169; }
.frist-card.erledigt { opacity: .55; }

.frist-card-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.frist-typ { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #718096; }
.frist-titel { margin: 4px 0 6px; font-size: 1rem; }
.frist-meta { display: flex; gap: 16px; font-size: .85rem; color: #555; flex-wrap: wrap; }
.frist-notiz { margin-top: 6px; }

.badge-ok { background: #c6f6d5; color: #22543d; border-radius: 999px; padding: 2px 10px; font-size: .78rem; }

/* ===================================================
   NOTIZEN
   =================================================== */
.notizen-liste { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

.notiz-card {
  background: #fffde7;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 14px 16px;
}
.notiz-card.notiz-wichtig { border-color: #f6ad55; background: #fffaf0; }
.notiz-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  justify-content: space-between;
}
.notiz-stern { font-size: 1.1rem; }
.notiz-inhalt { white-space: pre-wrap; margin: 0; line-height: 1.5; }

/* ===================================================
   KONTAKTE
   =================================================== */
.kontakte-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }

.kontakt-card {
  background: var(--bg-card, #fff);
  border: 1px solid #dde2ec;
  border-radius: 8px;
  padding: 14px 16px;
  transition: box-shadow .15s;
}
.kontakt-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.kontakt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kontakt-meta { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: #555; }
.kontakt-meta a { color: #4f8ef7; text-decoration: none; }
.kontakt-meta a:hover { text-decoration: underline; }

/* ===================================================
   AUFGABEN-HEAD (Wiederverwendung für neue Tabs)
   =================================================== */
.aufgaben-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ===================================================
   DOKUMENT-LISTE: Öffnen & Download
   =================================================== */
.doc-liste li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f0f0;
}
.doc-liste li:last-child { border-bottom: none; }

.doc-info { flex: 1; min-width: 0; }
.doc-name { font-weight: 500; word-break: break-word; }

.doc-aktionen {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.doc-aktionen a.btn {
  text-decoration: none;
  white-space: nowrap;
}

/* ===================================================
   AUFGABE: Alle Schritte ausführen + Fortschritt
   =================================================== */
.btn-ausfuehren {
  background: #1a2744;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, opacity .15s;
}
.btn-ausfuehren:hover:not(:disabled) { background: #2d3f6b; }
.btn-ausfuehren:disabled { opacity: .55; cursor: not-allowed; }
.btn-laufend { background: #7b6d3a; }

.fortschritt-leiste {
  position: relative;
  background: #e8ecf5;
  border-radius: 6px;
  height: 22px;
  margin: 10px 0 6px;
  overflow: hidden;
}
.fortschritt-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #4f8ef7, #38c172);
  border-radius: 6px;
  transition: width .4s ease;
}
.fortschritt-text {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 600;
  color: #1a2744;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}
