/* =====================================================================
   Feuerwehr Einsatzberichte - Design-Tokens
   Leitidee: "Einsatzakte" statt SaaS-Dashboard - eine farbige Seitenlinie
   als einziges kraeftiges Strukturelement (Formular-Abschnitte), sonst
   ruhige Haarlinien statt Schatten. Leuchtgelb ist ausschliesslich
   Aktiv-/Fokus-Farbe, nie Dekoration.
   ===================================================================== */

:root {
    --ink: #171a1d;
    --muted: #5e6670;
    --paper: #eff1ef;
    --surface: #ffffff;
    --hairline: #dcdfd9;

    --rot: #b3171d;
    --rot-dark: #8a1016;
    --leuchtgelb: #c9d94a;
    --slate: #22262c;

    --error-bg: #fbeae9;
    --error-ink: #8a1016;
    --ok-ink: #1c6b3c;

    --radius: 10px;
    --radius-sm: 7px;
    --font-sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

/* --- Dark Mode: respektiert Systemeinstellung, ueberschreibbar per Schalter (data-theme) --- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #e7e8e6;
        --muted: #9aa0a6;
        --paper: #16181b;
        --surface: #1e2024;
        --hairline: #2e3136;

        --rot: #e35d62;
        --rot-dark: #c94347;
        --leuchtgelb: #d7e46a;
        --slate: #0f1113;

        --error-bg: #3a1c1d;
        --error-ink: #f08b8e;
        --ok-ink: #6fc98d;
    }
}
:root[data-theme="dark"] {
    --ink: #e7e8e6;
    --muted: #9aa0a6;
    --paper: #16181b;
    --surface: #1e2024;
    --hairline: #2e3136;

    --rot: #e35d62;
    --rot-dark: #c94347;
    --leuchtgelb: #d7e46a;
    --slate: #0f1113;

    --error-bg: #3a1c1d;
    --error-ink: #f08b8e;
    --ok-ink: #6fc98d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    transition: background-color .2s ease, color .2s ease;
}

/* --- Icons --- */
.icon {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    vertical-align: -0.2em;
}
button .icon, .btn-danger .icon, .btn-link .icon, h1 .btn-link .icon { margin-right: 0.35rem; }

/* --- Toasts --- */
#toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: calc(100vw - 2.5rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--slate);
    color: #f1f1ef;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
    max-width: 360px;
}
.toast--in { opacity: 1; transform: translateY(0); }
.toast--success .icon { color: var(--leuchtgelb); }
.toast--error { background: var(--error-ink); color: #2a0b0c; }
.toast--error .icon { color: #2a0b0c; }
.toast--info .icon { color: var(--leuchtgelb); }

@media (max-width: 480px) {
    #toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
    .toast { max-width: none; }
}

h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: 1.6rem; }

a { color: var(--rot); transition: color .15s ease; }

:focus-visible {
    outline: 2px solid var(--leuchtgelb);
    outline-offset: 2px;
}

.mono { font-family: var(--font-mono); }

/* --- App-Kopfzeile: dunkle "Leitstelle" + Navigation --- */
.app-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 1.75rem;
    background: var(--slate);
    color: #f1f1ef;
}

.app-header__brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.app-header__title { font-weight: 600; font-size: 1.05rem; letter-spacing: 0.005em; }
.app-header__org { font-family: var(--font-mono); font-size: 0.7rem; color: rgba(241, 241, 239, 0.58); }

.role-badge {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(241, 241, 239, 0.4);
    border-radius: 999px;
    color: rgba(241, 241, 239, 0.9);
}

.app-header__logout { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--leuchtgelb); text-decoration: none; }
.app-header__logout:hover { text-decoration: underline; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(241, 241, 239, 0.25);
    background: none;
    color: rgba(241, 241, 239, 0.85);
    cursor: pointer;
    flex-shrink: 0;
}
.theme-toggle:hover { border-color: rgba(241, 241, 239, 0.5); color: #fff; }
.theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle__sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle__moon { display: block; }
}

/* --- Navigation --- */
.main-nav { display: flex; align-items: center; gap: 1.5rem; flex: 1; }
.main-nav__links { display: flex; align-items: center; gap: 1.4rem; }

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(241, 241, 239, 0.72);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color .15s ease;
}
.main-nav a:hover { color: #fff; }
.main-nav a.active { color: #fff; font-weight: 600; }

.main-nav__user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
    font-size: 0.85rem;
    color: rgba(241, 241, 239, 0.85);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #f1f1ef;
    border-radius: 1px;
    transition: transform .15s ease, opacity .15s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--slate);
        padding: 0.25rem 1.5rem 1rem;
        border-top: 1px solid rgba(241, 241, 239, 0.12);
        z-index: 20;
    }
    .main-nav.open { display: flex; }

    .main-nav__links { flex-direction: column; align-items: flex-start; gap: 0; }
    .main-nav__links a { padding: 0.65rem 0; width: 100%; }

    .main-nav__user {
        margin-left: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding-top: 0.75rem;
        margin-top: 0.4rem;
        border-top: 1px solid rgba(241, 241, 239, 0.12);
    }
}

/* --- Hauptbereich --- */
.app-main { max-width: 760px; margin: 2.5rem auto; padding: 0 1.5rem 3rem; }
.app-main--wide { max-width: 1060px; }

.step-indicator {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.case-number { font-family: var(--font-mono); }
h1 .btn-link { font-size: 0.8rem; font-weight: 400; vertical-align: 0.15em; }

.case-number-edit { display: flex; align-items: center; gap: 0.5rem; margin: -0.75rem 0 1.25rem; }
.case-number-edit input {
    font-family: var(--font-mono);
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.dashboard-links { line-height: 2.2; padding-left: 1.1rem; }
.dashboard-links em { color: var(--muted); font-style: normal; font-size: 0.85rem; }

/* --- Panels: Haarlinie statt Schatten --- */
.auth-box,
.report-summary,
.drafts-sidebar,
.editor-main,
.archive-filters,
.form-section,
#entity-dialog {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
}

/* --- Login / Setup --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--paper);
}

.auth-box { padding: 2.25rem; width: 100%; max-width: 380px; }

.auth-mark { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin-bottom: 0.3rem; }
.auth-box h1 { font-size: 1.3rem; margin: 0 0 1.5rem; }

/* Bewusst NICHT an "form" als Vorfahren gebunden: mehrere Seiten (z. B.
   die Review-Seite) bauen ihre Eingabebereiche ohne natives <form>, weil
   die Werte per AJAX/JS statt per Formular-Submit verschickt werden.
   Eine Bindung an "form ..." hiess, dass Labels/Inputs dort unstyled
   blieben - das war der Bug hinter den zusammengequetschten Feldern. */
label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0.8rem 0 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s ease;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    border-color: var(--rot);
}

/* Checkboxen/Radios bewusst NICHT von der obigen width:100%-Regel erfasst -
   das war der Bug hinter den verrutschten Haekchen. */
input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--rot);
    cursor: pointer;
}

form button[type="submit"]:not(.btn-link):not(.btn-danger),
.auth-box button {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.7rem;
    background: var(--rot);
    color: #fff;
    border: 1px solid var(--rot);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}
.auth-box button:hover { background: var(--rot-dark); border-color: var(--rot-dark); }

.alert {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-left: 3px solid var(--ink);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-ink);
    border-left-color: var(--error-ink);
    border-color: var(--error-bg);
}

/* --- Tabs (admin.php) --- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--hairline); margin-bottom: 1.5rem; }

.tab-btn {
    padding: 0.65rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    color: var(--muted);
    transition: color .15s ease, border-color .15s ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--rot); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Tabellen --- */
.panel-toolbar { margin-bottom: 0.85rem; }

.panel-toolbar > button {
    padding: 0.55rem 1.1rem;
    background: var(--rot);
    color: #fff;
    border: 1px solid var(--rot);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease;
}
.panel-toolbar > button:hover { background: var(--rot-dark); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.91rem;
}

.data-table th, .data-table td { text-align: left; padding: 0.7rem 0.9rem; }
.data-table th { font-weight: 600; font-size: 0.78rem; color: var(--muted); border-bottom: 2px solid var(--rot); }
.data-table td { border-bottom: 1px solid var(--hairline); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.is-inactive td { color: var(--muted); }
.data-table__empty { color: var(--muted); text-align: center; }
.data-table__actions { white-space: nowrap; }

.td-headline {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-link {
    background: none;
    border: none;
    color: var(--rot);
    padding: 0;
    margin-right: 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.btn-link--danger { color: var(--error-ink); }

.inline-form { display: inline; }

/* --- Dialog (Stammdaten anlegen/bearbeiten) --- */
#entity-dialog { padding: 1.7rem; width: 100%; max-width: 420px; }
#entity-dialog::backdrop { background: rgba(23, 26, 29, 0.45); }
#entity-dialog h2 { font-size: 1.1rem; margin-top: 0; }

.form-field { margin-bottom: 0.9rem; }
.form-field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
}

.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 1.1rem 0 0; padding: 0; }
.dialog-actions button {
    padding: 0.55rem 1.05rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--hairline);
    background: #fff;
    font: inherit;
    cursor: pointer;
}
.dialog-actions button[type="submit"] { background: var(--rot); color: #fff; border-color: var(--rot); }
.dialog-actions button[type="submit"]:hover { background: var(--rot-dark); }

/* --- Einsatzbericht-Formular --- */
.form-section {
    border-left: 3px solid var(--rot);
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.25rem;
}
.form-section h2 { font-size: 1rem; margin: 0 0 0.3rem; }

.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.btn-secondary {
    padding: 0.55rem 1rem;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease;
}
.btn-secondary:hover { border-color: var(--rot); }

#stages-container { margin-bottom: 0.75rem; }

.stage-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    padding: 0.9rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: #fafbfa;
}
.stage-row label { margin: 0 0 0.3rem; }
.stage-row .btn-link { white-space: nowrap; }
@media (max-width: 640px) { .stage-row { grid-template-columns: 1fr; } }

.stage-row-full {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #fafbfa;
}
.stage-row-full .stage-row { border: none; margin-bottom: 0; background: none; }

.stage-units-details { border-top: 1px solid var(--hairline); }
.stage-units-details summary {
    cursor: pointer;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    color: var(--rot);
}
.stage-units-inner { padding: 0 0.9rem 0.9rem; }
.stage-units-inner .muted { margin: 0.6rem 0 0.4rem; font-weight: 600; }

.checkbox-label.is-taken {
    opacity: 0.45;
}
.checkbox-label:has(input:disabled) { cursor: not-allowed; }

.checkbox-group { margin-bottom: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.checkbox-group__title {
    flex-basis: 100%;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 0.1rem;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: #fff;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.checkbox-label:hover { border-color: var(--rot); }
.checkbox-label:has(input:checked) { border-color: var(--rot); background: var(--error-bg); }
.checkbox-label--strong { font-weight: 600; }

.form-actions { margin-top: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.form-actions button {
    padding: 0.75rem 1.5rem;
    background: var(--rot);
    color: #fff;
    border: 1px solid var(--rot);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease;
}
.form-actions button:hover { background: var(--rot-dark); }

/* --- Review-Zusammenfassung --- */
.report-summary-collapsible { margin-bottom: 1.5rem; }
.report-summary-collapsible summary { cursor: pointer; color: var(--rot); font-size: 0.9rem; margin-bottom: 0.75rem; }
.report-summary-collapsible .report-summary { margin-top: 0.75rem; }

.report-summary { padding: 1.3rem 1.6rem; }
.report-summary dt { font-size: 0.78rem; color: var(--muted); margin-top: 1rem; }
.report-summary dt:first-child { margin-top: 0; }
.report-summary dd { margin: 0.15rem 0 0; font-size: 0.95rem; }
.report-summary__notes { white-space: pre-line; }

/* --- Editor-Layout (Review-Seite) --- */
.editor-layout { display: grid; grid-template-columns: 270px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .editor-layout { grid-template-columns: 1fr; } }

.drafts-sidebar { padding: 1.1rem; }
.drafts-sidebar > button {
    width: 100%;
    padding: 0.65rem;
    background: var(--rot);
    color: #fff;
    border: 1px solid var(--rot);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background .15s ease;
}
.drafts-sidebar > button:hover { background: var(--rot-dark); }
.drafts-sidebar > button:disabled { opacity: 0.55; cursor: default; }

.muted { color: var(--muted); font-size: 0.8rem; }

#drafts-list { margin-top: 1rem; }

.draft-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--ink);
    transition: border-color .15s ease;
}
.draft-item:hover { border-color: var(--rot); }
.draft-item strong { font-size: 0.73rem; color: var(--muted); }
.draft-item__body { font-weight: normal; color: var(--muted); }
.draft-item.active { border-left: 3px solid var(--leuchtgelb); }

.headline-field { padding: 1.1rem 1.1rem 0; }
.headline-field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.headline-field input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    transition: border-color .15s ease;
}
.headline-field input:focus { border-color: var(--rot); }

#editor { min-height: 320px; font-size: 1rem; }

.editor-main .form-actions { padding: 1.1rem; border-top: 1px solid var(--hairline); margin-top: 0; }

/* --- Social-Media-Post --- */
.social-section { margin-top: 1.5rem; }
.social-section[hidden] { display: none; }
.social-section__title { padding: 1.1rem 1.1rem 0; font-size: 1rem; }
.social-hint { margin-top: 1.5rem; }

#social-textarea {
    width: 100%;
    border: none;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    padding: 1.1rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    color: var(--ink);
}
#social-textarea:focus { outline: none; background: #fafbfa; }

.char-count { font-size: 0.8rem; color: var(--muted); }
.char-count--over { color: var(--error-ink); font-weight: 600; }

/* --- Export --- */
.export-section { padding: 0 1.1rem 1.1rem; display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }
.export-section span { color: var(--muted); }
.export-section[hidden] { display: none; }

/* --- Gefahrenzone (Bericht löschen) --- */
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--hairline); }
.btn-danger {
    padding: 0.6rem 1.1rem;
    background: #fff;
    color: var(--error-ink);
    border: 1px solid var(--error-ink);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background .15s ease;
}
.btn-danger:hover { background: var(--error-bg); }

/* --- Archiv --- */
.archive-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .archive-filters { grid-template-columns: 1fr 1fr; } }

.archive-filters label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.25rem; }
.archive-filters input, .archive-filters select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.archive-filters__actions { display: flex; align-items: center; gap: 0.75rem; }
.archive-filters__actions button {
    padding: 0.6rem 1.1rem;
    background: var(--rot);
    color: #fff;
    border: 1px solid var(--rot);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background .15s ease;
}
.archive-filters__actions button:hover { background: var(--rot-dark); }

.pagination { display: flex; justify-content: space-between; margin-top: 1.25rem; flex-wrap: wrap; gap: 0.75rem; }

/* --- Dashboard --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
@media (max-width: 640px) { .stats-row { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.stat-card__value { font-family: var(--font-mono); font-size: 1.8rem; font-weight: 600; }
.stat-card__label { font-size: 0.82rem; color: var(--muted); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}
@media (max-width: 760px) { .dashboard-grid { grid-template-columns: 1fr; } }

.dashboard-grid__title { font-size: 1rem; margin-bottom: 0.9rem; }

.recent-list { display: flex; flex-direction: column; gap: 0.6rem; }

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--ink);
    transition: border-color .15s ease;
}
.recent-item:hover { border-color: var(--rot); }

.recent-item__main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.recent-item__case { font-size: 0.75rem; color: var(--muted); }
.recent-item__headline {
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recent-item__meta { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; font-size: 0.78rem; }

.status-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}
.status-badge--draft { background: var(--error-bg); color: var(--error-ink); }
.status-badge--final { background: var(--surface); border: 1px solid var(--ok-ink); color: var(--ok-ink); }

.quick-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.quick-action {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--ink);
    font-size: 0.92rem;
    transition: border-color .15s ease;
}
.quick-action:hover { border-color: var(--rot); }
.quick-action .icon { color: var(--rot); }

/* --- Tabellen auf schmalen Screens seitlich scrollen statt umbrechen --- */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--hairline);
}
.table-scroll .data-table { border-radius: 0; border: none; }

/* --- Mobile Feinschliff --- */
@media (max-width: 560px) {
    .app-main { margin: 1.5rem auto; padding: 0 1rem 2.5rem; }
    .app-main--wide { padding: 0 1rem 2.5rem; }
    .form-section { padding: 1.1rem 1.2rem; }
    .report-summary { padding: 1.1rem 1.2rem; }
    .archive-filters { grid-template-columns: 1fr; padding: 1rem; }
    .form-actions, .editor-main .form-actions { flex-wrap: wrap; }
    .export-section { flex-wrap: wrap; }
    h1 { font-size: 1.35rem; }
    .headline-field input { font-size: 1rem; }
}
