/* ---------------------------------------------------------------------------
   Optemus – Haupt-App im Look des Splash-Screens, aber HELL.
   Designsprache: tiefdunkle Titelleiste mit Aurora-Verlauf (Blau -> Violett),
   helle Arbeitsfläche mit dezenten Aurora-Farbfeldern, weiße Karten-Panels,
   Gradient-Primärbuttons. Das Fenster ist rahmenlos: .topbar ist die
   Drag-Region und trägt die integrierte Fenstersteuerung.
   --------------------------------------------------------------------------- */
:root {
  --ink: #0f172a;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e4e8f2;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  /* Akzentfarben ausschließlich aus dem optemus-Logo (reine Blautöne). */
  --logo-deep: #17334b;
  --logo-navy: #25396a;
  --logo-blue: #224282;
  --logo-mid: #184a97;
  --logo-bright: #2859a2;
  --accent: #2859a2;
  --accent-dark: #184a97;
  --violet: #25396a;
  --grad: linear-gradient(135deg, #2859a2 0%, #184a97 45%, #17334b 100%);
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 28px rgba(15, 23, 42, 0.07);
  --titlebar-h: 52px;
  --foot-h: 58px;
  /* Höhe der Spaltenkopfzeile (Typ/Original/…) UND der Vorschau-Toolbar,
     damit beide Sub-Leisten über die Panels hinweg bündig sind. */
  --subhead-h: 38px;
  --focus-ring: 0 0 0 3px rgba(40, 89, 162, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  background: #eef1f8;
  font-size: 14px;
}

body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Helle "Aurora"-Arbeitsfläche: dieselben Farbfelder wie im Splash, nur als
   zarte Pastelltöne unter den Panels. Fixiert, läuft nicht mit dem Inhalt. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(720px 480px at -6% -12%, rgba(40, 89, 162, 0.11), transparent 65%),
    radial-gradient(640px 440px at 106% 0%, rgba(24, 74, 151, 0.10), transparent 65%),
    radial-gradient(560px 420px at 50% 118%, rgba(34, 66, 130, 0.09), transparent 62%),
    radial-gradient(380px 300px at 88% 96%, rgba(23, 51, 75, 0.05), transparent 60%),
    #eef1f8;
}
/* Feines Raster wie auf der Splash-Karte, oben links angedeutet. */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 22% 0%, black 20%, transparent 68%);
  -webkit-mask-image: radial-gradient(ellipse at 22% 0%, black 20%, transparent 68%);
}

/* ---------- Integrierte Titelleiste (Drag-Region) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  height: var(--titlebar-h);
  padding: 0 10px 0 18px;
  flex: 0 0 auto;
  color: #e2e8f0;
  /* Aurora der Splash-Karte, komprimiert auf Leistenhöhe */
  background:
    radial-gradient(620px 210px at 10% -60%, rgba(40, 89, 162, 0.60), transparent 70%),
    radial-gradient(520px 190px at 52% 150%, rgba(24, 74, 151, 0.42), transparent 70%),
    radial-gradient(420px 170px at 92% -40%, rgba(34, 66, 130, 0.34), transparent 70%),
    #070d1c;
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.16);
  -webkit-app-region: drag;
  user-select: none;
}
/* macOS: Platz für die nativen Ampel-Knöpfe links; im Vollbild sind sie weg. */
/* 96px = Ampel-Ende (77px) + 19px: Abstand Ampel->Wordmark exakt gleich
   Abstand Fensterrand->Ampel (sichtbare 12px-Kreise bei x 19-77, per
   Accessibility-Frames vermessen). */
body.platform-darwin .topbar { padding-left: 96px; }
body.platform-darwin.is-fullscreen .topbar { padding-left: 18px; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { height: 26px; width: auto; display: block; }

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  -webkit-app-region: no-drag;
}

/* ---------- Fenstersteuerung (nur Windows/Linux sichtbar) ---------- */
.win-controls {
  display: none;
  align-items: stretch; align-self: stretch;
  margin-left: 4px; margin-right: -10px;
  -webkit-app-region: no-drag;
}
body.platform-win32 .win-controls,
body.platform-linux .win-controls { display: flex; }

.win-btn {
  width: 46px; border: none; background: transparent; cursor: default;
  color: #cbd5e1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.win-btn:hover { background: rgba(148, 163, 184, 0.18); color: #fff; }
.win-btn.close:hover { background: #e81123; color: #fff; }
.win-btn svg { display: block; }
/* Maximieren <-> Wiederherstellen */
.win-btn .ico-restore { display: none; }
body.is-maximized .win-btn .ico-max { display: none; }
body.is-maximized .win-btn .ico-restore { display: block; }

/* ---------- Layout ---------- */
/* Flexbox statt Grid, damit die Spalten per Zieh-Griff (.col-resizer)
   in der Breite anpassbar sind. Aeussere Spalten haben eine feste,
   ziehbare Basisbreite; die mittlere Regel-Spalte fuellt den Rest. */
.layout {
  flex: 1 1 auto;
  display: flex;
  gap: 0;
  padding: 16px 16px 6px;
  overflow: hidden;
}
/* Proportionales Layout (Flex-Grow, Basis 0) statt fester Pixelbreiten, damit
   die Spalten immer im Verhältnis Dokumente : Ersetzungen : Vorschau = 1 : 2,5 : 1
   skalieren (responsive). Der Zieh-Griff passt die Grow-Werte an, das Aufklappen
   führt zu einer sinnvollen (nicht übergroßen) Vorschau. */
.files-panel { flex: 1 1 0; }
.rules-panel { flex: 2.5 1 0; }
.preview-panel { flex: 1 1 0; }

.col-resizer {
  flex: 0 0 10px;
  cursor: col-resize;
  position: relative;
  align-self: stretch;
}
.col-resizer::before {
  content: ''; position: absolute; top: 14px; bottom: 14px; left: 4px; width: 2px;
  background: rgba(15, 23, 42, 0.08); border-radius: 2px; transition: background .12s;
}
.col-resizer:hover::before, .col-resizer.dragging::before { background: var(--accent); }
body.col-resizing { cursor: col-resize; user-select: none; }
/* Graue Fläche, die sich beim Ziehen an den Rand über die Spalte legt (blendet
   ein, BEVOR der Inhalt gequetscht würde – die Breite wird dabei nicht unter das
   Minimum gedrückt, sondern die Fläche deckt den Rest ab, bis eingeklappt wird). */
.collapse-veil {
  position: absolute; inset: 0; z-index: 8;
  background: linear-gradient(180deg, #eef1f7, #e4e8f1);
  opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.collapse-veil::after {
  content: '«'; font-size: 22px; font-weight: 700; color: var(--muted);
}
.preview-panel .collapse-veil::after { content: '»'; }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel-head { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.panel-head.row, .panel-head .head-actions { display: flex; align-items: center; }
.panel-head.row { justify-content: space-between; gap: 10px; }
/* Aktions-Cluster darf bei zu schmaler Spalte horizontal scrollen statt
   abgeschnitten zu werden; die Buttons selbst behalten ihre Größe. */
.head-actions { gap: 8px; flex: 0 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.head-actions > * { flex: 0 0 auto; }
.head-actions::-webkit-scrollbar { height: 6px; }

/* Regeln-Kopf: Titel fix, dahinter eine scrollbare Leiste (Filter, "+ Ersetzung",
   Bulk-Aktionen). Bei zu wenig Platz wird sie horizontal scrollbar und zeigt an
   der abgeschnittenen Seite einen Abdunklungs-Verlauf (wie die Vorschau-Toolbar)
   statt eines Scrollbalkens. */
.panel-head.rules-head { justify-content: flex-start; gap: 10px; }
.rules-head h2 { flex: 0 0 auto; }
/* Die scrollbare Leiste reicht bis an den Panel-Rand (negatives Margin hebt das
   rechte Panel-Head-Padding auf), damit abgeschnittener Inhalt/der Verlauf
   bündig am äußeren Rand endet und nicht schon ein Padding davor. Das innere
   Padding-right hält den Abstand, solange alles passt. */
.rules-head .head-wrap { flex: 1 1 auto; min-width: 0; margin-right: -16px; align-self: stretch; }
/* Der Verlauf soll bis an die obere Panel-Kante (samt Rundung) reichen, statt
   nur die Höhe der Button-Reihe abzudecken – sonst wirkt die Ecke oben rechts
   "unbehandelt". Die Fade-Fläche wird über die Kopfzeilen-Höhe hinaus nach oben
   und unten ausgedehnt (das Panel schneidet sie per overflow:hidden + radius
   ohnehin sauber ab). */
.rules-head .head-wrap .tb-fade { top: -13px; bottom: -14px; }
.head-scroll {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  padding: 2px 16px 2px 0;
}
.head-scroll::-webkit-scrollbar { display: none; }
.head-scroll > * { flex: 0 0 auto; }
.head-scroll .search-field { flex: 0 0 180px; width: 180px; }
.head-scroll .push-right { margin-left: auto; }
.panel-head h2 {
  margin: 0; font-size: 13px; font-weight: 700; color: #334155;
  letter-spacing: .01em; white-space: nowrap;
}

/* ---------- Files ---------- */
.files-panel { min-width: 0; }
.dropzone {
  margin: 14px; padding: 24px 14px;
  border: 1.5px dashed #c3cce0; border-radius: 12px;
  text-align: center; color: var(--muted);
  transition: .15s;
  background: linear-gradient(155deg, rgba(40, 89, 162, 0.05), rgba(23, 51, 75, 0.05));
}
.dropzone.drag {
  border-color: var(--accent); color: var(--accent-dark);
  background: linear-gradient(155deg, rgba(40, 89, 162, 0.11), rgba(24, 74, 151, 0.11));
  box-shadow: var(--focus-ring);
}
.dropzone p { margin: 4px 0; }
.dropzone strong { color: var(--text); }

.file-list { list-style: none; margin: 0; padding: 0 14px; flex: 1 1 auto; overflow: auto; }
.file-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; margin-bottom: 8px;
  background: var(--panel-soft); border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.file-list .fi-icon { color: var(--danger); font-weight: 700; }
.file-list .fi-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fi-remove { cursor: pointer; color: var(--muted); border: none; background: none; font-size: 16px; line-height: 1; }
.file-list .fi-remove:hover { color: var(--danger); }

/* Alle drei Spalten-Fußleisten (Analyse / Regel-Zähler / Ergebnis-Aktionen)
   teilen sich dieselbe Höhe (--foot-h), damit ihre Oberkanten bündig sind. */
.panel-foot {
  display: flex; align-items: center;
  padding: 0 14px; min-height: var(--foot-h);
  border-top: 1px solid var(--border);
}
.panel-foot .btn { width: 100%; }
.hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* Status der automatischen Hintergrund-Analyse beim Hinzufuegen; sitzt oben
   in der Regel-Spalte, weil die Dokumente-Spalte dann eingeklappt ist. */
.detect-status {
  margin: 0; padding: 8px 16px;
  font-size: 12px; font-weight: 600; color: #334155;
  background: var(--panel-soft); border-bottom: 1px solid var(--border);
}
.detect-status.working { color: var(--accent-dark); }
.detect-status.error { color: var(--danger); }
/* Ladebalken der Hintergrund-Analyse (gleiche Optik wie im Speichern-Dialog,
   nur schlanker); im Fehlerfall nur die Meldung zeigen. */
.detect-status .detect-progress { height: 6px; margin-top: 6px; }
.detect-status.error .detect-progress { display: none; }

/* ---------- Rules table ---------- */
.rules-panel { min-width: 0; }
.table-wrap { flex: 1 1 auto; overflow: auto; position: relative; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rules-table thead th {
  position: sticky; top: 0; z-index: 2;
  height: var(--subhead-h);
  background: var(--panel-soft); text-align: left;
  padding: 4px 6px; font-weight: 650; color: #475569;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  font-size: 12px; letter-spacing: .02em;
}
.rules-table thead th.sortable { cursor: pointer; user-select: none; }
.rules-table thead th.sortable:hover { color: var(--accent-dark); }
.rules-table thead th .sort-ind { margin-left: 4px; font-size: 10px; color: var(--muted); }
.rules-table td { padding: 5px 6px; border-bottom: 1px solid #f1f4fa; vertical-align: middle; }
.rules-table tr:hover td { background: #f8faff; }
/* Zeile ist anklickbar (Sprung zur Trefferstelle); Eingabefelder behalten den
   Text-Cursor, damit Bearbeiten sich weiterhin normal anfuehlt. */
.rules-table tr.rule-row { cursor: pointer; }
.rules-table tr.rule-row input,
.rules-table tr.rule-row select,
.rules-table tr.rule-row button { cursor: auto; }
.rules-table tr.rule-row .mode-toggle button,
.rules-table tr.rule-row .type-select,
.rules-table tr.rule-row .cell-del { cursor: pointer; }
.col-active { width: 28px; }
.col-type { width: 52px; }
.col-mode { width: 72px; }
.col-del { width: 30px; }

/* Piktogramm statt farbigem Kaestchen: logisch passendes Symbol je Typ, in der
   Typ-Farbe eingefaerbt (siehe makeTypeIcon() in renderer.js). Das Piktogramm
   ist zugleich der Auswahlknopf: ein unsichtbares natives <select> liegt
   darueber (.type-select), Klick oeffnet die Typ-Liste. */
.type-pick {
  position: relative; display: inline-flex;
  width: 32px; height: 28px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.type-pick:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14); }
.type-select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.type-icon {
  flex: 0 0 auto; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.type-icon svg { width: 18px; height: 18px; display: block; }
.type-icon.hidden { visibility: hidden; }
/* Beim Schwaerzen gibt es keine Typ-Farbe -> Symbol dimmen, bleibt klickbar */
.type-icon.dimmed { filter: grayscale(1); opacity: .35; }

.empty-hint { padding: 26px 18px; color: var(--muted); text-align: center; }

/* form controls inside table */
.input, select.input {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus { outline: none; border-color: #60a5fa; box-shadow: var(--focus-ring); }
.input.search { width: 180px; }
/* Such-Icon links im Eingabefeld ("Suchen"-Feld für die Ersetzungen-Tabelle). */
.search-field { position: relative; display: inline-flex; width: 100%; }
.search-field .search-ico {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted); pointer-events: none;
}
.search-field .input.search { width: 100%; padding-left: 28px; }
.cell-del { cursor: pointer; border: none; background: none; color: var(--muted); font-size: 19px; line-height: 1; }
.cell-del:hover { color: var(--danger); }
.pseudo-disabled { opacity: .45; }

.mode-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fff;
}
.mode-toggle button {
  border: none; background: transparent; padding: 6px 10px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1;
  transition: background .12s, color .12s;
}
.mode-toggle button.active { background: var(--grad); color: #fff; }
.mode-toggle button.active.redact { background: #111827; }

/* ---------- Options + run bar ---------- */
.options { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); }
.opt { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #475569; cursor: pointer; }
.opt input[type="checkbox"] { accent-color: var(--accent); }

.run-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; min-height: var(--foot-h);
  border-top: 1px solid var(--border); background: var(--panel-soft);
  container-type: inline-size; container-name: runbar;
}
.run-info { display: flex; gap: 8px; flex: 0 0 auto; }
/* Reicht der Platz nicht, hat der rechtliche Hinweis Vorrang: die Zähler
   (Ersetzungen / Dateien) werden ausgeblendet. */
@container runbar (max-width: 380px) { .run-info { display: none; } }
/* Rechtlicher Hinweis: rechtsbündig in der unteren Regeln-Leiste. */
.run-disclaimer {
  margin: 0 0 0 14px; flex: 1 1 auto; min-width: 0;
  text-align: right; font-size: 11px; line-height: 1.35; color: var(--muted);
}
.badge {
  background: rgba(40, 89, 162, 0.10); color: #2a4a7d;
  border: 1px solid rgba(40, 89, 162, 0.18);
  border-radius: 999px;
  padding: 4px 11px; font-size: 12px; font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 570; transition: .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-soft); border-color: #cdd6e6; }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 7px 12px; font-size: 12.5px; }
.btn.primary {
  background: var(--grad); border: 1px solid transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(40, 89, 162, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn.primary:hover { filter: brightness(1.10); background: var(--grad); }
/* Ghost-Buttons sind standardmaessig DUNKEL (sichtbar auf hellen Panels wie
   Dokumente-/Vorschau-Spalte und in Modals). Nur in der dunklen Titelleiste
   werden sie hell dargestellt. */
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--panel-soft); }
.topbar .btn.ghost {
  border-color: rgba(148, 163, 184, 0.28); color: #dbe4f2;
  padding: 7px 13px; font-size: 12.5px; border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
}
.topbar .btn.ghost:hover { background: rgba(148, 163, 184, 0.22); color: #fff; border-color: rgba(148, 163, 184, 0.4); }
/* Einstellungs-Zahnrad: runder Icon-Button mit deutlich groesserem Glyph */
#btnSettings {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; width: 34px; height: 34px; line-height: 1; font-size: 19px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary:disabled { filter: none; }

/* ---------- Overlay / Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.45);
  display: grid; place-items: center; z-index: 50;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.overlay.hidden { display: none; }
.modal {
  background: #fff; border-radius: 18px; padding: 24px;
  width: 460px; max-width: 92vw;
  max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
  animation: modal-in .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.modal.wide { width: 640px; }
.modal h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.progress { height: 8px; background: #e6eaf3; border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #17334b, #2859a2, #184a97);
  background-size: 200% 100%;
  animation: progress-hue 3s linear infinite;
  transition: width .2s;
}
@keyframes progress-hue { to { background-position: 200% 0; } }
.result-log {
  margin: 14px 0 0; padding: 12px; background: var(--panel-soft);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.suggest-wrap { max-height: 46vh; border: 1px solid var(--border); border-radius: 10px; }
.suggest-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Einklappbare Aussenspalten (Dokumente + Live-Vorschau) ---------
   Eingeklappt bleibt nur eine schmale Klick-Leiste (.collapsed-tab) stehen.
   !important noetig, weil der Zieh-Griff die Breite als Inline-Style setzt. */
.panel.collapsed { flex: 0 0 44px !important; min-width: 44px; }
.panel.collapsed > *:not(.collapsed-tab) { display: none; }

.collapsed-tab {
  display: none;
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  transition: color .12s, background .12s;
}
.panel.collapsed .collapsed-tab {
  display: flex; flex: 1 1 auto;
  flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0;
}
.collapsed-tab .vlabel { writing-mode: vertical-rl; letter-spacing: .4px; }
.collapsed-tab:hover, .collapsed-tab.drag {
  color: var(--accent-dark);
  background: linear-gradient(180deg, rgba(40, 89, 162, 0.08), rgba(23, 51, 75, 0.08));
}
.tab-badge {
  background: rgba(40, 89, 162, 0.11); color: #2a4a7d;
  border: 1px solid rgba(40, 89, 162, 0.18);
  border-radius: 999px;
  padding: 3px 7px; font-size: 11px; font-weight: 600;
}

/* ---------- Live-Vorschau ---------- */
.preview-panel { min-width: 0; }
.preview-status {
  font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.preview-status.loading::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4); border-top-color: var(--accent);
  animation: preview-spin .7s linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }
.preview-status.error { color: var(--danger); }

.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--subhead-h); min-height: var(--subhead-h); flex: 0 0 auto;
  padding: 0 12px; border-bottom: 1px solid var(--border);
  background: #fff;
}
/* Wrapper haelt die Abdunklungs-Verlaeufe fix ueber den Toolbar-Raendern
   (statt eines sichtbaren Scrollbalkens). Sie werden per JS ein-/ausgeblendet,
   je nachdem, wohin noch gescrollt werden kann. */
.toolbar-wrap { position: relative; flex: 0 0 auto; container-type: inline-size; container-name: tbwrap; }
/* Reicht der Platz in der Vorschau-Toolbar nicht mehr, verschwindet zuerst der
   "anpassen"-Knopf (Zoom auf Breite zurücksetzen ist am ehesten verzichtbar,
   Seiten-Navigation und +/− bleiben erhalten). */
@container tbwrap (max-width: 360px) { #btnZoomReset { display: none; } }
.toolbar-wrap .tb-fade {
  position: absolute; top: 0; bottom: 1px; width: 22px; z-index: 4;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.toolbar-wrap .tb-fade-l { left: 0; background: linear-gradient(90deg, rgba(15, 23, 42, 0.13), rgba(15, 23, 42, 0)); }
.toolbar-wrap .tb-fade-r { right: 0; background: linear-gradient(-90deg, rgba(15, 23, 42, 0.13), rgba(15, 23, 42, 0)); }
.toolbar-wrap.can-scroll-left .tb-fade-l,
.toolbar-wrap.can-scroll-right .tb-fade-r { opacity: 1; }
.preview-pages, .preview-zoom { display: flex; align-items: center; gap: 6px; }
.preview-toolbar .btn.small { padding: 4px 9px; min-width: 28px; }
#zoomInfo { min-width: 42px; text-align: center; }

/* Scroll-Container: alle Seiten sind vertikal gestapelt; bei Zoom > Fit
   wird auch horizontal gescrollt statt gestaucht. */
.preview-body {
  flex: 1 1 auto; overflow: auto; position: relative;
  padding: 14px;
  background:
    radial-gradient(500px 340px at 0% 0%, rgba(40, 89, 162, 0.05), transparent 60%),
    radial-gradient(460px 320px at 100% 100%, rgba(24, 74, 151, 0.05), transparent 60%),
    var(--panel-soft);
}
.preview-pages-stack {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  min-width: min-content;
}
/* Ein Slot pro Seite: haelt das Seitenverhaeltnis frei, bis das Bild da ist,
   damit beim Lazy-Laden nichts springt. Breite wird per JS gesetzt (Zoom). */
.preview-page-slot {
  position: relative; background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.10);
  border-radius: 3px; overflow: hidden; flex: 0 0 auto;
}
.preview-page-slot .page-num {
  position: absolute; top: 4px; right: 6px; z-index: 2;
  font-size: 10px; color: var(--muted); background: rgba(255,255,255,0.75);
  padding: 1px 5px; border-radius: 6px; pointer-events: none;
}
.preview-page-slot img {
  display: block; width: 100%; height: 100%; cursor: crosshair;
}
.preview-page-slot .page-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 12px;
}
.preview-hint { padding: 10px 14px; border-top: 1px solid var(--border); margin: 0; }

/* Aufblitzende Trefferstelle nach Klick auf eine Regelzeile */
.rule-hit-flash {
  position: absolute; z-index: 4; pointer-events: none;
  border: 2px solid #f59e0b; border-radius: 3px;
  background: rgba(245, 158, 11, 0.28);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  animation: rule-hit-pulse 1.5s ease;
}
@keyframes rule-hit-pulse {
  0% { opacity: 0; transform: scale(1.15); }
  15% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Gummiband beim Aufziehen einer eigenen Bereichs-Box */
.box-select-rect {
  position: absolute; z-index: 3; pointer-events: none;
  border: 1.5px dashed var(--accent);
  background: rgba(40, 89, 162, 0.12);
  border-radius: 2px;
}

/* Bereichs-Box-Zeile in der Regel-Tabelle */
.box-label { font-weight: 600; color: #334155; white-space: nowrap; }
.box-file { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Datei-Auswahl fuer die Vorschau */
.file-list li { cursor: pointer; }
.file-list li.selected {
  border-color: rgba(40, 89, 162, 0.55);
  background: linear-gradient(155deg, rgba(40, 89, 162, 0.08), rgba(24, 74, 151, 0.08));
  box-shadow: 0 0 0 3px rgba(40, 89, 162, 0.14);
}

/* kurzes Aufblitzen, wenn ein Doppelklick in der Vorschau zu einer Regel springt */
@keyframes rule-jump-flash {
  0%, 100% { background: transparent; }
  30% { background: #fef08a; }
}
.rules-table tr.jump-flash td { animation: rule-jump-flash 1.1s ease; }

/* ---------- Zuletzt geöffnet: Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 300px; max-width: 420px; max-height: 62vh; overflow: auto;
  list-style: none; margin: 0; padding: 6px;
  background: #fff; color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.28);
  animation: modal-in .18s ease both;
}
.dropdown-menu li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.dropdown-menu li:hover { background: var(--panel-soft); }
.dropdown-menu .recent-main { flex: 1 1 auto; min-width: 0; }
.dropdown-menu .recent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dropdown-menu .recent-meta { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu .recent-empty { color: var(--muted); padding: 12px 10px; cursor: default; }
.dropdown-menu .recent-empty:hover { background: none; }
.dropdown-menu .recent-del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; }
.dropdown-menu .recent-del:hover { color: var(--danger); }

/* ---------- Einstellungen-Modal ---------- */
.settings-group { margin-bottom: 28px; }
.settings-group:last-of-type { margin-bottom: 8px; }
/* Minimalistische Tabelle: Sektionskopf als Haarlinien-Header, jede Option
   eine Zeile (Label links, Bedienelement rechts), getrennt durch Haarlinien. */
.settings-group h4 {
  margin: 0; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .7px; color: var(--muted); font-weight: 700;
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.settings-group .opt,
.settings-group .table-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 0; padding: 7px 2px;
  border-bottom: 1px solid var(--border);
}
.settings-group .opt:last-child,
.settings-group .table-row:last-child { border-bottom: none; }
.settings-group .opt-label { font-size: 12.5px; color: #475569; line-height: 1.35; }
.outdir-row { flex-wrap: wrap; }
.outdir-control {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end; flex: 1 1 auto; min-width: 0;
}
/* Sprachauswahl in den Einstellungen (schmales, natives Select rechtsbündig
   in der Options-Zeile - Optik wie die uebrigen Eingabefelder). */
.lang-select {
  font-size: 12.5px; color: #334155;
  padding: 6px 9px; min-width: 160px;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}
.lang-select:focus { outline: none; border-color: #60a5fa; box-shadow: var(--focus-ring); }

.setting-row { margin-top: 12px; }
.setting-label { display: block; font-size: 12.5px; color: #475569; margin-bottom: 6px; font-weight: 600; }
.path-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.path-value {
  flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; padding: 7px 9px;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 8px;
}

/* ---------- Einstellungen: Lizenz ---------- */
.license-grid {
  display: grid; grid-template-columns: 110px 1fr;
  row-gap: 7px; column-gap: 12px; align-items: center;
  font-size: 13px;
  padding: 10px 12px;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px;
}
.license-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.license-value.license-ok { color: #15803d; font-weight: 600; }
.license-value.license-bad { color: var(--danger); font-weight: 600; }
.license-key-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.license-key {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px;
  letter-spacing: .04em; word-break: break-all; /* Schlüssel immer vollständig lesbar */
}
.license-key-input {
  flex: 1 1 220px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .05em;
}
.license-msg { font-size: 12.5px; margin: 8px 0 0; color: var(--muted); min-height: 16px; }
.license-msg.ok { color: #15803d; }
.license-msg.bad { color: var(--danger); }

/* ---------- Vorschau: Datei-Umschalter + Seiten-Eingabe ---------- */
/* Bei knapper Spaltenbreite bleibt die Toolbar einzeilig und wird horizontal
   scrollbar, statt umzubrechen oder abgeschnitten zu werden. */
.preview-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.preview-toolbar > * { flex: 0 0 auto; }
.preview-toolbar::-webkit-scrollbar { display: none; }
/* Datei-Umschalter sitzt in der Kopfzeile neben Vollbild/Einklappen und darf
   bei schmaler Spalte schrumpfen (lange Dateinamen werden abgeschnitten). */
select.preview-file-select {
  width: auto; max-width: 200px; min-width: 60px; flex: 0 1 auto;
  padding: 5px 6px; font-size: 12px;
}
.preview-panel .panel-head .head-actions { min-width: 0; }
.preview-page-input { width: 48px; text-align: center; padding: 4px; }
#previewPageTotal { min-width: 34px; }

/* ---------- Vorschau-Fußzeile (Ergebnis-Aktionen + Speichern) ---------- */
.preview-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 14px; min-height: var(--foot-h);
  border-top: 1px solid var(--border); background: var(--panel-soft);
  container-type: inline-size; container-name: pfoot;
}
.preview-foot-left { display: flex; gap: 8px; flex-wrap: nowrap; }
/* Reicht der Platz nicht, schrumpfen Drucken/Per Mail senden auf reine Icons. */
@container pfoot (max-width: 430px) {
  .preview-foot-left .with-icon span { display: none; }
  .preview-foot-left .with-icon { padding: 9px; width: 36px; justify-content: center; }
}

/* ---------- Vollbild-Vorschau ---------- */
body.preview-full .files-panel,
body.preview-full .rules-panel,
body.preview-full .col-resizer { display: none !important; }
body.preview-full .preview-panel { flex: 1 1 auto !important; }
.exit-fullscreen {
  display: none; position: absolute; top: 10px; right: 12px; z-index: 25;
  align-items: center; gap: 8px;
  /* Anwendungstypische Ghost-Button-Farbe (wie alle anderen Toolbar-Buttons),
     nur mit etwas Deckkraft/Blur, damit sie auf dem Vorschau-Hintergrund
     ausreichend Kontrast hat. */
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
body.preview-full .exit-fullscreen { display: inline-flex; }
/* ESC als grau hinterlegtes Tasten-Badge statt in Klammern im Fließtext. */
.exit-fullscreen .kbd {
  padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  background: #64748b; color: #fff;
}

/* ---------- Fehlende Datei (aus zuletzt geöffnetem Projekt) ---------- */
.file-list li.missing { border-color: var(--danger); background: #fef2f2; cursor: default; }
.file-list li.missing .fi-name { color: var(--danger); }
.file-list li.missing .fi-icon { color: var(--danger); }
.file-list .fi-missing-actions { display: flex; gap: 8px; margin-top: 4px; }
.file-list .fi-link {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 11.5px; text-decoration: underline;
}
.file-list .fi-link.danger { color: var(--danger); }
.file-list .fi-col { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }

/* ---------- Disclaimer-Fußzeile ---------- */
.app-disclaimer {
  flex: 0 0 auto; padding: 1px 22px 8px; text-align: center;
  font-size: 11.5px; color: var(--muted);
  background: transparent;
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.30); border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.55); background-clip: content-box; border: 2px solid transparent; }

/* ---------- Buttons mit Icon ---------- */
.btn.with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn.with-icon .ico { width: 17px; height: 17px; flex: 0 0 auto; display: block; }
.btn.icon-only {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; width: 34px; height: 34px;
}
.btn.icon-only svg { width: 19px; height: 19px; display: block; }
/* In der dunklen Titelleiste bleiben Icon-Only-Knöpfe quadratisch/rund
   (überschreibt das breitere Pillen-Padding der Ghost-Buttons). */
/* Icon-Buttons in der Titelleiste (Einstellungen, Drei-Punkte) ohne Kontur:
   nur das Icon, dezente Fläche erst beim Hover. */
.topbar .btn.icon-only {
  padding: 6px; width: 34px; height: 34px;
  background: transparent; border-color: transparent;
}
.topbar .btn.icon-only:hover { background: rgba(148, 163, 184, 0.18); border-color: transparent; }

/* ---------- Pillen: Seiten-Navigation & Zoom ---------- */
.pill {
  display: inline-flex; align-items: stretch; gap: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: #fff; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
/* vertikale Trennstriche zwischen den Segmenten */
.pill > * + * { border-left: 1px solid var(--border); }
.pill .pill-seg { border-radius: 0; margin: 0; }
.preview-toolbar .pill .btn {
  border: none; background: transparent; box-shadow: none; border-radius: 0;
  padding: 7px 12px; min-width: 34px; color: var(--text); font-weight: 600;
}
.preview-toolbar .pill .btn:hover:not(:disabled) { background: var(--panel-soft); }
.preview-toolbar .pill .btn:active:not(:disabled) { transform: none; background: #eef2fb; }
.preview-toolbar .pill .btn:disabled { opacity: .4; }
.pill .pill-static {
  display: inline-flex; align-items: center; padding: 0 12px;
  color: var(--muted); white-space: nowrap;
}
.preview-toolbar .pill .preview-page-input {
  border: none; border-radius: 0; box-shadow: none; cursor: text;
  /* Hellgraue Fläche signalisiert: hier kann man die Seitenzahl eingeben. */
  background: #e9edf4;
  width: 46px; text-align: center; padding: 6px 4px; color: var(--text); font-weight: 600;
}
.preview-toolbar .pill .preview-page-input:focus {
  outline: none; box-shadow: none; background: rgba(40, 89, 162, 0.16);
}

/* ---------- Toggle-Switches (Einstellungen) ---------- */
/* Layout der Zeile kommt aus ".settings-group .opt" (Tabellen-Optik); hier nur
   das Klickverhalten der jeweiligen Zeile. */
.settings-group .toggle-row { cursor: pointer; }
.settings-group .outdir-row { cursor: default; }
.switch { position: relative; flex: 0 0 auto; width: 40px; height: 22px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: #cbd5e1; transition: background .2s;
}
.switch .slider::before {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  transition: transform .2s;
}
.switch input:checked ~ .slider { background: var(--grad); }
.switch input:checked ~ .slider::before { transform: translateX(18px); }
.switch input:focus-visible ~ .slider { box-shadow: var(--focus-ring); }

/* ---------- Dropdown-Titel + Liste (Zuletzt geöffnet) ---------- */
.dropdown-title {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.dropdown-title svg { width: 15px; height: 15px; flex: 0 0 auto; }
.dropdown-list { list-style: none; margin: 0; padding: 0; }
.dropdown-menu .recent-ico { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted); }

/* ---------- Leerzustand Regeln: zentrierter Hinweis mit optemus-Bildmarke ----
   table-wrap wird zur Flex-Spalte, damit der Hinweis den freien Raum unter der
   Spaltenkopfzeile füllt und mittig sitzt. */
.rules-panel .table-wrap { display: flex; flex-direction: column; }
.rules-empty {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 24px 34px;
}
.rules-empty-mark {
  width: auto; height: 150px; margin-bottom: 22px;
  opacity: 1; filter: drop-shadow(0 8px 20px rgba(15, 23, 42, 0.07));
}
.rules-empty-title { margin: 0 0 5px; font-size: 15px; font-weight: 700; color: #334155; }
.rules-empty-sub { margin: 0; max-width: 420px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* ---------- Dropdown: Projekt-Sektion (Laden/Speichern) ---------- */
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; background: none; cursor: pointer;
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text);
  text-align: left; font-family: inherit;
}
.dropdown-item:hover { background: var(--panel-soft); }
.dropdown-item-ico { display: inline-flex; color: var(--muted); flex: 0 0 auto; }
.dropdown-item-ico svg { width: 17px; height: 17px; display: block; }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Regel-Sektionen (selbst erstellt / automatisch) ---------- */
/* Sektions-Header scrollen mit dem Inhalt (nicht sticky). Zwei gleichzeitig
   klebende Header würden beim Scrollen eine durchscheinende Lücke erzeugen;
   nur die Spaltenkopfzeile (thead) bleibt oben stehen. */
.rules-table tr.rule-section-row td {
  background: #eef2fb; padding: 6px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.rules-table tr.rule-section-row:first-child td { border-top: none; }
.rules-table tr.rule-section-row:hover td { background: #eef2fb; }
.rule-section-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: #5b6b86;
}
.rule-section-count {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-size: 10.5px; font-weight: 700; color: #2a4a7d;
  background: rgba(40, 89, 162, 0.10); border: 1px solid rgba(40, 89, 162, 0.16);
  border-radius: 999px;
}

/* ---------- "+ Regel"-Knopf in der unteren Leiste ---------- */
.add-rule-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-dark); border-color: rgba(40, 89, 162, 0.30);
  background: rgba(40, 89, 162, 0.06); font-weight: 650;
}
.add-rule-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.add-rule-btn:hover { background: rgba(40, 89, 162, 0.12); border-color: rgba(40, 89, 162, 0.45); color: var(--accent-dark); }

/* ---------- Vorschau: schwebende Dokument-Leiste ----------
   Überlagert die Vorschau unten (über der Ergebnis-Fußzeile), schaltet
   zwischen den geladenen Dokumenten um. */
.doc-switcher {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--foot-h) + 16px); z-index: 8;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-width: calc(100% - 28px);
}
.doc-nav {
  flex: 0 0 auto; width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 999px;
  color: var(--text); cursor: pointer; transition: background .12s;
}
.doc-nav svg { width: 18px; height: 18px; display: block; }
.doc-nav:hover:not(:disabled) { background: var(--panel-soft); }
.doc-nav:disabled { opacity: .35; cursor: not-allowed; }
.doc-select {
  /* Feste Wunschbreite, schrumpft aber mit, wenn die Vorschau-Spalte schmal
     wird (lange Dateinamen werden dann per Ellipsis gekürzt). */
  flex: 0 1 190px; width: 190px; min-width: 70px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--text); font-size: 12.5px; font-weight: 600;
  text-overflow: ellipsis;
}
.doc-select:focus { outline: none; border-color: #60a5fa; box-shadow: var(--focus-ring); }
/* Im Vollbild etwas höher schweben, weil die Fußzeile bleibt. */
body.preview-full .doc-switcher { bottom: calc(var(--foot-h) + 22px); }
