/* ==========================================================================
   Store Manager – Design System
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
    --sm-primary: #6366f1;
    --sm-primary-rgb: 99, 102, 241;
    --sm-primary-600: #4f46e5;
    --sm-primary-700: #4338ca;
    --sm-accent: #8b5cf6;
    --sm-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);

    --sm-bg: #f4f5fb;
    --sm-surface: #ffffff;
    --sm-surface-2: #f1f5f9;
    --sm-border: rgba(15, 23, 42, .07);
    --sm-text: #0f172a;
    --sm-muted: #64748b;

    --sm-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --sm-shadow: 0 4px 6px -1px rgba(15, 23, 42, .05), 0 12px 28px -8px rgba(15, 23, 42, .14);
    --sm-shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, .3);

    --sm-radius: 1.1rem;
    --sm-sidebar-w: 264px;
    --sm-topbar-h: 64px;
    --sm-tabbar-h: 66px;
    --sm-ease: cubic-bezier(.22, 1, .36, 1);

    --bs-body-font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-bg: var(--sm-bg);
    --bs-body-color: var(--sm-text);
    --bs-secondary-color: var(--sm-muted);
    --bs-border-color: rgba(15, 23, 42, .11);
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-primary-text-emphasis: #3730a3;
    --bs-primary-bg-subtle: #e0e7ff;
    --bs-primary-border-subtle: #c7d2fe;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;
    --bs-border-radius: .7rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: 1rem;
    --bs-focus-ring-color: rgba(99, 102, 241, .25);
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --sm-bg: #0a0e1a;
    --sm-surface: #121829;
    --sm-surface-2: #1a2238;
    --sm-border: rgba(255, 255, 255, .07);
    --sm-text: #e2e8f0;
    --sm-muted: #94a3b8;
    --sm-shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --sm-shadow: 0 12px 32px -12px rgba(0, 0, 0, .7);
    --sm-shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, .8);

    --bs-body-bg: var(--sm-bg);
    --bs-body-color: var(--sm-text);
    --bs-emphasis-color: #f8fafc;
    --bs-secondary-color: var(--sm-muted);
    --bs-tertiary-bg: var(--sm-surface-2);
    --bs-secondary-bg: var(--sm-surface-2);
    --bs-border-color: rgba(255, 255, 255, .1);
    --bs-primary-text-emphasis: #a5b4fc;
    --bs-primary-bg-subtle: rgba(99, 102, 241, .15);
    --bs-primary-border-subtle: rgba(99, 102, 241, .35);
    --bs-link-color: #a5b4fc;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color: #c7d2fe;
    --bs-link-hover-color-rgb: 199, 210, 254;
}

/* Farbtöne für Icons, Timeline, KPIs */
.tone-primary { --tone: #6366f1; }
.tone-violet { --tone: #8b5cf6; }
.tone-pink { --tone: #ec4899; }
.tone-success { --tone: #10b981; }
.tone-warning { --tone: #f59e0b; }
.tone-danger { --tone: #ef4444; }
.tone-info { --tone: #06b6d4; }
.tone-secondary { --tone: #64748b; }

/* ---------- Grundlayout ---------- */
html { scroll-behavior: smooth; }

body {
    background: var(--sm-bg);
    color: var(--sm-text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.app { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.page {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 3rem;
    animation: pageIn .5s var(--sm-ease) backwards;
}

.page-narrow { max-width: 920px; }

.theme-transition, .theme-transition *, .theme-transition *::before, .theme-transition *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease !important;
}

/* ---------- Sidebar (Desktop) ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sm-sidebar-w);
    display: none;
    flex-direction: column;
    padding: 1.25rem .9rem;
    z-index: 1040;
    color: #cbd5e1;
    background:
        radial-gradient(600px 300px at -20% -10%, rgba(139, 92, 246, .35), transparent 60%),
        radial-gradient(400px 300px at 120% 110%, rgba(99, 102, 241, .25), transparent 60%),
        linear-gradient(180deg, #0f172a 0%, #151a3a 100%);
}

@media (min-width: 992px) {
    .sidebar { display: flex; }
    .app-main { margin-left: var(--sm-sidebar-w); }
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -.01em;
}

.sidebar .brand { color: #fff; font-size: 1.1rem; padding: .25rem .6rem 1.1rem; }
.brand:hover { color: inherit; }

.brand-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.1rem;
    background: var(--sm-gradient);
    box-shadow: 0 8px 20px -6px rgba(139, 92, 246, .7);
    transition: transform .5s var(--sm-ease);
}

.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }

.sidebar-label {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .09em;
    color: #64748b;
    font-weight: 600;
    padding: 1rem .8rem .45rem;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .62rem .8rem;
    margin-bottom: 2px;
    border-radius: .75rem;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: .93rem;
    transition: background-color .2s, color .2s;
}

.sidebar-nav a i { font-size: 1.1rem; opacity: .85; transition: transform .35s var(--sm-ease); }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a:hover i { transform: scale(1.15) rotate(-6deg); }

.sidebar-nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -.9rem;
    top: 22%;
    bottom: 22%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--sm-gradient);
    animation: growY .45s var(--sm-ease) backwards;
}

.nav-count {
    margin-left: auto;
    min-width: 1.5rem;
    padding: .1rem .45rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, .6);
    animation: pulseRing 2.2s infinite;
}

.sidebar-footer {
    margin-top: auto;
    padding: .9rem .6rem 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .8rem;
    color: #64748b;
}

.sidebar-footer .btn-icon { color: #cbd5e1; background: rgba(255, 255, 255, .06); border: 0; }
.sidebar-footer .btn-icon:hover { color: #fff; background: rgba(255, 255, 255, .12); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: calc(var(--sm-topbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) clamp(1rem, 3vw, 2.25rem) 0;
    background: rgba(244, 245, 251, .8);
    background: color-mix(in srgb, var(--sm-bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--sm-border);
}

.topbar .brand { font-size: 1rem; }
.topbar .brand-logo { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }

.search-trigger {
    flex: 1 1 auto;
    max-width: 440px;
    display: flex;
    align-items: center;
    gap: .6rem;
    height: 42px;
    padding: 0 .6rem 0 .95rem;
    border-radius: .9rem;
    border: 1px solid var(--sm-border);
    background: var(--sm-surface);
    color: var(--sm-muted);
    font-size: .9rem;
    box-shadow: var(--sm-shadow-sm);
    transition: border-color .2s, box-shadow .25s var(--sm-ease), transform .25s var(--sm-ease);
}

.search-trigger:hover {
    border-color: rgba(var(--sm-primary-rgb), .35);
    box-shadow: 0 0 0 4px rgba(var(--sm-primary-rgb), .08);
}

.search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

kbd {
    font-family: inherit;
    font-size: .7rem;
    font-weight: 600;
    padding: .15rem .45rem;
    border-radius: .4rem;
    color: var(--sm-muted);
    background: var(--sm-surface-2);
    border: 1px solid var(--sm-border);
    box-shadow: none;
}

/* ---------- Tab-Leiste (Mobil) ---------- */
.tabbar {
    position: fixed;
    left: .75rem;
    right: .75rem;
    bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    height: var(--sm-tabbar-h);
    z-index: 1035;
    display: flex;
    align-items: center;
    padding: 0 .35rem;
    border-radius: 22px;
    border: 1px solid var(--sm-border);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: var(--sm-shadow-lg);
    animation: slideUp .6s var(--sm-ease) backwards;
}

[data-bs-theme="dark"] .tabbar { background: rgba(18, 24, 41, .86); }

.tabbar a {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--sm-muted);
    text-decoration: none;
    font-size: .66rem;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

.tabbar a i { font-size: 1.3rem; line-height: 1; }
.tabbar a.active { color: var(--sm-primary); }
.tabbar a.active i { animation: tabPop .5s var(--sm-ease); }

.tabbar a.active::after {
    content: "";
    position: absolute;
    bottom: -9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sm-primary);
    animation: fadeIn .4s ease backwards;
}

.fab {
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    margin: -30px .35rem 0;
    border: 4px solid var(--sm-bg);
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.6rem;
    background: var(--sm-gradient);
    box-shadow: 0 14px 26px -10px rgba(99, 102, 241, .9);
    transition: transform .3s var(--sm-ease);
}

.fab i { transition: transform .4s var(--sm-ease); }
.fab:active { transform: scale(.92); }
body:has(.quick-sheet.show) .fab i { transform: rotate(135deg); }

@media (max-width: 991.98px) {
    .page { padding-bottom: calc(var(--sm-tabbar-h) + 3rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Quick-Add Sheet ---------- */
.quick-sheet {
    height: auto !important;
    border-radius: 1.6rem 1.6rem 0 0;
    background: var(--sm-surface) !important;
    border: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 99px;
    background: var(--bs-border-color);
    margin: .7rem auto 0;
}

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }

.quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem .4rem;
    border: 0;
    border-radius: 1rem;
    background: var(--sm-surface-2);
    color: var(--sm-text);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 600;
    transition: transform .2s var(--sm-ease);
}

.quick-tile:active { transform: scale(.95); }
.quick-sheet.show .quick-tile { animation: fadeUp .45s var(--sm-ease) backwards; animation-delay: calc(var(--i, 0) * 45ms + 80ms); }

.qt-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: #fff;
    background: var(--tone);
    box-shadow: 0 8px 18px -8px var(--tone);
}

/* ---------- Seitenkopf ---------- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
    font-weight: 750;
    letter-spacing: -.025em;
    margin: 0;
}

.page-header .subtitle { color: var(--sm-muted); margin: .25rem 0 0; font-size: .92rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--sm-muted); margin-bottom: .6rem; }
.crumbs a { color: var(--sm-muted); text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; transition: color .2s; }
.crumbs a:hover { color: var(--sm-primary); }

@media (max-width: 575.98px) {
    .page-actions { width: 100%; }
    .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1 1 auto; }
    .page-actions > form .btn, .page-actions > .dropdown > .btn { width: 100%; }
}

/* ---------- Karten ---------- */
.card {
    --bs-card-bg: var(--sm-surface);
    --bs-card-border-color: var(--sm-border);
    --bs-card-border-radius: var(--sm-radius);
    --bs-card-inner-border-radius: calc(var(--sm-radius) - 1px);
    --bs-card-cap-bg: transparent;
    box-shadow: var(--sm-shadow-sm);
}

.card-body { padding: 1.25rem; }

.card-hover { transition: transform .35s var(--sm-ease), box-shadow .35s var(--sm-ease), border-color .35s; color: inherit; text-decoration: none; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--sm-shadow); border-color: rgba(var(--sm-primary-rgb), .25); color: inherit; }

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: 1rem;
}

.section-title h2, .section-title h3 { font-size: 1rem; font-weight: 650; margin: 0; display: flex; align-items: center; gap: .55rem; }
.section-title h2 i, .section-title h3 i { color: var(--sm-primary); }

.list-group {
    --bs-list-group-bg: var(--sm-surface);
    --bs-list-group-border-color: var(--sm-border);
    --bs-list-group-action-hover-bg: rgba(var(--sm-primary-rgb), .05);
}

.modal { --bs-modal-bg: var(--sm-surface); --bs-modal-border-color: var(--sm-border); --bs-modal-border-radius: 1.25rem; }
.dropdown-menu { --bs-dropdown-bg: var(--sm-surface); --bs-dropdown-border-color: var(--sm-border); --bs-dropdown-link-active-bg: var(--sm-primary); border-radius: .9rem; padding: .4rem; box-shadow: var(--sm-shadow); animation: scaleIn .2s var(--sm-ease); }
.dropdown-item { border-radius: .55rem; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.offcanvas { --bs-offcanvas-bg: var(--sm-surface); }

/* ---------- Buttons ---------- */
.btn {
    --bs-btn-font-weight: 550;
    border-radius: .8rem;
    padding: .55rem 1rem;
    position: relative;
    overflow: hidden;
    transition: transform .15s var(--sm-ease), box-shadow .25s, background-color .2s, border-color .2s, color .2s;
}

.btn:active { transform: scale(.97); }
.btn-sm { border-radius: .6rem; padding: .35rem .7rem; }

.btn-primary {
    --bs-btn-bg: var(--sm-primary);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--sm-primary-600);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: var(--sm-primary-700);
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-bg: var(--sm-primary);
    --bs-btn-disabled-border-color: transparent;
    background-image: var(--sm-gradient);
    box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7);
}

.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(99, 102, 241, .85); transform: translateY(-1px); }

.btn-primary:not(.dropdown-toggle)::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .8s var(--sm-ease);
    pointer-events: none;
}

.btn-primary:not(.dropdown-toggle):hover::after { transform: translateX(100%); }

.btn-outline-primary {
    --bs-btn-color: var(--sm-primary-600);
    --bs-btn-border-color: rgba(var(--sm-primary-rgb), .35);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--sm-primary);
    --bs-btn-hover-border-color: var(--sm-primary);
    --bs-btn-active-bg: var(--sm-primary-600);
    --bs-btn-active-border-color: var(--sm-primary-600);
}

[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #a5b4fc; }

.btn-soft {
    --bs-btn-color: var(--sm-text);
    --bs-btn-bg: var(--sm-surface);
    --bs-btn-border-color: var(--sm-border);
    --bs-btn-hover-color: var(--sm-primary);
    --bs-btn-hover-bg: var(--sm-surface);
    --bs-btn-hover-border-color: rgba(var(--sm-primary-rgb), .4);
    --bs-btn-active-bg: var(--sm-surface-2);
    --bs-btn-active-color: var(--sm-primary);
    --bs-btn-active-border-color: rgba(var(--sm-primary-rgb), .4);
    box-shadow: var(--sm-shadow-sm);
}

.btn-soft-danger {
    --bs-btn-color: #ef4444;
    --bs-btn-bg: rgba(239, 68, 68, .08);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #ef4444;
    --bs-btn-hover-border-color: #ef4444;
    --bs-btn-active-bg: #dc2626;
    --bs-btn-active-color: #fff;
}

[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--sm-text);
    --bs-btn-bg: var(--sm-surface-2);
    --bs-btn-border-color: var(--sm-border);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #232c47;
    --bs-btn-hover-border-color: var(--sm-border);
}

.btn-icon { width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; border-radius: .85rem; font-size: 1.05rem; }
.btn-icon.btn-sm { width: 34px; height: 34px; border-radius: .65rem; font-size: .9rem; }

.btn.is-loading { pointer-events: none; opacity: .85; }

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: rgba(255, 255, 255, .45);
    animation: ripple .65s linear;
    pointer-events: none;
}

/* ---------- Formulare ---------- */
.form-label { font-weight: 550; font-size: .86rem; margin-bottom: .35rem; }

.form-control, .form-select {
    border-radius: .8rem;
    padding: .6rem .9rem;
    background-color: var(--sm-surface);
    border-color: var(--bs-border-color);
    transition: border-color .2s, box-shadow .25s var(--sm-ease), background-color .2s;
}

[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: var(--sm-surface-2); }

.form-control:focus, .form-select:focus {
    border-color: rgba(var(--sm-primary-rgb), .65);
    box-shadow: 0 0 0 4px rgba(var(--sm-primary-rgb), .15);
}

.form-control-lg { border-radius: .9rem; }

.input-group-text { background: var(--sm-surface-2); color: var(--sm-muted); border-color: var(--bs-border-color); border-radius: .8rem; }
.form-check-input:checked { background-color: var(--sm-primary); border-color: var(--sm-primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(var(--sm-primary-rgb), .15); border-color: rgba(var(--sm-primary-rgb), .6); }
.form-text { color: var(--sm-muted); }

.form-section {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sm-muted);
    font-weight: 700;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.form-section::after { content: ""; flex: 1; height: 1px; background: var(--sm-border); }

.flash-success { animation: flashField 1.2s ease; }

.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--sm-border);
    background: color-mix(in srgb, var(--sm-surface) 92%, transparent);
    backdrop-filter: blur(10px);
    border-radius: 0 0 var(--sm-radius) var(--sm-radius);
}

@media (max-width: 991.98px) {
    .sticky-actions { bottom: calc(var(--sm-tabbar-h) + 1rem + env(safe-area-inset-bottom, 0px)); border-radius: var(--sm-radius); border: 1px solid var(--sm-border); box-shadow: var(--sm-shadow); margin: 0 .5rem; }
    .sticky-actions .btn { flex: 1; }
}

/* Bild-Upload */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    aspect-ratio: 1;
    text-align: center;
    border: 2px dashed rgba(var(--sm-primary-rgb), .3);
    border-radius: var(--sm-radius);
    background: rgba(var(--sm-primary-rgb), .04);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .25s, background-color .25s, transform .3s var(--sm-ease);
    margin: 0;
}

.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--sm-primary);
    background: rgba(var(--sm-primary-rgb), .08);
}

.dropzone.is-dragover { transform: scale(1.02); }
.dropzone .dz-icon { font-size: 2.2rem; color: var(--sm-primary); animation: float 4s ease-in-out infinite; }
.dropzone .dz-title { font-weight: 600; font-size: .92rem; }
.dropzone .dz-sub { font-size: .78rem; color: var(--sm-muted); }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fadeIn .4s ease; }

.dropzone .dz-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    color: #fff;
    font-weight: 600;
    background: rgba(15, 23, 42, .55);
    opacity: 0;
    transition: opacity .25s;
}

.dropzone.has-image { border-style: solid; border-color: var(--sm-border); }
.dropzone.has-image .dz-empty { display: none; }
.dropzone.has-image:hover .dz-overlay { opacity: 1; }

/* Farbauswahl */
.swatches { display: flex; flex-wrap: wrap; gap: .65rem; }
.swatch { position: relative; margin: 0; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }

.swatch span {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--c);
    cursor: pointer;
    transition: transform .25s var(--sm-ease), box-shadow .25s;
}

.swatch span:hover { transform: scale(1.08); }
.swatch input:checked + span { transform: scale(1.12); box-shadow: 0 0 0 3px var(--sm-surface), 0 0 0 5px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--sm-primary); outline-offset: 4px; }

/* ---------- Chips & Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-bottom: 1rem; }

.search-box { position: relative; flex: 1 1 280px; }
.search-box > .bi-search { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--sm-muted); pointer-events: none; }
.search-box .form-control { padding-left: 2.7rem; padding-right: 3rem; height: 46px; border-radius: .95rem; }
.search-box .btn-scan { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); }

.chips {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: .15rem .1rem .45rem;
    margin: 0 -.1rem .5rem;
    -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .9rem;
    border-radius: 99px;
    border: 1px solid var(--sm-border);
    background: var(--sm-surface);
    color: var(--sm-text);
    font-size: .84rem;
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--sm-shadow-sm);
    transition: transform .25s var(--sm-ease), border-color .2s, color .2s, box-shadow .25s;
}

.chip:hover { color: var(--sm-primary); border-color: rgba(var(--sm-primary-rgb), .4); transform: translateY(-1px); }

.chip.active {
    color: #fff;
    border-color: transparent;
    background: var(--sm-gradient);
    box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7);
}

.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip.active .chip-dot { background: #fff; }
.chip-count { font-size: .7rem; font-weight: 700; padding: .05rem .45rem; border-radius: 99px; background: var(--sm-surface-2); color: var(--sm-muted); }
.chip.active .chip-count { background: rgba(255, 255, 255, .22); color: #fff; }

.view-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: .85rem; background: var(--sm-surface-2); }
.view-toggle button { border: 0; background: transparent; width: 38px; height: 36px; border-radius: .65rem; color: var(--sm-muted); transition: all .25s var(--sm-ease); }
.view-toggle button.active { background: var(--sm-surface); color: var(--sm-primary); box-shadow: var(--sm-shadow-sm); }

.toolbar .form-select { width: auto; height: 46px; border-radius: .95rem; }

/* ---------- Status & Kategorien ---------- */
.status-pill {
    --dot: #10b981;
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    padding: .22rem .6rem;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 650;
    color: #0f172a;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .1);
    white-space: nowrap;
}

[data-bs-theme="dark"] .status-pill { background: rgba(15, 23, 42, .85); color: #e2e8f0; }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.status-pill.is-low { --dot: #f59e0b; }
.status-pill.is-out { --dot: #ef4444; }
.status-pill.is-low .dot, .status-pill.is-out .dot { animation: pulseDot 1.7s infinite; }

.status-soft { background: color-mix(in srgb, var(--dot) 14%, transparent); color: color-mix(in srgb, var(--dot) 75%, var(--sm-text)); box-shadow: none; backdrop-filter: none; }
[data-bs-theme="dark"] .status-soft { background: color-mix(in srgb, var(--dot) 18%, transparent); color: color-mix(in srgb, var(--dot) 70%, #fff); }

.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 650;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 13%, transparent);
    text-decoration: none;
    white-space: nowrap;
}

.cat-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cat-pill.no-dot::before { display: none; }
.cat-solid { color: #fff; background: var(--c); box-shadow: 0 4px 10px -4px var(--c); }

/* ---------- Thumbnails ---------- */
.thumb-wrap, .item-media {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(100deg, var(--sm-surface-2) 35%, color-mix(in srgb, var(--sm-surface-2) 60%, #fff) 50%, var(--sm-surface-2) 65%);
    background-size: 220% 100%;
    animation: shimmer 1.4s linear infinite;
}

[data-bs-theme="dark"] .thumb-wrap, [data-bs-theme="dark"] .item-media {
    background-image: linear-gradient(100deg, var(--sm-surface-2) 35%, #222c47 50%, var(--sm-surface-2) 65%);
}

.media-loaded { animation: none; }
.thumb-wrap { display: inline-block; border-radius: .8rem; }
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .5s ease, transform .6s var(--sm-ease); }
.js .thumb-img:not(.is-loaded) { opacity: 0; }

.thumb-sm { width: 44px; height: 44px; border-radius: .7rem; }
.thumb-md { width: 64px; height: 64px; }
.thumb-lg { width: 100%; aspect-ratio: 1; border-radius: var(--sm-radius); }

/* ---------- Artikel-Karten ---------- */
.item-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

@media (max-width: 575.98px) {
    .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
}

.item-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius);
    box-shadow: var(--sm-shadow-sm);
    transition: transform .4s var(--sm-ease), box-shadow .4s var(--sm-ease), border-color .3s;
}

.item-card:hover { transform: translateY(-5px); box-shadow: var(--sm-shadow); border-color: rgba(var(--sm-primary-rgb), .25); color: inherit; }
.item-card .item-media { aspect-ratio: 4 / 3; }
.item-card:hover .thumb-img { transform: scale(1.07); }
.item-media .status-pill { position: absolute; left: .6rem; top: .6rem; }
.item-media .cat-pill { position: absolute; right: .6rem; top: .6rem; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }

.item-body { display: flex; flex-direction: column; gap: .2rem; flex: 1; padding: .85rem 1rem 1rem; }
.item-info { min-width: 0; }
.item-title { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { font-size: .76rem; color: var(--sm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-foot { margin-top: auto; padding-top: .55rem; display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; }
.item-price { font-weight: 750; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.item-price small { font-weight: 500; font-size: .72rem; color: var(--sm-muted); }
.item-stock { font-size: .78rem; color: var(--sm-muted); text-align: right; white-space: nowrap; }
.item-stock b { color: var(--sm-text); font-size: .9rem; }

.meter { height: 5px; border-radius: 99px; background: var(--sm-surface-2); overflow: hidden; margin-top: .6rem; }
.meter > span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--c); transform-origin: left; animation: growX 1.1s var(--sm-ease) backwards; animation-delay: .25s; }

@media (max-width: 575.98px) {
    .item-media .cat-pill { top: auto; bottom: .5rem; right: .5rem; max-width: calc(100% - 1rem); }
    .item-body { padding: .7rem .75rem .8rem; }
    .item-foot { flex-direction: column; align-items: flex-start; gap: .1rem; }
    .item-stock { text-align: left; }
}

/* Listenansicht */
.item-grid.is-list { grid-template-columns: 1fr; gap: .6rem; }
.is-list .item-card { flex-direction: row; align-items: center; }
.is-list .item-card:hover { transform: translateX(4px); }
.is-list .item-card .item-media { width: 76px; height: 76px; aspect-ratio: auto; margin: .6rem; border-radius: .85rem; }
.is-list .item-media .status-pill, .is-list .item-media .cat-pill { display: none; }
.is-list .item-body { flex-direction: row; align-items: center; gap: 1rem; padding: .5rem 1.1rem .5rem .2rem; }
.is-list .item-info { flex: 1; }
.is-list .item-foot { flex-direction: column; align-items: flex-end; margin: 0; padding: 0; gap: .1rem; }
.is-list .item-stock { text-align: right; }
.is-list .meter { display: none; }
.item-list-extra { display: none; }
.is-list .item-list-extra { display: inline-flex; }

/* ---------- KPIs & Dashboard ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 1.4rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    color: #fff;
    background: var(--sm-gradient);
    box-shadow: 0 24px 48px -22px rgba(99, 102, 241, .85);
    isolation: isolate;
}

.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    background: rgba(255, 255, 255, .13);
    animation: float 10s ease-in-out infinite;
}

.hero::before { width: 320px; height: 320px; right: -80px; top: -140px; }
.hero::after { width: 200px; height: 200px; right: 22%; bottom: -120px; animation-delay: -4s; }
.hero .hero-eyebrow { opacity: .85; font-weight: 500; font-size: .9rem; }
.hero h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.02em; margin: .2rem 0 1.1rem; }
.hero-value { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-label { opacity: .8; font-size: .82rem; font-weight: 500; margin-top: .35rem; }
.hero-split { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1.25rem; }
.hero-split div { font-size: .82rem; opacity: .85; }
.hero-split strong { display: block; font-size: 1.05rem; opacity: 1; font-variant-numeric: tabular-nums; }
.hero .btn-hero { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(6px); }
.hero .btn-hero:hover { background: rgba(255, 255, 255, .28); color: #fff; }

.kpi { position: relative; overflow: hidden; height: 100%; padding: 1.15rem 1.2rem; display: block; }

.kpi::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -34px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--tone);
    opacity: .07;
    transition: transform .6s var(--sm-ease);
}

.kpi:hover::after { transform: scale(1.35); }

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    margin-bottom: .9rem;
    color: var(--tone);
    background: color-mix(in srgb, var(--tone) 14%, transparent);
}

.kpi-value { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 750; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--sm-muted); font-size: .82rem; font-weight: 550; margin-top: .2rem; }

.vbar { display: block; color: inherit; text-decoration: none; margin-bottom: 1rem; }
.vbar:last-child { margin-bottom: 0; }
.vbar-head { display: flex; justify-content: space-between; gap: .75rem; font-size: .86rem; margin-bottom: .4rem; }
.vbar-head span:first-child { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbar-head span:last-child { font-variant-numeric: tabular-nums; color: var(--sm-muted); white-space: nowrap; }
.vbar-track { height: 10px; border-radius: 99px; background: var(--sm-surface-2); overflow: hidden; }

.vbar-fill {
    height: 100%;
    width: var(--w);
    min-width: 6px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff));
    transform-origin: left;
    animation: growX 1.2s var(--sm-ease) backwards;
    animation-delay: calc(var(--i, 0) * 90ms + 250ms);
}

.vbar:hover .vbar-fill { filter: brightness(1.08) saturate(1.1); }

.mini-row {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .6rem .5rem;
    margin: 0 -.5rem;
    border-radius: .8rem;
    color: inherit;
    text-decoration: none;
    transition: background-color .2s;
}

.mini-row:hover { background: rgba(var(--sm-primary-rgb), .06); color: inherit; }
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row .title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .sub { font-size: .76rem; color: var(--sm-muted); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: .85rem; padding-bottom: 1.1rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--sm-border); }

.tl-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--tone);
    background: color-mix(in srgb, var(--tone) 14%, transparent);
}

.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; justify-content: space-between; gap: .75rem; }
.tl-title { font-weight: 600; font-size: .88rem; }
.tl-title a { color: inherit; text-decoration: none; }
.tl-title a:hover { color: var(--sm-primary); }
.tl-meta { font-size: .77rem; color: var(--sm-muted); }
.tl-qty { font-weight: 700; font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-qty.is-plus { color: #10b981; }
.tl-qty.is-minus { color: #ef4444; }
.tl-route { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }

/* ---------- Stores ---------- */
.store-card { overflow: hidden; height: 100%; display: flex; flex-direction: column; }

.store-banner {
    position: relative;
    height: 84px;
    background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 50%, #a855f7));
}

.store-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1.2px);
    background-size: 14px 14px;
    mask-image: linear-gradient(90deg, transparent, #000);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000);
}

.store-avatar {
    position: relative;
    z-index: 1;
    width: 58px;
    height: 58px;
    margin: -30px 0 0 1.15rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--c);
    background: var(--sm-surface);
    border: 3px solid var(--sm-surface);
    box-shadow: var(--sm-shadow);
    transition: transform .5s var(--sm-ease);
}

.card-hover:hover .store-avatar { transform: rotate(-6deg) scale(1.06); }

.avatar-sm {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 750;
    font-size: .82rem;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 14%, transparent);
}
.store-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: auto; }
.store-stat { background: var(--sm-surface-2); border-radius: .8rem; padding: .55rem .75rem; font-size: .75rem; color: var(--sm-muted); }
.store-stat b { display: block; font-size: 1rem; color: var(--sm-text); font-variant-numeric: tabular-nums; }

/* Bannerbild: Foto statt Farbverlauf, unten leicht abgedunkelt für den Übergang zur Karte */
.store-banner.has-image {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 45%, rgba(15, 23, 42, .35) 100%), var(--banner) center / cover no-repeat, var(--sm-surface-2);
}

.store-banner.has-image::after { display: none; }
.store-card .store-banner.has-image { height: 120px; }
.store-card .store-banner { transition: transform .6s var(--sm-ease); transform-origin: center; }
.store-card { overflow: hidden; }
.store-card:hover .store-banner.has-image { transform: scale(1.04); }
.store-hero .store-banner.has-image { height: clamp(150px, 24vw, 240px); }

.banner-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 5;
    min-height: 130px;
    margin: 0;
    text-align: center;
    border: 2px dashed rgba(var(--sm-primary-rgb), .3);
    border-radius: var(--sm-radius);
    background: rgba(var(--sm-primary-rgb), .04);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .25s, background-color .25s, transform .3s var(--sm-ease);
}

.banner-drop:hover, .banner-drop.is-dragover { border-color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .08); }
.banner-drop.is-dragover { transform: scale(1.01); }
.banner-drop .dz-icon { font-size: 2rem; color: var(--sm-primary); }
.banner-drop .dz-title { font-weight: 600; font-size: .92rem; }
.banner-drop .dz-sub { font-size: .78rem; color: var(--sm-muted); }
.banner-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fadeIn .4s ease; transition: filter .3s, opacity .3s; }
.banner-drop .dz-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .4rem; color: #fff; font-weight: 600; background: rgba(15, 23, 42, .5); opacity: 0; transition: opacity .25s; }
.banner-drop.has-image { border-style: solid; border-color: var(--sm-border); }
.banner-drop.has-image .dz-empty { display: none; }
.banner-drop.has-image:hover .dz-overlay { opacity: 1; }
.banner-drop.is-removed img { filter: grayscale(1); opacity: .3; }

/* Kein overflow:hidden, sonst wird das Aktionen-Dropdown abgeschnitten – stattdessen Banner selbst abrunden */
.store-hero { position: relative; z-index: 2; }
.store-hero .store-banner { height: 120px; border-radius: calc(var(--sm-radius) - 1px) calc(var(--sm-radius) - 1px) 0 0; overflow: hidden; }
.store-hero .store-avatar { width: 76px; height: 76px; font-size: 1.5rem; margin-top: -38px; border-radius: 22px; }

.info-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.info-list li { display: flex; gap: .75rem; align-items: flex-start; font-size: .9rem; }
.info-list i { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .1); }
.info-list small { display: block; color: var(--sm-muted); font-size: .74rem; }

.inv-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--sm-border);
    transition: background-color .2s;
}

.inv-item:last-child .inv-row { border-bottom: 0; }
.inv-row:hover { background: rgba(var(--sm-primary-rgb), .03); }
.inv-name { font-weight: 600; color: inherit; text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-name:hover { color: var(--sm-primary); }

.qty-badge {
    display: inline-block;
    padding: .28rem .65rem;
    border-radius: .65rem;
    font-weight: 700;
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
    color: var(--sm-primary-600);
    background: rgba(var(--sm-primary-rgb), .1);
}

[data-bs-theme="dark"] .qty-badge { color: #a5b4fc; }

.inv-actions { padding: 0 1.1rem 1rem; border-bottom: 1px solid var(--sm-border); }
.inv-actions-inner { background: var(--sm-surface-2); border-radius: .9rem; padding: 1rem; }
.btn-expand i { transition: transform .35s var(--sm-ease); }
.btn-expand[aria-expanded="true"] i { transform: rotate(180deg); }

/* ---------- Artikel-Detail ---------- */
.detail-media { position: relative; }
.detail-media .status-pill { position: absolute; left: .9rem; top: .9rem; }

.ring {
    --p: 0;
    --c: var(--sm-primary);
    position: relative;
    width: 128px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sm-surface-2) 0);
    animation: ringFill 1.4s var(--sm-ease) backwards;
}

.ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--sm-surface); }
.ring > div { position: relative; text-align: center; line-height: 1.15; }
.ring b { font-size: 1.3rem; display: block; font-variant-numeric: tabular-nums; }
.ring small { color: var(--sm-muted); font-size: .72rem; }

@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

.dist-bar { display: flex; gap: 3px; height: 14px; border-radius: 99px; overflow: hidden; background: var(--sm-surface-2); }
.dist-bar span { width: var(--w); background: var(--c); transform-origin: left; animation: growX 1s var(--sm-ease) backwards; animation-delay: calc(var(--i, 0) * 120ms + 200ms); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; font-size: .8rem; color: var(--sm-muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }

.stat-tile { background: var(--sm-surface-2); border-radius: .95rem; padding: .85rem 1rem; height: 100%; }
.stat-tile .label { font-size: .75rem; color: var(--sm-muted); font-weight: 550; }
.stat-tile .value { font-size: 1.2rem; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.nav-segment { display: inline-flex; gap: 2px; padding: 4px; border-radius: .95rem; background: var(--sm-surface-2); }
.nav-segment .nav-link { border-radius: .75rem; padding: .45rem .95rem; color: var(--sm-muted); font-weight: 550; font-size: .88rem; transition: all .25s var(--sm-ease); }
.nav-segment .nav-link.active { color: var(--sm-text); background: var(--sm-surface); box-shadow: var(--sm-shadow-sm); }

.book-type { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.book-type input { position: absolute; opacity: 0; }
.book-type label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem;
    border-radius: .9rem;
    border: 2px solid var(--sm-border);
    cursor: pointer;
    font-weight: 600;
    transition: all .25s var(--sm-ease);
}

.book-type input:checked + label { border-color: var(--tone); color: var(--tone); background: color-mix(in srgb, var(--tone) 10%, transparent); }

/* ---------- Karte ---------- */
.map { height: 360px; border-radius: var(--sm-radius); overflow: hidden; z-index: 0; background: var(--sm-surface-2); }
.map-sm { height: 220px; }
.leaflet-container { font-family: inherit; }
[data-bs-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.5); }
.leaflet-popup-content-wrapper { border-radius: .9rem; box-shadow: var(--sm-shadow); }
[data-bs-theme="dark"] .leaflet-popup-content-wrapper, [data-bs-theme="dark"] .leaflet-popup-tip { background: var(--sm-surface); color: var(--sm-text); }
.map-pin { background: none; border: 0; }

.pin {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: grid;
    place-items: center;
    background: var(--sm-gradient);
    border: 3px solid #fff;
    box-shadow: 0 8px 16px -6px rgba(79, 70, 229, .9);
    animation: pinDrop .7s var(--sm-ease) backwards;
}

.pin i { transform: rotate(45deg); color: #fff; font-size: .8rem; }

/* ---------- Toasts ---------- */
.toast-stack {
    position: fixed;
    z-index: 1090;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    right: 1rem;
    width: min(390px, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
}

.sm-toast {
    --tone: #10b981;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .95rem 1rem 1.05rem;
    border-radius: 1rem;
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    box-shadow: var(--sm-shadow-lg);
    animation: toastIn .55s var(--sm-ease) backwards;
}

.sm-toast.is-error { --tone: #ef4444; }
.sm-toast > i { font-size: 1.25rem; color: var(--tone); line-height: 1.2; }
.sm-toast .toast-text { flex: 1; font-size: .9rem; font-weight: 550; }
.sm-toast .toast-close { border: 0; background: none; color: var(--sm-muted); font-size: 1.2rem; line-height: 1; padding: 0 .2rem; }
.sm-toast .toast-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); transform-origin: left; animation: shrinkX 5.5s linear forwards; }
.sm-toast.is-error .toast-progress { animation-duration: 9s; }
.sm-toast:hover .toast-progress { animation-play-state: paused; }
.sm-toast.is-leaving { animation: toastOut .4s var(--sm-ease) forwards; }

/* ---------- Modals: Suche & Bestätigung ---------- */
.modal-backdrop { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-backdrop.show { opacity: .45; }
.modal.fade .modal-dialog { transform: translateY(14px) scale(.96); transition: transform .35s var(--sm-ease), opacity .25s; }
.modal.show .modal-dialog { transform: none; }
.modal-content { box-shadow: var(--sm-shadow-lg); }

.search-dialog .modal-content { overflow: hidden; }
.search-input-wrap { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--sm-border); }
.search-input-wrap > i { font-size: 1.15rem; color: var(--sm-primary); }
.search-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--sm-text); font-size: 1.08rem; }
.search-results { max-height: min(62vh, 520px); overflow: auto; padding: .5rem; }
.search-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--sm-muted); font-weight: 700; padding: .8rem .75rem .35rem; }

.search-hit {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .6rem .75rem;
    border-radius: .85rem;
    color: inherit;
    text-decoration: none;
    animation: fadeUp .35s var(--sm-ease) backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
}

.search-hit.is-active { background: rgba(var(--sm-primary-rgb), .1); color: inherit; }
.hit-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: .75rem; display: grid; place-items: center; overflow: hidden; color: var(--sm-primary); background: var(--sm-surface-2); }
.hit-icon img { width: 100%; height: 100%; object-fit: cover; }
.hit-title { font-weight: 600; font-size: .92rem; }
.hit-sub { font-size: .78rem; color: var(--sm-muted); }
.hit-arrow { margin-left: auto; color: var(--sm-muted); opacity: 0; transform: translateX(-6px); transition: all .25s var(--sm-ease); }
.search-hit.is-active .hit-arrow { opacity: 1; transform: none; }
.search-empty { padding: 2.5rem 1rem; text-align: center; color: var(--sm-muted); }
.search-footer { display: flex; gap: 1rem; padding: .6rem 1.25rem; border-top: 1px solid var(--sm-border); font-size: .75rem; color: var(--sm-muted); }

.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 1.8rem;
    color: #ef4444;
    background: rgba(239, 68, 68, .1);
    animation: shake .6s var(--sm-ease) .15s;
}

/* Scanner */
.scan-viewport { position: relative; border-radius: 1rem; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-viewport video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 22% 12%; border-radius: 1rem; box-shadow: 0 0 0 999px rgba(0, 0, 0, .45); border: 2px solid rgba(255, 255, 255, .85); }
.scan-line { position: absolute; left: 6%; right: 6%; height: 2px; background: #22d3ee; box-shadow: 0 0 12px #22d3ee; animation: scanLine 1.8s ease-in-out infinite alternate; }

/* ---------- Leere Zustände & Pagination ---------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; }

.empty-icon {
    width: 92px;
    height: 92px;
    margin: 0 auto 1.2rem;
    border-radius: 30px;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    color: var(--sm-primary);
    background: rgba(var(--sm-primary-rgb), .1);
    animation: float 6s ease-in-out infinite;
}

.empty-state h3 { font-size: 1.15rem; font-weight: 650; }
.empty-state p { color: var(--sm-muted); max-width: 380px; margin: .4rem auto 1.25rem; }

.pagination { --bs-pagination-bg: var(--sm-surface); --bs-pagination-border-color: var(--sm-border); --bs-pagination-color: var(--sm-text); --bs-pagination-hover-bg: rgba(var(--sm-primary-rgb), .08); --bs-pagination-hover-color: var(--sm-primary); --bs-pagination-active-bg: var(--sm-primary); --bs-pagination-active-border-color: var(--sm-primary); --bs-pagination-disabled-bg: var(--sm-surface); gap: .35rem; }
.pagination .page-link { border-radius: .7rem !important; min-width: 40px; text-align: center; font-weight: 550; }

.text-muted-2 { color: var(--sm-muted) !important; }
.min-w-0 { min-width: 0; }
.fw-650 { font-weight: 650; }
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Erweiterungen: Belege, Varianten, Galerie, Auswertungen
   ========================================================================== */

/* Diagramm-Tokens (validiert: hell gegen #ffffff, dunkel gegen #121829) */
:root {
    --series-1: #6366f1;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --chart-grid: #e8eaf0;
    --chart-axis: #cbd5e1;
}

[data-bs-theme="dark"] {
    --series-1: #7c83f6;
    --series-2: #d95926;
    --series-3: #199e70;
    --chart-grid: #232b42;
    --chart-axis: #2f3852;
}

.chart-box { position: relative; height: 280px; }
.chart-box.chart-sm { height: 220px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--sm-muted); margin: -.25rem 0 .75rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 220px; color: var(--sm-muted); font-size: .9rem; }
.chart-empty i { font-size: 2rem; opacity: .5; }
.chart-empty.sm { min-height: 0; padding: 1.25rem 0; flex-direction: row; }
.chart-empty.sm i { font-size: 1.1rem; }

.table-view { margin-top: .75rem; }
.table-view summary { cursor: pointer; font-size: .82rem; color: var(--sm-muted); list-style: none; display: inline-flex; align-items: center; gap: .4rem; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary:hover { color: var(--sm-primary); }
.table-view[open] summary { color: var(--sm-primary); }

/* Tabellen */
.data-table { --bs-table-bg: transparent; --bs-table-color: var(--sm-text); margin-bottom: 0; }
.data-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sm-muted); font-weight: 650; border-bottom-color: var(--sm-border); white-space: nowrap; }
.data-table td { border-bottom-color: var(--sm-border); vertical-align: middle; }
.data-table tbody tr { transition: background-color .2s; }
.data-table tbody tr:hover { background: rgba(var(--sm-primary-rgb), .03); }
.data-table tfoot td { border-bottom: 0; padding-top: .9rem; }
.data-table tr.is-archived td { opacity: .55; }
.data-table tr.is-short td { color: #ef4444; }

.kpi-sub { font-size: .75rem; color: var(--sm-muted); margin-top: .25rem; }

.delta { display: inline-flex; align-items: center; gap: .2rem; font-weight: 650; font-size: .85rem; }
.delta.is-up { color: #f97316; }
.delta.is-down { color: #10b981; }

/* Chips */
.chip-sep { flex: 0 0 1px; align-self: stretch; background: var(--sm-border); margin: .2rem .2rem; }
.chip-sm { padding: .2rem .6rem; font-size: .74rem; box-shadow: none; }
.size-presets { display: flex; flex-wrap: wrap; gap: .3rem; }

/* Hinweisboxen */
.archive-banner, .setup-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .9rem;
    padding: .9rem 1.1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--sm-radius);
    border: 1px solid var(--sm-border);
    background: var(--sm-surface);
    box-shadow: var(--sm-shadow-sm);
}

.archive-banner > i, .setup-hint > i {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
}

.archive-banner > i { background: rgba(100, 116, 139, .14); color: #64748b; }
.setup-hint > i { background: rgba(245, 158, 11, .15); color: #d97706; }
.setup-hint { border-color: rgba(245, 158, 11, .35); }

.info-note { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: .8rem; background: rgba(var(--sm-primary-rgb), .07); font-size: .85rem; }
.info-note i { color: var(--sm-primary); margin-top: .1rem; }

.toggle-card { padding: .85rem 1rem; border-radius: .9rem; border: 1px solid var(--sm-border); background: var(--sm-surface-2); }

/* Sidebar: Einstellungen */
.sidebar-settings { color: #94a3b8; text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; transition: color .2s; }
.sidebar-settings:hover, .sidebar-settings.active { color: #fff; }
.sidebar-settings i { transition: transform .6s var(--sm-ease); }
.sidebar-settings:hover i { transform: rotate(90deg); }

/* Artikelkarten: Zusatzplaketten */
.media-badges { position: absolute; left: .6rem; bottom: .6rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.media-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .5rem; border-radius: 99px; font-size: .68rem; font-weight: 650; color: #fff; background: rgba(15, 23, 42, .62); backdrop-filter: blur(6px); }
.item-card.is-archived { opacity: .7; filter: grayscale(.5); }
.is-list .media-badges { display: none; }

@media (max-width: 575.98px) {
    .media-badges { display: none; }
}

/* Galerie */
.gallery-main { position: relative; }
.gallery-open { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; }
.gallery-open img { transition: opacity .2s ease, transform .6s var(--sm-ease); }
.gallery-open:hover img { transform: scale(1.03); }
.gallery-open img.is-swapping { opacity: 0; }
.gallery-zoom { position: absolute; right: .8rem; bottom: .8rem; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); opacity: 0; transform: translateY(6px); transition: all .3s var(--sm-ease); }
.gallery-open:hover .gallery-zoom, .gallery-open:focus-visible .gallery-zoom { opacity: 1; transform: none; }
.gallery-strip { display: flex; gap: .5rem; padding: .7rem; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--sm-border); }
.gallery-thumb { width: 58px; height: 58px; flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: .7rem; cursor: pointer; transition: border-color .2s, transform .25s var(--sm-ease); }
.gallery-thumb:hover { transform: translateY(-2px); }
.gallery-thumb.active { border-color: var(--sm-primary); }

.lightbox .modal-content { background: transparent; border: 0; box-shadow: none; align-items: center; }
.lightbox-img { max-width: 100%; max-height: 82vh; border-radius: 1rem; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); opacity: 0; transform: scale(.96); transition: opacity .35s ease, transform .45s var(--sm-ease); background: #fff; }
.lightbox-img.is-in { opacity: 1; transform: none; }
.lightbox-close { position: absolute; top: -2.5rem; right: 0; z-index: 2; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; color: #fff; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); font-size: 1.2rem; z-index: 2; transition: background-color .2s, transform .2s; }
.lightbox-nav:hover { background: rgba(99, 102, 241, .85); }
.lightbox-nav.prev { left: .5rem; }
.lightbox-nav.next { right: .5rem; }
.lightbox.single .lightbox-nav, .lightbox.single .lightbox-count { display: none; }
.lightbox-count { position: absolute; bottom: -2.2rem; color: #fff; font-size: .85rem; opacity: .85; }
.modal-backdrop.show:has(+ .lightbox) { opacity: .85; }

/* Bildverwaltung im Formular */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.image-tile { position: relative; aspect-ratio: 1; border-radius: var(--sm-radius); overflow: hidden; background: var(--sm-surface-2); border: 1px solid var(--sm-border); animation: scaleIn .35s var(--sm-ease) backwards; }
.image-tile img { width: 100%; height: 100%; object-fit: cover; transition: filter .3s, opacity .3s; }
.image-tile.is-removed img { filter: grayscale(1); opacity: .35; }
.image-tile.is-removed::after { content: "wird entfernt"; position: absolute; inset: auto 0 .5rem; text-align: center; font-size: .72rem; font-weight: 650; color: #ef4444; }
.image-main, .image-remove { position: absolute; top: .45rem; margin: 0; cursor: pointer; }
.image-main { left: .45rem; }
.image-remove { right: .45rem; }
.image-main input, .image-remove input { position: absolute; opacity: 0; pointer-events: none; }
.image-main span, .image-remove span { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; border-radius: 99px; font-size: .7rem; font-weight: 650; color: #fff; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); transition: background-color .2s, transform .2s var(--sm-ease); }
.image-main input:checked + span { background: var(--sm-gradient); }
.image-main span i { color: #fde68a; opacity: .5; }
.image-main input:checked + span i { opacity: 1; }
.image-remove input:checked + span { background: #ef4444; }
.image-main span:hover, .image-remove span:hover { transform: scale(1.06); }
.image-new-badge { position: absolute; left: .45rem; top: .45rem; padding: .2rem .5rem; border-radius: 99px; font-size: .68rem; font-weight: 700; color: #fff; background: #10b981; }
.image-remove-new { position: absolute; right: .45rem; top: .45rem; width: 26px; height: 26px; border-radius: 50%; border: 0; color: #fff; background: rgba(15, 23, 42, .6); font-size: .75rem; display: grid; place-items: center; }
.image-add { aspect-ratio: 1; min-height: 0; }
.image-add .dz-icon { font-size: 1.7rem; }
.logo-preview { width: 180px; height: 90px; border-radius: .9rem; border: 1px dashed var(--bs-border-color); display: grid; place-items: center; background: #fff; overflow: hidden; padding: .5rem; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Varianten */
.variant-bars { display: grid; gap: .45rem; }
.variant-bar { display: grid; grid-template-columns: minmax(70px, auto) 1fr auto; align-items: center; gap: .6rem; font-size: .8rem; color: inherit; text-decoration: none; }
.variant-bar:hover .vb-label { color: var(--sm-primary); }
.vb-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.vb-track { height: 8px; border-radius: 99px; background: var(--sm-surface-2); overflow: hidden; }
.vb-fill { display: block; height: 100%; width: var(--w); min-width: 3px; border-radius: inherit; background: var(--c); transform-origin: left; animation: growX 1s var(--sm-ease) backwards; animation-delay: calc(var(--i, 0) * 70ms + 200ms); }
.vb-value { font-variant-numeric: tabular-nums; color: var(--sm-muted); min-width: 2.5rem; text-align: right; }
.variant-chip { display: inline-block; padding: .1rem .5rem; margin: .1rem 0; border-radius: 99px; background: rgba(var(--sm-primary-rgb), .1); color: var(--sm-primary-600); font-weight: 600; animation: scaleIn .25s var(--sm-ease) backwards; }
[data-bs-theme="dark"] .variant-chip { color: #a5b4fc; }

.tab-scroll { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-scroll .nav-link { white-space: nowrap; }
.tab-pane.fade { transition: opacity .3s ease, transform .3s var(--sm-ease); transform: translateY(6px); }
.tab-pane.fade.show { transform: none; }

/* Belege: Liste */
.doc-list { overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--sm-border); color: inherit; text-decoration: none; transition: background-color .2s; animation: fadeUp .45s var(--sm-ease) backwards; }
.doc-row:hover { background: rgba(var(--sm-primary-rgb), .04); color: inherit; }
.doc-row:hover .doc-chevron { transform: translateX(3px); color: var(--sm-primary); }
.doc-row:last-of-type { border-bottom: 0; }
.doc-row.is-cancelled .doc-main, .doc-row.is-cancelled .doc-amount { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(100, 116, 139, .5); }
.doc-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.page-header .doc-icon { width: 52px; height: 52px; border-radius: 16px; font-size: 1.4rem; }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-number { font-weight: 650; font-variant-numeric: tabular-nums; }
.doc-type { font-weight: 500; font-size: .75rem; color: var(--sm-muted); margin-left: .35rem; }
.doc-recipient { font-size: .82rem; color: var(--sm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-date { font-size: .82rem; text-align: right; min-width: 92px; display: flex; flex-direction: column; }
.doc-date small { color: var(--sm-muted); }
.doc-amount { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; white-space: nowrap; }
.doc-chevron { color: var(--sm-muted); transition: transform .25s var(--sm-ease), color .2s; }
.doc-sum { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; background: var(--sm-surface-2); font-size: .88rem; }
@media (max-width: 575.98px) {
    .doc-row { flex-wrap: wrap; gap: .5rem .75rem; }
    .doc-main { flex: 1 1 calc(100% - 60px); }
    .doc-status { margin-left: 52px; }
    .doc-amount { margin-left: auto; min-width: 0; }
    .doc-chevron { display: none; }
}

/* Belege: Formular */
.type-switch { display: flex; flex-wrap: wrap; gap: .6rem; }
.type-option { flex: 1 1 140px; display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; margin: 0; border-radius: var(--sm-radius); border: 2px solid var(--sm-border); background: var(--sm-surface); cursor: pointer; font-weight: 650; box-shadow: var(--sm-shadow-sm); transition: border-color .25s, transform .25s var(--sm-ease), box-shadow .25s; }
.type-option:hover { transform: translateY(-2px); box-shadow: var(--sm-shadow); }
.type-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); transition: all .3s var(--sm-ease); }
input:checked + .type-option { border-color: var(--tone); box-shadow: 0 10px 24px -14px var(--tone); }
input:checked + .type-option .type-icon { color: #fff; background: var(--tone); transform: rotate(-6deg) scale(1.05); }
input:focus-visible + .type-option { outline: 2px solid var(--sm-primary); outline-offset: 2px; }

.line-editor { display: grid; gap: .5rem; }
.line-head, .line-row { display: grid; grid-template-columns: minmax(0, 1fr) 124px 92px 76px 86px 32px; gap: .45rem; align-items: start; }
.no-vat .line-head, .no-vat .line-row { grid-template-columns: minmax(0, 1fr) 124px 92px 86px 32px; }
.line-qty .form-control { padding-left: .45rem; padding-right: .45rem; }
.line-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sm-muted); font-weight: 650; padding: 0 .1rem; }
.line-row { padding: .6rem; border-radius: .9rem; background: var(--sm-surface-2); border: 1px solid transparent; transition: border-color .2s, opacity .22s, transform .22s var(--sm-ease); }
.line-row:focus-within { border-color: rgba(var(--sm-primary-rgb), .35); }
.line-row.is-new { animation: fadeUp .35s var(--sm-ease) backwards; }
.line-row.is-leaving { opacity: 0; transform: translateX(16px) scale(.98); }
.line-total { font-weight: 700; text-align: right; padding-top: .3rem; white-space: nowrap; }
.unit-input { max-width: 56px; }
.line-row .is-warning { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .15); }
@media (max-width: 767.98px) {
    .line-row, .no-vat .line-row { grid-template-columns: 1fr 1fr; grid-template-areas: "item item" "qty price" "vat total" "x x"; }
    .line-item { grid-column: 1 / -1; }
    .line-total { align-self: center; }
    .line-row > [data-remove-line] { grid-column: 1 / -1; justify-self: end; width: auto; padding: 0 .7rem; }
}

.doc-side { position: sticky; top: calc(var(--sm-topbar-h) + 1rem); }
.totals-card .card-body { padding: 1.25rem; }
.totals-row { display: flex; justify-content: space-between; padding: .3rem 0; color: var(--sm-muted); font-size: .9rem; }
.totals-row.total { color: var(--sm-text); font-weight: 750; font-size: 1.35rem; border-top: 1px solid var(--sm-border); margin-top: .4rem; padding-top: .7rem; }
.totals-row .bump { display: inline-block; animation: bump .45s var(--sm-ease); }
.totals-card.is-muted .totals-row { opacity: .55; }

/* Belege: Detail */
.paper-preview { position: relative; overflow: hidden; background: #e2e8f0; height: 600px; transition: height .3s ease; }
[data-bs-theme="dark"] .paper-preview { background: #0f1424; }
.paper-preview iframe { border: 0; transform-origin: 0 0; display: block; opacity: 0; transition: opacity .4s ease; }
.paper-preview.is-ready iframe { opacity: 1; }
.doc-total { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.due-line { display: flex; align-items: center; gap: .55rem; padding: .6rem .8rem; border-radius: .8rem; font-size: .88rem; background: rgba(245, 158, 11, .12); color: #b45309; }
.due-line.is-overdue { background: rgba(239, 68, 68, .12); color: #dc2626; animation: shake .6s var(--sm-ease) .4s; }
.due-line.is-paid { background: rgba(16, 185, 129, .12); color: #047857; }
[data-bs-theme="dark"] .due-line { color: #fbbf24; }
[data-bs-theme="dark"] .due-line.is-overdue { color: #f87171; }
[data-bs-theme="dark"] .due-line.is-paid { color: #34d399; }

/* Fertigung */
.requirements { animation: fadeUp .35s var(--sm-ease); }
.requirements tr { animation: fadeUp .3s var(--sm-ease) backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.tl-icon.tone-violet, .mini-row .tl-icon { flex-shrink: 0; }

/* ==========================================================================
   Benutzer, Anmeldung & Rollen
   ========================================================================== */

/* Rollen: Bedienelemente ausblenden, die nicht erlaubt sind (der Server prüft zusätzlich) */
.role-viewer a[href*="/new"],
.role-viewer a[href$="/edit"],
.role-viewer .fab,
.role-viewer form[method="post"]:not([data-keep]),
.role-viewer [data-bs-target="#bookModal"],
.role-viewer [data-bs-target="#produceModal"],
.role-viewer [data-bs-target="#cancelModal"],
.role-viewer .dropdown-toggle-split,
.role-employee form[action$="/delete"]:not([action*="/bom/"]),
.role-employee [data-bs-target="#cancelModal"] { display: none !important; }
.role-viewer .tabbar { justify-content: space-around; }

/* Benutzermenü */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    height: 42px;
    padding: 0 .55rem 0 .3rem;
    border-radius: 99px;
    border: 1px solid var(--sm-border);
    background: var(--sm-surface);
    color: var(--sm-text);
    box-shadow: var(--sm-shadow-sm);
    transition: border-color .2s, box-shadow .25s var(--sm-ease);
}

.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: rgba(var(--sm-primary-rgb), .4); box-shadow: 0 0 0 4px rgba(var(--sm-primary-rgb), .08); }
.user-chip .bi-chevron-down { font-size: .75rem; color: var(--sm-muted); transition: transform .3s var(--sm-ease); }
.user-chip[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.user-name { font-weight: 600; font-size: .88rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: .74rem;
    font-weight: 750;
    color: #fff;
    background: linear-gradient(135deg, var(--tone, #6366f1), color-mix(in srgb, var(--tone, #6366f1) 55%, #a855f7));
}

.user-avatar.lg { width: 42px; height: 42px; font-size: .88rem; }
.user-avatar.xl { width: 64px; height: 64px; font-size: 1.3rem; box-shadow: 0 12px 26px -12px var(--tone, #6366f1); }
.user-menu { min-width: 250px; }
.user-menu-head { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem .35rem; }
.tl-user { white-space: nowrap; }

/* Rollenauswahl & Rollen-Karten */
.role-picker { display: grid; gap: .6rem; }
.role-option { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; margin: 0; border-radius: var(--sm-radius); border: 2px solid var(--sm-border); background: var(--sm-surface); cursor: pointer; transition: border-color .25s, transform .25s var(--sm-ease), box-shadow .25s; }
.role-option:hover { transform: translateY(-1px); box-shadow: var(--sm-shadow-sm); }
input:checked + .role-option { border-color: var(--tone); box-shadow: 0 10px 24px -16px var(--tone); }
input:checked + .role-option .type-icon { color: #fff; background: var(--tone); }
input:focus-visible + .role-option { outline: 2px solid var(--sm-primary); outline-offset: 2px; }
.role-card .kpi-icon { margin-bottom: 0; }

/* Anmeldung & Ersteinrichtung */
.auth-body { min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(380px, 46%) 1fr; } }

.auth-brand {
    position: relative;
    overflow: hidden;
    display: none;
    padding: 3.5rem;
    color: #e2e8f0;
    background:
        radial-gradient(700px 400px at -10% -10%, rgba(139, 92, 246, .55), transparent 60%),
        radial-gradient(600px 500px at 110% 110%, rgba(99, 102, 241, .45), transparent 60%),
        linear-gradient(160deg, #0f172a 0%, #1e1b4b 100%);
}

@media (min-width: 992px) { .auth-brand { display: flex; align-items: center; } }
.auth-brand-inner { position: relative; z-index: 1; max-width: 460px; animation: fadeUp .8s var(--sm-ease) backwards; }
.auth-brand .brand { color: #fff; font-size: 1.25rem; margin-bottom: 2.5rem; }
.auth-brand h2 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 750; letter-spacing: -.025em; line-height: 1.2; color: #fff; margin-bottom: 1.75rem; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.auth-features li { display: flex; align-items: center; gap: .8rem; font-size: .98rem; animation: fadeUp .6s var(--sm-ease) backwards; }
.auth-features li:nth-child(1) { animation-delay: .25s; }
.auth-features li:nth-child(2) { animation-delay: .33s; }
.auth-features li:nth-child(3) { animation-delay: .41s; }
.auth-features li:nth-child(4) { animation-delay: .49s; }
.auth-features i { width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #c7d2fe; }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(2px); background: rgba(255, 255, 255, .06); animation: float 12s ease-in-out infinite; }
.orb-1 { width: 420px; height: 420px; right: -140px; top: -120px; }
.orb-2 { width: 260px; height: 260px; left: -90px; bottom: -80px; animation-delay: -4s; }
.orb-3 { width: 140px; height: 140px; right: 18%; bottom: 14%; animation-delay: -8s; background: rgba(168, 85, 247, .18); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: calc(2rem + env(safe-area-inset-top, 0px)) 1.25rem 2rem; }
.auth-card { width: 100%; max-width: 440px; animation: fadeUp .6s var(--sm-ease) backwards .1s; }
.auth-card .brand { font-size: 1.15rem; }
.auth-card h1 { font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.025em; margin-bottom: .35rem; }
.auth-step { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; margin-bottom: .9rem; border-radius: 99px; font-size: .78rem; font-weight: 650; color: var(--sm-primary-600); background: rgba(var(--sm-primary-rgb), .1); }
.auth-input { position: relative; }
.auth-input > i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--sm-muted); pointer-events: none; z-index: 2; }
.auth-input .form-control { padding-left: 2.75rem; padding-right: 3rem; border-radius: .95rem; }
.auth-eye { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: .7rem; background: transparent; color: var(--sm-muted); }
.auth-eye:hover { color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .08); }
.auth-alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; margin-bottom: 1.25rem; border-radius: .9rem; font-size: .9rem; font-weight: 500; animation: scaleIn .35s var(--sm-ease); }
.auth-alert.is-error { color: #b91c1c; background: rgba(239, 68, 68, .1); animation: shake .5s var(--sm-ease); }
.auth-alert.is-success { color: #047857; background: rgba(16, 185, 129, .1); }
[data-bs-theme="dark"] .auth-alert.is-error { color: #fca5a5; }
[data-bs-theme="dark"] .auth-alert.is-success { color: #6ee7b7; }
[data-bs-theme="dark"] .auth-step { color: #a5b4fc; }

/* ==========================================================================
   Fotos mit dem Handy (QR-Übergabe)
   ========================================================================== */

/* Laptop: QR-Dialog */
.qr-frame { position: relative; width: min(260px, 70vw); margin: 0 auto; padding: 14px; border-radius: 1.25rem; background: #fff; box-shadow: var(--sm-shadow); overflow: hidden; animation: scaleIn .4s var(--sm-ease); }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-scan-line { position: absolute; left: 10px; right: 10px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--sm-primary), transparent); box-shadow: 0 0 14px var(--sm-primary); animation: scanLine 2.2s ease-in-out infinite alternate; opacity: .7; }
.qr-url code { color: var(--sm-muted); word-break: break-all; font-size: .76rem; }
.qr-warning { text-align: left; padding: .6rem .8rem; border-radius: .8rem; color: #b45309; background: rgba(245, 158, 11, .12); }
[data-bs-theme="dark"] .qr-warning { color: #fbbf24; }
.phone-status { display: inline-flex; align-items: center; gap: .55rem; padding: .45rem .9rem; border-radius: 99px; font-size: .86rem; font-weight: 600; color: var(--sm-muted); background: var(--sm-surface-2); transition: all .3s var(--sm-ease); }
.phone-status.is-received { color: #047857; background: rgba(16, 185, 129, .12); animation: bump .45s var(--sm-ease); }
[data-bs-theme="dark"] .phone-status.is-received { color: #34d399; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sm-primary); --dot: var(--sm-primary); animation: pulseDot 1.6s infinite; }
.phone-received { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .9rem; }
.phone-thumb { position: relative; width: 64px; height: 64px; border-radius: .8rem; overflow: hidden; box-shadow: var(--sm-shadow-sm); animation: photoIn .5s var(--sm-ease) backwards; }
.phone-thumb img { width: 100%; height: 100%; object-fit: cover; }
.phone-thumb i { position: absolute; right: 3px; bottom: 3px; color: #10b981; background: #fff; border-radius: 50%; font-size: .85rem; line-height: 1; }

/* Formular: Kachel „Mit Handy“ und übertragene Fotos */
.phone-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    aspect-ratio: 1;
    padding: .5rem;
    border: 2px dashed rgba(139, 92, 246, .35);
    border-radius: var(--sm-radius);
    background: rgba(139, 92, 246, .05);
    color: var(--sm-text);
    text-align: center;
    transition: border-color .25s, background-color .25s, transform .25s var(--sm-ease);
}
.phone-add:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, .1); transform: translateY(-2px); }
.phone-add .dz-icon { font-size: 1.7rem; color: #8b5cf6; }
.phone-add .dz-title { font-weight: 600; font-size: .9rem; }
.phone-add .dz-sub { font-size: .74rem; color: var(--sm-muted); }
.image-tile.is-phone { box-shadow: 0 0 0 2px rgba(139, 92, 246, .45); }
.image-phone-badge { position: absolute; left: .45rem; top: .45rem; display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem; border-radius: 99px; font-size: .68rem; font-weight: 700; color: #fff; background: #8b5cf6; }
.photo-head-icon { width: 64px; height: 64px; flex-shrink: 0; border-radius: .8rem; display: grid; place-items: center; font-size: 1.6rem; color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .1); }

/* Handy: Fotoseite */
.photo-body { min-height: 100vh; }
.photo-page { max-width: 520px; margin: 0 auto; padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem calc(2rem + env(safe-area-inset-bottom, 0px)); animation: pageIn .45s var(--sm-ease) backwards; }
.photo-head { display: flex; align-items: center; gap: .9rem; padding: .9rem; margin-bottom: 1.25rem; border-radius: var(--sm-radius); background: var(--sm-surface); border: 1px solid var(--sm-border); box-shadow: var(--sm-shadow-sm); }
.camera-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 2.2rem 1rem 1.8rem;
    margin: 0;
    border-radius: 1.5rem;
    color: #fff;
    cursor: pointer;
    text-align: center;
    background: var(--sm-gradient);
    box-shadow: 0 24px 44px -20px rgba(99, 102, 241, .9);
    transition: transform .2s var(--sm-ease);
    -webkit-tap-highlight-color: transparent;
}
.camera-button:active { transform: scale(.97); }
.camera-ring { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-size: 2.3rem; background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); animation: cameraPulse 2.2s infinite; margin-bottom: .5rem; }
.camera-title { font-size: 1.25rem; font-weight: 750; }
.camera-sub { font-size: .85rem; opacity: .85; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1.25rem; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: .9rem; overflow: hidden; background: var(--sm-surface-2); animation: photoIn .45s var(--sm-ease) backwards; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: filter .3s, opacity .3s; }
.photo-tile.is-uploading img { filter: blur(1px) brightness(.75); }
.photo-tile.is-failed img { filter: grayscale(1); opacity: .5; }
.photo-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .35); overflow: hidden; transition: opacity .3s; }
.photo-progress span { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; transition: width .2s ease; }
.photo-tile:not(.is-uploading) .photo-progress { opacity: 0; }
.photo-state { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; color: #fff; background: rgba(15, 23, 42, .55); }
.photo-tile.is-done .photo-state { background: #10b981; animation: bump .4s var(--sm-ease); }
.photo-tile.is-failed .photo-state { background: #ef4444; }
.photo-tile.is-uploading .photo-state i { animation: float 1.2s ease-in-out infinite; }
.photo-hint { display: flex; gap: .5rem; margin-top: 1.25rem; padding: .8rem .9rem; border-radius: .9rem; background: var(--sm-surface-2); }

/* ---------- Animationen ---------- */
@keyframes bump { 40% { transform: scale(1.08); } }
@keyframes photoIn { from { opacity: 0; transform: scale(.8) translateY(8px); } }
@keyframes cameraPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); } 70%, 100% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); } }
.stagger > * { animation: fadeUp .6s var(--sm-ease) backwards; animation-delay: calc(var(--i, 0) * 55ms + 60ms); }
.reveal { animation: fadeUp .65s var(--sm-ease) backwards; animation-delay: var(--d, 0ms); }

@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95) translateY(-4px); } }
@keyframes slideUp { from { transform: translateY(140%); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes shrinkX { to { transform: scaleX(0); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-10px, 10px); } }
@keyframes tabPop { 40% { transform: scale(1.28) translateY(-3px); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes ringFill { from { --p: 0; } }
@keyframes pinDrop { from { opacity: 0; transform: translateY(-36px) rotate(-45deg); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes scanLine { from { top: 10%; } to { top: 88%; } }
@keyframes shake { 20%, 60% { transform: rotate(-8deg); } 40%, 80% { transform: rotate(8deg); } }
@keyframes flashField { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); border-color: #10b981; } 100% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 65%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); } }

/* ==========================================================
   Wareneingang, Bedarfsplanung, Import, Massenbearbeitung,
   Duplizieren, Sammelrechnung, E-Mail-Versand
   ========================================================== */

/* Wareneingang: Positionszeilen */
.line-head.receipt-grid, .line-row.receipt-grid { grid-template-columns: minmax(0, 1fr) 140px 104px 92px 32px; }
.total-card { position: sticky; top: 1rem; }
@media (max-width: 767.98px) {
    .line-row.receipt-grid { grid-template-columns: 1fr 1fr; grid-template-areas: none; }
    .line-row.receipt-grid .line-item { grid-column: 1 / -1; }
    .line-row.receipt-grid > [data-remove-line] { grid-column: 1 / -1; justify-self: end; width: auto; padding: 0 .7rem; }
}

/* Bedarfsplanung */
.plan-groups { display: grid; gap: .9rem; max-height: 60vh; overflow: auto; padding-right: .2rem; }
.plan-group-title { font-weight: 650; font-size: .9rem; margin-bottom: .35rem; }
.plan-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 130px; gap: .6rem; align-items: center; padding: .4rem .6rem; border-radius: .7rem; background: var(--sm-surface-2); margin-bottom: .3rem; cursor: text; }
.plan-row:focus-within { box-shadow: 0 0 0 2px rgba(var(--sm-primary-rgb), .35); }
.plan-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-verdict { display: flex; gap: .8rem; align-items: center; padding: 1rem 1.2rem; border-radius: var(--sm-radius); margin-bottom: 1rem; }
.plan-verdict > i { font-size: 1.6rem; }
.plan-verdict.is-ok { background: rgba(16, 185, 129, .1); color: #047857; }
.plan-verdict.is-short { background: rgba(245, 158, 11, .12); color: #b45309; }
[data-bs-theme="dark"] .plan-verdict.is-ok { color: #6ee7b7; }
[data-bs-theme="dark"] .plan-verdict.is-short { color: #fcd34d; }
.is-short-row td { background: rgba(245, 158, 11, .06) !important; }
.shortage { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-weight: 700; color: #b45309; background: rgba(245, 158, 11, .15); }
[data-bs-theme="dark"] .shortage { color: #fcd34d; }
.plan-products { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.plan-products li { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: .8rem; background: var(--sm-surface-2); }
@media print {
    .sidebar, .tabbar, .topbar, .crumbs, [data-plan-form], .btn { display: none !important; }
    .col-xl-7 { width: 100% !important; }
}

/* Import */
.import-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 2.4rem 1rem; border: 2px dashed rgba(var(--sm-primary-rgb), .3); border-radius: var(--sm-radius); background: rgba(var(--sm-primary-rgb), .03); text-align: center; cursor: pointer; transition: border-color .2s, background-color .2s, transform .25s var(--sm-ease); }
.import-drop:hover, .import-drop.is-over { border-color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .07); transform: translateY(-2px); }
.import-drop.has-file { border-style: solid; border-color: #10b981; background: rgba(16, 185, 129, .06); }
.import-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; color: var(--sm-primary); background: rgba(var(--sm-primary-rgb), .1); margin-bottom: .3rem; }
.import-drop.has-file .import-icon { color: #10b981; background: rgba(16, 185, 129, .12); }
.import-steps { padding-left: 1.1rem; margin: 0; display: grid; gap: .6rem; font-size: .88rem; }
.import-fields { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
.import-table { max-height: 60vh; overflow: auto; }
.import-table thead th { position: sticky; top: 0; background: var(--sm-surface); z-index: 1; }
.is-error-row td { background: rgba(239, 68, 68, .05) !important; }
.import-confirm { position: sticky; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 10px 30px rgba(15, 23, 42, .12); }

/* Artikelliste: Auswahlmodus */
.select-mark { position: absolute; right: .6rem; top: .6rem; z-index: 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: transparent; background: rgba(255, 255, 255, .9); border: 2px solid rgba(15, 23, 42, .2); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s var(--sm-ease), background-color .2s, border-color .2s, color .2s; pointer-events: none; }
.select-mode .select-mark { opacity: 1; transform: scale(1); }
.select-mode .item-card { cursor: pointer; user-select: none; }
.select-mode .item-card.is-selected { box-shadow: 0 0 0 3px var(--sm-primary); }
.item-card.is-selected .select-mark { color: #fff; background: var(--sm-primary); border-color: var(--sm-primary); transform: scale(1.08); }
.is-list .select-mark { left: .4rem; right: auto; top: .4rem; width: 22px; height: 22px; font-size: .75rem; }
.bulk-bar { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1040; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 2rem); padding: .55rem .7rem .55rem 1rem; border-radius: 1.1rem; background: var(--sm-surface); border: 1px solid var(--sm-border); box-shadow: 0 18px 50px rgba(15, 23, 42, .22); animation: bulkIn .35s var(--sm-ease); }
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: .88rem; white-space: nowrap; }
.bulk-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
@keyframes bulkIn { from { opacity: 0; transform: translate(-50%, 20px); } }
@media (max-width: 991.98px) {
    .bulk-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
    .bulk-actions .btn span { display: none; }
}
.segmented { display: flex; gap: .35rem; flex-wrap: wrap; }
.segmented .btn-check:checked + .btn { background: var(--sm-primary); color: #fff; border-color: var(--sm-primary); }

/* Duplizieren */
.copy-options { display: grid; gap: .45rem; }
.copy-option { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: .8rem; background: var(--sm-surface-2); cursor: pointer; border: 1px solid transparent; transition: border-color .2s; }
.copy-option:has(input:checked) { border-color: rgba(var(--sm-primary-rgb), .4); }
.copy-option .form-check-input { margin: 0; flex-shrink: 0; }
.copy-option strong { display: block; font-size: .9rem; }
.copy-option small { color: var(--sm-muted); font-size: .76rem; }

/* Sammelrechnung */
.billing-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 1rem; }
.billing-group.is-focus { box-shadow: 0 0 0 3px rgba(var(--sm-primary-rgb), .45); }
.billing-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .8rem; }
.avatar-circle { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.billing-notes { display: grid; gap: .35rem; max-height: 340px; overflow: auto; }
.billing-note { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: .75rem; background: var(--sm-surface-2); cursor: pointer; border: 1px solid transparent; transition: border-color .2s; }
.billing-note:has(input:checked) { border-color: rgba(var(--sm-primary-rgb), .45); background: rgba(var(--sm-primary-rgb), .06); }
.billing-note .form-check-input { margin: 0; flex-shrink: 0; }
.doc-flag { display: inline-block; margin-left: .35rem; padding: .05rem .45rem; border-radius: 99px; font-size: .66rem; font-weight: 700; color: #b45309; background: rgba(245, 158, 11, .15); vertical-align: middle; }
[data-bs-theme="dark"] .doc-flag { color: #fcd34d; }

/* E-Mail-Versand */
.mail-attachment { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: .7rem; background: var(--sm-surface-2); font-size: .88rem; }
.mail-attachment .bi { color: #ef4444; font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .sm-toast .toast-progress { animation-duration: 6s !important; }
}
