/* ============================================================
   PYROPICK · PREMIUM DESIGN SYSTEM
   Zentrale, seitenübergreifende Gestaltung.
   Wird NACH den Modul-Styles geladen und vereinheitlicht das
   Erscheinungsbild (Farben, Typografie, Abstände, Schatten,
   Komponenten) – ohne die Funktionalität zu verändern.
   ============================================================ */

/* ---------- Design Tokens ---------- */
/* Shop-Feature-Gating: deaktivierte Funktionen ausgrauen */
.shop-feature-disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(60%);
}

/* PP-242: Hinweis, wenn der Benutzer keinen Shop-Schreibzugriff hat. */
.shop-write-banner {
    border-left: 4px solid var(--warning, #d98324);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

/* ---------- Schrift: Open Sans (selbst gehostet, CSP font-src 'self') ---------- */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('fonts/open-sans-latin-ext-wght.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('fonts/open-sans-latin-wght.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Farbwerte 1:1 zu backend/functions/ui_brand_theme.py (DEFAULT_* / _AHLERS_*_DERIVED).
   Flaches Design: Die *-grad-Tokens heißen aus Kompatibilitätsgründen weiter so,
   enthalten aber flache Farben (Farbschema-API, gespeicherte Overrides). */
:root {
    /* Marke – Ahlers Pyrotechnik (Moodboard v1): Anthrazit #161616, Signalrot #FE0000, Silber #B6B6B6 */
    --brand-50:  #fff0f0;
    --brand-100: #ffd1d1;
    --brand-200: #ffa6a6;
    --brand-400: #fe6161;
    --brand-500: #fe0000;
    --brand-600: #d00000;
    --brand-700: #b20000;
    --brand-grad: #161616;
    --brand-grad-btn: #d00000;
    --brand-grad-soft: #fff0f0;
    --silver: #b6b6b6;

    /* Neutrale Flächen */
    --bg:          #f4f4f4;
    --bg-grad:     #f4f4f4;
    --surface:     #ffffff;
    --surface-2:   #fafafa;
    --surface-3:   #f0f0f0;

    /* Linien */
    --border:        #e6e6e6;
    --border-strong: #cfcfcf;

    /* Text */
    --text:        #161616;
    --text-muted:  #555555;
    --text-faint:  #8a8a8a;

    /* Semantik */
    --success:      #16a34a;
    --success-bg:   #dcfce7;
    --success-text: #166534;
    --warning:      #d97706;
    --warning-bg:   #fef3c7;
    --warning-text: #92400e;
    --danger:       #dc2626;
    --danger-bg:    #fee2e2;
    --danger-text:  #991b1b;
    --info:         #0891b2;
    --info-bg:      #cffafe;
    --info-text:    #155e75;

    /* Pastell-Borders für Alerts/Cards */
    --success-border: #bbf7d0;
    --danger-border:  #fecaca;
    --warning-border: #fde68a;
    --info-border:    #a5f3fc;

    /* Weiche, getönte Kartenflächen (Item-Cards Picker/Packer) */
    --warning-bg-soft: #fffdf5;
    --success-bg-soft: #f3fbf6;

    /* Overlay/Scrim (z. B. Packer Cart-Gate) */
    --overlay-bg: rgba(244, 244, 244, .72);
    /* Dialog-Hintergrund (Modals, Login) – neutrales Anthrazit statt Blaustich */
    --modal-scrim: rgba(22, 22, 22, .55);

    /* Radien (v2, PP-303: etwas weicher als v1 – 8/12/16 → 10/14/20) */
    --r-xs: 6px;
    --r-sm: 10px;
    --r:    14px;
    --r-lg: 20px;
    --r-pill: 999px;
    --r-badge: 999px;

    /* Schatten – neutral, zurückhaltend */
    --shadow-xs: 0 1px 2px rgba(22, 22, 22, .05);
    --shadow-sm: 0 1px 2px rgba(22, 22, 22, .06), 0 1px 3px rgba(22, 22, 22, .04);
    --shadow:    0 4px 12px rgba(22, 22, 22, .07);
    --shadow-md: 0 8px 24px rgba(22, 22, 22, .09);
    --shadow-lg: 0 20px 44px rgba(22, 22, 22, .16);
    --shadow-brand: 0 1px 2px rgba(22, 22, 22, .12);

    /* Bewegung */
    --t: .18s cubic-bezier(.4, 0, .2, 1);
    /* Leichtes Überschwingen für Zähler, Badges, Haken (v2) */
    --t-spring: .32s cubic-bezier(.34, 1.56, .64, 1);

    /* v2 „Ruhig mit Tiefe“ (PP-303): geschichtete Elevation statt Einzelschatten.
       Stufe 1 = Karten, 2 = Hover/Kacheln/Sticky-Leisten, 3 = Dialoge/Paletten. */
    --elev-1: 0 1px 2px rgba(22, 22, 22, .04), 0 2px 8px rgba(22, 22, 22, .04);
    --elev-2: 0 1px 3px rgba(22, 22, 22, .06), 0 8px 20px rgba(22, 22, 22, .08);
    --elev-3: 0 2px 6px rgba(22, 22, 22, .08), 0 24px 56px rgba(22, 22, 22, .18);

    /* Glas für sticky Kopf, Scan-Leiste, Bottom-Navigation */
    --glass-bg: color-mix(in srgb, var(--surface) 82%, transparent);
    --glass-border: color-mix(in srgb, var(--border) 70%, transparent);
    --glass-blur: blur(14px) saturate(1.4);
    /* Glas-Kopfzeile im Apple-Stil (PP-311): leicht getönt statt reinweiß, kräftiger Blur
       mit Sättigung, Lichtkante oben, weicher Schatten schon im Ruhezustand – so hebt
       sich der Kopf vom weißen Inhalt ab. Grundfarben --header-bg/-text/-chip sind im
       Farbschema einstellbar (ui_brand_theme.py), alles Weitere wird daraus gemischt. */
    --header-bg: #e1e1e1;
    --header-text: #161616;
    --header-chip: #ffffff;
    --header-text-muted: color-mix(in srgb, var(--header-text) 70%, var(--header-bg));
    --header-glass-bg: color-mix(in srgb, var(--header-bg) 78%, transparent);
    --header-glass-border: color-mix(in srgb, var(--header-text) 12%, transparent);
    --header-glass-blur: blur(28px) saturate(1.9);
    --header-glass-edge: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -1px 0 rgba(255, 255, 255, .25);
    --header-glass-shadow: 0 1px 2px rgba(22, 22, 22, .06), 0 10px 28px -12px rgba(22, 22, 22, .22);
    --header-glass-shadow-scrolled: 0 1px 3px rgba(22, 22, 22, .08), 0 16px 36px -12px rgba(22, 22, 22, .3);
    /* Kopf-Buttons als schwebende Glas-Kapseln („Liquid Glass“): heller als die Leiste,
       Lichtkante oben, kleiner Schatten */
    --header-chip-bg: color-mix(in srgb, var(--header-chip) 72%, transparent);
    --header-chip-bg-hover: var(--header-chip);
    --header-chip-border: color-mix(in srgb, var(--header-text) 9%, transparent);
    --header-chip-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(22, 22, 22, .08), 0 4px 10px -4px rgba(22, 22, 22, .14);

    /* Typo-Skala (Display für Seitentitel, KPI für Kennzahlen) */
    --fs-display: 30px;
    --fs-h1: 24px;
    --fs-h2: 18px;
    --fs-kpi: 36px;

    /* Abstands-Skala (4er-Raster) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;

    /* Native Controls (Suche, Number-Spinner) folgen dem Theme */
    color-scheme: light;

    --font: 'Open Sans', Arial, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    /* Kopfzeile (App-Shell): Höhe, damit Seitenkopf und Menükopf bündig sind */
    --shell-header-h: 64px;
    --shell-accent: 3px;

    /* Text auf Marke (Header, Primärbutton) – überschreibbar im Farbschema */
    --on-brand: #ffffff;
    --header-ink: #161616;
    --brand-grad-btn-hover: #b20000;
    --success-grad: #16a34a;
    --success-grad-hover: #15803d;
    --success-shadow: 0 1px 2px rgba(22, 22, 22, .12);
    --success-on: #ffffff;
    --danger-grad: #dc2626;
    --danger-grad-hover: #b91c1c;
    --danger-shadow: 0 1px 2px rgba(22, 22, 22, .12);
    --danger-on: #ffffff;
    --warning-grad: #f59e0b;
    --warning-grad-hover: #d97706;
    --warning-shadow: 0 1px 2px rgba(22, 22, 22, .12);
    --warning-on: #43320b;
    --info-on: #ffffff;
}

/* ---------- Dark Mode (neutrales Anthrazit, Marken-Silber als Sekundärtext) ---------- */
:root[data-theme="dark"] {
    --brand-50:  rgba(255, 59, 59, .12);
    --brand-100: rgba(255, 59, 59, .22);
    --brand-200: rgba(255, 59, 59, .35);
    --brand-400: #ff7a7a;
    --brand-500: #ff3b3b;
    --brand-600: #ff6b6b;
    --brand-700: #ffa3a3;
    --brand-grad: #0b0b0b;
    --brand-grad-btn: #d00000;
    --brand-grad-soft: #271313;

    --bg:          #0f0f0f;
    --bg-grad:     #0f0f0f;
    --surface:     #161616;
    --surface-2:   #1d1d1d;
    --surface-3:   #262626;

    --border:        #2e2e2e;
    --border-strong: #3d3d3d;

    --text:        #f2f2f2;
    --text-muted:  #b6b6b6;
    --text-faint:  #8a8a8a;

    --success:      #34d071;
    --success-bg:   rgba(52, 208, 113, .16);
    --success-text: #6fe3a0;
    --warning:      #f5a623;
    --warning-bg:   rgba(245, 166, 35, .16);
    --warning-text: #f7c15c;
    --danger:       #f0554a;
    --danger-bg:    rgba(240, 85, 74, .16);
    --danger-text:  #f58c83;
    --info:         #35c2dd;
    --info-bg:      rgba(53, 194, 221, .16);
    --info-text:    #7fd8e9;

    --success-border: rgba(52, 208, 113, .4);
    --danger-border:  rgba(240, 85, 74, .4);
    --warning-border: rgba(245, 166, 35, .4);
    --info-border:    rgba(53, 194, 221, .4);

    --warning-bg-soft: rgba(245, 166, 35, .08);
    --success-bg-soft: rgba(52, 208, 113, .08);

    --overlay-bg: rgba(15, 15, 15, .72);
    --modal-scrim: rgba(0, 0, 0, .6);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .25);
    --shadow:    0 4px 12px rgba(0, 0, 0, .4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 44px rgba(0, 0, 0, .55);
    --shadow-brand: 0 1px 2px rgba(0, 0, 0, .4);

    /* Elevation dunkel: feine Lichtkante oben ersetzt den im Dunkeln unsichtbaren Schatten */
    --elev-1: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .4);
    --elev-2: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 20px rgba(0, 0, 0, .45);
    --elev-3: inset 0 1px 0 rgba(255, 255, 255, .07), 0 24px 56px rgba(0, 0, 0, .6);

    --header-glass-edge: inset 0 1px 0 rgba(255, 255, 255, .08);
    --header-glass-shadow: 0 1px 0 rgba(0, 0, 0, .45), 0 10px 28px -12px rgba(0, 0, 0, .7);
    --header-glass-shadow-scrolled: 0 1px 0 rgba(0, 0, 0, .55), 0 16px 36px -10px rgba(0, 0, 0, .8);
    --header-bg: #343434;
    --header-text: #f2f2f2;
    --header-chip: #4a4a4a;
    --header-chip-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .5), 0 4px 12px -4px rgba(0, 0, 0, .6);

    color-scheme: dark;

    --on-brand: #ffffff;
    --header-ink: #0b0b0b;
    --brand-grad-btn-hover: #e00000;
    --success-grad: #22c55e;
    --success-grad-hover: #34d071;
    --success-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --success-on: #052e16;
    --danger-grad: #dc2626;
    --danger-grad-hover: #ef4444;
    --danger-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --danger-on: #ffffff;
    --warning-grad: #f5a623;
    --warning-grad-hover: #f7b84a;
    --warning-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --warning-on: #1a1408;
    --info-on: #052e38;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --brand-50:  rgba(255, 59, 59, .12);
        --brand-100: rgba(255, 59, 59, .22);
        --brand-200: rgba(255, 59, 59, .35);
        --brand-400: #ff7a7a;
        --brand-500: #ff3b3b;
        --brand-600: #ff6b6b;
        --brand-700: #ffa3a3;
        --brand-grad: #0b0b0b;
        --brand-grad-btn: #d00000;
        --brand-grad-soft: #271313;

        --bg:          #0f0f0f;
        --bg-grad:     #0f0f0f;
        --surface:     #161616;
        --surface-2:   #1d1d1d;
        --surface-3:   #262626;

        --border:        #2e2e2e;
        --border-strong: #3d3d3d;

        --text:        #f2f2f2;
        --text-muted:  #b6b6b6;
        --text-faint:  #8a8a8a;

        --success:      #34d071;
        --success-bg:   rgba(52, 208, 113, .16);
        --success-text: #6fe3a0;
        --warning:      #f5a623;
        --warning-bg:   rgba(245, 166, 35, .16);
        --warning-text: #f7c15c;
        --danger:       #f0554a;
        --danger-bg:    rgba(240, 85, 74, .16);
        --danger-text:  #f58c83;
        --info:         #35c2dd;
        --info-bg:      rgba(53, 194, 221, .16);
        --info-text:    #7fd8e9;

        --success-border: rgba(52, 208, 113, .4);
        --danger-border:  rgba(240, 85, 74, .4);
        --warning-border: rgba(245, 166, 35, .4);
        --info-border:    rgba(53, 194, 221, .4);

        --warning-bg-soft: rgba(245, 166, 35, .08);
        --success-bg-soft: rgba(52, 208, 113, .08);

        --overlay-bg: rgba(15, 15, 15, .72);
        --modal-scrim: rgba(0, 0, 0, .6);

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .25);
        --shadow:    0 4px 12px rgba(0, 0, 0, .4);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
        --shadow-lg: 0 20px 44px rgba(0, 0, 0, .55);
        --shadow-brand: 0 1px 2px rgba(0, 0, 0, .4);

        /* Elevation dunkel: feine Lichtkante oben ersetzt den im Dunkeln unsichtbaren Schatten */
        --elev-1: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .4);
        --elev-2: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 20px rgba(0, 0, 0, .45);
        --elev-3: inset 0 1px 0 rgba(255, 255, 255, .07), 0 24px 56px rgba(0, 0, 0, .6);

        --header-glass-edge: inset 0 1px 0 rgba(255, 255, 255, .08);
        --header-glass-shadow: 0 1px 0 rgba(0, 0, 0, .45), 0 10px 28px -12px rgba(0, 0, 0, .7);
        --header-glass-shadow-scrolled: 0 1px 0 rgba(0, 0, 0, .55), 0 16px 36px -10px rgba(0, 0, 0, .8);
        --header-bg: #343434;
        --header-text: #f2f2f2;
        --header-chip: #4a4a4a;
        --header-chip-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .5), 0 4px 12px -4px rgba(0, 0, 0, .6);

        color-scheme: dark;

        --on-brand: #ffffff;
        --header-ink: #0b0b0b;
        --brand-grad-btn-hover: #e00000;
        --success-grad: #22c55e;
        --success-grad-hover: #34d071;
        --success-shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --success-on: #052e16;
        --danger-grad: #dc2626;
        --danger-grad-hover: #ef4444;
        --danger-shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --danger-on: #ffffff;
        --warning-grad: #f5a623;
        --warning-grad-hover: #f7b84a;
        --warning-shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --warning-on: #1a1408;
        --info-on: #052e38;
    }
}

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

body {
    font-family: var(--font);
    background: var(--bg-grad);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Shell-Normalisierung: unabhängig davon, ob ein Modul einen CSS-Reset mitbringt
   (Konto/Zeiterfassung haben keinen – sonst verschieben Browser-Abstände die Kopfzeile). */
body { margin: 0; }
header h1 { margin: 0; }
header .header-subtitle { margin: 2px 0 0; }

::selection {
    background: var(--brand-100);
    color: var(--text);
}

/* Dezente, moderne Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

/* Sichtbarer, eleganter Fokus-Ring (nur Tastatur) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* ---------- Header ---------- */
/* Helle Glas-Kopfzeile (PP-311): sticky, Inhalt scrollt unscharf darunter durch.
   Nur der Shell-Kopf (.container > header) – andere <header> bleiben unberührt.
   Rot nur als Marker am Titel; Schatten wird beim Scrollen kräftiger (.is-scrolled, menu.js). */
.container > header {
    position: sticky;
    top: 0;
    z-index: 80;          /* unter Bottom-Nav (85), FAB (90), Sheets (1000) und Menü */
    background: var(--header-glass-bg);
    -webkit-backdrop-filter: var(--header-glass-blur);
    backdrop-filter: var(--header-glass-blur);
    color: var(--header-text);
    border-bottom: 1px solid var(--header-glass-border);
    box-shadow: var(--header-glass-edge), var(--header-glass-shadow);
    transition: box-shadow var(--t);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .container > header { background: var(--header-bg); }
}
.container > header.is-scrolled {
    box-shadow: var(--header-glass-edge), var(--header-glass-shadow-scrolled);
}
header h1 {
    font-weight: 700;
    letter-spacing: 0;
}
/* Kopf-Aktionen als Glas-Kapseln (PP-311): Textbuttons als Pille, Icon-Buttons rund.
   Hover hellt die Kapsel auf – gleiche Sprache im Menükopf (menu.css). */
.container > header .btn-secondary,
.container > header .btn:not(.btn-primary) {
    margin: 0;            /* Modul-Abstände (z. B. Picker) würden den 64px-Kopf strecken */
    width: auto;          /* Picker setzt Buttons auf 100 % – im Kopf nur so breit wie der Text */
    min-height: 40px;
    height: 40px;
    padding: 0 16px;
    background: var(--header-chip-bg);
    color: var(--header-text);
    border: 1px solid var(--header-chip-border);
    box-shadow: var(--header-chip-shadow);
    border-radius: var(--r-pill);
    font-weight: 600;
    transition: background var(--t), color var(--t), transform var(--t);
}
.container > header .btn-icon {
    width: 40px;
    min-width: 40px;
    padding: 0;
    color: var(--header-text-muted);
}
.container > header .btn-secondary:hover,
.container > header .btn:not(.btn-primary):hover {
    background: var(--header-chip-bg-hover);
    color: var(--header-text);
}
.container > header .btn-secondary:active,
.container > header .btn:not(.btn-primary):active { transform: scale(.96); }
.container > header .btn-primary {
    min-height: 40px;
    height: 40px;
    border-radius: var(--r-pill);
}

/* Anker und scrollIntoView landen nicht unter dem sticky Kopf */
html { scroll-padding-top: var(--shell-sticky-top, 0px); }

/* ---------- Buttons ---------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    font-family: var(--font);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t), box-shadow var(--t), border-color var(--t), color var(--t);
    -webkit-tap-highlight-color: transparent;
}
/* Flach: kein Hover-Sprung, Rückmeldung nur über die Fläche */
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-danger:active,
.btn-warning:active { transform: scale(.98); }

/* Primär: Fläche --brand-grad-btn (abgedunkeltes Rot, Weiß ≥ 4,5:1); #FE0000 bleibt Akzent */
.btn,
.btn-primary {
    background: var(--brand-grad-btn);
    color: var(--on-brand);
    box-shadow: var(--shadow-brand);
}
.btn:hover,
.btn-primary:hover {
    background: var(--brand-grad-btn-hover);
}

/* Sekundärbutton (außerhalb des Headers) */
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: none;
}
.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--text-faint);
}

.btn-success {
    background: var(--success-grad);
    color: var(--success-on);
    box-shadow: var(--success-shadow);
}
.btn-success:hover { background: var(--success-grad-hover); }

.btn-danger {
    background: var(--danger-grad);
    color: var(--danger-on);
    box-shadow: var(--danger-shadow);
}
.btn-danger:hover { background: var(--danger-grad-hover); }

.btn-warning {
    background: var(--warning-grad);
    color: var(--warning-on);
    box-shadow: var(--warning-shadow);
}
.btn-warning:hover { background: var(--warning-grad-hover); }

button:disabled,
.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-with-icon svg { flex-shrink: 0; }

/* ---------- Formulare ---------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="tel"],
select,
textarea {
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder { color: var(--text-faint); }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
    background: var(--surface);
}

label { color: var(--text); }
small { color: var(--text-muted); }

/* ---------- Karten / Flächen ---------- */
.card,
.stat-card,
.user-card,
.picklist-card,
.picklist-item,
.detail-header,
.scan-section,
.items-section,
.packages-section,
.print-section,
.sync-status,
.activities-table,
.activities-filter,
.current-pickup,
.table-window-container,
.filter-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--elev-1);
    transition: box-shadow var(--t), border-color var(--t);
}

/* Flach: Hover nur über Rahmen und leichten Schatten, kein Anheben */
.card:hover,
.stat-card:hover,
.user-card:hover {
    box-shadow: var(--elev-2);
    border-color: var(--border-strong);
}

.card h2 { color: var(--text); font-weight: 700; }
.card p { color: var(--text-muted); }
.stat-card .value { color: var(--brand-600); }

/* Eyebrow-Label (Moodboard „SUB-HEADING“): klein, Versalien, gesperrt.
   --text-muted statt --text-faint: die Labels tragen Information (WCAG ≥ 4,5:1). */
.eyebrow,
.stat-card h3,
.picklist-stats-grid .stat-item .label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Listenkarten / anklickbare Elemente (1.5px: Rahmen trägt Statusfarbe, im Lager gut sichtbar) */
.item-card,
.picklist-card,
.picklist-item {
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}
.item-card.clickable:hover,
.picklist-card:hover,
.picklist-item:hover {
    border-color: var(--brand-400);
    box-shadow: var(--elev-2);
}
.picklist-item.active {
    border-color: var(--brand-500);
    background: var(--brand-50);
    box-shadow: 0 0 0 3px var(--brand-100);
}

/* Artikelkarten (Picker/Packer) – v2, PP-305: neutrale Fläche, Status als
   4px-Streifen links und großer Mengenzähler statt vollflächiger Tönung.
   Im Packer heißt `.picked` „noch zu packen“ – die Umdeutung steht in
   packer/style.css (#packer-main-content). */
.item-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--elev-1);
}
.item-card.open {
    border-color: var(--border);
    border-left-color: var(--warning);
    background: var(--surface);
}
.item-card.picked,
.item-card.packed {
    border-color: var(--border);
    border-left-color: var(--success);
    background: var(--surface);
}
.item-card.clickable:hover {
    border-color: var(--border-strong);
    border-left-color: var(--brand-500);
    box-shadow: var(--elev-2);
}
.item-card .progress-text {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.01em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.item-card .progress-unit {
    margin-left: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-muted);
}
.item-card.picked .progress-text,
.item-card.packed .progress-text { color: var(--success-text); }
.item-card.picked .progress-fill,
.item-card.packed .progress-fill { background: var(--success); }
.click-hint { color: var(--brand-500); }

/* Filter-Chips (PP-305): kurze Statusfilter über Listen, mit Zähler.
   Gruppe mit role="group", Chips mit aria-pressed. */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
    -webkit-tap-highlight-color: transparent;
}
.filter-chip:hover { color: var(--text); border-color: var(--text-faint); }
.filter-chip.is-active {
    color: var(--text);
    background: var(--brand-50);
    border-color: var(--brand-500);
}
.filter-chip-count {
    min-width: 20px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface-3);
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}
.filter-chip.is-active .filter-chip-count {
    color: var(--on-brand);
    background: var(--brand-grad-btn);
}

/* Lagerort als Chip mit Text (Picker, öffnet das Lagerplatz-Popup) */
.item-loc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 32px;
    margin: 0 0 8px;
    padding: 4px 10px 4px 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.item-loc-chip svg { flex-shrink: 0; color: var(--brand-500); }
.item-loc-chip:hover { border-color: var(--brand-400); }
.item-loc-chip-more { color: var(--text-muted); font-weight: 600; }

/* ---------- Picklisten-Info (Picker) ---------- */
.picklist-info { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.info-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.info-box .label { color: var(--text-muted); letter-spacing: .4px; }
.info-box .value { color: var(--text); }

/* ---------- Status-Badges & Indikatoren ---------- */
.status-badge,
.status-indicator,
.badge {
    border-radius: var(--r-badge);
    font-weight: 700;
    letter-spacing: .4px;
}
.status-indicator.open,   .badge-warning, .status-badge.open   { background: var(--warning-bg); color: var(--warning-text); }
.status-indicator.picking,.badge-info,    .status-badge.picking,
.status-badge.packing { background: var(--info-bg); color: var(--info-text); }
.status-indicator.picked, .badge-success, .status-badge.picked,
.status-badge.active { background: var(--success-bg); color: var(--success-text); }
.badge-danger, .status-badge.inactive { background: var(--danger-bg); color: var(--danger-text); }
.status-badge.packed { background: var(--info-bg); color: var(--info-text); }
.status-badge.abgeholt { background: var(--success-bg); color: var(--success-text); }

/* v2 (PP-303): Statuspunkt vor dem Text. Die kräftige Semantikfarbe trägt der Punkt,
   die Fläche bleibt zart – so bleibt der Status auch bei kleiner Schrift erkennbar. */
.status-indicator.open, .status-badge.open, .badge-warning { --dot: var(--warning); }
.status-indicator.picking, .status-badge.picking, .status-badge.packing,
.status-badge.packed, .badge-info { --dot: var(--info); }
.status-indicator.picked, .status-badge.picked, .status-badge.active,
.status-badge.abgeholt, .badge-success { --dot: var(--success); }
.status-badge.inactive, .badge-danger { --dot: var(--danger); }
.status-badge::before,
.status-indicator::before,
.badge-warning::before,
.badge-info::before,
.badge-success::before,
.badge-danger::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    vertical-align: 1px;
    border-radius: 50%;
    background: var(--dot, currentColor);
    flex-shrink: 0;
}

/* ---------- Tabellen ---------- */
.table,
.activities-table {
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--elev-1);
}
.table th,
.activities-table th {
    background: var(--surface-2) !important;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 11px;
    border-bottom: 1px solid var(--border) !important;
}
.table td,
.activities-table td { border-bottom: 1px solid var(--border); color: var(--text); }
.table tr:hover,
.activities-table tbody tr:hover { background: var(--surface-2); }
.table th.sortable:hover,
.table th:hover { background: var(--surface-3) !important; }

/* Sticky Tabellenkopf in scrollbaren Fenstern (PP-306). Die Tabelle selbst darf dort
   nicht clippen, sonst klebt der Kopf an ihr statt am Fenster. */
.table-window-wrapper > .table,
.table-wrapper > .table { overflow: visible; }
.table-window-wrapper .table thead th,
.table-wrapper .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Kompakte Zeilen (bindTableDensityToggle in common/ui.js) */
.table.table--compact { font-size: 13px; }
.table.table--compact th,
.table.table--compact td {
    padding-top: 4px;
    padding-bottom: 4px;
}

/* Tabellen-Container */
.table-window-container { padding: 16px; }
.table-window-wrapper { border: 1px solid var(--border); border-radius: var(--r-sm); }

/* ---------- Segmented Control (PP-306) ----------
   Kurze, sich ausschließende Filter (z. B. Alle / Pyro / Betriebsmittel).
   Gruppe mit role="group", Buttons mit aria-pressed und .is-active. */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}
.segmented-btn {
    min-height: 36px;
    padding: 6px 14px;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: 0;
    border-radius: calc(var(--r-sm) - 3px);
    cursor: pointer;
    transition: background var(--t), color var(--t), box-shadow var(--t);
    -webkit-tap-highlight-color: transparent;
}
.segmented-btn:hover { color: var(--text); }
.segmented-btn.is-active {
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--elev-1);
}

/* ---------- Kennzahl-Kacheln mit Drill-down (PP-306) ----------
   `.stat-card.kpi` als <button>: Klick filtert die Tabelle darunter,
   aria-pressed zeigt den aktiven Filter. */
button.kpi {
    display: block;
    width: 100%;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.kpi .value { font-variant-numeric: tabular-nums; }
.stat-card.kpi.is-clickable { transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.stat-card.kpi.is-clickable:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--elev-2);
}
.stat-card.kpi[aria-pressed="true"] {
    border-color: var(--brand-500);
    background: var(--brand-50);
}
.kpi-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

/* ---------- Admin-Tabs (Segmented Control) ---------- */
.admin-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    margin-bottom: 16px;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.tab-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 12px 24px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--t), color var(--t), box-shadow var(--t), border-color var(--t), transform var(--t);
    -webkit-tap-highlight-color: transparent;
}
.tab-button:hover {
    background: var(--surface);
    color: var(--text);
}
/* Aktiver Tab: neutraler Text, Marke nur als Unterstrich */
.tab-button.active {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
    box-shadow: inset 0 -2px 0 var(--brand-500), var(--shadow-xs);
}
.tab-button:active { transform: scale(.98); }

.section-header h2 { color: var(--text); font-weight: 700; }

/* ---------- Modals ---------- */
.modal,
.warning-popup {
    background: var(--modal-scrim) !important;
    backdrop-filter: blur(4px);
}
.modal-content,
.warning-popup-content {
    border-radius: var(--r-lg);
    box-shadow: var(--elev-3);
    /* Getönte Kante statt Weiss – sonst leuchtet der Rahmen im Darkmode */
    border: 1px solid var(--border);
}
/* Login-Modal (Hintergrund, Karte, Kopf) gestaltet login.css komplett (PP-373) */

/* Dialoge aus ui.js (PP-339): Sie laufen auf jeder Seite, die Anordnung von .modal stand aber
   nur in admin/style.css. Ohne sie landete der Dialog am Seitenende. Bewusst über die IDs:
   Lagerhaus und Pyrostorage haben eigene .modal-Regeln, die sonst überschrieben würden. */
#ui-confirm-dialog,
#ui-confirm-phrase-dialog,
#ui-email-input-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
#ui-confirm-dialog .modal-content,
#ui-confirm-phrase-dialog .modal-content,
#ui-email-input-dialog .modal-content {
    width: 100%;
    max-height: 90vh;
    padding: 0 20px 20px;
    overflow-y: auto;
    background: var(--surface);
}
#ui-confirm-dialog .modal-header,
#ui-confirm-phrase-dialog .modal-header,
#ui-email-input-dialog .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -20px 16px;
    padding: 16px 20px;
}
#ui-confirm-dialog .modal-header h2,
#ui-confirm-phrase-dialog .modal-header h2,
#ui-email-input-dialog .modal-header h2 {
    margin: 0;
    font-size: 18px;
}
#ui-confirm-dialog .close-btn,
#ui-confirm-phrase-dialog .close-btn,
#ui-email-input-dialog .close-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    border-radius: var(--r-pill);
}
#ui-confirm-dialog .flex-end-row,
#ui-confirm-phrase-dialog .flex-end-row,
#ui-email-input-dialog .flex-end-row {
    align-items: center;
}
/* Picker- und Pickup-Stylesheets machen Buttons breit und geben .btn-secondary einen
   Unterabstand – der streckte den Nachbarbutton in der Flex-Zeile auf ungleiche Höhe */
#ui-confirm-dialog .flex-end-row .btn,
#ui-confirm-phrase-dialog .flex-end-row .btn,
#ui-email-input-dialog .flex-end-row .btn {
    width: auto;
    margin: 0;
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-header h2 { color: var(--text); font-weight: 700; }
.modal-actions { border-top: 1px solid var(--border); }
/* Ohne Reset zeigt der Browser seinen Standardrahmen (Picker hat keine eigene .close-btn-Regel) */
.close-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
}
.modal-close,
.login-modal-close,
.close-btn {
    border-radius: var(--r-xs);
    color: var(--text-muted);
    transition: background var(--t), color var(--t);
}
.modal-close:hover,
.login-modal-close:hover,
.close-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Alerts / Meldungen ---------- */
.alert { border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 500; }
.alert-success, .success-message { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-error, .error-message, .login-error { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.alert-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.success-message, .error-message { border-radius: var(--r-sm); border-style: solid; border-width: 1px; }

.header-success-message {
    background: var(--success-bg) !important;
    color: var(--success-text) !important;
    box-shadow: var(--shadow-md);
}

/* Scan-Feedback */
.scan-feedback { border-radius: var(--r-sm); font-weight: 600; }
.scan-feedback.success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.scan-feedback.error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }

/* ---------- Auf-/zuklappbare Karte (<details class="card collapsible-card">) ---------- */
.collapsible-card-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.collapsible-card-summary::-webkit-details-marker { display: none; }
.collapsible-card-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.collapsible-card-heading {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
}
.collapsible-card-toggle {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform var(--t);
}
.collapsible-card[open] > .collapsible-card-summary .collapsible-card-toggle {
    transform: rotate(-135deg);
    margin-top: 4px;
}
.collapsible-card-body {
    margin-top: 16px;
}

/* ---------- Fortschrittsbalken ---------- */
.progress-bar { background: var(--surface-3); border-radius: var(--r-pill); }
.progress-fill { background: var(--brand-500); border-radius: var(--r-pill); }
.progress-text { color: var(--brand-600); }

/* ---------- Lade-Zustände ---------- */
.loading,
.no-selection { color: var(--text-muted); }
.loading::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    vertical-align: -4px;
    border: 2.5px solid var(--brand-100);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: pp-spin .7s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }

/* ---------- Skeleton-Loader (v2, PP-303) ----------
   Platzhalter in der Form des späteren Inhalts statt Spinner-Text.
   Markup erzeugt `renderSkeleton()` in common/ui.js (auch automatisch für
   `[data-skeleton]`). Der Schimmer ist ein funktionaler Verlauf (Design-System §1.1). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Lädt ein `.loading`-Element ein Skeleton, entfallen Spinner und Zentrierung.
   Ersetzt JS den Inhalt später durch Text (Fehlerfall), greift wieder der Spinner. */
.loading:has(> .skeleton-group) {
    display: block;
    min-height: 0;
    padding: var(--space-4);
}
.loading:has(> .skeleton-group)::before { content: none; }
.skeleton-group { display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface-3);
    border-radius: var(--r-xs);
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent);
    animation: pp-shimmer 1.4s ease-in-out infinite;
}
@keyframes pp-shimmer { to { transform: translateX(100%); } }
.skeleton-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--elev-1);
}
.skeleton-line { height: 12px; width: 100%; }
.skeleton-line--title { height: 18px; width: 38%; }
.skeleton-line--short { width: 62%; }
.skeleton-line--bar { height: 6px; border-radius: var(--r-pill); }
.skeleton-chips { display: flex; gap: var(--space-2); }
.skeleton-chip { height: 24px; width: 92px; border-radius: var(--r-pill); }
.skeleton-row {
    display: grid;
    grid-template-columns: 2fr 3fr 1fr 1fr;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}
.skeleton-row:last-child { border-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
    .skeleton::after { content: none; }
}

/* ---------- Suchleisten / Sektionen ---------- */
.admin-search-section { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.scan-section { border: 1px solid var(--border); }
.package-badge {
    background: var(--brand-50);
    border: 1.5px solid var(--brand-200);
    color: var(--brand-700);
    border-radius: var(--r-pill);
}
.package-indicator.scanned { background: var(--brand-500) !important; border-color: var(--brand-500) !important; }

/* ---------- Packer-Sidebar ---------- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); }
.sidebar h2 { background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text); font-weight: 700; }

/* ---------- Aktivitäten ---------- */
.activities-day-header { background: var(--brand-grad) !important; border-radius: var(--r-sm); box-shadow: none; }

/* ---------- Filter-Dropdowns ---------- */
.filter-dropdown { border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-md); }
.filter-dropdown-footer .btn-apply { background: var(--brand-grad-btn); }
.filter-btn.has-filter { background: var(--brand-50); }

/* ---------- Picker/Packer: Stat-Grid & Scan-Bar ---------- */
.picklist-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    padding: 16px 20px;
}
.picklist-stats-grid .stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.picklist-stats-grid .stat-item .value,
.picklist-stats-grid .stat-item > span:not(.label) {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
.picklist-stats-grid .stat-item.stat-full {
    grid-column: 1 / -1;
}
.picklist-stats-grid .stat-row-primary {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.picklist-stats-grid .stat-left,
.picklist-stats-grid .stat-right {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.picklist-stats-grid .stat-right {
    text-align: right;
    align-items: flex-end;
    flex-shrink: 0;
}
.picklist-detail-page .scan-section,
.picklist-detail-page #cart-scan-section {
    position: sticky;
    top: var(--shell-sticky-top, 0px);   /* unter dem sticky Glas-Kopf (PP-311) */
    z-index: 20;
    background: var(--surface);
    box-shadow: var(--elev-2);
}
.picklist-detail-page #scan-feedback {
    margin: 0 20px 8px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Übersicht: Mini-Fortschritt auf Picklist-Karten */
.card-progress {
    margin-top: 12px;
}
.card-progress-bar {
    height: 6px;
    background: var(--surface-3);
    border-radius: var(--r-pill);
    overflow: hidden;
    margin-bottom: 6px;
}
.card-progress-fill {
    height: 100%;
    background: var(--brand-500);
    border-radius: var(--r-pill);
    transition: width var(--t);
}
.card-progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Sofort-Feedback beim Hochzählen (ohne Layout-Shift): der Zähler federt kurz
   auf (v2, PP-305) statt die ganze Karte einzufärben */
.item-card.just-updated .progress-text {
    animation: qty-pop var(--t-spring);
}
@keyframes qty-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}
.progress-text {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.item-progress .progress-bar {
    height: 10px;
}

/* ---------- Scan-Flash (PP-305) ----------
   Farbiger Rand um den ganzen Bildschirm nach einem Scan (`scanFeedback()` in
   common/ui.js). Liegt über allem, fängt aber keine Klicks ab. */
.scan-flash {
    position: fixed;
    inset: 0;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    --flash: var(--success);
}
.scan-flash.is-ok      { --flash: var(--success); }
.scan-flash.is-warning { --flash: var(--warning); }
.scan-flash.is-error   { --flash: var(--danger); }
.scan-flash[class*="is-"] {
    box-shadow:
        inset 0 0 0 6px var(--flash),
        inset 0 0 48px color-mix(in srgb, var(--flash) 45%, transparent);
    animation: scan-flash .5s ease-out forwards;
}
@keyframes scan-flash {
    0%   { opacity: 1; }
    60%  { opacity: .85; }
    100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    /* Ohne Ausblenden: kurz stehender Rahmen, JS entfernt ihn nach 500 ms */
    .scan-flash[class*="is-"] { animation: none; opacity: 1; }
}

/* Kurzes grünes Aufleuchten eines Buttons nach Erfolg, z. B. Druckauftrag
   (flashButtonSuccess in common/ui.js; Packer, Code & Label) */
.btn-flash-success {
    animation: btn-flash-success 1.4s ease-out;
}
@keyframes btn-flash-success {
    25% {
        background: var(--success, #16a34a);
        border-color: var(--success, #16a34a);
        color: var(--success-on, #fff);
    }
}

/* ---------- Seitenwechsel (v2, PP-303) ----------
   Seitenübergreifende View Transitions: Der Browser hält die alte Seite, bis die
   neue rendert, und blendet kurz über (Chrome/Edge ab 126, Safari ab 18.2).
   Ältere Browser nutzen weiter app-leaving/app-entering aus menu.css. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .18s;
    animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
}

/* ---------- Reduzierte Bewegung respektieren ---------- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    .loading::before { animation: pp-spin 1.2s linear infinite !important; }
}

/* ============================================================
   LAYOUT-KONTEXTE & GEMEINSAME SHELL-KOMPONENTEN
   body-Klassen: layout-desktop | layout-fulfillment | layout-wide
   ============================================================ */

/* Standard-Container (Desktop) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--surface);
    min-height: 100vh;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.06);
}

body.layout-desktop .container {
    max-width: 1200px;
}

body.layout-wide .container {
    max-width: 1500px;
    padding: 10px;
}

@media (min-width: 768px) {
    body.layout-wide .container { padding: 20px; }
}

/* Glas-Kopf randlos bis an den Fensterrand (PP-311): negativer Rand = Container-Padding.
   Ab 1025px setzt menu.css das Padding mit fester Sidebar ohnehin auf 0. */
@media (max-width: 1024px) {
    body.layout-wide .container > header { margin: -10px -10px 0; }
}
@media (min-width: 768px) and (max-width: 1024px) {
    body.layout-wide .container > header { margin: -20px -20px 0; }
}

body.layout-fulfillment {
    padding: 12px;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
}

body.layout-fulfillment .container {
    max-width: 680px;
    margin: 16px auto;
    border-radius: var(--r-lg);
    box-shadow: var(--elev-2);
    /* clip statt hidden: hidden wäre ein Scroll-Container, an dem der sticky
       Glas-Kopf hängen bliebe (Muster aus betriebsmittel.css) */
    overflow: clip;
    border: 1px solid var(--border);
    min-height: auto;
}

/* ---------- Header-Shell ---------- */
/* min-height = Menükopf (menu.css), damit die Haarlinie bündig durchläuft */
.container > header {
    box-sizing: border-box;
    min-height: var(--shell-header-h);
    /* Vertikal knapp: 44px-Buttons + Linie bleiben in 64px, min-height zentriert */
    padding: 6px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-title-group {
    flex: 1;
    min-width: 0;
}

/* Breadcrumb „Sektion / Seite“ (PP-304, gesetzt von menu.js). PP-311: ab Tablet
   eine Zeile – Marker · Bereich / · Titel · Untertitel. Unter 768px nur Titel + Untertitel. */
.header-breadcrumb {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--header-text-muted);
    white-space: nowrap;
}
.header-breadcrumb::after {
    content: "/";
    margin-left: 8px;
    color: color-mix(in srgb, var(--header-text) 45%, var(--header-bg));
}
@media (min-width: 768px) {
    .container > header .header-title-group:not(.header-title-group--detail) {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    /* Roter Marker = „hier bist du“, wie der Balken am aktiven Menüeintrag */
    .container > header .header-title-group:not(.header-title-group--detail)::before {
        content: "";
        flex-shrink: 0;
        width: 3px;
        height: 18px;
        margin-right: 6px;
        border-radius: var(--r-pill);
        background: var(--brand-500);
    }
    .container > header .header-title-group h1 { flex-shrink: 0; }
    .container > header .header-title-group:not(.header-title-group--detail) .header-subtitle {
        min-width: 0;
        margin: 0 0 0 6px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
}
@media (max-width: 767px) {
    .header-breadcrumb { display: none; }
}

/* Quadratischer Icon-Button (z. B. ↻ im Seitenkopf); Text steht in aria-label/title */
.btn-icon,
header .btn-icon {
    width: 44px;
    min-width: 44px;
    padding: 0;
}
.btn-icon svg { flex-shrink: 0; }

/* Initialen-Avatar (Menü, Picklisten-Bearbeiter) – avatarHtml() in menu.js */
.avatar {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-grad, #161616);
    color: var(--on-brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--brand-500);
}
.avatar--sm {
    width: 22px;
    height: 22px;
    font-size: 9px;
    box-shadow: none;
}

.header-title-group--detail {
    text-align: center;
}

header h1 {
    font-size: 20px;
    line-height: 1.2;
    color: var(--header-text, var(--text));
}

.header-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--header-text-muted, var(--text-muted));
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
}

.back-link {
    color: var(--header-text, var(--text));
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
}

/* ---------- Main-Content-Layout ---------- */
.main-content-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--elev-1);
    padding: 24px;
    min-height: 0;
    min-width: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--elev-1);
    overflow: hidden;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    background: transparent;
    border: none;
}

.sidebar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-600);
}

/* ---------- Sektions-Header ---------- */
.section-head {
    margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
}

.section-head p {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.section-head--inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---------- Empty State & Loading ---------- */
.loading,
.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
}

.empty-state {
    max-width: 360px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--brand-500);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
}

td.empty-state,
.az-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 16px;
}

/* ---------- Kacheln (v2, PP-303) ----------
   Übersichtsseiten (Admin, Storage-Hub). Die ganze Kachel ist der Link; Markup
   erzeugt `renderTileGroups()` in common/tiles.js. Klickbare Kacheln dürfen sich
   leicht anheben (Ausnahme vom flachen Button-Verhalten, Design-System §1.1). */
.tile-groups {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
}
.tile-group-title { margin: 0 0 var(--space-3); }
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}
.tile {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5);
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--elev-1);
    transition: transform var(--t), box-shadow var(--t), border-color var(--t);
    -webkit-tap-highlight-color: transparent;
}
.tile:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--elev-2);
}
.tile:active { transform: translateY(0) scale(.99); }
.tile:focus-visible { border-radius: var(--r); }
.tile-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    background: var(--brand-50);
    color: var(--brand-600);
    transition: background var(--t), color var(--t);
}
.tile:hover .tile-icon {
    background: var(--brand-grad-btn);
    color: var(--on-brand);
}
.tile-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.tile-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.tile-text { font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.tile-arrow {
    flex: 0 0 auto;
    color: var(--text-faint);
    transition: transform var(--t), color var(--t);
}
.tile:hover .tile-arrow {
    color: var(--brand-500);
    transform: translate(2px, -2px);
}
/* Live-Status: Punkt + kurzer Text, Farbe je Ton */
.tile-status {
    align-self: flex-start;
    margin-top: var(--space-2);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.tile-status::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    vertical-align: 1px;
    border-radius: 50%;
    background: var(--dot, var(--text-faint));
}
.tile-status[data-tone="success"] { --dot: var(--success); color: var(--success-text); }
.tile-status[data-tone="warning"] { --dot: var(--warning); color: var(--warning-text); }
.tile-status[data-tone="danger"]  { --dot: var(--danger);  color: var(--danger-text); }
.tile-status[data-tone="info"]    { --dot: var(--info);    color: var(--info-text); }

/* Empty-State: dezenter Marken-Schimmer hinter dem Icon (v2, nur dekorativ) */
.empty-state-icon {
    background: radial-gradient(circle at 50% 35%, var(--brand-50), var(--surface-2) 72%);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-50) 45%, transparent);
}

/* ---------- Action Toolbar ---------- */
.action-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.mobile-back-btn {
    display: none;
}

/* ---------- Karten-Modifier ---------- */
.card--accent-left {
    border-left: 4px solid var(--brand-500);
}

.card--wizard,
.wizard-step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--elev-1);
    padding: 20px;
    margin-bottom: 16px;
}

.card--feedback,
.feedback-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--elev-1);
    padding: 24px;
    margin-bottom: 20px;
}

/* ---------- Utility-Klassen ---------- */
.u-mb-sm { margin-bottom: 8px; }
.u-mb-md { margin-bottom: 16px; }
.u-mb-lg { margin-bottom: 20px; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.text-muted { color: var(--text-muted); }
.muted { color: var(--text-muted); }

/* ---------- Button-Größen ---------- */
.btn-sm {
    padding: 8px 14px;
    min-height: 36px;
    font-size: 13px;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning {
    padding: 12px 20px;
    min-height: 44px;
    font-size: 14px;
}

/* ---------- Tab-Content (Admin/Storage) ---------- */
.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

/* Menü ist bis 1024px ein Overlay – Kopfzeile braucht dort keine bündige Mindesthöhe */
@media (max-width: 1024px) {
    :root { --shell-header-h: 0px; }
}

/* ---------- Responsive (Mobile ≤767px) ---------- */
@media (max-width: 767px) {
    .container > header {
        min-height: 56px;
        padding: 8px 12px;
        padding-top: max(8px, env(safe-area-inset-top));
        gap: 8px;
    }

    header h1 { font-size: 18px; }
    .header-subtitle {
        font-size: 12px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    /* Tab-Leiste bleibt im Viewport; Tabs scrollen innen */
    .admin-tabs {
        display: flex;
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .admin-tabs .tab-button {
        padding: 10px 14px;
        font-size: 14px;
    }

    body.layout-fulfillment {
        padding: 0;
        overflow: auto;
    }

    body.layout-fulfillment .container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        min-height: 100dvh;
    }

    .main-content {
        flex-direction: column;
        padding: 0;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        border-radius: 0;
    }

    .sidebar.mobile-hidden { display: none; }

    .content-area {
        padding: 16px 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .action-toolbar {
        flex-direction: column;
        width: 100%;
    }

    .action-toolbar .btn,
    .action-toolbar .btn-primary,
    .action-toolbar .btn-secondary {
        width: 100%;
    }

    .mobile-back-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        margin-bottom: 12px;
    }

    .scan-input-group {
        flex-direction: column;
    }

    .scan-input-group .btn-primary,
    .scan-input-group .btn {
        width: 100%;
    }

    /* Tabellen als Karten auf dem Handy */
    .table.table-stack-mobile {
        display: block;
        box-shadow: none;
        background: transparent;
        min-width: 0;
    }

    .table.table-stack-mobile thead {
        display: none;
    }

    .table.table-stack-mobile tbody {
        display: block;
    }

    .table.table-stack-mobile tr {
        display: block;
        background: var(--surface, white);
        border: 1px solid var(--border, #e0e0e0);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .table.table-stack-mobile tr:hover {
        background: var(--surface, white);
    }

    .table.table-stack-mobile td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border-bottom: none;
        white-space: normal;
        text-align: right;
    }

    .table.table-stack-mobile td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted, #666);
        text-align: left;
        flex-shrink: 0;
        max-width: 45%;
    }

    .table.table-stack-mobile td[colspan] {
        display: block;
        text-align: center;
        padding: 10px 0;
    }

    .table.table-stack-mobile td[colspan]::before {
        display: none;
    }

    .table.table-stack-mobile td[data-label="Aktionen"],
    .table.table-stack-mobile td[data-label="Aktion"] {
        flex-direction: column;
        align-items: stretch;
    }

    .table.table-stack-mobile td[data-label="Aktionen"]::before,
    .table.table-stack-mobile td[data-label="Aktion"]::before {
        margin-bottom: 4px;
    }

    .table.table-stack-mobile td[data-label="Aktionen"] .btn,
    .table.table-stack-mobile td[data-label="Aktion"] .btn {
        width: 100%;
        margin: 4px 0 !important;
        padding: 12px;
        min-height: 44px;
    }

    .table.table-stack-mobile td[data-label="Bild"] {
        justify-content: flex-start;
        align-items: center;
    }

    /* Fallback: Tabellen ohne Card-Stack bleiben horizontal scrollbar */
    .table-wrapper,
    .table-window-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table:not(.table-stack-mobile) {
        min-width: 600px;
    }
}

/* CSP utility classes (style-src 'self' – keine Inline-Styles).
 * `.is-hidden` muss Display-Utilities schlagen: beide hatten `!important`,
 * `.is-flex` stand danach und ließ Dialoge nach „Schließen“ stehen (L-181/PP-182). */
.is-hidden,
.modal.is-hidden,
.login-modal.is-hidden { display: none !important; }
.is-block:not(.is-hidden) { display: block !important; }
.is-flex:not(.is-hidden) { display: flex !important; }
.is-inline-flex:not(.is-hidden) { display: inline-flex !important; }
.is-grid:not(.is-hidden) { display: grid !important; }
.is-inline-block:not(.is-hidden) { display: inline-block !important; }
.is-inline:not(.is-hidden) { display: inline !important; }
.is-clickable { cursor: pointer; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted, #666); }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-15 { margin-bottom: 15px; }
.w-full { width: 100%; }
.max-w-120 { max-width: 120px; }
.max-w-500 { max-width: 500px; }
.max-w-580 { max-width: 580px; }
.max-w-600 { max-width: 600px; }
.gap-10 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.justify-end { justify-content: flex-end; }
.table-scroll-y { max-height: 600px; overflow-y: auto; }
.progress-fill { height: 100%; background: var(--brand-500, #c84040); }
.w-pct-0 { width: 0%; }
.w-pct-1 { width: 1%; }
.w-pct-2 { width: 2%; }
.w-pct-3 { width: 3%; }
.w-pct-4 { width: 4%; }
.w-pct-5 { width: 5%; }
.w-pct-6 { width: 6%; }
.w-pct-7 { width: 7%; }
.w-pct-8 { width: 8%; }
.w-pct-9 { width: 9%; }
.w-pct-10 { width: 10%; }
.w-pct-11 { width: 11%; }
.w-pct-12 { width: 12%; }
.w-pct-13 { width: 13%; }
.w-pct-14 { width: 14%; }
.w-pct-15 { width: 15%; }
.w-pct-16 { width: 16%; }
.w-pct-17 { width: 17%; }
.w-pct-18 { width: 18%; }
.w-pct-19 { width: 19%; }
.w-pct-20 { width: 20%; }
.w-pct-21 { width: 21%; }
.w-pct-22 { width: 22%; }
.w-pct-23 { width: 23%; }
.w-pct-24 { width: 24%; }
.w-pct-25 { width: 25%; }
.w-pct-26 { width: 26%; }
.w-pct-27 { width: 27%; }
.w-pct-28 { width: 28%; }
.w-pct-29 { width: 29%; }
.w-pct-30 { width: 30%; }
.w-pct-31 { width: 31%; }
.w-pct-32 { width: 32%; }
.w-pct-33 { width: 33%; }
.w-pct-34 { width: 34%; }
.w-pct-35 { width: 35%; }
.w-pct-36 { width: 36%; }
.w-pct-37 { width: 37%; }
.w-pct-38 { width: 38%; }
.w-pct-39 { width: 39%; }
.w-pct-40 { width: 40%; }
.w-pct-41 { width: 41%; }
.w-pct-42 { width: 42%; }
.w-pct-43 { width: 43%; }
.w-pct-44 { width: 44%; }
.w-pct-45 { width: 45%; }
.w-pct-46 { width: 46%; }
.w-pct-47 { width: 47%; }
.w-pct-48 { width: 48%; }
.w-pct-49 { width: 49%; }
.w-pct-50 { width: 50%; }
.w-pct-51 { width: 51%; }
.w-pct-52 { width: 52%; }
.w-pct-53 { width: 53%; }
.w-pct-54 { width: 54%; }
.w-pct-55 { width: 55%; }
.w-pct-56 { width: 56%; }
.w-pct-57 { width: 57%; }
.w-pct-58 { width: 58%; }
.w-pct-59 { width: 59%; }
.w-pct-60 { width: 60%; }
.w-pct-61 { width: 61%; }
.w-pct-62 { width: 62%; }
.w-pct-63 { width: 63%; }
.w-pct-64 { width: 64%; }
.w-pct-65 { width: 65%; }
.w-pct-66 { width: 66%; }
.w-pct-67 { width: 67%; }
.w-pct-68 { width: 68%; }
.w-pct-69 { width: 69%; }
.w-pct-70 { width: 70%; }
.w-pct-71 { width: 71%; }
.w-pct-72 { width: 72%; }
.w-pct-73 { width: 73%; }
.w-pct-74 { width: 74%; }
.w-pct-75 { width: 75%; }
.w-pct-76 { width: 76%; }
.w-pct-77 { width: 77%; }
.w-pct-78 { width: 78%; }
.w-pct-79 { width: 79%; }
.w-pct-80 { width: 80%; }
.w-pct-81 { width: 81%; }
.w-pct-82 { width: 82%; }
.w-pct-83 { width: 83%; }
.w-pct-84 { width: 84%; }
.w-pct-85 { width: 85%; }
.w-pct-86 { width: 86%; }
.w-pct-87 { width: 87%; }
.w-pct-88 { width: 88%; }
.w-pct-89 { width: 89%; }
.w-pct-90 { width: 90%; }
.w-pct-91 { width: 91%; }
.w-pct-92 { width: 92%; }
.w-pct-93 { width: 93%; }
.w-pct-94 { width: 94%; }
.w-pct-95 { width: 95%; }
.w-pct-96 { width: 96%; }
.w-pct-97 { width: 97%; }
.w-pct-98 { width: 98%; }
.w-pct-99 { width: 99%; }
.w-pct-100 { width: 100%; }
/* Zusätzliche CSP-Hilfsklassen */
.is-disabled-look { opacity: 0.55; pointer-events: none; filter: grayscale(0.2); }
.is-semi-disabled { opacity: 0.6; }
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.cursor-crosshair { cursor: crosshair; }
.cursor-default { cursor: default; }
.white-space-pre-wrap { white-space: pre-wrap; }
.modal-content-sm { max-width: 420px; }
.modal-content-md { max-width: 480px; }
.modal-content-500 { max-width: 500px; }
.modal-content-580 { max-width: 580px; }
.modal-content-600 { max-width: 600px; }
.flex-end-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.flex-end-row-mt { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.flex-gap-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.flex-gap-wrap-mt { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.flex-between-wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.flex-align-center { display: flex; align-items: center; gap: 8px; }
.flex-align-center-gap { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.flex-1-min { flex: 1; min-width: 0; }
.mb-0 { margin-bottom: 0; }
.mb-6 { margin-bottom: 6px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-18 { margin-bottom: 18px; }
.mb-20 { margin-bottom: 20px; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-30 { margin-top: 30px; }
.ml-10 { margin-left: 10px; }
.m-0 { margin: 0; }
.p-6 { padding: 6px; }
.p-6-muted { padding: 6px; color: var(--text-muted); font-size: 0.85em; }
.p-6-click { padding: 6px; cursor: pointer; font-size: 0.9em; }
.font-mono-danger { font-family: monospace; font-size: 18px; font-weight: 600; color: var(--brand-500); }
.font-09 { font-size: 0.9em; }
.font-085 { font-size: 0.85em; }
.font-08 { font-size: 0.8em; }
.font-082 { font-size: 0.82rem; }
.font-13 { font-size: 13px; }
.text-danger { color: var(--danger, #b00); }
.text-danger-block { color: var(--danger, #b00); display: block; margin-top: 2px; }
.text-warning { color: var(--warning-text); }
.text-label-muted { display: block; margin: 0 0 6px; font-size: 13px; color: var(--text-muted, #555); }
.text-faint { color: var(--text-faint, #9a9090); }
.text-nowrap { white-space: nowrap; }
.w-90 { width: 90px; }
.w-100-pad { width: 100%; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-xs); box-sizing: border-box; }
.w-100-pad-10 { width: 100%; padding: 10px; font-size: 16px; }
.search-results-box { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 14px; background: var(--surface-2); }
.search-results-box-sm { max-height: 160px; overflow-y: auto; }
.summary-clickable { cursor: pointer; margin: 15px 0; }
.hr-my-30 { margin: 30px 0; }
.btn-compact,
.btn-compact-sm,
.btn-compact-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
}
.btn-compact { padding: 3px 8px; font-size: 0.8em; }
.btn-compact-sm { padding: 4px 10px; font-size: 0.85em; }
.btn-compact-xs { padding: 5px 10px; font-size: 12px; }
.form-group-flex { margin: 0; flex: 1 1 260px; }
.scanner-video { width: 100%; border-radius: 8px; }
.alert-inline { margin: 0; padding: 8px 12px; font-size: 14px; }
.lh-obj-label span { font-size: clamp(16px, 35%, 26px); display: block; overflow: hidden; text-overflow: ellipsis; }

/* Scroll-Lock, Popups, Filter */
body.body-scroll-lock { overflow: hidden; }
.z-popup { z-index: 99999; }
.z-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9998; background: var(--warning); color: var(--warning-on); padding: 10px 16px; text-align: center; font-weight: 600; font-size: 14px; }
.text-left { text-align: left; }
.font-semibold { font-weight: 600; }
.text-success { color: var(--success, #16a34a); }
.ml-4 { margin-left: 4px; }
.ml-8 { margin-left: 8px; }
.mt-24 { margin-top: 24px; }
.mt-15 { margin-top: 15px; }
.mb-16 { margin-bottom: 16px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.p-20 { padding: 20px; }
.max-w-400 { max-width: 400px; }
.max-w-520 { max-width: 520px; }
.max-w-900 { max-width: 900px; }
.modal-content-620 { max-width: 620px; width: 92%; }
.modal-content-640 { max-width: 640px; width: 92%; max-height: 90vh; overflow-y: auto; }
.modal-w-92 { width: 92%; }
.modal-scroll-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border, #e8e4e4); border-radius: 6px; }
.search-results-scroll { max-height: 400px; overflow-y: auto; border: 1px solid var(--border, #ddd); border-radius: 4px; }
.overflow-x-auto { overflow-x: auto; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.flex-start { align-items: flex-start; }
.flex-align-start { display: flex; align-items: flex-start; }
.grid-100-1fr { display: grid; grid-template-columns: 100px 1fr; gap: 10px; }
.grid-90-1fr { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: end; }
.inline-editable { padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-xs); display: inline-block; min-width: 100px; text-align: center; }
.budget-summary-border { border-top: 1px solid var(--border, #e6e6e6); padding-top: 15px; }
.scroll-300 { max-height: 300px; overflow-y: auto; }
.scroll-55vh { max-height: 55vh; overflow-y: auto; }
.border-top { border-top: 1px solid var(--border, #ddd); }
.my-10 { margin: 10px 0; }
.pb-8 { padding: 0 0 8px; }
.w-30 { width: 30px; }
.w-40 { width: 40px; }
.w-70 { width: 70px; }
.w-75 { width: 75px; }
.w-80 { width: 80px; }
.w-95 { width: 95px; }
.w-100 { width: 100px; }
.w-110 { width: 110px; }
.w-58-input { width: 58px; font-size: 0.85em; padding: 2px 4px; border: 1px solid var(--border-strong); border-radius: var(--r-xs); text-align: center; }
.btn-shrink { flex-shrink: 0; }
.cursor-default { cursor: default; }
.error-box-padded { margin: 20px; padding: 20px; }
.status-msg-success { border-left-color: var(--success, #4CAF50); background: var(--success-bg, #e8f5e9); }
.status-msg-info { border-left-color: var(--info, #2196F3); background: var(--surface-3, #f5f5f5); }
.status-msg-danger { border-left-color: var(--danger, #f44336); background: var(--danger-bg, #ffebee); }
.input-readonly-bg { background-color: var(--surface-3, #f0f0f0); }
.thumb-120 { width: 120px; height: 120px; }
.video-scan { width: 100%; max-width: 100%; height: auto; }
.fw-delta-pos { font-weight: 600; color: var(--success, #16a34a); }
.fw-delta-neg { font-weight: 600; color: var(--danger, #dc3545); }
.fw-delta-zero { font-weight: 600; color: var(--text-muted, #666); }
.fwsim-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr); gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border, #eee); align-items: start; }
.fwsim-badge { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 10px; font-size: 0.78em; color: var(--on-brand); }
.fwsim-badge--ok { background: var(--success, #16a34a); }
.fwsim-badge--warn { background: var(--warning); }
.fwsim-badge--bad { background: var(--danger, #dc3545); }
.inv-pct-0 { --inv-pct: 0; }
.inv-pct-25 { --inv-pct: 25; }
.inv-pct-50 { --inv-pct: 50; }
.inv-pct-75 { --inv-pct: 75; }
.inv-pct-100 { --inv-pct: 100; }

/* Standard-Formularfeld (auch außerhalb .form-group; Theme setzt sonst nur Border) */
.form-input {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text, #1a1a1a);
    background: var(--surface, #fff);
    border: 1.5px solid var(--border-strong, #e8e4e4);
    border-radius: var(--r-sm, 7px);
    box-sizing: border-box;
    transition: border-color var(--t, .18s), box-shadow var(--t, .18s), background var(--t, .18s);
}
textarea.form-input {
    min-height: 80px;
    height: auto;
    resize: vertical;
}
select.form-input {
    cursor: pointer;
}
.form-input:focus {
    outline: none;
    border-color: var(--brand-500, #c84040);
    box-shadow: 0 0 0 4px var(--brand-100, #faf0f0);
    background: var(--surface, #fff);
}

/* Form validation (CSP) */
.form-input.field-ok { border-color: var(--border, #ddd); }
.form-input.field-missing { border: 1px solid var(--danger, #b00); }

/* data-tone text colors */
[data-tone="brand"] { color: var(--brand-500); }
[data-tone="success"] { color: var(--success); }
[data-tone="warning"] { color: var(--warning); }
[data-tone="info"] { color: var(--info); }
[data-tone="purple"] { color: var(--info); }
[data-tone="muted"] { color: var(--text-muted, #666); }
[data-tone="danger"] { color: var(--danger, #dc3545); }
[data-tone="warn"] { color: var(--warning-text); }
[data-tone="inherit"] { color: inherit; }

/* data-tone backgrounds (step-num, badges) */
.step-num[data-tone="muted"] { background: var(--text-faint); }
.step-num[data-tone="success"] { background: var(--success); }
.fwsim-badge[data-tone="success"],
.fw-badge[data-tone="success"] { background: var(--success, #16a34a); color: var(--success-on); }
.fwsim-badge[data-tone="warn"],
.fw-badge[data-tone="warn"] { background: var(--warning); color: var(--warning-on); }
.fwsim-badge[data-tone="danger"],
.fw-badge[data-tone="danger"] { background: var(--danger); color: var(--danger-on); }
.fwsim-badge[data-tone="info"],
.fw-badge[data-tone="info"] { background: var(--info); color: var(--info-on); }
.fwsim-badge[data-tone="muted"],
.fw-badge[data-tone="muted"] { background: var(--text-muted); color: var(--on-brand); }

/* Stat cards (picker übersicht) */
.stat-card { padding: 15px; border-radius: var(--r-sm); border-left: 4px solid; }
.stat-card--warning { background: var(--warning-bg); border-left-color: var(--warning); }
.stat-card--info { background: var(--info-bg); border-left-color: var(--info); }
.stat-card--success { background: var(--success-bg); border-left-color: var(--success); }
.stat-label { font-size: 14px; margin-bottom: 5px; }
.stat-label--warning { color: var(--warning-text); }
.stat-label--info { color: var(--info-text); }
.stat-label--success { color: var(--success-text); }
.stat-value { font-weight: 700; }
.stat-value--warning { font-size: 32px; color: var(--warning-text); }
.stat-value--info { font-size: 32px; color: var(--info-text); }
.stat-value--success { font-size: 24px; color: var(--success-text); }
.stat-hint { font-size: 12px; margin-top: 5px; color: var(--success-text); }

/* Alert / info boxes */
.alert-box { padding: 20px; border-radius: 4px; border-left: 4px solid; }
.alert-box--success { background: var(--success-bg); border-left-color: var(--success); }
.alert-box--success h3 { margin-top: 0; color: var(--success-text); }
.alert-box--success p { color: var(--success-text); margin: 0; }
.text-success-dark { color: var(--success-text); }
.text-warning-dark { color: var(--warning-text); }
.text-info-dark { color: var(--info-text); }
.text-amber { color: var(--warning-text); }
.text-slate { color: var(--text-muted); }

/* Misc CSP utilities */
.field-missing-label { color: var(--danger, #b00); }
.font-10 { font-size: 10px; }
.font-12 { font-size: 12px; }
.font-14 { font-size: 14px; }
.font-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-12 { margin-top: 12px; }
.mr-5 { margin-right: 5px; }
.ml-12 { margin-left: 12px; }
.p-8-2 { padding: 8px 2px; }
.p-10-0 { padding: 10px 0; }
.py-4 { padding: 4px 0; }
.w-36 { width: 36px; }
.max-w-540 { max-width: 540px; }
.min-w-140 { min-width: 140px; }
.flex-1 { flex: 1; }
.rounded-sm { border-radius: 4px; }
.rounded-md { border-radius: 8px; }
.rounded-top-lg { border-radius: 12px 12px 0 0; }
.move-panel { padding: 10px; border: 1px solid var(--border, #ddd); margin-bottom: 5px; border-radius: 4px; background: var(--surface, white); }
.move-option { padding: 8px; border: 1px solid var(--border, #ddd); margin-bottom: 5px; border-radius: 4px; cursor: pointer; background: var(--surface-3, #f0f0f0); }
.move-option--success { border-color: var(--success, #4CAF50); background: var(--success-bg, #e8f5e9); }
.info-box-light { background: var(--surface-2); border-radius: 8px; padding: 12px; font-size: 14px; }
.warning-list { margin: 8px 0 0 18px; font-size: 13px; color: var(--warning-text); }
.totp-qr-img { width: 220px; height: 220px; border: 1px solid var(--border, #ddd); border-radius: 4px; }
.code-block { display: block; word-break: break-all; padding: 10px; background: var(--surface-3, #f5f5f5); border-radius: 4px; font-size: 14px; }
.code-block-lg { padding: 12px; font-size: 16px; }
.btn-clockout { margin-left: 12px; padding: 4px 10px; border: none; border-radius: 6px; background: var(--text); color: var(--surface); font-weight: 700; cursor: pointer; }
.inline-editable-sm { min-width: 50px; }
.network-warnings { margin-top: 10px; }
.mb-0-card { margin-bottom: 0; }
.text-right { text-align: right; }
.mt-14 { margin-top: 14px; }
.mt-40 { margin-top: 40px; }
.my-16 { margin: 1rem 0; }
.max-w-560 { max-width: 560px; }
.min-w-180 { min-width: 180px; }
.enroll-result-icon { font-size: 2rem; margin: 0.5rem; }
.spinner-sm {
    border: 3px solid var(--surface-3, #f3f3f3);
    border-top: 3px solid var(--info, #0891b2);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ---------- Suchfeld (zentrale Komponente) ----------
   Einheitliches Suchfeld mit Lupen-Icon; gleiche Höhe/Optik wie auf
   Bestand und Besteller. Markup: .search-field > svg.search-field-icon + input */
.search-field {
    position: relative;
    display: block;
    width: 100%;
}

.search-field > input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px 11px 40px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

.search-field > input:focus {
    outline: none;
    border-color: var(--brand-400);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--brand-50);
}

.search-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-faint);
    pointer-events: none;
}

/* Abstand zwischen Suchfeld und Ergebnisliste */
.search-field + .search-results-scroll,
.search-field + .search-results-box { margin-top: 10px; }

/* ---------- Statusleiste für laufende Vorgänge (zentrale Komponente) ----------
   Fortschrittsanzeige am unteren Bildschirmrand für Aktionen, die auf einen
   fremden Dienst warten – vor allem Schreibzugriffe in den Shop. Die dauern je
   nach Shop mehrere Sekunden; ohne Anzeige wirkt die Seite eingefroren.
   Markup erzeugt `showStatusBar()` in common/ui.js, keine Seite hält es vor. */
.status-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;            /* über Modals (1000), unter Menü/Popups */
    display: flex;
    justify-content: center;
    padding: 0 16px 16px;
    pointer-events: none;     /* verdeckt nie einen Klick */
}

@media (min-width: 1025px) {
    /* Bei aufgeklappter Desktop-Navigation über dem Inhalt zentrieren. */
    body.has-app-menu .status-bar {
        left: var(--menu-sidebar-width, 288px);
    }
}

.status-bar-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-sm, 8px);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}

.status-bar.is-visible .status-bar-inner {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.status-bar-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* Symbol links: Spinner während des Vorgangs, danach Haken bzw. Ausrufezeichen. */
.status-bar-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.status-bar[data-state="busy"] .status-bar-icon {
    border: 2px solid var(--surface-3, #f0eaea);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    box-sizing: border-box;
    animation: spin 0.9s linear infinite;
}

.status-bar[data-state="ok"] .status-bar-inner {
    border-color: var(--success, #2e7d32);
    color: var(--success-text, #1b5e20);
}

.status-bar[data-state="ok"] .status-bar-icon::before {
    content: '\2713';
}

.status-bar[data-state="error"] .status-bar-inner {
    border-color: var(--danger, #c62828);
    color: var(--danger-text, #b71c1c);
}

.status-bar[data-state="error"] .status-bar-icon::before {
    content: '!';
}

/* Unbestimmter Fortschrittsbalken: Es gibt keine Rückmeldung über den
   Fortschritt eines Shop-Writes, also läuft der Balken durch. */
.status-bar-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    overflow: hidden;
    background: var(--surface-3, #f0eaea);
}

.status-bar:not([data-state="busy"]) .status-bar-track {
    display: none;
}

.status-bar-fill {
    display: block;
    width: 40%;
    height: 100%;
    background: var(--brand-500);
    animation: status-bar-slide 1.1s ease-in-out infinite;
}

@keyframes status-bar-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

@media (prefers-reduced-motion: reduce) {
    .status-bar-inner { transition: none; }
    .status-bar[data-state="busy"] .status-bar-icon { animation: none; }
    .status-bar-fill { animation: none; width: 100%; opacity: 0.5; }
}

/* ---------- Toasts (PP-306) ----------
   Gestapelte Meldungen von `showToast()`/`showAlert()` (common/ui.js): am PC
   unten rechts, am Handy oben – unten sitzen dort Scan-Leiste und Navigation. */
.toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1150;            /* über Statusleiste (1100) und Modals, unter dem Menü */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
body:has(.fab) .toast-stack { bottom: 88px; }
.toast {
    --tone: var(--info);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 8px 12px 14px;
    box-sizing: border-box;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--tone);
    border-radius: var(--r-sm);
    box-shadow: var(--elev-3);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--t), transform var(--t-spring);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast--success { --tone: var(--success); }
.toast--warning { --tone: var(--warning); }
.toast--error   { --tone: var(--danger); }
.toast-icon {
    display: flex;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--tone);
}
.toast-text {
    flex: 1;
    min-width: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.toast-action,
.toast-close {
    flex-shrink: 0;
    margin: -2px 0;
    font-family: var(--font);
    background: none;
    border: 0;
    border-radius: var(--r-xs);
    cursor: pointer;
}
.toast-action {
    padding: 2px 8px;
    color: var(--brand-600);
    font-size: 13px;
    font-weight: 700;
}
.toast-close {
    display: flex;
    padding: 4px;
    color: var(--text-muted);
}
.toast-action:hover,
.toast-close:hover { color: var(--text); background: var(--surface-3); }
@media (max-width: 767px) {
    .toast-stack {
        top: max(12px, env(safe-area-inset-top));
        right: 12px;
        bottom: auto;
        left: 12px;
        width: auto;
        align-items: stretch;
    }
    .toast { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
}

/* ---------- Bottom-Sheet (zentrale Komponente) ----------
   Dialog, der auf dem Handy von unten einfährt und ab Tablet-Breite als
   normaler, zentrierter Dialog erscheint. Gegenüber `.modal` ist das Sheet
   daumenfreundlich: Inhalt und Aktionen liegen am unteren Bildschirmrand.
   Markup liegt in der Seite, Auf-/Zuklappen übernimmt `openSheet()`/
   `closeSheet()` in common/ui.js. Das Muster stammt aus der Inventur
   (`.inv-sheet*`), die noch ihre eigenen Klassen nutzt. */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;            /* gleiche Ebene wie .modal */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--modal-scrim);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t);
}

.sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: var(--elev-3);
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

.sheet-backdrop.open .sheet {
    transform: none;
}

/* Greifer: signalisiert „von unten eingefahren, nach unten wegzuwischen". */
.sheet-handle {
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    margin: 0 auto 16px;
    border-radius: var(--r-pill);
    background: var(--border-strong);
}

.sheet-title {
    flex-shrink: 0;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

/* Nur dieser Bereich scrollt, damit Titel und Aktionen stehen bleiben. */
.sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sheet-actions {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.sheet-actions .btn {
    flex: 1;
    min-height: 44px;
}

/* Liste einfacher Aktionen im Sheet (Überlaufmenü). */
.sheet-menu {
    display: flex;
    flex-direction: column;
}

.sheet-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 14px 4px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
}

.sheet-menu-item:last-child {
    border-bottom: 0;
}

.sheet-menu-item:active {
    background: var(--surface-2);
}

.sheet-menu-item.is-danger {
    color: var(--danger);
}

.sheet-menu-item:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (min-width: 768px) {
    /* Ab Tablet als klassischer, zentrierter Dialog. */
    .sheet-backdrop {
        align-items: center;
    }

    .sheet {
        max-height: 82vh;
        padding-bottom: 22px;
        border-radius: var(--r-lg);
        transform: translateY(16px) scale(.98);
        opacity: 0;
        transition: transform .2s cubic-bezier(.4, 0, .2, 1), opacity .2s;
    }

    .sheet-backdrop.open .sheet {
        transform: none;
        opacity: 1;
    }

    .sheet-handle {
        display: none;
    }

    .sheet-actions {
        flex-direction: row-reverse;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sheet-backdrop,
    .sheet {
        transition: none;
    }
}

/* ---------- Seitenpanel (Sheet-Variante, PP-359) ----------
   Fährt auf allen Breiten von rechts ein, volle Fensterhöhe. Für umfangreiche
   Bearbeitung neben der Liste (z. B. Druckerkonfiguration). Gleiches Markup und
   gleiche Steuerung wie das Bottom-Sheet: `.sheet-backdrop.sheet-backdrop--side >
   .sheet.sheet--side`, öffnen mit `openSheet(id, { onClose })`. Kopf und Fuß
   bleiben stehen, nur `.sheet-body` scrollt. Ebene wie Admin-Dialoge (10000):
   über der festen Sidebar (9999); Bestätigungsdialoge aus ui.js hängen später
   im DOM und liegen deshalb trotzdem darüber. */
.sheet-backdrop.sheet-backdrop--side {
    z-index: 10000;
    align-items: stretch;
    justify-content: flex-end;
}

.sheet.sheet--side {
    width: min(760px, 100vw);
    max-width: none;
    height: 100%;
    max-height: none;
    padding: 0;
    border-radius: 0;
    border-left: 1px solid var(--border);
    opacity: 1;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
}

.sheet-backdrop--side.open .sheet--side {
    transform: none;
}

@media (min-width: 768px) {
    .sheet.sheet--side {
        max-height: none;
        padding: 0;
        border-radius: var(--r-lg) 0 0 var(--r-lg);
        opacity: 1;
        transform: translateX(100%);
        transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    }
    .sheet-backdrop--side.open .sheet--side {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sheet.sheet--side {
        transition: none;
    }
}

/* ---------- Schwebender Aktionsknopf (FAB) ----------
   Eine einzige Hauptaktion pro Seite, dauerhaft in Daumenreichweite.
   Bewusst unter der Sheet-Ebene, damit er ein offenes Sheet nicht überlagert. */
.fab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--brand-grad-btn);
    color: var(--on-brand);
    box-shadow: var(--shadow-brand);
    cursor: pointer;
    touch-action: manipulation;
    transition: transform var(--t), box-shadow var(--t);
}

.fab:hover {
    background: var(--brand-grad-btn-hover);
}

.fab:active {
    transform: scale(.94);
    box-shadow: var(--shadow-sm);
}

.fab:focus-visible {
    outline: 3px solid var(--brand-200);
    outline-offset: 2px;
}

.fab svg {
    width: 26px;
    height: 26px;
}

@media (min-width: 1025px) {
    /* Bei aufgeklappter Desktop-Navigation nicht unter die Leiste rutschen. */
    body.has-app-menu .fab {
        right: 32px;
        bottom: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fab { transition: none; }
}

/* PP-319: Bestellung nach Picklisten-Erstellung storniert (Picker, Packer, Abholung, Schalter) */
.cancelled-notice {
    display: flex;
    gap: var(--space-2, 8px);
    align-items: flex-start;
    margin: var(--space-3, 12px) 0;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border: 1px solid var(--danger-border, #fecaca);
    border-left: 4px solid var(--danger, #dc2626);
    border-radius: var(--r-sm, 10px);
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-text, #991b1b);
    line-height: 1.4;
}
.cancelled-notice-icon { flex: none; }
.cancelled-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill, 999px);
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-text, #991b1b);
    border: 1px solid var(--danger-border, #fecaca);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* PP-374: Shop-Positionen ohne Artikelzuordnung (nicht auf der Pickliste) */
.unmatched-notice {
    margin: var(--space-3, 12px) 0;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border: 1px solid var(--warning-border, #fde68a);
    border-left: 4px solid var(--warning, #d97706);
    border-radius: var(--r-sm, 10px);
    background: var(--warning-bg, #fef3c7);
    color: var(--warning-text, #92400e);
    line-height: 1.4;
}
.unmatched-notice ul { margin: 6px 0 0; padding-left: 20px; }
.unmatched-notice p { margin: 6px 0 0; }
.unmatched-notice-order { opacity: .8; }
.unmatched-tag {
    display: inline-flex;
    padding: 1px 8px;
    border-radius: var(--r-pill, 999px);
    background: var(--warning-bg, #fef3c7);
    color: var(--warning-text, #92400e);
    border: 1px solid var(--warning-border, #fde68a);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
