/* ==========================================================================
   aHead Management - Design-System

   Richtung: ruhige, moderne Produktoberfläche (Personio / Linear / Attio).
   Die Primärfarbe und ihre Abstufungen kommen zusätzlich aus theme.css.php
   (Admin-Einstellung). Die Werte hier sind nur der Standard.

   Regeln, die überall gelten:
   - Radien: Badges 6 · Bedienelemente 8 · Karten 12 · App-Panel 14 · Modal 16 · Portal-Karten 20 · Avatare rund
   - Farbe: genau ein Akzent (Primärfarbe), dazu nur semantische Statusfarben
   - Flächen werden über Haarlinien und Tönung getrennt, Schatten nur für schwebende Elemente
   - Text erreicht mindestens WCAG AA (4,5:1)
   - Alle Farben laufen über semantische Tokens, damit ein Dark Mode später ergänzt werden kann
   ========================================================================== */

/* ---------- Schrift (lokal, variabel) ---------- */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter/InterVariable.woff2') format('woff2');
}

/* ---------- Design-Tokens ---------- */

:root {
    --color-primary: #239F96;
    --color-primary-hover: #208F87;
    --color-primary-strong: #1A7670;
    --color-primary-soft: #E9F5F4;
    /* Tönung für Flächen, die im Dunkeln nicht hell aufleuchten dürfen (Matrix, Mail-Vorschau) */
    --color-primary-tint: var(--color-primary-soft);
    --color-primary-ring: rgba(35, 159, 150, 0.28);
    --color-primary-contrast: #FFFFFF;

    --canvas: #F4F5F6;
    --surface: #FFFFFF;
    --surface-subtle: #F8F9FA;
    --surface-hover: rgba(16, 24, 40, 0.045);
    --surface-pressed: rgba(16, 24, 40, 0.075);
    --line: rgba(16, 24, 40, 0.08);
    --line-soft: rgba(16, 24, 40, 0.055);
    --line-strong: rgba(16, 24, 40, 0.16);
    --line-hover: rgba(16, 24, 40, 0.26);

    --text: #17191C;
    --text-secondary: #454A52;
    --text-muted: #676C75;
    --text-disabled: #A1A6AE;

    --success: #067647;
    --success-soft: #ECFDF3;
    --success-icon: #17A34A;
    --warning: #93370D;
    --warning-soft: #FFF6E5;
    --warning-icon: #DC8A06;
    --danger: #D92D20;
    --danger-hover: #B42318;
    --danger-text: #B42318;
    --danger-soft: #FEF3F2;
    --danger-ring: rgba(217, 45, 32, 0.2);
    --info: #1F5BB5;
    --info-soft: #EFF5FF;
    --info-icon: #2F6FD6;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-panel: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-ring: 0 0 0 1px var(--line);
    --shadow-raised: 0 0 0 1px var(--line), 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-pop: 0 0 0 1px rgba(16, 24, 40, 0.06), 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 18px 36px -10px rgba(16, 24, 40, 0.2);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 120ms;
    --duration: 160ms;
    --duration-slow: 220ms;

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs: 14px;
    --fs-md: 15px;
    --fs-lg: 17px;
    --fs-xl: 20px;
    --fs-2xl: 26px;

    --sidebar-width: 240px;

    /* Abstände (seit 2.0.0): Die Dichte der Anwendung hängt an diesen acht Stufen statt an
       einzelnen Pixelwerten in den Regeln. Wer sie lockerer oder enger will, dreht hier. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
}

/* ---------- Basis ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs);
    font-optical-sizing: auto;
    font-feature-settings: 'cv05', 'cv08';
    line-height: 1.5;
    letter-spacing: -0.006em;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}
h1 { font-size: var(--fs-2xl); letter-spacing: -0.022em; }
h2 { font-size: var(--fs-xl); letter-spacing: -0.018em; }
h3 { font-size: var(--fs-md); letter-spacing: -0.01em; }
p { margin: 0; }

a {
    color: var(--color-primary-strong);
    text-decoration: none;
    text-underline-offset: 3px;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

::selection {
    background: var(--color-primary-soft);
    color: var(--text);
}

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

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 12px;
    z-index: 300;
    padding: 8px 12px;
    color: #fff;
    background: var(--text);
    border-radius: var(--radius-sm);
}
.skip-link:focus {
    top: 12px;
}

.icon {
    display: inline-block;
    flex: none;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}
.icon--xs { width: 14px; height: 14px; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }

/* ---------- Hilfsklassen ---------- */

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0; }
.code {
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    letter-spacing: 0;
    background: var(--surface-subtle);
    border-radius: var(--radius-xs);
    box-shadow: inset 0 0 0 1px var(--line);
}
.divider { height: 1px; margin: 20px 0; background: var(--line); border: 0; }

.dl {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: 10px 24px;
    margin: 0;
}
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; color: var(--text); }

@media (max-width: 767px) {
    .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
    .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .dl dd { margin-bottom: 12px; }
}

/* ---------- Buttons ---------- */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    font: inherit;
    font-size: var(--fs);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--duration) var(--ease-out),
                box-shadow var(--duration) var(--ease-out),
                color var(--duration) var(--ease-out),
                transform var(--duration-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--color-primary); }
.btn .icon { width: 16px; height: 16px; }

.btn--primary {
    color: var(--color-primary-contrast);
    background: var(--color-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 1px var(--color-primary-hover), 0 1px 2px rgba(16, 24, 40, 0.12);
}
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--secondary {
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(16, 24, 40, 0.05);
}
.btn--secondary:hover { background: var(--surface-subtle); box-shadow: 0 0 0 1px var(--line-hover), 0 1px 2px rgba(16, 24, 40, 0.05); }

.btn--ghost { color: var(--text-secondary); }
.btn--ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn--ghost:active { background: var(--surface-pressed); }

.btn--danger {
    color: #fff;
    background: var(--danger);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0 0 1px var(--danger-hover), 0 1px 2px rgba(16, 24, 40, 0.12);
}
.btn--danger:hover { background: var(--danger-hover); }
.btn--danger:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--danger); }

.btn--sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); }
.btn--lg { height: 44px; padding: 0 18px; font-size: var(--fs-md); }
.btn--block { width: 100%; }

.btn:disabled,
.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading .icon { visibility: hidden; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn--primary.is-loading::after,
.btn--danger.is-loading::after {
    border-color: rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }
.icon-btn:active { background: var(--surface-pressed); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--color-primary); }
.icon-btn .icon { width: 18px; height: 18px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Karten ---------- */

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-raised);
}
.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5) 0;
}
.card__title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.card__subtitle { margin-top: 2px; font-size: var(--fs-sm); color: var(--text-muted); }
.card__body { padding: var(--space-5); }
.card__header + .card__body { padding-top: var(--space-4); }
.card__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--line-soft);
}

/* ---------- Seitenkopf ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
}
.page-header__title { font-size: var(--fs-2xl); }
.page-header__subtitle { max-width: 65ch; margin-top: var(--space-1); color: var(--text-muted); }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.breadcrumbs li + li::before {
    content: '/';
    margin-right: 6px;
    color: var(--line-hover);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--text); text-decoration: none; }

/* ---------- Formulare ---------- */

.form { display: flex; flex-direction: column; gap: 20px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}
.form-grid .field--full { grid-column: 1 / -1; }
/* Meine Einstellungen (Rückmeldung 16./17.11.2026, #35): schmale Karte je Reiter, je Ereignis eine
   Zeile mit Beschriftung links und Auswahl rechts, nach Bereichen gruppiert. */
.einstellungen-karte { max-width: 760px; }
.einstellungen-gruppe > legend { width: 100%; margin-bottom: var(--space-1); }
.einstellung {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    align-items: center;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line-soft);
}
.einstellung:last-child { border-bottom: 0; }
.einstellung__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.einstellung__label { font-weight: 500; color: var(--text); }
.einstellung .field { margin: 0; }
@media (max-width: 639px) {
    .einstellung { grid-template-columns: minmax(0, 1fr); }
}

/* Ein fieldset nur zum Sperren (disabled) oder Gruppieren, ohne eigenen Rahmen */
.fieldset-plain { min-width: 0; margin: 0; padding: 0; border: 0; }

/* Eine leise Erklärung mehrerer Begriffe nebeneinander, zum Beispiel die Modi der HR-Feldmatrix */
.legende {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-2) var(--space-5);
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.legende dt { font-weight: 600; color: var(--text-secondary); }
.legende dd { margin: 2px 0 0; }

/* Ein Feld mit Bedingung (HR-Wizard): Die Hülle reiht sich nicht selbst ins Raster ein, ihr Feld
   schon. Ausgeblendet verschwindet sie ganz. */
.bedingt { display: contents; }
.bedingt[hidden] { display: none; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field__req { margin-left: 2px; color: var(--danger-text); }
.field__help { font-size: var(--fs-sm); color: var(--text-muted); }
.field__error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: var(--fs-sm);
    color: var(--danger-text);
}
.field__error .icon { width: 16px; height: 16px; margin-top: 1px; }

.input,
.select,
.textarea {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    font: inherit;
    font-size: var(--fs);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}
.textarea {
    height: auto;
    min-height: 96px;
    padding: 9px 11px;
    line-height: 1.5;
    resize: vertical;
}
.select {
    padding-right: 34px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23676C75'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-hover); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: 1; }
.input:disabled, .select:disabled, .textarea:disabled {
    color: var(--text-disabled);
    background-color: var(--surface-subtle);
    box-shadow: none;
    cursor: not-allowed;
}
.input[readonly] { background: var(--surface-subtle); box-shadow: none; }

.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea { border-color: var(--danger); }
.field.is-invalid .input:focus,
.field.is-invalid .select:focus,
.field.is-invalid .textarea:focus { box-shadow: 0 0 0 3px var(--danger-ring); }

.input--code {
    font-family: var(--font-mono);
    font-size: var(--fs-lg);
    letter-spacing: 0.3em;
    text-align: center;
}

.input-icon { position: relative; }
.input-icon > .icon {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}
.input-icon > .input { padding-left: 33px; }

.check {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
}
.check input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--color-primary);
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
}
.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.switch__track {
    position: relative;
    flex: none;
    width: 32px;
    height: 18px;
    background: var(--line-strong);
    border-radius: var(--radius-full);
    transition: background-color var(--duration) var(--ease-out);
}
.switch__track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
    transition: transform var(--duration-slow) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--color-primary); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--color-primary-ring); }
.switch input:disabled + .switch__track { opacity: 0.5; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn {
    height: 36px;
    margin-left: -1px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.copy-field .input { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0; }

@media (max-width: 767px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Hinweise ---------- */

.alert {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    background: var(--surface-subtle);
    border-radius: var(--radius-sm);
}
.alert > .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert__title { font-weight: 600; color: inherit; }
.alert--info { color: var(--info); background: var(--info-soft); }
.alert--info > .icon { color: var(--info-icon); }
.alert--success { color: var(--success); background: var(--success-soft); }
.alert--success > .icon { color: var(--success-icon); }
.alert--warning { color: var(--warning); background: var(--warning-soft); }
.alert--warning > .icon { color: var(--warning-icon); }
.alert--danger { color: var(--danger-text); background: var(--danger-soft); }
.alert--danger > .icon { color: var(--danger); }

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.js .flash-stack { display: none; }

/* ---------- Badge / Status ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--text-secondary);
    background: var(--surface-subtle);
    border-radius: var(--radius-xs);
    box-shadow: inset 0 0 0 1px var(--line);
}
.badge__dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.badge--primary { color: var(--color-primary-strong); background: var(--color-primary-soft); box-shadow: inset 0 0 0 1px var(--color-primary-ring); }
.badge--success { color: var(--success); background: var(--success-soft); box-shadow: inset 0 0 0 1px rgba(6, 118, 71, 0.16); }
.badge--warning { color: var(--warning); background: var(--warning-soft); box-shadow: inset 0 0 0 1px rgba(147, 55, 13, 0.16); }
.badge--danger { color: var(--danger-text); background: var(--danger-soft); box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.16); }
.badge--info { color: var(--info); background: var(--info-soft); box-shadow: inset 0 0 0 1px rgba(31, 91, 181, 0.16); }
.badge--success .badge__dot { background: var(--success-icon); }
.badge--warning .badge__dot { background: var(--warning-icon); }
.badge--danger .badge__dot { background: var(--danger); }
.badge--info .badge__dot { background: var(--info-icon); }
.badge--primary .badge__dot { background: var(--color-primary); }

/* ---------- Tabellen ---------- */

.table-wrap {
    /* position: relative hält absolut positionierte Kinder (z. B. .visually-hidden) im Scrollbereich */
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
.table th {
    height: 38px;
    padding: 0 16px;
    font-size: var(--fs-xs);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    color: var(--text-muted);
    border-bottom: 1px solid var(--line);
}
/* Eine Zeilenüberschrift trägt oft einen erklärenden Untertitel und darf umbrechen. Die
   Spaltenköpfe bleiben einzeilig, sonst zerfasert der Tabellenkopf. */
.table th[scope="row"] {
    height: auto;
    white-space: normal;
    color: var(--text);
    border-bottom: 1px solid var(--line-soft);
}
.table td {
    height: 44px;
    padding: var(--space-1) var(--space-4);
    vertical-align: middle;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line-soft);
}
.table tbody tr { transition: background-color var(--duration-fast) var(--ease-out); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-subtle); }
.table .cell-strong { font-weight: 500; color: var(--text); white-space: nowrap; }

.th-sort { padding: 0 !important; }
.th-sort a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    color: inherit;
    white-space: nowrap;
}
.th-sort a:hover { color: var(--text); text-decoration: none; }
.th-sort .icon { width: 13px; height: 13px; opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.th-sort a:hover .icon { opacity: 0.45; }
.th-sort.is-sorted a { color: var(--text); }
.th-sort.is-sorted .icon { opacity: 1; }

/* Höhere Spezifität als .select und .table-filter .select, deren feste Höhe die Mehrfachauswahl sonst zusammenstaucht */
.table-filter select.select--multi,
select.select--multi {
    height: auto;
    min-width: 170px;
    padding: 6px 8px;
    background-image: none;
    line-height: 1.5;
}
select.select--multi option { padding: 2px 6px; border-radius: 4px; }
.table-filter .field:has(.select--multi) { flex: 0 1 190px; }

/* Auf dem Smartphone bleibt die Filterleiste sonst höher als der Bildschirm */
@media (max-width: 767px) {
    .table-filter select.select--multi { max-height: 86px; overflow-y: auto; }
    /* Bei vielen Filtern schiebt sich die Tabelle sonst ganz aus dem Bild */
    .table-filter { max-height: 55vh; overflow-y: auto; }
}
.table .cell-actions { width: 1%; text-align: right; white-space: nowrap; }

.table-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.table-filter .field { flex: 0 1 150px; gap: 0; }
/* Datumsfelder brauchen eine sichtbare Beschriftung: ein type="date" zeigt keinen Platzhalter */
.table-filter .field--labelled { gap: 2px; }
.table-filter .field__label { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.2; }
.table-filter .field--search { flex: 1 1 200px; max-width: 340px; }
.table-filter .input,
.table-filter .select { height: 34px; }
.table-filter__actions { display: flex; gap: 6px; margin-left: auto; }
/* Der Knopf „Filtern" bleibt sichtbar, auch mit JavaScript. Er war früher ausgeblendet, weil
   Auswahlfelder von selbst absenden - nur die Mehrfachauswahl tat das nicht, und damit gab es für
   sie überhaupt keinen sichtbaren Weg, den Filter anzuwenden. */

.table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    border-top: 1px solid var(--line);
}

@media (max-width: 639px) {
    .table-filter .field,
    .table-filter .field--search { flex-basis: 100%; max-width: none; }
    .table-filter__actions { width: 100%; margin-left: 0; }
    .table-filter__actions .btn { flex: 1; }
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast) var(--ease-out);
}
.pagination a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.pagination .is-current { color: var(--text); background: var(--surface); box-shadow: var(--shadow-raised); }
.pagination .is-disabled { color: var(--text-disabled); }

/* ---------- Leerer Zustand ---------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 48px 24px;
    text-align: center;
}
.empty-state__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    color: var(--text-muted);
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--line);
}
.empty-state__icon .icon { width: 22px; height: 22px; }
.empty-state__title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.empty-state__text { max-width: 380px; color: var(--text-muted); }
.empty-state .btn { margin-top: 16px; }

/* ---------- Dropdown ---------- */

.dropdown { position: relative; }
.dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    min-width: 220px;
    padding: 4px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop);
    transform-origin: top right;
    animation: pop-in var(--duration) var(--ease-out);
}
.dropdown--up .dropdown__menu {
    top: auto;
    right: 0;
    bottom: calc(100% + 6px);
    left: 0;
    transform-origin: bottom left;
}
.dropdown__header {
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line-soft);
}
.dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    font: inherit;
    text-align: left;
    color: var(--text);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.dropdown__item:hover,
.dropdown__item:focus-visible { background: var(--surface-hover); text-decoration: none; outline: none; }
.dropdown__item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.dropdown__item--danger,
.dropdown__item--danger .icon { color: var(--danger-text); }
.dropdown__divider { height: 1px; margin: 4px 0; background: var(--line-soft); }
.dropdown form { margin: 0; }

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: none; }
}

/* ---------- Durchsuchbare Auswahl ---------- */
/* Entsteht erst durch auswahl.js aus einem gewöhnlichen <select>. Ohne das Skript bleibt das Feld
   sichtbar und bedienbar; mit dem Skript tritt es hinter Knopf und Liste zurück - es bleibt im
   Formular stehen und trägt weiterhin den Wert. */

.auswahl { position: relative; }
.auswahl.is-bereit > select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.auswahl__knopf {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 38px;
    padding: 0 10px;
    font: inherit;
    color: var(--text-muted);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
}
.auswahl__knopf:hover { border-color: var(--line-strong); }
.auswahl__knopf:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.auswahl.is-gefuellt .auswahl__knopf { color: var(--text); }
.auswahl__text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auswahl__knopf .icon { width: 16px; height: 16px; color: var(--text-muted); }
.auswahl.is-offen .auswahl__knopf { border-color: var(--primary); }

.auswahl__blatt {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 60;
    width: 260px;
    max-width: calc(100vw - 32px);
    padding: 6px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop);
    transform-origin: top left;
    animation: pop-in var(--duration) var(--ease-out);
}
.auswahl__suche { margin-bottom: 6px; }
.auswahl__suche .input { height: 32px; }
.auswahl__liste {
    max-height: 260px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}
.auswahl__eintrag {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.auswahl__eintrag .icon { flex: none; width: 16px; height: 16px; opacity: 0; color: var(--primary); }
.auswahl__eintrag[aria-selected='true'] .icon { opacity: 1; }
.auswahl__eintrag[aria-selected='true'] { font-weight: 500; }
.auswahl__eintrag:hover,
.auswahl__eintrag.is-aktiv { background: var(--surface-hover); }
.auswahl__leer { padding: 10px 8px; margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.auswahl__fertig { display: none; }

.table-filter .auswahl__knopf { height: 34px; }
.table-filter .field:has(.auswahl) { flex: 0 1 170px; }

/* Auf dem Telefon ist die Filterleiste scrollbar; ein Popover darin würde abgeschnitten. Deshalb
   legt sich die Liste dort als Blatt über den unteren Bildschirmrand. */
@media (max-width: 639px) {
    .auswahl__blatt {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 110;
        width: auto;
        max-width: none;
        padding: 12px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: none;
    }
    .auswahl__liste { max-height: 50vh; }
    .auswahl__fertig { display: flex; width: 100%; margin-top: 10px; }
    body.hat-auswahl { overflow: hidden; }
}

/* ---------- Modal ---------- */

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.36);
    animation: fade-in var(--duration-slow) var(--ease-out);
}
@supports ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .modal__backdrop {
        background: rgba(16, 24, 40, 0.28);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
}
.modal__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 460px;
    max-height: calc(100dvh - 32px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    animation: modal-in var(--duration-slow) var(--ease-out);
}
.modal--lg .modal__dialog { max-width: 720px; }
.modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
}
.modal__title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.014em; color: var(--text); }
.modal__header .icon-btn { margin: -6px -8px 0 0; }
.modal__body { padding: 12px 20px 20px; overflow-y: auto; color: var(--text-secondary); }
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--line-soft);
}

.modal.is-closing .modal__backdrop { animation: fade-out var(--duration-fast) ease-in forwards; }
.modal.is-closing .modal__dialog { animation: modal-out var(--duration-fast) ease-in forwards; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
@keyframes modal-out {
    to { opacity: 0; transform: translateY(4px) scale(0.98); }
}
@keyframes sheet-in {
    from { transform: translateY(100%); }
    to { transform: none; }
}
@keyframes sheet-out {
    to { transform: translateY(100%); }
}

@media (max-width: 639px) {
    .modal { align-items: flex-end; padding: 0; }
    .modal__dialog {
        max-width: none;
        max-height: calc(100dvh - 24px);
        padding-top: 8px;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        animation-name: sheet-in;
        animation-duration: 260ms;
    }
    .modal__dialog::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        background: var(--line-strong);
        border-radius: var(--radius-full);
        transform: translateX(-50%);
    }
    .modal.is-closing .modal__dialog { animation-name: sheet-out; animation-duration: 180ms; }
    .modal__footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
    .modal__footer .btn { flex: 1; height: 44px; }
}

/* ---------- Jahresraster der Planansichten ---------- */

/* Eigener Scrollbereich, weil hier Kopfzeile und erste Spalte kleben */
.plan-wrap {
    position: relative;
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.plan-grid {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.plan-grid th,
.plan-grid td {
    height: 28px;
    padding: 0;
    text-align: center;
    /* box-shadow statt border: an klebenden Zellen scrollen Rahmen sonst mit weg */
    box-shadow: inset -1px -1px 0 var(--line-soft);
}
.plan-grid thead th {
    position: sticky;
    z-index: 2;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-subtle);
}
.plan-grid thead tr:first-child th { top: 0; }
.plan-grid thead tr:last-child th { top: 22px; height: 22px; }
.plan-grid thead tr:first-child th { height: 22px; }
.plan-grid__month { padding: 0 4px; white-space: nowrap; }
.plan-grid__day { width: 16px; min-width: 16px; font-weight: 400; }

/* Die Mitarbeiterspalte bleibt beim seitlichen Scrollen stehen */
/* Spezifischer als ".plan-grid th", sonst gewinnt dort text-align: center */
.plan-grid .plan-grid__name {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 180px;
    min-width: 180px;
    height: 28px;
    padding: 2px 10px;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    background: var(--surface);
    box-shadow: inset -1px -1px 0 var(--line);
}
.plan-grid thead .plan-grid__name { z-index: 4; height: 44px; background: var(--surface-subtle); }
.plan-grid__name a { display: block; overflow: hidden; text-overflow: ellipsis; }
.plan-grid__name .small { display: block; font-size: 10px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.plan-grid tbody tr:hover .plan-grid__name { background: var(--surface-subtle); }

.plan-grid__cell { cursor: pointer; font-weight: 600; }
.plan-grid__cell--first,
.plan-grid__day--first { box-shadow: inset -1px -1px 0 var(--line-soft), inset 1px 0 0 var(--line-strong); }
/* Dieselben Töne wie in den Plan-PDFs, damit Bildschirm und Ausdruck zusammenpassen */
/* Wochenende, Feiertag und Schulferien kommen aus theme.css.php: Web und PDF benutzen dieselben
   Werte aus App\Calendar\CalendarColors. */
/* Liegt ein Eintrag über einem Feiertag, gewinnt die Artfarbe. Ein schmaler Streifen am unteren
   Rand hält den Feiertag trotzdem sichtbar, damit der Plan die Übersicht nicht verliert. */

/* Die Auswahl ist ein Rahmen, keine Fläche: die Artfarben sind Flächen, eine weitere wäre nicht
   davon zu unterscheiden. Ein Rahmen in der Primärfarbe liegt über jeder von ihnen, auch über der
   schwarzen Fläche des unbezahlten Urlaubs. */
.plan-grid__cell.is-selected {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}
.js .plan-grid__cell:hover { outline: 1px solid var(--line-strong); outline-offset: -1px; }

/* Heute (Rückmeldung 16.11.2026, #21): der Tageskopf als Marke in der Primärfarbe, darunter eine
   feine Linie links und rechts durch alle Zeilen. Als ::after, weil box-shadow schon die
   Rasterlinien und den Feiertagsstreifen trägt. */
.plan-grid thead .plan-grid__day--heute { color: var(--color-primary-contrast); font-weight: 700; background: var(--color-primary); }
.plan-grid__cell--heute { position: relative; }
.plan-grid__cell--heute::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 1px 0 0 var(--color-primary), inset -1px 0 0 var(--color-primary);
}

/* Saldospalten zwischen Name und Raster, wie in der bisherigen Excel-Tabelle. Sie kleben wie die
   Namensspalte, sonst wären sie beim Blick auf den Dezember nicht mehr zu sehen. */
.plan-grid .plan-grid__saldo,
.plan-grid .plan-grid__saldo-kopf {
    position: sticky;
    z-index: 3;
    width: 30px;
    min-width: 30px;
    padding: 0 2px;
    font-size: 10px;
    background: var(--surface);
    box-shadow: inset -1px -1px 0 var(--line-soft);
}
.plan-grid thead .plan-grid__saldo,
.plan-grid thead .plan-grid__saldo-kopf { background: var(--surface-subtle); }
.plan-grid .plan-grid__saldo-kopf { left: 180px; z-index: 4; }
/* Mehr Regeln als Saldospalten: kommt eine dazu oder fällt eine weg, bleibt das Stylesheet
   richtig. Die Abschlusslinie rechts hängt an .plan-grid__saldo--last, nicht an einer Nummer. */
.plan-grid tbody .plan-grid__saldo:nth-child(2) { left: 180px; }
.plan-grid tbody .plan-grid__saldo:nth-child(3) { left: 210px; }
.plan-grid tbody .plan-grid__saldo:nth-child(4) { left: 240px; }
.plan-grid tbody .plan-grid__saldo:nth-child(5) { left: 270px; }
.plan-grid tbody .plan-grid__saldo:nth-child(6) { left: 300px; }
.plan-grid tbody .plan-grid__saldo:nth-child(7) { left: 330px; }
.plan-grid tbody .plan-grid__saldo:nth-child(8) { left: 360px; }
.plan-grid tbody .plan-grid__saldo:nth-child(9) { left: 390px; }
.plan-grid tbody .plan-grid__saldo:nth-child(10) { left: 420px; }
.plan-grid tbody .plan-grid__saldo:nth-child(11) { left: 450px; }
.plan-grid tbody .plan-grid__saldo:nth-child(12) { left: 480px; }
.plan-grid tbody .plan-grid__saldo:nth-child(13) { left: 510px; }
.plan-grid tbody .plan-grid__saldo:nth-child(14) { left: 540px; }
.plan-grid tbody .plan-grid__saldo:nth-child(15) { left: 570px; }
/* Die zweite Kopfzeile beginnt bei nth-child(1), weil die Mitarbeiterspalte dort ein rowspan ist */
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(1) { left: 180px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(2) { left: 210px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(3) { left: 240px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(4) { left: 270px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(5) { left: 300px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(6) { left: 330px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(7) { left: 360px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(8) { left: 390px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(9) { left: 420px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(10) { left: 450px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(11) { left: 480px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(12) { left: 510px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(13) { left: 540px; }
.plan-grid thead tr:last-child .plan-grid__saldo:nth-child(14) { left: 570px; }
.plan-grid .plan-grid__saldo--last { box-shadow: inset -1px -1px 0 var(--line-soft), inset -2px 0 0 var(--line-strong); }
.plan-grid .plan-grid__saldo--low  { background: #FEF3C7; font-weight: 600; }
.plan-grid .plan-grid__saldo--over { background: #FECACA; font-weight: 600; }

@media (max-width: 767px) {
    .plan-grid__name { width: 140px; min-width: 140px; }
    /* Acht klebende Zahlenspalten fressen den halben Bildschirm; hier scrollen sie mit */
    .plan-grid .plan-grid__saldo,
    .plan-grid .plan-grid__saldo-kopf { position: static; }
    .plan-wrap { max-height: 60vh; }
    /* Sechs Filter füllen hier sonst den ganzen Bildschirm und das Raster bleibt unerreichbar */
    .plan-card .table-filter { max-height: 26vh; }
}

/* ---------- Schwebender Knopf (Feedback-Werkzeug) ---------- */

.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--color-primary-contrast);
    background: var(--color-primary);
    border: 0;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 24px -6px rgba(16, 24, 40, 0.4);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.fab:hover { background: var(--color-primary-hover); }
.fab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.fab:active { transform: scale(0.96); }
.fab .icon { width: 22px; height: 22px; }

/* Sonst deckt die erste Meldung den Knopf zu: der Meldungsbereich sitzt an derselben Ecke */
body.has-fab .toast-region { bottom: 84px; }

@media (max-width: 639px) {
    .fab { right: 16px; bottom: 16px; }
    body.has-fab .toast-region { bottom: 76px; }
}

/* ---------- Eine Stelle auf der Seite markieren (Feedback-Werkzeug) ---------- */

/* Solange markiert wird, ist das Popup weg und der Zeiger ein Kreuz. Der Stern erwischt auch
   Knöpfe und Links, die sonst ihren eigenen Zeiger mitbringen. */
body.is-picking,
body.is-picking * { cursor: crosshair; }
body.is-picking { user-select: none; }
body.is-picking .fab { display: none; }

/* Was unter dem Zeiger liegt, und danach die gewählte Stelle. Beides als outline, damit sich das
   Maß der Seite nicht verschiebt - ein Rahmen würde Tabellenzellen auseinanderschieben. */
.is-feedback-hover {
    outline: 2px dashed var(--color-primary);
    outline-offset: 1px;
}
.is-feedback-marked {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
    box-shadow: 0 0 0 4px var(--color-primary-ring);
}

.feedback-hint {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 210;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 16px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--color-primary-contrast);
    background: var(--color-primary);
    box-shadow: 0 8px 20px -10px rgba(16, 24, 40, 0.55);
}
.feedback-hint,
.feedback-hint * { cursor: default; }
.feedback-hint__abbrechen {
    padding: 4px 12px;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: var(--radius-full);
    cursor: pointer;
}
.feedback-hint__abbrechen:hover { background: rgba(255, 255, 255, 0.16); }

/* Die gewählte Stelle im Popup */
.feedback-spot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-subtle);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.feedback-spot__text { margin: 0; font-size: 14px; }
.feedback-spot__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ---------- Toasts ---------- */

.toast-region {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(380px, calc(100vw - 40px));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 8px 11px 14px;
    font-size: var(--fs);
    color: #F4F5F6;
    background: #17191C;
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 12px 32px -8px rgba(16, 24, 40, 0.45);
    pointer-events: auto;
    animation: toast-in var(--duration-slow) var(--ease-out);
}
.toast__icon { width: 18px; height: 18px; margin-top: 1px; }
.toast--success .toast__icon { color: #4ADE80; }
.toast--info .toast__icon { color: #7DB3FF; }
.toast--warning .toast__icon { color: #FBBF24; }
.toast--danger .toast__icon { color: #FF8A80; }
.toast__message { flex: 1; padding-top: 1px; }
.toast .icon-btn { width: 24px; height: 24px; color: #9CA1A9; }
.toast .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.toast .icon-btn .icon { width: 14px; height: 14px; }
.toast.is-leaving { animation: toast-out 150ms ease-in forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

@media (max-width: 639px) {
    .toast-region { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; width: auto; }
}

/* ---------- Kacheln (Portal) ---------- */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 136px;
    padding: 18px;
    color: var(--text);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
    transition: box-shadow var(--duration) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
a.tile:hover {
    text-decoration: none;
    box-shadow: 0 0 0 1px var(--line-strong), 0 6px 16px -6px rgba(16, 24, 40, 0.14);
}
a.tile:active { transform: translateY(1px); }
.tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--color-primary-strong);
    background: var(--color-primary-soft);
    border-radius: 10px;
}
.tile__arrow {
    position: absolute;
    top: 18px;
    right: 16px;
    color: var(--text-disabled);
    transition: transform var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.tile__arrow .icon { width: 16px; height: 16px; }
a.tile:hover .tile__arrow { color: var(--color-primary-strong); transform: translateX(2px); }
.tile__title { margin-top: 16px; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.tile__text { font-size: var(--fs-sm); color: var(--text-muted); }
/* Kleine Zusatzzeile am Fuß einer Kachel, zum Beispiel die Zahl der Felder einer HR-Aktion */
.tile__meta { margin-top: auto; padding-top: 10px; font-size: var(--fs-sm); color: var(--text-disabled); }

@media (max-width: 479px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { min-height: 128px; padding: 14px; border-radius: var(--radius-md); }
    .tile__arrow { top: 14px; right: 12px; }
    .tile__title { margin-top: 12px; font-size: var(--fs); }
}

/* ---------- Schrittanzeige (Installer) ---------- */

.stepper {
    display: flex;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}
.stepper__item {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: var(--fs-xs);
    text-align: center;
    color: var(--text-muted);
}
.stepper__item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    right: calc(-50% + 18px);
    left: calc(50% + 18px);
    height: 2px;
    background: var(--line);
    border-radius: var(--radius-full);
}
.stepper__item.is-done:not(:last-child)::after { background: var(--color-primary); }
.stepper__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: var(--fs-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.stepper__dot .icon { width: 13px; height: 13px; }
.stepper__item.is-done .stepper__dot { color: var(--color-primary-contrast); background: var(--color-primary); box-shadow: none; }
.stepper__item.is-current .stepper__dot { color: var(--color-primary-strong); box-shadow: inset 0 0 0 2px var(--color-primary), 0 0 0 4px var(--color-primary-ring); }
.stepper__item.is-current { font-weight: 500; color: var(--text); }
.stepper__label { max-width: 100%; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper-caption { display: none; margin: -14px 0 20px; font-size: var(--fs-sm); text-align: center; color: var(--text-muted); }

/* Anklickbare Schritte im HR-Wizard (Rückmeldung 16.11.2026, #28) */
.stepper__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
    margin: -4px;
    padding: 4px;
    font: inherit;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
}
.stepper__link:hover { color: var(--text); text-decoration: none; }
.stepper__link:hover .stepper__dot { box-shadow: inset 0 0 0 1.5px var(--color-primary); }
.stepper__item.is-done .stepper__link:hover .stepper__dot { background: var(--color-primary-strong); }
.stepper__link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

@media (max-width: 639px) {
    .stepper__label { display: none; }
    .stepper-caption { display: block; }
}

/* ---------- Marke und Avatar ---------- */

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -0.014em;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand__mark {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: var(--fs);
    font-weight: 700;
    color: var(--color-primary-contrast);
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(16, 24, 40, 0.08);
}
.brand__logo { display: block; width: auto; max-width: 168px; max-height: 28px; }
.brand__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand__sub { display: block; font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; color: var(--text-muted); }

.avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-primary-strong);
    background: var(--color-primary-soft);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--color-primary-ring);
}

/* ==========================================================================
   Backend-Layout: Sidebar auf der Grundfläche, Inhalt im Inset-Panel
   ========================================================================== */

.layout-backend .app { display: flex; min-height: 100dvh; }

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 8px 10px 10px;
    background: var(--canvas);
}
.sidebar__brand {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 52px;
    padding: 0 6px 0 8px;
}
.sidebar__close { display: none; }
.sidebar__nav { flex: 1; margin: 8px -4px 0; padding: 0 4px 16px; overflow-y: auto; }

.nav-group + .nav-group { margin-top: 22px; }
.nav-group__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 8px 6px;
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-muted);
}
/* Kleine Aktion an einer Gruppenüberschrift, heute nur „Favoriten ordnen". Sie soll auffindbar
   sein, aber nicht so laut wie ein eigener Eintrag (Rückmeldung von Gino, 02.10.2026). */
.nav-group__action {
    display: inline-flex;
    flex: none;
    color: var(--text-disabled);
    border-radius: var(--radius-sm);
    transition: color var(--duration) var(--ease-out);
}
.nav-group__action:hover { color: var(--text); }
.nav-group__action:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Rubrik als Menüpunkt (Entscheidung Gino, 15.11.2026, Notiz #20 — „als wäre ein schlechter
   Designer am Werk"): Die Rubrik ist eine Zeile in der Größe eines Punktes, mit eigenem Symbol,
   aufgeklappt stehen ihre Punkte eingerückt an einer feinen Linie, ohne Symbol. Höchstens eine
   Rubrik ist offen; darum kümmert sich das Akkordeon in app.js. Favoriten sehen gleich aus,
   klappen aber nicht. */
.nav-group + .nav-group--rubrik { margin-top: 12px; }
.nav-group--rubrik + .nav-group--rubrik { margin-top: 1px; }
.nav-rubrik {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 8px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    list-style: none;
    transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.nav-rubrik .icon { width: 18px; height: 18px; flex: none; }
.nav-rubrik__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
summary.nav-rubrik { cursor: pointer; }
summary.nav-rubrik::-webkit-details-marker { display: none; }
summary.nav-rubrik:hover { color: var(--text); background: var(--surface-hover); }
summary.nav-rubrik:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.nav-rubrik.is-current,
details[open] > .nav-rubrik { color: var(--text); }
.nav-rubrik.is-current .icon:not(.nav-rubrik__chevron) { color: var(--color-primary); }
.nav-rubrik__chevron { color: var(--text-disabled); transition: transform var(--duration) var(--ease-out); }
details[open] > .nav-rubrik .nav-rubrik__chevron { transform: rotate(180deg); }
details[open] > .nav-rubrik .nav-rubrik__badge { display: none; }
/* Doppelte Klasse: .nav-list steht weiter unten und setzt Rand und Innenabstand auf null */
.nav-list.nav-list--sub {
    margin: 2px 0 6px 16px;
    padding-left: 10px;
    border-left: 1px solid var(--line);
}
.nav-list--sub .nav-link { height: 30px; font-weight: 400; }
.nav-list--sub .nav-link.is-active { font-weight: 500; }
@media (max-width: 1023px) {
    .nav-rubrik { height: 40px; }
    .nav-list--sub .nav-link { height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
    .nav-rubrik__chevron { transition: none; }
}
.nav-list { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; list-style: none; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 8px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.nav-link .icon { width: 18px; height: 18px; color: var(--text-muted); transition: color var(--duration-fast) var(--ease-out); }
.nav-link:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.nav-link:active { background: var(--surface-pressed); }
.nav-link.is-active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-raised); }
.nav-link.is-active .icon { color: var(--color-primary); }
.nav-link__badge { margin-left: auto; }

.sidebar__footer { flex: none; padding-top: 8px; border-top: 1px solid var(--line-soft); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 8px;
    font: inherit;
    text-align: left;
    color: var(--text);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out);
}
.user-chip:hover,
.user-chip[aria-expanded='true'] { background: var(--surface-hover); }
.user-chip__text { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-chip__name,
.user-chip__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip__name { font-weight: 500; color: var(--text); }
.user-chip__meta { font-size: var(--fs-xs); color: var(--text-muted); }
.user-chip > .icon { width: 14px; height: 14px; color: var(--text-muted); }

.main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 8px 8px 8px 0;
}
.panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border-radius: var(--radius-panel);
    box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(16, 24, 40, 0.04);
}
.topbar { display: none; }
.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-7) var(--space-8) var(--space-8);
}
.content:focus { outline: none; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(16, 24, 40, 0.32);
    animation: fade-in var(--duration-slow) var(--ease-out);
}

@media (min-width: 1024px) {
    .sidebar-overlay { display: none !important; }
}

@media (max-width: 1023px) {
    .sidebar {
        width: 272px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        box-shadow: var(--shadow-pop);
        transform: translateX(-104%);
        transition: transform var(--duration-slow) var(--ease-out);
    }
    .sidebar-open .sidebar { transform: none; }
    .sidebar__close { display: inline-flex; }
    .nav-link { height: 40px; }
    .main { margin-left: 0; padding: 0; }
    .panel { border-radius: 0; box-shadow: none; }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: 6px;
        height: 56px;
        padding: 0 12px 0 8px;
        background: rgba(255, 255, 255, 0.92);
        border-bottom: 1px solid var(--line);
    }
    @supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
        .topbar {
            background: rgba(255, 255, 255, 0.8);
            -webkit-backdrop-filter: saturate(180%) blur(8px);
            backdrop-filter: saturate(180%) blur(8px);
        }
    }
    .topbar .icon-btn { width: 40px; height: 40px; }
    .content { padding: var(--space-6) var(--space-6) var(--space-8); }
}

@media (max-width: 639px) {
    .content { padding: var(--space-5) var(--space-4) var(--space-8); }
    .page-header { margin-bottom: var(--space-5); }
    .page-header__title { font-size: 22px; }
    .page-header__actions { width: 100%; }
}

/* ==========================================================================
   Portal-Layout (mobil zuerst, Touch-Ziele 44 px)
   ========================================================================== */

.portal { display: flex; flex-direction: column; min-height: 100dvh; }
.portal-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 960px;
    height: 64px;
    margin: 0 auto;
    padding: 0 20px;
}
.portal-header .cluster { flex-wrap: nowrap; }
.portal-header form { margin: 0; }
.lang-switch { position: relative; display: flex; align-items: center; margin: 0; }
.lang-switch > .icon {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
.lang-switch .select {
    width: auto;
    height: 36px;
    padding-left: 32px;
    font-size: 16px;
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}
.lang-switch .select:hover { background-color: var(--surface-hover); border-color: transparent; }
.lang-switch .select:focus { background-color: var(--surface); border-color: var(--color-primary); }

.portal-main { flex: 1; width: 100%; margin: 0 auto; padding: 32px 20px 48px; }
.portal-main--narrow { max-width: 420px; padding-top: max(32px, 8dvh); }
.portal-main--wide { max-width: 960px; }
.portal-footer { padding: 24px 20px; font-size: var(--fs-xs); text-align: center; color: var(--text-muted); }
.portal-footer__link { margin-left: 10px; }

.layout-portal .card { border-radius: var(--radius-xl); }
.layout-portal .card__body { padding: 28px; }
.layout-portal .input,
.layout-portal .select:not(.lang-switch .select) { height: 44px; font-size: 16px; }
.layout-portal h1 { font-size: 24px; }

@media (max-width: 639px) {
    .portal-header__inner { padding: 0 12px 0 16px; }
    .portal-main { padding: 20px 16px 40px; }
    .portal-main--narrow { padding-top: 16px; }
    .layout-portal .card__body { padding: 22px; }
}

/* Beschriftung auf sehr schmalen Displays nur für Screenreader, Icon bleibt sichtbar */
@media (max-width: 479px) {
    .label-sm-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .lang-switch .select { max-width: 132px; }
}

/* ==========================================================================
   Installer
   ========================================================================== */

.install { max-width: 640px; margin: 0 auto; padding: 48px 20px 64px; }
.install__brand { display: flex; justify-content: center; margin-bottom: 32px; }
.install__card { border-radius: var(--radius-lg); }
.install__card > .card__body { padding: 32px; }

@media (max-width: 639px) {
    .install { padding: 24px 12px 40px; }
    .install__brand { margin-bottom: 24px; }
    .install__card > .card__body { padding: 20px; }
}

/* ==========================================================================
   Fehler- und Wartungsseiten
   ========================================================================== */

.plain-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
}
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 480px;
    text-align: center;
}
.error-page__code {
    margin-bottom: 4px;
    font-size: 64px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary-strong);
}
.error-page__title { font-size: var(--fs-xl); letter-spacing: -0.018em; }
.error-page__text { color: var(--text-muted); }
.error-page__meta { font-size: var(--fs-sm); color: var(--text-muted); }
.error-page__detail {
    max-width: 100%;
    margin: 4px 0 0;
    padding: 12px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised);
}
.error-page .btn { margin-top: 12px; }

/* ==========================================================================
   Installer-Bausteine
   ========================================================================== */

.form-actions--between { justify-content: space-between; }
.form-actions--start { justify-content: flex-start; }

.checklist {
    margin: 0;
    padding: 0;
    list-style: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-ring);
}
.checklist__item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.checklist__item + .checklist__item { border-top: 1px solid var(--line-soft); }
.checklist__icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 50%;
}
.checklist__icon .icon { width: 13px; height: 13px; }
.checklist__item.is-ok .checklist__icon { color: var(--success); background: var(--success-soft); }
.checklist__item.is-warnung .checklist__icon { color: var(--warning); background: var(--warning-soft); }
.checklist__item.is-fehler .checklist__icon { color: var(--danger-text); background: var(--danger-soft); }
.checklist__label { font-weight: 500; color: var(--text); }
.checklist__detail { font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: steps;
}
.steps-list > li { position: relative; padding-left: 38px; counter-increment: steps; }
.steps-list > li::before {
    content: counter(steps);
    position: absolute;
    top: -1px;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-subtle);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--line);
}

.qr-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
}
.qr {
    flex: none;
    width: 172px;
    height: 172px;
    padding: 10px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-ring);
}
.qr svg { display: block; width: 100%; height: 100%; }
.qr-block > .stack { flex: 1; min-width: 180px; }
.secret {
    font-family: var(--font-mono);
    font-size: var(--fs);
    letter-spacing: 0.06em;
    color: var(--text);
    overflow-wrap: anywhere;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 14px;
    list-style: none;
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
}
.recovery-codes li {
    padding: 9px 8px;
    font-family: var(--font-mono);
    font-size: var(--fs-md);
    letter-spacing: 0.08em;
    text-align: center;
    color: var(--text);
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-ring);
}

.result-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.result-hero__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
    color: var(--success);
    background: var(--success-soft);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(6, 118, 71, 0.16);
}
.result-hero__icon .icon { width: 26px; height: 26px; }
.result-hero__icon--primary { color: var(--color-primary-strong); background: var(--color-primary-soft); box-shadow: inset 0 0 0 1px var(--color-primary-ring); }
.result-hero__icon--warning { color: var(--warning-icon); background: var(--warning-soft); box-shadow: inset 0 0 0 1px rgba(181, 71, 8, 0.16); }
.result-hero h1 { margin: 0; }

@media print {
    .layout-install .install__brand,
    .layout-install .stepper,
    .layout-install .stepper-caption,
    .no-print { display: none !important; }
    .layout-install .install { padding: 0; }
    .layout-install .install__card { box-shadow: none; }
}

/* ==========================================================================
   Admin-Bereich
   ========================================================================== */

.grid--start { align-items: start; }

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.admin-grid--reverse { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

@media (max-width: 1199px) {
    .admin-grid,
    .admin-grid--reverse { grid-template-columns: minmax(0, 1fr); }
}

.card__footer--between { justify-content: space-between; align-items: center; }
/* Im HR-Wizard steht „Zurück" links, muss im Quelltext aber hinter „Weiter" stehen: Die
   Eingabetaste löst sonst den ersten Absendeknopf aus, und das wäre der Rückwärtsschritt. */
.card__footer .btn--first { order: -1; }
.card__footer--start { justify-content: flex-start; }
.card__footer form { margin: 0; }
.card__body--flush-top { padding-top: 0; }

.form-actions--sticky {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 12px 0 4px;
    background: linear-gradient(to top, var(--surface) 65%, rgba(255, 255, 255, 0));
}

.fieldset { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.check input[type='radio'] { accent-color: var(--color-primary); }
.check-group__title { margin: 4px 0 8px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; }

.dl--stacked { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.dl--stacked dd { margin-bottom: 12px; }
.dl--stacked dd:last-child { margin-bottom: 0; }
.break { overflow-wrap: anywhere; }

.tabs {
    display: inline-flex;
    gap: 2px;
    margin: 0 0 20px;
    padding: 3px;
    list-style: none;
    background: var(--surface-subtle);
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px var(--line);
}
.tabs a {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-raised); }

/* Viele Reiter (Mitarbeiterformular) scrollen auf schmalen Bildschirmen seitlich */
.tabs--scroll { display: flex; max-width: 100%; overflow-x: auto; }
.tabs--scroll a { white-space: nowrap; }
.field__help--locked { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.field__help--locked .icon { width: 15px; height: 15px; }

.textarea--list { min-height: 120px; font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0; line-height: 1.7; }
.textarea--code { min-height: 320px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; letter-spacing: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0;
    color: var(--text-secondary);
    background: var(--surface-subtle);
    border-radius: var(--radius-xs);
    box-shadow: inset 0 0 0 1px var(--line);
}

/* Als Link in der Suche: anklickbar und mit erkennbarem Zustand */
a.chip { text-decoration: none; }
a.chip:hover { background: var(--surface-hover); }
.chip.is-active { color: var(--color-primary-contrast); background: var(--color-primary); box-shadow: none; }

/* Suchfeld oben in der Seitenleiste */
.sidebar-search { padding: 0 12px 10px; }
.sidebar-search .input { height: 34px; font-size: 13px; }

.mail-preview { overflow: hidden; background: var(--canvas); border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--line); }
.mail-preview iframe { display: block; width: 100%; height: 560px; border: 0; }

.pre {
    max-height: 420px;
    margin: 0;
    padding: 14px;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    letter-spacing: 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--line);
}

.truncate { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.truncate--link { font-weight: 500; color: var(--text); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.value-change { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.value-change__old { color: var(--text-muted); text-decoration: line-through; }

.matrix .select { width: auto; min-width: 190px; }
.matrix__flag { padding-left: 32px !important; color: var(--text-secondary); }

/* Die Rechte stehen in denselben Gruppen wie die Seitenleiste; die erste Zeile jeder Gruppe trägt
   die Abkürzung „ganze Gruppe auf …" */
.matrix__group th,
.matrix__group td {
    background: var(--surface-subtle);
}
.matrix__group th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Jede Gruppe ist ein Akkordeon. Die Zusammenfassung sagt, was drinsteht, ohne sie zu öffnen. */
.matrix-group {
    padding: 0 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.details.matrix-group > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 12px 0;
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text);
}
.details.matrix-group[open] > summary { border-bottom: 1px solid var(--line-soft); }
.matrix-group__meta {
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--text-muted);
}
.matrix-group .table-wrap { margin: 0 -16px; }

.btn--danger-text { color: var(--danger-text); }
.btn--danger-text:hover { color: var(--danger-hover); background: var(--danger-soft); }

/* Löschsymbol in einer Kopfzeile: erst beim Überfahren rot. Ein dauerhaft roter Papierkorb in
   jeder Zeile einer Liste wäre lauter, als die Sache ist. */
.icon-btn--danger:hover { color: var(--danger-hover); background: var(--danger-soft); }

/* Dateifelder (Rückmeldung Carolin Graf, 16.11.2026, #23: „nicht aussehen wie in den 2000er"):
   gleiche Höhe wie die übrigen Eingaben, der Knopf im Stil eines Zweitknopfs, daneben leise der
   Dateiname. Gilt für jedes Dateifeld, weil alle diese Klasse tragen. */
.input--file {
    height: 36px;
    padding: 3px;
    font-size: var(--fs-sm);
    line-height: 28px;
    color: var(--text-muted);
    cursor: pointer;
}
.input--file::file-selector-button {
    height: 28px;
    margin-right: var(--space-3);
    padding: 0 12px;
    font: inherit;
    font-weight: 500;
    color: var(--text);
    background: var(--surface-subtle);
    border: 0;
    border-radius: var(--radius-xs);
    box-shadow: 0 0 0 1px var(--line-strong);
    cursor: pointer;
    transition: background-color var(--duration) var(--ease-out);
}
.input--file:hover::file-selector-button { background: var(--surface-hover); box-shadow: 0 0 0 1px var(--line-hover); }
.input--file:disabled::file-selector-button { color: var(--text-disabled); cursor: not-allowed; }

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 104px;
    padding: 16px;
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 1px var(--line);
}
.logo-preview img { max-width: 100%; max-height: 64px; }

.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type='color'] {
    flex: none;
    width: 44px;
    height: 36px;
    padding: 3px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.color-field .input { max-width: 140px; text-transform: uppercase; }

.swatches { display: flex; flex-wrap: wrap; gap: 16px; }
.swatch { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.swatch svg { display: block; width: 56px; height: 40px; }

.area-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.area-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    border-radius: 10px;
    box-shadow: var(--shadow-raised);
    transition: background-color var(--duration-fast) var(--ease-out);
}
.area-link:hover { background: var(--surface-subtle); text-decoration: none; }
.area-link > .icon { width: 18px; height: 18px; color: var(--color-primary); }
.area-link__label { display: block; font-weight: 500; }
.area-link__group { display: block; font-size: var(--fs-xs); color: var(--text-muted); }

.steps-list--compact { gap: 12px; margin-top: 12px; }
.steps-list--compact > li { padding-left: 34px; line-height: 1.55; }
.plain-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pre-line { max-width: 420px; white-space: pre-line; overflow-wrap: anywhere; }

.changelog { display: flex; flex-direction: column; gap: 28px; }
.changelog__version { display: flex; flex-direction: column; gap: 6px; }
.changelog__version + .changelog__version { padding-top: 24px; border-top: 1px solid var(--line-soft); }
.changelog__title { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.changelog__section { margin: 10px 0 2px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.changelog ul { margin: 0; padding-left: 18px; }
.changelog li { margin: 4px 0; line-height: 1.55; }
.changelog p { margin: 0; }
.changelog code {
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    letter-spacing: 0;
    background: var(--surface-subtle);
    border-radius: var(--radius-xs);
}

/* ==========================================================================
   Anmeldung (Backend)
   ========================================================================== */

.auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 40px 16px;
}
.auth__brand { display: flex; justify-content: center; margin-bottom: 24px; }
.auth__card { width: 100%; max-width: 400px; border-radius: var(--radius-xl); }
.auth__card--wide { max-width: 560px; }
.auth__card > .card__body { padding: 32px; }
.auth__title { font-size: var(--fs-2xl); }
.auth__secondary { display: flex; justify-content: center; margin: 16px 0 0; }

@media (max-width: 479px) {
    .auth { justify-content: flex-start; padding-top: 28px; }
    .auth__card > .card__body { padding: 22px; }
}

@media print {
    .layout-auth .auth__brand { display: none !important; }
    .layout-auth .auth__card { box-shadow: none; }
}

/* ---------- Kennzahlen, Aufklapper und Jahresraster (Portal) ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
}
.stat--primary { background: var(--color-primary-soft); }
.stat__label { font-size: var(--fs-xs); color: var(--text-muted); }
.stat__value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
}
.stat--primary .stat__value { color: var(--color-primary-strong); }
.stat__unit { font-size: var(--fs-xs); color: var(--text-muted); }

.details > summary {
    padding: 8px 0;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--color-primary-strong);
    cursor: pointer;
}
.details > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.details[open] > summary { margin-bottom: 8px; }

.table--compact td,
.table--compact th { height: 36px; padding-top: 0; padding-bottom: 0; }

/* Zeilen zum Ziehen (Rückmeldung Gino, 15.11.2026). Griff und Verdecken der Zahlenfelder gelten
   erst, wenn sortieren.js die Klasse gesetzt hat — ohne JavaScript bleibt alles sichtbar. */
.spalte-griff { display: none; }
.is-sortierbar .spalte-griff { display: table-cell; width: 40px; }
.is-sortierbar .spalte-ordnung { display: none; }
.griff {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-disabled);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: grab;
    touch-action: none;
}
.griff:hover { color: var(--text); background: var(--surface-hover); }
.griff:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.griff .icon { transform: rotate(90deg); }
tr.is-dragging { cursor: grabbing; background: var(--color-primary-soft); }
tr.is-dragging .griff { cursor: grabbing; }

.art-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 20px;
    padding: 0 6px;
    margin-right: 6px;
    font-size: var(--fs-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-secondary);
}

.year-grid {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.year-grid th,
.year-grid td {
    height: 20px;
    padding: 0 2px;
    text-align: center;
    border: 1px solid var(--line);
}
.year-grid thead th,
.year-grid tbody th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-subtle);
}
.year-grid tbody th { width: 28px; font-weight: 400; }
.year-grid td { font-weight: 600; }
.year-grid__none { background: #DCE0E6; }

@media (max-width: 479px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { padding: 12px; }
    .stat__value { font-size: 22px; }
}

/* ---------- Unterschriftenfeld (Portal) ---------- */

.is-hidden { display: none !important; }

.signature {
    position: relative;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    touch-action: none;
}
.signature__canvas { display: block; width: 100%; height: 160px; cursor: crosshair; }

/* Das Vermieterformular, auf dem die Druckstellen gesetzt werden (H6) */
.formular { display: grid; gap: 16px; }
.formular__blatt {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    /* Erst wenn das Blatt gerendert ist, lohnt der Zeiger. Vorher ist nichts zu treffen. */
    cursor: default;
}
.formular.is-bereit .formular__blatt { cursor: crosshair; }
/* Das Blatt ist fokussierbar, weil die Pfeiltasten die gewählte Stelle verschieben. Ohne sichtbaren
   Rahmen wüsste niemand, dass die Tasten gerade dorthin gehen. */
.formular__blatt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Rückmeldung beim Umwandeln eines HEIC-Bildes vor dem Hochladen */
.is-error { color: var(--danger-text); }
.is-invalid .signature { border-color: var(--danger-text); }

/* ---------- Bewegung und Druck ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .sidebar, .topbar, .toast-region, .skip-link { display: none !important; }
    .main { margin-left: 0; padding: 0; }
    .panel { box-shadow: none; }
    body { background: #fff; }
}

/* Hinweis auf abgeschalteten oder umgeleiteten Postausgang. Steht über dem Inhalt und nicht als
   Toast: Er soll bleiben, solange der Zustand gilt, und nicht nach vier Sekunden verschwinden. */
.mailbanner {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 10px 24px;
    background: #FEF3C7;
    color: #92400E;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #FDE68A;
}
.mailbanner .icon { flex: none; }
@media (max-width: 767px) {
    .mailbanner { padding: 10px 16px; }
}

/* Fußzeile unter dem Inhalt. Einstellbar unter Administration, siehe copyright_line(). */
.panel-footer {
    padding: 16px 24px 24px;
    color: var(--text-muted);
    font-size: 12px;
}
@media (max-width: 767px) {
    .panel-footer { padding: 16px 16px 24px; }
}

/* Stern neben der Seitenüberschrift: setzt die Seite als Favorit. Ein Formular, kein Skript. */
.page-header__star { display: inline-block; vertical-align: middle; margin-left: 6px; }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }

/* Ein Wert, der nicht eingegeben, sondern gezeigt wird (HR-Felder mit Herkunft) */
.field__static {
    margin: 0;
    padding: 9px 0;
    font-size: var(--fs-sm);
    color: var(--text);
}
.icon-btn--sm { width: 30px; height: 30px; }
.icon-btn--sm .icon { width: 18px; height: 18px; }
.icon-btn.is-active { color: var(--color-primary); }

/* Zwischenüberschrift in einer Karte, die mehrere Blöcke zeigt (HR-Vorgang, Vorschau) */
.group-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 8px;
    padding-bottom: 6px;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line-soft);
}
.group-title:first-child { margin-top: 0; }
/* „Ändern" springt im Wizard auf die Seite dieses Abschnitts; es ist ein Link, keine Überschrift. */
.group-title a { font-weight: 500; text-transform: none; letter-spacing: normal; }

/* Matrizen des HR-Tools: viele schmale Spalten, deshalb bleibt die Feldspalte beim seitlichen
   Scrollen stehen. Dasselbe Muster wie im Jahresraster, nur mit normaler Zeilenhöhe. */
/* Eigener Scrollbereich, damit Kopfzeile und Feldspalte beim Blättern stehen bleiben. Ohne ihn
   klebt der Kopf am Seitenscroll, und bei fünfzig Zeilen weiß niemand mehr, welche Spalte welche
   Aktion ist. Auf dem Smartphone bleibt die Tabelle in Seitenhöhe, dort stört der zweite
   Scrollbereich mehr, als der klebende Kopf nützt. */
.matrix-scroll { overflow: auto; }
@media (min-width: 768px) {
    .matrix-scroll { max-height: calc(100vh - 240px); }
}
.matrix-table { border-collapse: separate; border-spacing: 0; }

/* Vorschau einer Empfängermail (Rückmeldung 16.11.2026, #29): eine Postfachzeile zum Aufklappen,
   darin die Mail auf grauem Grund wie in einem Mailprogramm. */
.mail-vorschau { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.mail-vorschau__zeile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius-md);
}
.mail-vorschau__zeile::-webkit-details-marker { display: none; }
.mail-vorschau__zeile:hover { background: var(--surface-hover); }
.mail-vorschau__zeile:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.mail-vorschau__symbol {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    color: var(--color-primary); background: var(--color-primary-tint); border-radius: 50%;
}
.mail-vorschau__symbol .icon { width: 16px; height: 16px; }
.mail-vorschau__wer { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-sm); }
.mail-vorschau__adressen,
.mail-vorschau__betreff { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-muted); }
.mail-vorschau__pfeil { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--duration-fast) var(--ease-out); }
.mail-vorschau[open] .mail-vorschau__pfeil { transform: rotate(180deg); }
.mail-vorschau[open] .mail-vorschau__zeile { border-bottom: 1px solid var(--line-soft); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.mail-vorschau.is-leer .mail-vorschau__symbol { color: var(--text-muted); background: var(--surface-subtle); }
.mail-vorschau.is-leer .mail-vorschau__wer strong,
.mail-vorschau.is-leer .mail-vorschau__betreff { color: var(--text-muted); }

.mail-vorschau__mail { padding: var(--space-4); background: var(--canvas); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.mail-vorschau__kopf {
    display: grid; gap: var(--space-1);
    margin: 0 0 var(--space-3); padding: 0 var(--space-1);
    font-size: var(--fs-sm);
}
.mail-vorschau__kopf div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-2); }
.mail-vorschau__kopf dt { color: var(--text-muted); }
.mail-vorschau__kopf dd { margin: 0; overflow-wrap: anywhere; }
.mail-vorschau__inhalt {
    max-width: 640px;
    padding: var(--space-5);
    font-size: var(--fs-sm);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
}
.mail-vorschau__inhalt > * + * { margin-top: var(--space-4); }
.mail-vorschau__text { margin: 0; }
.mail-vorschau__angaben { margin: 0; }
.mail-vorschau__angabe {
    display: grid; grid-template-columns: 40% minmax(0, 1fr); gap: var(--space-3);
    padding: 6px 0; border-bottom: 1px solid var(--line-soft);
}
.mail-vorschau__angabe dt { font-weight: 600; }
.mail-vorschau__angabe dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
/* Ein Raster braucht die ganze Breite: Beschriftung darüber, Tabelle darunter */
.mail-vorschau__angabe--breit { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
.mail-vorschau__knopf {
    display: inline-block; padding: 8px 14px;
    font-weight: 600; color: var(--color-primary-contrast);
    background: var(--color-primary); border-radius: var(--radius-xs);
}

@media (max-width: 639px) {
    .mail-vorschau__zeile { grid-template-columns: auto minmax(0, 1fr) auto; }
    .mail-vorschau__betreff { display: none; }
    .mail-vorschau__mail { padding: var(--space-3); }
    .mail-vorschau__inhalt { padding: var(--space-4); }
}

/* Ein Matrix-Wert zum Lesen: Tag × Zeitfenster mit Haken (Rückmeldung 16.11.2026, #30) */
.matrix-anzeige { margin-top: var(--space-1); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.matrix-anzeige .table th[scope="row"] { font-weight: 500; white-space: nowrap; }
.matrix-anzeige__spalte { white-space: normal !important; min-width: 88px; line-height: 1.3; }
.matrix-anzeige__zelle { text-align: center; }
.matrix-anzeige__zelle.is-an { color: var(--color-primary); background: var(--color-primary-tint); }
.matrix-anzeige__zelle .icon { width: 16px; height: 16px; vertical-align: middle; }
.matrix-table th,
.matrix-table td { box-shadow: inset 0 -1px 0 var(--line-soft); vertical-align: middle; }
.matrix-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-subtle); }
.matrix-table .matrix-table__name {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 180px;
    text-align: left;
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--line-soft), inset 0 -1px 0 var(--line-soft);
}
.matrix-table thead .matrix-table__name { z-index: 3; background: var(--surface-subtle); }
.matrix-table tbody tr:hover .matrix-table__name { background: var(--surface-subtle); }
.matrix-table__group th {
    position: sticky;
    left: 0;
    padding-top: 14px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* In einer Matrixzelle steht nur das Eingabeelement; der Abstand kommt von der Zeile */
.matrix-table .field { margin: 0; }
.matrix-table .select { min-width: 130px; }
.matrix-table td .field--check { display: flex; justify-content: center; }
.matrix-table td .check input { margin: 0; }
/* Kopfzellen als Schalter für ganze Zeilen und Spalten (matrix.js, Notiz #16). Sie sehen aus wie
   die Kopfzelle, die sie ersetzen — nur der Zeiger und der Unterstrich beim Überfahren verraten sie. */
.matrix-schalter {
    padding: 0;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: inherit;
    background: none;
    border: 0;
    border-radius: var(--radius-xs);
    cursor: pointer;
}
.matrix-schalter:hover { color: var(--color-primary-strong); text-decoration: underline; text-underline-offset: 3px; }
.matrix-schalter:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* --------------------------------------------------------------------------------------------
   Dunkle Darstellung (Rückmeldung von Gino, 02.10.2026).
   Nur Farben werden neu belegt; Radien, Schatten und Schriften bleiben. Gesetzt wird sie
   serverseitig über <html data-theme="dunkel"> — kein Inline-Skript, die CSP bleibt unangetastet.
   Bei "auto" fehlt das Attribut und das Gerät entscheidet.
   -------------------------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="hell"]) {
        --canvas: #14161A;
        --color-primary-tint: var(--color-primary-ring);
        --surface: #1C1F24;
        --surface-subtle: #22262C;
        --surface-hover: rgba(255, 255, 255, 0.05);
        --surface-pressed: rgba(255, 255, 255, 0.08);
        --line: rgba(255, 255, 255, 0.10);
        --line-soft: rgba(255, 255, 255, 0.07);
        --line-strong: rgba(255, 255, 255, 0.18);
        --line-hover: rgba(255, 255, 255, 0.28);

        --text: #E8EAED;
        --text-secondary: #B4B9C1;
        --text-muted: #8B9099;
        --text-disabled: #5E636B;

        --success: #4ADE80;
        --success-soft: #0E2A1D;
        --success-icon: #4ADE80;
        --warning: #FBBF24;
        --warning-soft: #2E2210;
        --warning-icon: #FBBF24;
        --danger: #F87171;
        --danger-hover: #EF4444;
        --danger-text: #FCA5A5;
        --danger-soft: #2E1512;
        --danger-ring: rgba(248, 113, 113, 0.25);
        --info: #93C5FD;
        --info-soft: #14233D;
        --info-icon: #93C5FD;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-raised: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.4), 0 18px 36px -10px rgba(0, 0, 0, 0.6);
    }
}

:root[data-theme="dunkel"] {
    --canvas: #14161A;
    --color-primary-tint: var(--color-primary-ring);
    --surface: #1C1F24;
    --surface-subtle: #22262C;
    --surface-hover: rgba(255, 255, 255, 0.05);
    --surface-pressed: rgba(255, 255, 255, 0.08);
    --line: rgba(255, 255, 255, 0.10);
    --line-soft: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.18);
    --line-hover: rgba(255, 255, 255, 0.28);

    --text: #E8EAED;
    --text-secondary: #B4B9C1;
    --text-muted: #8B9099;
    --text-disabled: #5E636B;

    --success: #4ADE80;
    --success-soft: #0E2A1D;
    --success-icon: #4ADE80;
    --warning: #FBBF24;
    --warning-soft: #2E2210;
    --warning-icon: #FBBF24;
    --danger: #F87171;
    --danger-hover: #EF4444;
    --danger-text: #FCA5A5;
    --danger-soft: #2E1512;
    --danger-ring: rgba(248, 113, 113, 0.25);
    --info: #93C5FD;
    --info-soft: #14233D;
    --info-icon: #93C5FD;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-raised: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.4), 0 18px 36px -10px rgba(0, 0, 0, 0.6);
}

/* Die Kalender- und Artfarben bleiben auch im Dunkeln hell: Sie gehören zum Plan, der gedruckt
   wird, und sollen am Bildschirm genauso aussehen. Nur der Text darauf muss dunkel bleiben.
   Die Kennzeichen des Kalenders bringen ihre Textfarbe aus theme.css.php selbst mit.

   Das Plättchen der Legende bekommt im Dunkeln einen hauchfeinen hellen Rand: Der unbezahlte
   Urlaub ist eine schwarze Fläche und verschwände sonst im dunklen Untergrund. Im Raster ist das
   kein Thema, dort umgibt die Rasterlinie jede Zelle. */
:root[data-theme="dunkel"] .plan-grid .plan-grid__saldo--low,
:root[data-theme="dunkel"] .plan-grid .plan-grid__saldo--over { color: #17191C; }
:root[data-theme="dunkel"] .art-badge { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="hell"]) .plan-grid .plan-grid__saldo--low,
    :root:not([data-theme="hell"]) .plan-grid .plan-grid__saldo--over { color: #17191C; }
    :root:not([data-theme="hell"]) .art-badge { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
}

/* ------------------------------------------------------------------ Umsatzmeldung
   Die Monatsseite ist eine Tabelle mit Eingabefeldern in den Zeilen. Auf dem Telefon wird daraus
   eine Liste aus Karten: Sieben Spalten mit Feldern sind auf 375 px nicht zu retten, und
   waagerecht scrollen und gleichzeitig tippen geht nicht. */
.text-warning { color: var(--warning); }

.month-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.month-nav__label { display: flex; flex-direction: column; min-width: 150px; }
.month-nav__label strong { font-size: 16px; }
.month-nav__jump { display: flex; gap: 8px; margin-left: auto; }
.month-nav__jump .input { width: auto; }
.month-nav .icon-btn[aria-disabled] { opacity: 0.4; pointer-events: none; }

.input--amount { max-width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.input--note { min-width: 110px; max-width: 170px; }
.summe { font-weight: 600; font-variant-numeric: tabular-nums; }
.table .field { margin: 0; }

@media (max-width: 767px) {
    .month-nav__jump { margin-left: 0; width: 100%; }
    .month-nav__jump .input { flex: 1; }

    .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .table--cards tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }
    .table--cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 4px 0;
        border: 0;
        text-align: left;
    }
    .table--cards td[data-label]::before {
        content: attr(data-label);
        flex: none;
        color: var(--text-muted);
        font-size: 12px;
    }
    .table--cards td:first-child { display: block; padding-bottom: 8px; }
    .table--cards td:first-child::before { content: none; }
    .table--cards .input--amount { max-width: 160px; }
    .table--cards .cell-actions { width: auto; text-align: left; }
    .table--cards td.is-leer { display: none; }
    /* Eine Zeilenüberschrift verhält sich wie die erste Zelle: oben, über die ganze Breite. */
    .table--cards th[scope="row"] { display: block; padding: 4px 0 8px; text-align: left; }
    /* Steht ein vollständiges Formularfeld in der Zelle, bekommt es den Rest der Breite.
       Ohne min-width bricht sein Inhalt nicht um und schiebt die Karte seitlich auf. */
    .table--cards td > .field { flex: 1 1 auto; min-width: 0; margin: 0; }
    .table--cards td > .field--check { flex: none; }
}
