:root {
    --bg: #f2f5fa;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: #e8f0ff;
    --ok: #059669;
    --warn: #b45309;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .06);
    --font: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* Reserviert den Platz für die vertikale Scrollbar dauerhaft – verhindert, dass ihr
   Ein-/Ausblenden (abhängig von der Seitenhöhe) die verfügbare Breite ändert und so
   eine Rückkoppelungsschleife mit der Lebenslauf-Vorschau (Skalierung ↔ Höhe) auslöst. */
html { scrollbar-gutter: stable; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

.app { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }

/* ---------- Sektor 1: Kopfband (über die ganze Breite, blau mit feinem Muster) ---------- */
.hero-header {
    position: relative; width: 100%; overflow: hidden;
    background:
        radial-gradient(640px 240px at 84% -20%, rgba(96, 165, 250, .28), transparent 70%),
        radial-gradient(520px 220px at 12% 120%, rgba(59, 130, 246, .2), transparent 70%),
        linear-gradient(125deg, #0d1f3c 0%, #16335e 48%, #1f4987 100%);
    color: #fff;
    border-bottom: 1px solid rgba(147, 197, 253, .22);
}
.hero-pattern { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    padding: 18px 30px; width: 100%;
}
.hero-left { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; flex: none; }
.brand:hover { text-decoration: none; opacity: .95; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(135deg, #3b82f6, #60a5fa); color: #fff; font-weight: 700; font-size: 18px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-text { font-weight: 650; font-size: 15px; letter-spacing: .01em; color: #e2e8f0; white-space: nowrap; }
.hero-divider { width: 1px; height: 32px; background: rgba(191, 219, 254, .26); flex: none; }
.hero-titles { min-width: 0; }
.hero-titles h1 { color: #fff; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.hero-subtitle { margin: 3px 0 0; color: rgba(219, 234, 254, .84); font-size: 13px; }

.hero-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-header .topbar-actions .btn {
    background: #3b82f6; border-color: rgba(147, 197, 253, .45); color: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .22);
}
.hero-header .topbar-actions .btn:hover { background: #2563eb; border-color: rgba(191, 219, 254, .65); }
.hero-header .topbar-actions .btn-secondary {
    background: rgba(255, 255, 255, .13); color: #fff; border-color: rgba(255, 255, 255, .28);
    backdrop-filter: blur(6px); box-shadow: none;
}
.hero-header .topbar-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .48); color: #fff;
}
.hero-header .topbar-actions .btn-ok { background: #059669; border-color: rgba(110, 231, 183, .45); }
.hero-header .topbar-actions .btn-ok:hover { background: #047857; }

.hero-ai-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
    background: rgba(15, 23, 42, .32); border: 1px solid rgba(191, 219, 254, .24); color: #e2e8f0;
    text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s;
}
.hero-ai-pill:hover { background: rgba(15, 23, 42, .48); border-color: rgba(191, 219, 254, .45); color: #fff; }
.hero-ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none; }
.hero-ai-pill.is-on .hero-ai-dot { background: #34d399; box-shadow: 0 0 8px rgba(52, 211, 153, .75); }

.hero-user {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 6px 4px 5px; border-radius: 999px;
    background: rgba(15, 23, 42, .28); border: 1px solid rgba(191, 219, 254, .2);
}
.avatar {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-size: 13px; font-weight: 700; flex: none;
}
.hero-user-name { color: #f1f5f9; font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.hero-logout {
    padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
    color: #dbeafe; background: rgba(255, 255, 255, .1); text-decoration: none !important;
    transition: background .15s, color .15s; white-space: nowrap;
}
.hero-logout:hover { background: rgba(239, 68, 68, .85); color: #fff; }

/* ---------- Sektor 2: Navisektor (über die ganze Breite direkt unter dem Header) ---------- */
.subnav-bar {
    position: sticky; top: 0; z-index: 30; width: 100%;
    background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px);
    border-bottom: 1px solid #dbe4f0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .05);
}
.subnav-inner {
    display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
    padding: 0 24px; width: 100%;
}
.nav-link {
    position: relative; display: inline-flex; align-items: center; gap: 7px;
    padding: 12px 12px; color: #334155; font-size: 13.8px; font-weight: 600;
    white-space: nowrap; text-decoration: none !important;
    border-bottom: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}
.nav-link svg { width: 17px; height: 17px; fill: currentColor; opacity: .82; flex: none; }
.nav-link:hover { color: var(--accent-dark); background: #f1f6ff; }
.nav-link.is-active {
    color: var(--accent-dark);
    background: linear-gradient(180deg, rgba(37, 99, 235, .04), rgba(37, 99, 235, .11));
    border-bottom-color: var(--accent);
}
.nav-link.is-active svg { opacity: 1; }
.nav-badge {
    min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.nav-link.is-active .nav-badge { background: var(--accent); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; padding: 24px 30px 40px; width: 100%; max-width: none; }
.main.is-wide { max-width: none; }
.app-foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; }
.card-head .muted { margin: 2px 0 0; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 16px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfe; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat-sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
    background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: transform .08s, background .15s, box-shadow .15s;
    text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #e9eef4; color: var(--ink); border-color: #d7e0ea; }
.btn-secondary:hover { background: #64748b; border-color: #64748b; color: #fff; }
.btn-secondary:active { background: #475569; border-color: #475569; color: #fff; }
.btn-ghost { background: transparent; color: #cbd5e1; border-color: rgba(148, 163, 184, .3); }
.btn-ghost:hover { background: rgba(148, 163, 184, .16); color: #fff; }
.btn-primary-soft { background: var(--accent-soft); color: var(--accent-dark); }
.btn-primary-soft:hover { background: #dbe8ff; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #047857; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Lebenslauf: Info-Knopf oben rechts im Kopf und Archiv-Zeile über dem Editor */
.cv-info-btn { display: inline-flex; align-items: center; gap: 7px; }
.cv-info-btn svg { width: 16px; height: 16px; flex: none; }
.cv-archive-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cv-archive-inline .check { margin: 0 0 7px; }
/* Neuer Sektor «Als Dokument speichern»: hellblaue Leiste, etwas höher als die grössten Schaltflächen */
.cv-archive-band {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    min-height: 72px; padding: 14px 18px; margin: 0 0 20px;
    background: linear-gradient(180deg, #eef5ff 0%, #dfeeff 100%);
    border: 1px solid #bcd6fb; border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 3px rgba(37, 99, 235, .08);
}
.cv-band-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 700; color: #1e3a8a; white-space: nowrap; }
.cv-band-label svg { width: 20px; height: 20px; fill: #2563eb; flex: none; }
.cv-band-input { flex: 1 1 220px; min-width: 180px; max-width: 420px; background: #fff; }
.cv-band-hint { flex: 1 1 200px; font-size: 12.5px; line-height: 1.35; color: #475a7a; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
/* Abgesetzte Gruppe: hellgrau hinterlegt mit feinem Rand (z. B. Anschreiben-Einstellungen) */
.panel {
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.panel > *:last-child { margin-bottom: 0; }
.panel .field { margin-bottom: 0; }
/* Mehrere Felder in einer gemeinsamen hellgrauen Box (Anschreiben-Einstellungen) */
.panel-stack { display: grid; gap: 13px; }
.panel .form-row { gap: 14px; }
.panel .form-row.form-row-single { grid-template-columns: minmax(0, 1fr); }
.panel .hint { margin-bottom: 0; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 5px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=number], input[type=tel], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
    font: inherit; font-size: 14px; color: var(--ink); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #93b4f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
textarea.letter-input { min-height: 420px; font-family: var(--font); }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }.check { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.design-preview { height: 46px; border-radius: 10px; margin-bottom: 16px; border: 1px solid rgba(15, 23, 42, .08); transition: box-shadow .2s; }
[hidden] { display: none !important; }
dialog.design-dialog { border: 0; padding: 0; width: min(560px, 94vw); max-height: 88vh; background: transparent; border-radius: 16px; overflow: visible; margin: 40px auto auto 32px; }
@media (max-width: 900px) { dialog.design-dialog { margin: 24px auto; } }
dialog.design-dialog::backdrop { background: rgba(15, 23, 42, .25); backdrop-filter: blur(1px); }
dialog.design-dialog .card { box-shadow: 0 30px 70px rgba(15, 23, 42, .35); max-height: 88vh; overflow: auto; }
.design-close { position: absolute; top: 10px; right: 12px; z-index: 3; width: 32px; height: 32px; border: 0; border-radius: 9px; background: #f1f5f9; color: #334155; font-size: 19px; line-height: 1; cursor: pointer; }
.design-close:hover { background: #e2e8f0; }
/* Popup «Schrift…»: drei Gruppen (Überschrift, Titel, Text) */
.font-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.font-group { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #f8fafc; }
.font-group h3 { margin: 0 0 2px; font-size: 15px; color: #0f172a; }
.font-group p { margin: 0 0 9px; }
.font-group label { display: block; font-size: 13px; color: #475569; margin: 0 0 4px; }
.font-group input[type=number] { width: 100%; margin-bottom: 9px; }
.font-group input[type=color] { height: 34px; margin-bottom: 6px; }
.font-group .check { font-size: 13px; }
@media (max-width: 900px) { .font-grid { grid-template-columns: 1fr; } }
/* Abschnittsfarben im «Schrift…»-Dialog */
.sec-color-head { margin: 6px 0 2px; font-size: 15px; color: #0f172a; }
.sec-color-list { display: grid; gap: 6px; }
.sec-color-row { display: grid; grid-template-columns: minmax(120px, 1fr) 150px 150px; gap: 10px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.sec-color-name { font-size: 13px; font-weight: 600; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-color-field { display: flex; align-items: center; gap: 8px; }
.sec-color-field input[type=color] { width: 46px; height: 30px; padding: 2px; }
.sec-color-field .check { font-size: 12px; gap: 5px; }
.sec-color-field .check input { width: 14px; height: 14px; }
@media (max-width: 900px) { .sec-color-row { grid-template-columns: 1fr; } }

/* Aktionsleiste oben im Formular (Inserat/Kontakt): bleibt beim Scrollen unter der Navigationsleiste sichtbar */
.card-nav {
  position: sticky; top: 56px; z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; margin: 0 0 16px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
}
.card-nav .btn { margin: 0; }
@media (max-width: 700px) { .card-nav { position: static; } }
/* E-Mail-Maske: Anhänge nach Kategorie */
.mail-attachments { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f8fafc; }
.mail-attach-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.mail-attachments .check { align-items: flex-start; font-size: 14px; }
.mail-attachments .check .muted { margin-left: 6px; }
.mail-attach-link { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(37, 99, 235, .35); }
.mail-attach-link:hover { border-bottom-color: currentColor; }

/* Versendete Bewerbungen: Suche, Markierung, Status-Kästchen */
.sent-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.sent-search input[type=search] { min-width: 240px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 14px; }
.sent-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.sent-bulk { display: flex; gap: 8px; align-items: center; margin: 0; }
.table-scroll { overflow-x: auto; }
.sel-cell { width: 1%; min-width: 36px; white-space: nowrap; }
.sel-cell .sent-entered { margin-left: 7px; vertical-align: middle; }
.sel-cell input, .status-box { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.status-cell { text-align: center; width: 44px; }
.table th.status-col-head { text-align: center; white-space: nowrap; padding: 10px 6px; }
.status-ico { width: 17px; height: 17px; fill: currentColor; display: block; margin: 0 auto; }
.table th.status-col-head .status-ico { width: 18px; height: 18px; }
.st-gesendet { color: #2563eb; }
.st-warte { color: #b45309; }
.st-gespraech { color: #6d28d9; }
.st-absage { color: #b91c1c; }
.st-zusage { color: #047857; }
.status-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
/* Register (Tabs) der Versendet-Liste */
.sent-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.sent-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; text-decoration: none;
}
.sent-tab:hover { background: #f1f5f9; }
.sent-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sent-tab-count { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: #eef2f7; color: #475569; }
.sent-tab.is-active .sent-tab-count { background: rgba(255, 255, 255, .22); color: #fff; }
.sent-entered { font-size: 11px; white-space: nowrap; }
.status-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.status-legend .status-ico { width: 15px; height: 15px; }
.row-status-form { display: none; }
.sent-table { font-size: 13.5px; }
.sent-table th, .sent-table td { padding: 10px 10px; }
.sent-table tbody tr.sent-row { cursor: pointer; }
.sent-table tbody tr:has(.sel-box:checked) td, .sent-table tbody tr.sent-row.is-selected td { background: #eff6ff; }

/* Arbeitsbemühungen (Job-Room) */
.jr-row { cursor: pointer; }
.jr-row:hover td { background: #f8fafc; }

/* Arbeitsbemühungen: Ansicht und Bearbeiten als Fenster */
.jr-table td .badge { white-space: nowrap; }
dialog.jr-dialog { width: min(820px, 95vw); margin: 28px auto; }
dialog.jr-dialog .card { max-height: 86vh; overflow: auto; }
.jr-dialog .jr-mask { border: 0; padding: 0; margin: 0; }
.jr-view-list { margin: 0 0 18px; }
.jr-view-row { display: grid; grid-template-columns: minmax(140px, 210px) minmax(0, 1fr); gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.jr-view-row:first-child { border-top: 1px solid var(--line); }
.jr-view-row dt { margin: 0; color: #64748b; font-size: 12.5px; }
.jr-view-row dd { margin: 0; color: #0f172a; font-size: 13.5px; overflow-wrap: anywhere; }
.jr-view-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jr-view-actions form { margin: 0; }
@media (max-width: 620px) { .jr-view-row { grid-template-columns: 1fr; gap: 2px; } }

/* Symbol-Knöpfe mit Beschriftung beim Überfahren (Import / Übermitteln) */
.jr-toolbar { align-items: center; }
.jr-icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; }
.jr-icon-btn svg { width: 18px; height: 18px; }
.jr-tip {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  padding: 6px 10px; border-radius: 7px; background: #0f172a; color: #fff;
  font-size: 12px; line-height: 1.3; white-space: nowrap;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.jr-icon-btn:hover .jr-tip,
.jr-icon-btn:focus-visible .jr-tip { opacity: 1; visibility: visible; transform: translateY(0); }

/* Import-Vorschau und Übermittlungsblöcke */
.jr-transfer-block { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px 12px; margin: 0 0 12px; background: #fff; }
.jr-transfer-block > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; font-weight: 600; color: #0f172a; }
.jr-transfer-block > summary .badge { font-weight: 500; }
.jr-month-text {
  margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #f8fafc; font-size: 12.5px; line-height: 1.55; color: #334155;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto;
}
.jr-script-box {
  width: 100%; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #0f172a; color: #e2e8f0; font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px; line-height: 1.5; resize: vertical;
}
.jr-entry-values { margin: 0 0 14px; }
.jr-entry-values > summary { cursor: pointer; color: #475569; font-size: 13px; margin-bottom: 8px; }
.jr-value-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.jr-value-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jr-value-head .btn { margin-left: auto; }

/* Job-Room-Zugang */
.jr-browser-card .card-head { flex-wrap: wrap; }
.jr-login-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Arbeitsbemühungen: Monate wie im Job-Room (Kontrollperioden) */
.jr-periods { display: flex; flex-direction: column; gap: 12px; }
.jr-period { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.jr-period.is-current { border-left: 4px solid #c8102e; }
.jr-period-head {
  display: grid; grid-template-columns: 18px minmax(96px, 0.85fr) minmax(80px, 1fr) minmax(100px, 1.35fr); gap: 10px 14px; align-items: center;
  width: 100%; padding: 12px 14px; border: 0; background: #f8fafc; text-align: left; cursor: pointer;
  font: inherit; color: inherit;
}
@media (max-width: 900px) {
  .jr-period-head { grid-template-columns: 18px 1fr; row-gap: 6px; }
  .jr-period-meta { grid-column: 2; }
}
.jr-period-head:hover { background: #f1f5f9; }
.jr-period.is-current .jr-period-head { background: #fdf2f4; }
.jr-period-chevron { color: #94a3b8; font-size: 12px; transition: transform .15s; }
.jr-period.is-open .jr-period-chevron { transform: rotate(90deg); }
.jr-period-month { font-weight: 650; color: #0f172a; }
.jr-period.is-current .jr-period-month { color: #c8102e; }
.jr-period-meta { display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.jr-meta-label { color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.jr-meta-value { color: #334155; overflow-wrap: anywhere; }
.jr-transfer.is-ready .jr-meta-value { color: #b45309; }
.jr-transfer.is-sent .jr-meta-value { color: #0f766e; font-weight: 600; }
.jr-meta-auto { display: block; font-size: 11px; color: #94a3b8; margin-top: 2px; }
.jr-transfer.is-empty .jr-meta-value,
.jr-transfer.is-open-status .jr-meta-value { color: #64748b; }
.jr-period-body { padding: 4px 16px 14px; border-top: 1px solid var(--line); }
.jr-period-empty { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; color: #64748b; font-size: 13.5px; }

/* Erfassen-Maske wie das Job-Room-Formular */
.jr-mask { border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 6px; margin: 0 0 18px; background: #fff; }
.jr-mask-actions { margin-top: 6px; }
/* Abschnitt wie im Job-Room: grauer Titelbalken, darunter die Felder */
.jr-step { margin: 0 0 18px; }
.jr-step-title {
  background: #f1f3f5; border-radius: 4px; padding: 10px 14px; font-size: 14.5px; color: #212529;
  border-bottom: 1px solid #e3e6ea;
}
.jr-step-body { padding: 12px 2px 0; }
.jr-step-body .field { margin-bottom: 10px; }
.jr-field-label { display: block; font-size: 12.5px; color: #495057; margin: 0 0 4px; }
.jr-optional { color: #94a3b8; font-weight: 400; }
.jr-req { color: #c8102e; }
/* Auswahlzeilen wie im Job-Room (ganze Zeile anklickbar) */
.jr-options { display: flex; flex-direction: column; gap: 8px; }
.jr-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8f9fa;
  border: 1px solid #e9ecef; border-radius: 3px; font-size: 14px; color: #212529; cursor: pointer;
}
.jr-option:hover { background: #f1f3f5; }
.jr-option input { width: 18px; height: 18px; accent-color: #c8102e; margin: 0; }
.jr-position-field { max-width: 640px; }
.jr-counter { font-size: 12px; color: #6c757d; text-align: right; margin-top: 3px; }
/* PLZ/Ort mit Suche und Auswahlliste */
.jr-geo { position: relative; }
.jr-geo-field { position: relative; }
.jr-geo-field input { width: 100%; padding-right: 40px; }
.jr-geo-icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: #c8102e; pointer-events: none; }
.jr-geo-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid #ced4da; border-radius: 4px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .16); max-height: 260px; overflow: auto;
}
.jr-geo-list li { padding: 7px 12px; font-size: 14px; cursor: pointer; display: flex; gap: 8px; }
.jr-geo-list li:hover, .jr-geo-list li.is-active { background: #f1f3f5; }
.jr-geo-list li .zip { font-weight: 700; color: #212529; }
.jr-geo-list li .zip mark, .jr-geo-list li .town mark { background: #fdf0b0; color: inherit; padding: 0 1px; }
.jr-geo-list li .canton { color: #94a3b8; font-size: 12px; margin-left: auto; }
.jr-hint { font-size: 12px; color: #6c757d; margin-top: 4px; }
.jr-link-btn { border: 0; background: none; padding: 0; color: var(--accent-dark); font: inherit; cursor: pointer; text-decoration: underline; }
.jr-link-btn:hover { color: var(--accent); }
/* Übermittlungsstatus je Monat von Hand setzen */
.jr-status-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.jr-status-edit form { margin: 0; }
.jr-status-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 100%; }
.jr-status-text .jr-meta-label { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.jr-status-form { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.jr-inline-label { font-size: 12.5px; color: #475569; white-space: nowrap; }
.jr-date.jr-date { width: 148px; flex: none; }
.jr-close-form { margin: 0; }
.jr-period.is-closed .jr-period-month { color: #475569; }
.jr-period.is-closed .jr-period-head { background: #f8fafc; }
.jr-lock { font-size: 12px; margin-left: 4px; }
.jr-script-details, .jr-nachweis { margin: 0 0 12px; }
.jr-script-details > summary, .jr-nachweis > summary { cursor: pointer; font-size: 12.5px; color: #475569; }
.jr-nachweis .jr-month-text { margin-top: 8px; }
/* Auto-Übermittlung (Erweiterung) */
.jr-queue { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 10px 12px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px; margin: 0 0 12px; }
.jr-status-edit .jr-queue { margin: 0; flex: 1 1 100%; }
.jr-queue.is-error { border-color: #fecaca; background: #fef2f2; }
.jr-queue-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; font-size: 13px; }
.jr-queue-conn { font-size: 12px; color: #64748b; }
.jr-queue-conn.is-ok { color: #047857; }
.jr-queue-conn.is-off { color: #b45309; }
.jr-queue-hint { margin: 0 0 12px; padding: 10px 12px; border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; font-size: 12.5px; color: #78350f; }
.jr-queue-hint[hidden] { display: none; }
.jr-queue-hint ol { margin: 6px 0 6px; padding-left: 18px; }
.jr-queue-hint li { margin-bottom: 3px; }
.jr-queue-hint code { background: #fef3c7; border-radius: 4px; padding: 0 4px; font-size: 12px; }
.jr-queue-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: searchPulse 1.1s ease-in-out infinite; flex: none; }
.jr-street-row { display: grid; grid-template-columns: minmax(0, 2fr) 110px minmax(0, 1.4fr); gap: 14px; }
.jr-info-title { margin: 16px 0 6px; font-size: 14px; color: #0f172a; }
@media (max-width: 900px) {
  .jr-street-row { grid-template-columns: 1fr; }
}
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--accent); }
/* Suchkreis: Anzeige während des Suchlaufs */
.search-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .58); }
.search-overlay[hidden] { display: none; }
.search-panel { width: min(600px, 100%); max-height: 88vh; overflow: auto; background: #fff; border-radius: 16px; padding: 22px 24px 18px; box-shadow: 0 30px 80px rgba(2, 6, 23, .45); text-align: center; }
.search-panel h3 { margin: 0 0 4px; font-size: 17px; }
.search-spinner { width: 54px; height: 54px; margin: 2px auto 14px; border-radius: 50%; border: 4px solid #dbeafe; border-top-color: var(--accent); display: grid; place-items: center; animation: searchSpin 1s linear infinite; }
.search-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: searchPulse 1.1s ease-in-out infinite; }
@keyframes searchSpin { to { transform: rotate(360deg); } }
@keyframes searchPulse { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
.search-sites { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow: auto; text-align: left; }
.search-sites li { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.search-sites .site-mark { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; flex: none; }
.search-sites .site-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-sites .site-state { font-size: 11.5px; color: var(--muted); flex: none; }
.search-sites li[data-state="laeuft"] { border-color: #bfdbfe; background: #eff6ff; }
.search-sites li[data-state="laeuft"] .site-mark { background: var(--accent); animation: searchPulse .9s ease-in-out infinite; }
.search-sites li[data-state="laeuft"] .site-state { color: var(--accent-dark); font-weight: 650; }
.search-sites li[data-state="fertig"] .site-mark { background: #10b981; }
.search-sites li[data-state="fertig"] .site-state { color: #047857; }
.search-sites li[data-state="uebersprungen"] { opacity: .55; }
body.is-searching { overflow: hidden; }

/* Ergebnis des letzten Laufs: Seitenliste bleibt sichtbar */
.run-summary .card-body { display: flex; flex-direction: column; gap: 14px; }
.run-group-title { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.run-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.run-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; font-size: 12.5px; }
.run-chip .run-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; flex: none; }
.run-chip .run-state { font-size: 11.5px; color: var(--muted); }
.run-chip.is-fertig { border-color: #bbf7d0; background: #f0fdf4; }
.run-chip.is-fertig .run-dot { background: #10b981; }
.run-chip.is-fertig .run-state { color: #047857; }
.run-chip.is-uebersprungen { opacity: .7; }
.run-chip.is-uebersprungen .run-dot { background: #f59e0b; }
.run-chip.is-datei { border-color: #bfdbfe; background: #eff6ff; }
.run-chip.is-datei .run-dot { background: var(--accent); }
.run-chip.is-datei .run-state { color: var(--accent-dark); font-weight: 650; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafcff; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: #f1f5f9; color: #475569; }
.badge-blue { background: var(--accent-soft); color: var(--accent-dark); }
.badge-green { background: #d1fae5; color: #047857; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-violet { background: #ede9fe; color: #5b21b6; }
.badge-new { background: var(--accent); color: #fff; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 11px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 9px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; border: 1px solid transparent; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); background: #f8fafc; text-decoration: none; }
.tab.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); background: #fff; }

/* ---------- Dropzone ---------- */
.dropzone {
    border: 2px dashed #cbd5e1; border-radius: 12px; padding: 26px 18px; text-align: center;
    background: #fbfdff; color: var(--muted); transition: border-color .15s, background .15s;
    cursor: pointer; font-size: 13.5px;
}
.dropzone:hover, .dropzone.is-over { border-color: #93b4f8; background: #f2f7ff; color: var(--accent-dark); }
.dropzone strong { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 3px; }
.dropzone .kbd { display: inline-block; padding: 1px 6px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; font-size: 11.5px; font-family: ui-monospace, monospace; }

/* ---------- Documents ---------- */
.doc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.doc-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.doc-thumb { height: 132px; background: #f1f5f9; display: grid; place-items: center; overflow: hidden; position: relative; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .filetype { font-size: 26px; font-weight: 700; color: #94a3b8; letter-spacing: .04em; }
.doc-thumb iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.doc-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.doc-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; word-break: break-word; }
.doc-meta { color: var(--muted); font-size: 11.5px; }
.doc-mail-hint { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12px; color: #15803d; font-weight: 600; }
.doc-mail-hint.muted { color: var(--muted); font-weight: 400; }
.doc-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }

/* ---------- Layout picker ---------- */
.layout-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.layout-option { position: relative; cursor: pointer; }
.layout-option input { position: absolute; opacity: 0; pointer-events: none; }
.layout-option .preview { border: 2px solid var(--line); border-radius: 11px; background: #fff; height: 118px; overflow: hidden; padding: 9px; display: flex; flex-direction: column; gap: 5px; transition: border-color .15s, box-shadow .15s; }
.layout-option:hover .preview { border-color: #bfd3fb; }
.layout-option input:checked + .preview { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.layout-option .pv-bar { height: 14px; border-radius: 3px; }
.layout-option .pv-line { height: 4px; border-radius: 2px; background: #e2e8f0; }
.layout-option .pv-line.short { width: 55%; }
.layout-option .label { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; font-size: 12.5px; font-weight: 600; }
.layout-option .label small { color: var(--muted); font-weight: 400; font-size: 11px; }

/* ---------- Steps / timeline ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.steps li { position: relative; padding: 0 0 18px 34px; }
.steps li:before { content: attr(data-step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.steps li:after { content: ""; position: absolute; left: 11.5px; top: 26px; bottom: 2px; width: 1.5px; background: var(--line); }
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child:after { display: none; }
.steps li strong { display: block; font-size: 14px; }
.steps li span { color: var(--muted); font-size: 13px; }

/* ---------- Copy fields ---------- */
.copy-field { display: flex; gap: 8px; align-items: flex-start; }
.copy-field .copy-value { flex: 1; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; min-height: 38px; }

/* ---------- Letter preview ---------- */
.preview-shell { background: #e9eef6; border-radius: 12px; padding: 14px; overflow: auto; }
.preview-shell iframe { width: 100%; height: 720px; border: 0; border-radius: 8px; background: #fff; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(15, 23, 42, .25); max-width: 340px; animation: toastIn .18s ease-out; }
.toast.job-toast { border-left: 3px solid #3b82f6; animation-name: jobToastIn; animation-duration: .35s; }
@keyframes jobToastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.toast.is-error { background: #b91c1c; }
.toast.is-ok { background: #047857; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- KI-Anbieter ---------- */
.provider-info { border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; padding: 13px 15px; margin-bottom: 16px; }
.provider-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.provider-head strong { font-size: 14.5px; }
.provider-info p { margin-bottom: 8px; }
.provider-info .chips { margin-top: 2px; }

/* ---------- Kantone ---------- */
.canton-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
.canton-box { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 12.5px; transition: border-color .12s, background .12s; }
.canton-box:hover { border-color: #bfd3fb; background: #f8fbff; }
.canton-box input { width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.canton-box input:checked ~ .canton-code { background: var(--accent); color: #fff; }
.canton-code { font-weight: 700; font-size: 11px; letter-spacing: .03em; background: #eef2f7; color: #475569; border-radius: 5px; padding: 1px 5px; flex: none; min-width: 26px; text-align: center; }
.canton-name { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canton-box:has(input:checked) { border-color: #93b4f8; background: #f3f8ff; }
.canton-box:has(input:checked) .canton-name { color: var(--ink); font-weight: 600; }

/* ---------- Jobsuche ---------- */
.finding-list { display: flex; flex-direction: column; gap: 12px; }
.finding { display: flex; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; background: #fff; align-items: flex-start; }
.finding:hover { border-color: #cbd9f5; box-shadow: 0 6px 18px rgba(15, 23, 42, .05); }
.finding { scroll-margin-top: 18px; }
.finding:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.finding-main { flex: 1; min-width: 0; }
.finding-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.finding-title a { color: var(--ink); }
.finding-title a:hover { color: var(--accent-dark); }
.finding-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: #475569; margin-bottom: 7px; }
.finding-desc { font-size: 13px; color: var(--muted); margin: 0; }
.finding-filter { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; background: #fbfcfe; }
.finding-filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.finding-filter .field label { font-size: 12px; color: var(--muted); }

.card-head.cv-head { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; }
.cv-head-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head.cv-head .cv-head-name { width: 220px; max-width: 100%; margin-left: auto; }
.cv-head-mark:empty { display: none; }
.cv-head-mark { font-size: 12.5px; margin-top: -2px; }
.cv-default-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; opacity: 0; }

.cv-doc {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 28px 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.cv-sec { border-radius: 10px; margin-bottom: 6px; padding: 2px 6px 8px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.cv-sec:hover { background: #f8fafc; }
.cv-sec.is-selected { background: #eef4ff; border-color: #bfd4ff; }
.cv-sec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; padding: 6px 2px; }
.cv-sec-no { width: 22px; height: 22px; border-radius: 50%; background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cv-sec.is-selected .cv-sec-no { background: var(--accent); color: #fff; }
.cv-doc .cv-sec-title { font-family: inherit; font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: .02em; text-transform: uppercase; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 6px; width: 260px; max-width: 100%; flex: 0 0 auto; box-shadow: none; }
.cv-doc .cv-sec-title:hover { border-color: #cbd5e1; background: #fff; }
.cv-doc .cv-sec-title:focus { border-color: var(--accent); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.cv-sec-meta { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #64748b; }
.cv-sec-meta select { font-size: 12px; padding: 3px 6px; border-radius: 6px; }
.cv-sec-tools { margin-left: auto; display: inline-flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.cv-sec:hover .cv-sec-tools, .cv-sec.is-selected .cv-sec-tools { opacity: 1; }
.cv-sec-body { padding: 0 2px; }
.cv-empty { margin: 4px 0 6px 30px; font-size: 13px; color: #94a3b8; }
/* Aufklappbare Abschnitte (nur der Titel bleibt sichtbar) und Ziehen zum Sortieren */
.cv-acc-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.cv-grip { color: #b6c0cf; font-size: 15px; letter-spacing: -3px; line-height: 1; cursor: grab; padding: 4px 3px; user-select: none; touch-action: none; flex: none; }
.cv-sec-head:hover .cv-grip { color: #475569; }
.cv-sec-no, .cv-sec-count { user-select: none; }
.cv-sec-toggle { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #64748b; display: grid; place-items: center; cursor: pointer; flex: none; }
.cv-sec-toggle:hover { background: #e2e8f0; color: #0f172a; }
.cv-sec-toggle svg { width: 20px; height: 20px; fill: currentColor; transition: transform .15s; }
.cv-sec:not(.is-collapsed) .cv-sec-toggle svg { transform: rotate(90deg); }
.cv-sec-count { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: #eef2f7; color: #64748b; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.cv-sec.is-collapsed .cv-sec-body, .cv-sec.is-collapsed .cv-sec-meta { display: none; }
.cv-sec.is-collapsed { padding-bottom: 2px; }
.cv-table tr.cv-item:not(.is-editing) { user-select: none; }
.cv-table tr.cv-item:not(.is-editing) td:last-child { width: 28px; text-align: right; color: #cbd5e1; touch-action: none; white-space: nowrap; }
.cv-table tr.cv-item:not(.is-editing) td:last-child::after { content: "⋮⋮"; letter-spacing: -3px; font-size: 14px; }
.cv-table tr.cv-item:not(.is-editing):hover td:last-child { color: #64748b; }
.cv-table tr.cv-item.is-dragging td, .cv-sec.is-dragging { opacity: .38; }
.cv-table tr.cv-item.drop-before td { box-shadow: inset 0 3px 0 var(--accent); }
.cv-table tr.cv-item.drop-after td { box-shadow: inset 0 -3px 0 var(--accent); }
.cv-sec.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.cv-sec.drop-after { box-shadow: 0 3px 0 var(--accent); }
body.cv-dragging, body.cv-dragging * { cursor: grabbing !important; user-select: none !important; }
.cv-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none; max-width: 340px; padding: 7px 12px; border-radius: 9px;
  background: #0f172a; color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .35);
}
@media (max-width: 720px) { .cv-doc { padding: 16px; } .cv-sec-meta { display: none; } .cv-sec-tools { opacity: 1; } }

.doc-pick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.doc-pick-row {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
  transition: border-color .12s, background .12s;
}
.doc-pick-row:hover { border-color: #cbd5e1; background: #f8fafc; }
.doc-pick-row:has(input:checked) { border-color: var(--accent); background: #eef4ff; }
.doc-pick-row input { margin-top: 3px; flex: none; }
.doc-pick-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doc-pick-main strong { font-size: 13.5px; color: #0f172a; }
.doc-pick-meta { font-size: 11.5px; color: #64748b; }
.doc-pick-main .badge { align-self: flex-start; }

.cv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 2px 0 16px; }
.cv-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.cv-tile:hover { border-color: #cbd5e1; box-shadow: 0 2px 10px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.cv-tile.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }
.cv-tile-label { font-size: 11.5px; color: #475569; line-height: 1.25; }
.cv-tile.is-active .cv-tile-label { color: var(--accent-dark); font-weight: 650; }

.cv-thumb { position: relative; display: block; width: 100%; height: 96px; background: #fff; border: 1px solid #e2e8f0; border-radius: 4px; overflow: hidden; }.cv-thumb .th-name { position: absolute; left: 8px; top: 10px; width: 46px; height: 6px; border-radius: 2px; background: var(--tile, #334155); }
.cv-thumb .th-lines { position: absolute; left: 8px; right: 8px; top: 26px; display: flex; flex-direction: column; gap: 4px; }
.cv-thumb .th-lines i { display: block; height: 3px; border-radius: 2px; background: #e2e8f0; }
.cv-thumb .th-lines i:first-child { width: 60%; background: #cbd5e1; }
.cv-thumb .th-photo { position: absolute; right: 8px; top: 8px; width: 18px; height: 22px; border-radius: 2px; background: #cbd5e1; }
.cv-thumb .th-band { position: absolute; left: 0; right: 0; top: 0; height: 0; background: var(--tile, #94a3b8); }
/* Eigene Vorlagen: Kachel mit Werkzeug-Symbolen (Hovertext beim Überfahren) */
.cv-tile-wrap { position: relative; display: flex; }
.cv-tile-wrap .cv-tile { width: 100%; }
.cv-tile-tools { position: absolute; top: 14px; right: 14px; display: flex; gap: 5px; z-index: 2; }
.cv-tool {
  position: relative; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(148, 163, 184, .65); background: rgba(255, 255, 255, .96); color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .2); transition: background .12s, color .12s, transform .12s;
}
.cv-tool svg { width: 14px; height: 14px; fill: currentColor; }
.cv-tool:hover { background: #dbeafe; transform: scale(1.08); }
.cv-tool.is-danger { color: #b91c1c; }
.cv-tool.is-danger:hover { background: #fee2e2; }
/* Hovertext direkt am Symbol (rechtsbündig, damit er nie aus der Karte ragt) */
.cv-tool::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 7px); right: 0;
  padding: 5px 9px; border-radius: 7px; background: #0f172a; color: #fff;
  font-size: 12px; font-weight: 500; line-height: 1.2; white-space: nowrap;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-3px);
  transition: opacity .12s, transform .12s, visibility .12s; z-index: 5;
}
.cv-tool:hover::after, .cv-tool:focus-visible::after { opacity: 1; visibility: visible; transform: none; }
.cv-tile.is-preset .cv-tile-label { color: #334155; }
.spacing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .spacing-grid { grid-template-columns: 1fr; } }
.t-kopfband .th-band { height: 26px; }
.t-kopfband .th-name, .t-kopfband .th-lines { top: auto; }
.t-kopfband .th-name { top: 9px; background: #fff; }
.t-kopfband .th-photo { top: 5px; background: rgba(255, 255, 255, .85); }
.t-kopfband .th-lines { top: 32px; }
.t-seitenleiste .th-band { height: 100%; width: 26px; }
.t-seitenleiste .th-name { left: 33px; }
.t-seitenleiste .th-lines { left: 33px; }
.t-seitenleiste .th-photo { left: 4px; right: auto; top: 8px; width: 18px; height: 20px; }
.t-farbig .th-name { background: var(--tile, #1f3a5f); }
.t-farbig .th-lines i:first-child { width: 38%; height: 6px; border-radius: 2px; background: var(--tile, #1f3a5f); }
.t-kreativ .th-band { height: 100%; width: 6px; }
.t-modern .th-name { background: var(--tile, #1d4ed8); }
.t-modern .th-lines i:first-child { background: var(--tile, #1d4ed8); width: 24%; height: 3px; }
.t-minimal .th-photo { border-radius: 50%; }
.t-streng .th-name { left: 50%; transform: translateX(-50%); width: 52px; }
.t-streng .th-lines i:first-child { width: 100%; margin: 0 auto; }

.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-thumb { width: 78px; height: 92px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f1f5f9; }

.cv-row { display: grid; grid-template-columns: 110px 1.1fr 1.1fr 1.4fr; gap: 8px; margin-bottom: 6px; }
.cv-row input { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.cv-row .cv-when { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .cv-row { grid-template-columns: 1fr 1fr; } }
.cv-table { width: 100%; border-collapse: collapse; }
.cv-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.cv-table tr.cv-item { cursor: pointer; }
.cv-table tr.cv-item:hover { background: #f8fafc; }
.cv-table tr.cv-item.is-selected { background: #e8f0fe; box-shadow: inset 3px 0 0 var(--accent); }
.cv-table tr.cv-item.is-editing { background: #fff7ed; }
.cv-table tr.cv-item.is-editing input { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.cv-table .cv-actions { width: 90px; text-align: right; }
.cv-table td input[type="hidden"] { display: none; }
.finding-actions { display: flex; flex-direction: column; gap: 6px; width: 168px; flex: none; }

@media (max-width: 860px) {
    .finding { flex-direction: column; }
    .finding-actions { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .finding-actions form { flex: 1; }
}

/* ---------- Kamera-Scan ---------- */
.cam-modal { position: fixed; inset: 0; background: rgba(8, 15, 30, .72); display: none; place-items: center; padding: 20px; z-index: 300; }
.cam-modal.is-open { display: grid; }
.cam-box { width: 100%; max-width: 760px; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(2, 6, 23, .5); overflow: hidden; display: flex; flex-direction: column; }
.cam-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cam-head strong { font-size: 15px; }
.cam-close { background: none; border: 0; font-size: 24px; line-height: 1; color: #64748b; cursor: pointer; padding: 0 4px; }
.cam-close:hover { color: var(--ink); }
.cam-stage { position: relative; background: #0b1220; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.cam-video, .cam-shot { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-msg { position: absolute; inset: auto 16px 16px; background: rgba(15, 23, 42, .86); color: #e2e8f0; padding: 9px 13px; border-radius: 9px; font-size: 13px; line-height: 1.45; }
.cam-msg.is-error { background: #7f1d1d; color: #fee2e2; }
.cam-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfcfe; }
.cam-tools select { width: auto; min-width: 190px; max-width: 320px; }
.cam-tools .btn-ok { margin-left: auto; }
.cam-hint { padding: 0 18px 14px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 10% 0%, #1e293b, #0b1220); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 30px 80px rgba(2, 6, 23, .45); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .brand { color: var(--ink); padding: 0 0 18px; }
.auth-card .brand-mark { width: 40px; height: 40px; }
.auth-card .brand-text { color: var(--ink); }
.auth-help { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px; color: #475569; }
.auth-help summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.auth-help ol { margin: 9px 0 0; padding-left: 20px; }
.auth-help li { margin-bottom: 6px; }
.auth-help code { font-size: 11.5px; }

/* ---------- Misc ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.split.cv-split { grid-template-columns: minmax(0, 1fr) 640px; }
/* Vorschau: etwas breiter als A5 (148 mm), so hoch wie das Fenster, mit eigener Bildlaufleiste */
.cv-preview-box { padding: 0; background: #e2e8f0; height: calc(100vh - 150px); min-height: 460px; overflow-y: scroll; overflow-x: hidden; }
.cv-preview-box iframe { display: block; }
/* A4-Popup einer einzelnen Seite */
dialog.cv-page-dialog {
  --cv-bar: 54px;
  border: 0; padding: 0; background: #e2e8f0; border-radius: 14px; overflow: hidden;
  height: min(96vh, 1260px);
  width: min(96vw, calc((min(96vh, 1260px) - var(--cv-bar)) / 1.4142));
  min-width: min(96vw, 420px);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .5);
}
dialog.cv-page-dialog::backdrop { background: rgba(15, 23, 42, .62); backdrop-filter: blur(2px); }
dialog.cv-page-dialog[open] { display: flex; flex-direction: column; }
.cv-page-bar { flex: none; height: var(--cv-bar); display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.cv-page-bar strong { white-space: nowrap; }
.cv-page-bar .btn { white-space: nowrap; }
.cv-page-spacer { flex: 1; }
@media (max-height: 860px) { .cv-page-bar .cv-page-size { display: none; } }
.cv-page-frame { flex: 1; width: 100%; min-height: 0; border: 0; display: block; background: #e2e8f0; }
@media (max-width: 1280px) { .split.cv-split { grid-template-columns: minmax(0, 1fr); } }
.inline-form { display: inline; }
.btn-group { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 9px; padding: 3px 4px; background: #f8fafc; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px; }
.file-list .ftype { width: 34px; height: 34px; border-radius: 8px; background: #f1f5f9; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #64748b; flex: none; }
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Automatik: Portale/Links mit Häkchen */
.auto-links { display: flex; flex-direction: column; gap: 8px; }
.auto-link { display: flex; align-items: center; gap: 12px; margin: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.auto-link:hover { border-color: #cbd9f5; }
.auto-link.is-off { background: #f8fafc; opacity: .62; }
.auto-link.is-off .auto-link-text strong { text-decoration: line-through; }
.auto-link-check { flex: 1; min-width: 0; align-items: flex-start; margin: 0; gap: 10px; }
.auto-link-text { display: flex; flex-direction: column; min-width: 0; }
.auto-link-text strong { font-size: 13.5px; }
.auto-link-url, .auto-link-status { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-link .btn { flex: none; }
.sep { height: 1px; background: var(--line); margin: 18px 0; }
.warn-box { border-left: 3px solid var(--warn); background: #fffbeb; padding: 12px 15px; border-radius: 0 10px 10px 0; font-size: 13.5px; color: #7c2d12; }

@media (max-width: 1080px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .hero-inner { padding: 14px 16px; gap: 12px; }
    .brand-text, .hero-divider, .hero-user-name { display: none; }
    .subnav-inner { padding: 0 12px; }
    .nav-link { padding: 11px 11px; font-size: 13.5px; }
    .main { padding: 18px 16px 32px; }
    .grid-2, .grid-3, .grid-4, .form-row, .form-row-3 { grid-template-columns: minmax(0, 1fr); }
}
