/* ===================================================================
   INTEX Vertriebstool – Stylesheet
   Farben: Cream + Lila-Akzent (Brand-Vereinheitlichung 2026-05-16)
   =================================================================== */

/* Phase 6 (2026-05-16): Token-Konsolidierung. tokens-unified.css +
   tokens-additions.css + die Inline-:root-Variablen hier wurden in
   ein einziges tokens.css zusammengefuehrt. Alle alten Namen
   (--primary, --accent, --bg, --dt-*) bleiben als Compat-Aliasses
   in tokens.css §21 bestehen. Brand-Entscheidung: --accent wechselt
   von Stahl-Orange auf Cream/Lila. Stahl-Orange bleibt als
   --color-brand-orange explizit nutzbar.
   Die alten Files tokens-unified.css und tokens-additions.css liegen
   noch im Repo fuer Rollback (Phase 6.x), werden aber nicht mehr
   geladen. Loeschung nach 1-2 Wochen stabiler Live-Phase.

   Phase 7 (2026-05-16): dt-mobile.css Pattern-Library wird hier
   nach tokens.css geladen — generische Mobile-Patterns (.dtm-*)
   die page-by-page im Code-Marathon angewendet werden. */
@import url('/static/tokens.css?v=1');
@import url('/static/dt-mobile.css?v=1');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── Login-Seite ──────────────────────────────────────────────── */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-card {
    background: var(--card);
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .logo { text-align: center; margin-bottom: 32px; }

.login-card .logo h1 {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
}

.login-card .logo h1 span { color: var(--accent); }

.login-card .logo p {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Formulare ──────────────────────────────────────────────── */

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232,121,43,0.15);
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: 15px;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--primary); color: #fff; }
.btn-secondary:hover { background: var(--primary-light); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── App-Layout ──────────────────────────────────────────────── */

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

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 { font-size: 18px; font-weight: 700; }
.sidebar-header h2 span { color: var(--accent); }
.sidebar-header p { font-size: 11px; opacity: 0.6; margin-top: 2px; }

/* Sidebar-Brand: IX-Kachel + INTEX + Subtitle */
.sidebar-brand-tile {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--accent);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -.02em;
    flex-shrink: 0;
}
.sidebar-brand-text { line-height: 1.1; }
.sidebar-brand-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.sidebar-brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    letter-spacing: .15em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Defensive: Sidebar-Links nie unterstreichen, egal welche
   Cascade ein anderes <a>-Default eingeschleust hat */
.sidebar-nav a,
.sidebar-nav a:hover,
.sidebar-nav a:focus,
.sidebar-nav a:visited { text-decoration: none !important; }

/* ── Sidebar-Search (Trigger fuers QuickSearch-Modal) ───────────── */
/* Input bleibt sichtbar im DOM (Designer-locked rule), wird beim Klick zum
   Modal-Trigger. readonly verhindert direkte Eingabe in der Sidebar. */
.sidebar-search {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-search .qs-icon {
    position: absolute;
    left: 24px; top: 50%;
    transform: translateY(-50%);
    width: 14px; height: 14px;
    color: rgba(255,255,255,0.45);
    pointer-events: none;
}
.sidebar-search .qs-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 7px 56px 7px 32px;
    color: #fff;
    font: inherit; font-size: 13px;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none; appearance: none;
    transition: border-color .12s, background-color .12s;
}
.sidebar-search .qs-input:hover {
    background: rgba(255,255,255,0.07);
    border-color: var(--color-accent, #6b4fff);
}
.sidebar-search .qs-input::placeholder { color: rgba(255,255,255,0.4); }
.sidebar-search .qs-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* Modal offen -> Sidebar-Input "depressed" */
body.qs-modal-open .sidebar-search .qs-input {
    opacity: 0.6;
    background: rgba(255,255,255,0.02);
}
.sidebar-search .qs-kbd {
    position: absolute;
    right: 24px; top: 50%;
    transform: translateY(-50%);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.04);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
    letter-spacing: .02em;
}

/* ── QuickSearch-Modal (Designer-Spec 2026-05-19) ─────────────────── */
/* Single Source of Truth fuer Visuals: docs/qsearch-modal-mockup.html
   Designer-Handoff: docs/qsearch-implementation-handoff.md
   Token-konform (tokens.css Creme/Lila), keine Inline-Hex-Werte. */

.qs-overlay {
    position: fixed; inset: 0;
    background: rgba(20,25,35,0.45);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    transition: opacity 150ms ease-out;
    opacity: 1;
}
.qs-overlay[hidden] { display: none; }
.qs-overlay[data-opening="true"] { opacity: 0; }
.qs-overlay[data-closing="true"] {
    opacity: 0;
    transition: opacity 100ms ease-in;
}

.qs-modal {
    width: 600px; max-width: calc(100vw - 32px);
    background: var(--color-surface-1);
    color: var(--color-text-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--color-border-tertiary);
    display: flex; flex-direction: column;
    max-height: 70vh;
    overflow: hidden;
    transform: scale(1); opacity: 1;
    transition: transform 150ms ease-out, opacity 150ms ease-out;
}
.qs-overlay[data-opening="true"] .qs-modal { transform: scale(0.96); opacity: 0; }
.qs-overlay[data-closing="true"] .qs-modal {
    transform: scale(0.98); opacity: 0;
    transition: transform 100ms ease-in, opacity 100ms ease-in;
}

/* Top-Loading-Bar (Slider) */
.qs-loadbar {
    position: relative; height: 2px;
    background: transparent;
    overflow: hidden;
}
.qs-loadbar::before {
    content: ""; position: absolute; top: 0; left: 0;
    height: 100%; width: 40%;
    background: var(--color-accent);
    animation: qs-loadbar 1.2s ease-in-out infinite;
}
.qs-loadbar[hidden] { display: none; }
@keyframes qs-loadbar {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(150%); }
    100% { transform: translateX(250%); }
}

/* Header (Search-Input) */
.qs-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px 14px 18px;
    border-bottom: 1px solid var(--color-border-tertiary);
}
.qs-head__icon { color: var(--color-text-tertiary); flex-shrink: 0; }
.qs-head .qs-modal-input {
    flex: 1;
    border: none; outline: none;
    background: transparent;
    font: 400 15px/1.4 var(--font-sans);
    color: var(--color-text-primary);
    padding: 0;
    -webkit-appearance: none; appearance: none;
}
.qs-head .qs-modal-input::placeholder { color: var(--color-text-quaternary); }
.qs-head .qs-modal-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.qs-counter {
    font-size: 11px;
    color: var(--color-text-tertiary);
    background: var(--color-surface-2);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.qs-counter--loading { color: var(--color-accent); background: var(--color-accent-bg); }
.qs-close {
    background: none; border: none; color: var(--color-text-tertiary);
    cursor: pointer; padding: 4px;
    display: flex; align-items: center;
    font-size: 18px; line-height: 1;
}
.qs-close:hover { color: var(--color-text-primary); }

/* Body */
.qs-body {
    max-height: 480px;
    overflow-y: auto;
    transition: opacity 200ms ease-out;
}
.qs-body--loading { opacity: 0.6; pointer-events: none; }

/* Sections */
.qs-section { padding-top: 6px; }
.qs-section + .qs-section {
    border-top: 1px solid rgba(20,25,35,0.04);
    margin-top: 6px;
    padding-top: 8px;
}
.qs-section__head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px 4px;
}
.qs-section__dot {
    width: 6px; height: 6px; border-radius: 50%;
}
.qs-section__label {
    font-size: 11px; font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase; letter-spacing: 0.6px;
}
.qs-section__count { font-size: 11px; color: var(--color-text-quaternary); }

/* Entity-Akzente (Section-Dot + Item-Icon-Farbe) — aus linkpill-Tokens */
.qs-section--kontakt    .qs-section__dot,
.qs-section--kontakt    .qs-item__icon { background: var(--color-link-kontakt-fg); color: var(--color-link-kontakt-fg); }
.qs-section--vorgang    .qs-section__dot,
.qs-section--vorgang    .qs-item__icon { background: var(--color-link-abwicklung-fg); color: var(--color-link-abwicklung-fg); }
.qs-section--bestellung .qs-section__dot,
.qs-section--bestellung .qs-item__icon { background: var(--color-link-lieferant-fg); color: var(--color-link-lieferant-fg); }
.qs-section--rechnung   .qs-section__dot,
.qs-section--rechnung   .qs-item__icon { background: var(--color-link-kunde-fg); color: var(--color-link-kunde-fg); }
.qs-section--coil       .qs-section__dot,
.qs-section--coil       .qs-item__icon { background: var(--color-link-gebot-fg); color: var(--color-link-gebot-fg); }
.qs-section--aufgabe    .qs-section__dot,
.qs-section--aufgabe    .qs-item__icon { background: var(--color-link-dokument-fg); color: var(--color-link-dokument-fg); }
.qs-section--mail       .qs-section__dot,
.qs-section--mail       .qs-item__icon { background: var(--color-link-mail-fg); color: var(--color-link-mail-fg); }
.qs-section--page       .qs-section__dot,
.qs-section--page       .qs-item__icon { background: var(--color-text-tertiary); color: var(--color-text-tertiary); }
/* Section-Dot ist `background`, Item-Icon ist `color` — beide via dieselbe Regel
   abgedeckt; das Doppel-Set ist absichtlich (Item-Icon-svg nutzt currentColor). */
.qs-section__dot { background-clip: padding-box; }

/* Rows */
.qs-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px 10px 15px;
    margin: 0 6px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none; color: inherit;
    transition: background-color 80ms ease, border-color 80ms ease;
}
.qs-item:hover { background: var(--color-surface-2); }
.qs-item--active {
    background: var(--color-accent-bg);
    border-left-color: var(--color-accent);
    padding-left: 12px;
}
.qs-item__icon {
    width: 22px; height: 22px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.qs-item__icon svg { width: 18px; height: 18px; }
.qs-item__main { flex: 1; min-width: 0; }
.qs-item__label {
    font-size: 14px; font-weight: 500;
    color: var(--color-text-primary); line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qs-item__sub {
    font-size: 12px;
    color: var(--color-text-secondary); line-height: 1.4;
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qs-item__label mark,
.qs-item__sub mark {
    background: #fde68a; color: var(--color-text-primary);
    padding: 0 1px; border-radius: 2px;
}

.qs-pill {
    font-size: 10px; font-weight: 500;
    padding: 2px 8px; border-radius: var(--radius-pill);
    white-space: nowrap;
}
.qs-pill--ok        { background: var(--color-link-kunde-bg);     color: var(--color-link-kunde-fg); }
.qs-pill--warn      { background: var(--color-link-gebot-bg);     color: var(--color-link-gebot-fg); }
.qs-pill--error     { background: var(--color-status-error-bg, #fde2e2); color: var(--color-status-error-fg, #b91c1c); }
.qs-pill--lieferant { background: var(--color-link-lieferant-bg); color: var(--color-link-lieferant-fg); }
.qs-pill--info      { background: var(--color-link-kontakt-bg);   color: var(--color-link-kontakt-fg); }
.qs-pill--neutral   { background: var(--color-surface-2);         color: var(--color-text-secondary); }

/* Footer */
.qs-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: var(--color-surface-0);
    border-top: 1px solid var(--color-border-tertiary);
    font-size: 11px; color: var(--color-text-tertiary);
}
.qs-foot__hints { display: flex; align-items: center; gap: 14px; }
.qs-foot kbd {
    display: inline-block;
    padding: 1px 5px;
    background: var(--color-surface-1);
    border: 1px solid var(--color-border-secondary);
    border-radius: 3px;
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 10px;
    color: var(--color-text-secondary);
    margin-right: 4px;
}

/* Empty / No-Results */
.qs-empty {
    padding: 36px 24px; text-align: center;
    color: var(--color-text-tertiary); font-size: 13px;
}
.qs-empty--err { color: var(--color-status-error-fg, #b91c1c); }

/* Mobile: Bottom-Sheet statt full-screen */
@media (max-width: 700px) {
    .qs-overlay {
        align-items: flex-end; padding-top: 0;
    }
    .qs-modal {
        width: 100%; max-width: 100%;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 32px rgba(20,25,35,0.25);
    }
    /* Grab-Handle oben am Sheet */
    .qs-modal::before {
        content: ""; display: block;
        width: 36px; height: 4px;
        background: var(--color-border-secondary);
        border-radius: 999px;
        margin: 8px auto 0;
    }
    /* Mobile-Row-Layout (Designer-Nachzug 2026-05-19): Pills wandern unter
       das Sublabel, sublabels duerfen umbrechen — sonst kollidieren lange
       Sublabels (Adresse + Mail + AP) mit der rechts haftenden Pille. */
    .qs-item {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 12px 14px;
        min-height: 64px;
    }
    .qs-item__icon { margin-top: 1px; }
    .qs-item__main { min-width: 0; flex: 1 1 0; }
    .qs-item__label,
    .qs-item__sub { white-space: normal; }
    .qs-item .qs-pill {
        order: 99;
        flex-basis: 100%;
        margin-top: 4px;
        align-self: flex-start;
    }
}
/* Alte qs-section/qs-item/qs-empty-Defs entfernt — durch Modal-Spec oben ersetzt.
   Designer-Refactor 2026-05-19. */

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

/* Section-Header: mono-lowercase + Type-Bar links als Akzent */
.nav-group-label {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    text-transform: lowercase;
    letter-spacing: 0.18em;
    color: rgba(255,255,255,0.4);
    padding: 14px 20px 6px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    font-weight: 500;
}
.nav-group-label .nav-group-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.nav-group-label .nav-group-text::before {
    content: "";
    display: inline-block;
    width: 14px; height: 2px;
    background: rgba(107,79,255,0.55);
    flex: none;
}
.nav-group-label--static { cursor: default; }
.nav-group-label--static .nav-chevron { display: none; }
.nav-group-label:first-child { padding-top: 10px; }
.nav-group-label .nav-chevron { font-size: 8px; transition: transform .2s; opacity: 0.4 }
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg) }
.nav-group.collapsed .nav-group-items { display: none }
.nav-group-items a.active { display: flex !important }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.12s;
    border-left: 2px solid transparent;
    position: relative;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(107,79,255,0.12);
    border-left-color: var(--accent);
}
.sidebar-nav a.active::after {
    content: "";
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
}
.sidebar-nav a.active .nav-badge { margin-right: 12px; }

.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-nav a .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notification-Badges */
.nav-badge {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    line-height: 1.4;
    letter-spacing: .02em;
    flex: none;
    background: var(--color-badge-default-bg, rgba(107,79,255,0.20));
    color: var(--color-badge-default-fg, #c4b5ff);
}
.nav-badge--alert { background: rgba(185,28,28,0.20); color: #f0a0a0; }
.nav-badge--info  { background: rgba(45,74,122,0.32); color: #a8c0e8; }
.nav-badge[hidden] { display: none; }

/* Recent-Liste */
.recent-items a.recent-item {
    padding: 5px 20px;
    font-size: 12.5px;
    color: rgba(255,255,255,0.55);
    border-left: 2px solid transparent;
}
.recent-items a.recent-item:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.04); }
.recent-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex: none;
    margin-left: 4px;
}
.recent-dot--kunde     { background: #2d6a4f; }
.recent-dot--lieferant { background: var(--accent); }
.recent-dot--beides    { background: #6b7280; }
.recent-marker {
    margin-left: auto;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    flex: none;
}

/* Footer: User-Chip + Pop-up-Menue */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    position: relative;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color .12s;
}
.user-chip:hover { background: rgba(255,255,255,0.05); }
.user-chip__avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex: none;
}
.user-chip__main {
    flex: 1; min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-chip__name {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip__role {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
    letter-spacing: .04em;
}
.user-chip__caret { color: rgba(255,255,255,0.45); flex: none; }
.user-chip[aria-expanded="true"] .user-chip__caret { color: rgba(255,255,255,0.8); }

.user-menu {
    position: absolute;
    left: 12px; right: 12px;
    bottom: calc(100% + 6px);
    background: #1a2332;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.35);
    overflow: hidden;
    z-index: 50;
    padding: 4px 0;
    animation: userMenuSlide .12s ease-out;
}
@keyframes userMenuSlide {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.user-menu[hidden] { display: none; }
.user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.85);
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.user-menu__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.user-menu__item--danger:hover { background: rgba(185,28,28,0.15); color: #f0a0a0; }
.user-menu__item svg { flex: none; opacity: 0.7; }
.user-menu__sep { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }

/* ── Main Content ──────────────────────────────────────────────── */

.main-content { flex: 1; margin-left: var(--sidebar-width); }

.page-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h1 { font-size: 22px; font-weight: 700; }

.page-body { padding: 24px 32px; }

/* ── Karten ──────────────────────────────────────────────── */

.card {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ── Statistik-Karten ──────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: var(--info); }
.stat-icon.orange { background: #ffedd5; color: var(--accent); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }

.stat-card { transition: box-shadow 0.15s, transform 0.15s; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ── Tabellen ──────────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
    background: var(--bg);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover { background: #f8fafc; }

/* ── Badges ──────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* ── Alerts ──────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}
.alert.show { display: block; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ── Dashboard Greeting ─────────────────────────────────── */

.dash-greeting {
    margin-bottom: 24px;
}
.dash-greeting h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.dash-greeting p {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ── Dashboard Hinweis-Leiste ───────────────────────────── */

.dash-hints {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

a.dash-hint,
.dash-hint {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    transition: box-shadow 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.dash-hint:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dash-hint .hint-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.dash-hint .hint-body {
    flex: 1;
    min-width: 0;
}
.dash-hint .hint-title {
    font-weight: 600;
    font-size: 14px;
}
.dash-hint .hint-detail {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 1px;
}
.dash-hint .hint-arrow {
    color: var(--text-light);
    font-size: 18px;
    flex-shrink: 0;
}

/* Hint color variants */
.dash-hint.hint-danger  { border-left: 4px solid var(--danger); }
.dash-hint.hint-danger .hint-icon  { background: #fee2e2; color: var(--danger); }

.dash-hint.hint-warning { border-left: 4px solid var(--warning); }
.dash-hint.hint-warning .hint-icon { background: #fef3c7; color: #92400e; }

.dash-hint.hint-info    { border-left: 4px solid var(--info); }
.dash-hint.hint-info .hint-icon    { background: #dbeafe; color: var(--info); }

.dash-hint.hint-success { border-left: 4px solid var(--success); }
.dash-hint.hint-success .hint-icon { background: #dcfce7; color: var(--success); }

.dash-hint.hint-purple  { border-left: 4px solid #7c3aed; }
.dash-hint.hint-purple .hint-icon  { background: #ede9fe; color: #7c3aed; }

.dash-hint.hint-teal    { border-left: 4px solid #0d9488; }
.dash-hint.hint-teal .hint-icon    { background: #ccfbf1; color: #0d9488; }

/* ── Toolbar ──────────────────────────────────────────────── */

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 12px center no-repeat;
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--card);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Stepper (wiederverwendbar) ───────────────────────────── */
.stepper { display:flex; gap:0; margin-bottom:20px; padding:0 24px; border-bottom:2px solid var(--border); position:relative }
.stepper-step { flex:1; display:flex; align-items:center; gap:8px; padding:12px 4px; cursor:pointer; position:relative; color:var(--text-light); font-size:13px; font-weight:500; transition:all .2s; border-bottom:2px solid transparent; margin-bottom:-2px; white-space:nowrap }
.stepper-step:hover { color:var(--text) }
.stepper-num { width:24px; height:24px; border-radius:50%; background:#e2e8f0; color:#64748b; font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .2s }
.stepper-step.active { color:var(--accent); border-bottom-color:var(--accent) }
.stepper-step.active .stepper-num { background:var(--accent); color:#fff }
.stepper-step.done { color:#16a34a }
.stepper-step.done .stepper-num { background:#16a34a; color:#fff; font-size:0 }
.stepper-step.done .stepper-num::after { content:'\2713'; font-size:14px }
.stepper-step.done .stepper-num span { display:none }
.stepper-content { display:none; padding:20px 24px }
.stepper-content.active { display:block }
@media (max-width:768px) {
    .stepper { padding:0 12px; gap:0; overflow-x:auto }
    .stepper-step { font-size:0; gap:4px; padding:10px 8px; justify-content:center }
    .stepper-step .stepper-label { display:none }
    .stepper-num { width:28px; height:28px; font-size:13px }
    .stepper-content { padding:16px 12px }
}

/* ── Spinner ──────────────────────────────────────────────── */

.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hamburger-Menü ──────────────────────────────────────────── */

/* Globaler position:fixed Hamburger — Fallback fuer Pages die kein renderTopbar
   nutzen. Pages mit renderTopbar setzen body.has-dtm-topbar -> Hamburger ist dort
   im Header und der globale wird hidden. */
.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.has-dtm-topbar .hamburger { display: none !important; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.show { display: block; }

/* ── Responsive: Tablet (max 1024px) ────────────────────────── */

/* ── Responsive: Tablet + Mobile (max 1024px) ───────────────── */
/* Bis 1024 px wird die Sidebar einklappbar (Hamburger). Deckt
   iPad Portrait (810-834px) und kleinere Displays ab. Auf Desktops
   >=1025 px bleibt die Sidebar fix. */

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header { padding: 16px 20px; padding-left: 64px; }
    .page-body { padding: 16px 20px; }
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrapper table { min-width: 600px; }

    /* Sidebar einklappbar ab iPad */
    .hamburger { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }

    /* Page-Heads aller dt-scope-Pages: Platz schaffen, damit der fixed
       Hamburger-Btn (top:12, left:12, 40x40) nicht in den Crumbs/Titel reinhaengt */
    .auf-head, .av-head, .be-head, .lg-topbar, .rm-head, .se-head, .st-head {
        padding-left: 64px !important;
    }

    /* Kontaktliste iPad-freundlich: unwichtige Spalten ausblenden.
       Die Spalten sind in Reihenfolge: checkbox, KD-NR, FIRMA, TYP,
       ANSPRECHPARTNER, E-MAIL, TELEFON, TAGS, ABC.
       Auf iPad/Tablet: TELEFON(7) + ABC(9) raus — bleiben KD-NR, FIRMA,
       TYP, AP, E-MAIL, TAGS sichtbar. */
    table.kontakte-table th:nth-child(7),
    table.kontakte-table td:nth-child(7),
    table.kontakte-table th:nth-child(9),
    table.kontakte-table td:nth-child(9) { display: none; }
}

/* ── Responsive: Mobile (max 768px) ─────────────────────────── */

@media (max-width: 768px) {
    .page-header {
        padding: 12px 16px;
        padding-left: 56px; /* Platz für Hamburger */
    }
    .page-header h1 { font-size: 20px; }
    .page-body { padding: 12px 16px; }

    /* Kontaktliste Mobile: zusaetzlich TYP(4) + AP(5) + TAGS(8) raus.
       Es bleiben nur KD-NR, FIRMA, E-MAIL sichtbar. */
    table.kontakte-table th:nth-child(4),
    table.kontakte-table td:nth-child(4),
    table.kontakte-table th:nth-child(5),
    table.kontakte-table td:nth-child(5),
    table.kontakte-table th:nth-child(8),
    table.kontakte-table td:nth-child(8) { display: none; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 24px; }

    .toolbar { flex-wrap: wrap; gap: 8px; }
    .toolbar .btn { font-size: 12px; padding: 6px 10px; }

    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrapper table { min-width: 500px; }
    .table-wrapper th, .table-wrapper td { padding: 8px 6px; font-size: 13px; }

    /* Modals fullscreen */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    /* Tab-Leiste scrollbar */
    .tab-bar { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    /* Analyse-Stats kleiner */
    .analyse-stats { gap: 8px; flex-wrap: wrap; }
    .analyse-stat { min-width: 60px; }
    .analyse-stat .value { font-size: 20px; }
    .analyse-stat .label { font-size: 10px; }

    /* Vorschlag-Cards */
    .vorschlag-actions { flex-wrap: wrap; gap: 6px; }
    .vorschlag-actions .btn { font-size: 11px; padding: 4px 8px; }
}

.text-muted { color: var(--text-light); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ===================================================================
   Kanban-Board
   =================================================================== */
.kanban-board { display: flex; gap: 12px; padding: 16px 0; overflow-x: auto; }
.kanban-col { flex: 1; min-width: 220px; max-width: 280px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; }
.kanban-col-header { padding: 12px; font-weight: 600; font-size: 13px; color: var(--text); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.kanban-col-header .kanban-count { background: #e2e8f0; color: var(--text-light); border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 500; }
.kanban-col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 65vh; }

/* Spalten-Farben */
.kanban-col-offen .kanban-col-header { border-left: 3px solid #f59e0b; }
.kanban-col-ab_erstellt .kanban-col-header { border-left: 3px solid #3b82f6; }
.kanban-col-fahrauftrag .kanban-col-header { border-left: 3px solid #8b5cf6; }
.kanban-col-geliefert .kanban-col-header { border-left: 3px solid #10b981; }
.kanban-col-rechnung .kanban-col-header { border-left: 3px solid #ec4899; }

/* Kanban-Karten */
.kanban-card { background: white; border-radius: 6px; padding: 10px 12px; border: 1px solid var(--border); cursor: pointer; transition: box-shadow 0.15s; }
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.kanban-card-mat { font-weight: 700; color: #1e40af; font-size: 13px; }
.kanban-card-detail { font-size: 12px; color: var(--text); margin-top: 2px; }
.kanban-card-kunde { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.kanban-card-preis { font-size: 12px; font-weight: 600; color: var(--text); }
.kanban-card-lieferart { font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.kanban-card-lieferart.lief { background: #dbeafe; color: #1d4ed8; }
.kanban-card-lieferart.abh { background: #f3f4f6; color: #4b5563; }
.kanban-card-btns { margin-top: 6px; display: flex; gap: 4px; }
.kanban-card-btns button { padding: 3px 8px; font-size: 11px; border-radius: 4px; border: none; cursor: pointer; }
.kanban-btn-next { background: #dbeafe; color: #1d4ed8; }
.kanban-btn-next:hover { background: #bfdbfe; }
.kanban-btn-pdf { background: #f0fdf4; color: #166534; }
.kanban-btn-done { background: #f0fdf4; color: #166534; }

/* Auftrags-Gruppierung */
.kanban-group { border: 2px solid #dbeafe; border-radius: 8px; padding: 6px; background: #f0f7ff; }
.kanban-group-label { font-size: 10px; color: #3b82f6; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; padding-left: 4px; }
.kanban-group .kanban-card { border-color: #bfdbfe; }
.kanban-group .kanban-card + .kanban-card { margin-top: 6px; }
.kanban-group-btns { padding: 6px 4px 2px; display: flex; gap: 6px; border-top: 1px solid #e2e8f0; margin-top: 4px; }
.kanban-group-btns button { padding: 5px 10px; font-size: 11px; font-weight: 600; border-radius: 5px; border: none; cursor: pointer; transition: all .15s; }
.kanban-btn-teillieferung { background: #dcfce7; color: #166534; }
.kanban-btn-teillieferung:hover { background: #bbf7d0; }
.kanban-btn-teilrechnung { background: #fef3c7; color: #92400e; }
.kanban-btn-teilrechnung:hover { background: #fde68a; }
.kanban-btn-alle { background: #f1f5f9; color: #475569; }
.kanban-btn-alle:hover { background: #e2e8f0; }

/* Eingeklappte Gruppe */
.kanban-group-collapsed { border: 2px solid #dbeafe; border-radius: 8px; padding: 8px 12px; background: #f0f7ff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.15s; }
.kanban-group-collapsed:hover { background: #e0efff; }
.kanban-gc-name { font-size: 12px; font-weight: 600; color: #1e40af; }
.kanban-gc-info { font-size: 11px; color: #3b82f6; }

/* Kompakte Karte (in Gruppen) */
.kanban-card-compact { background: white; border-radius: 4px; padding: 6px 10px; border: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.kanban-card-compact:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.kanban-card-compact + .kanban-card-compact { margin-top: 4px; }
.kanban-cc-mat { font-weight: 700; color: #1e40af; min-width: 65px; }
.kanban-cc-detail { color: var(--text); flex: 1; }
.kanban-cc-preis { font-weight: 600; color: var(--text); min-width: 40px; text-align: right; }

/* Kanban Statistik-Leiste */
.kanban-stats { display: flex; gap: 16px; padding: 12px 16px; background: white; border: 1px solid var(--border); border-top: none; font-size: 13px; color: var(--text-light); flex-wrap: wrap; align-items: center; }
.kanban-stat { display: flex; align-items: center; gap: 6px; }
.kanban-stat-dot { width: 8px; height: 8px; border-radius: 50%; }

/* View Toggle */
.view-toggle { margin-left: auto; display: flex; gap: 0; }
.view-toggle button { padding: 4px 12px; font-size: 12px; border: 1px solid var(--border); background: white; cursor: pointer; color: var(--text-light); }
.view-toggle button.active { background: var(--primary); color: white; border-color: var(--primary); }
.view-toggle button:first-child { border-radius: 4px 0 0 4px; }
.view-toggle button:last-child { border-radius: 0 4px 4px 0; }

/* Akkordeon fuer Markt-Tab */
.accordion-section { border: 1px solid var(--border); border-radius: 8px; background: white; margin-top: 12px; }
.accordion-header { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 500; color: var(--text); user-select: none; }
.accordion-header:hover { background: #f8fafc; }
.accordion-header .accordion-badge { background: #e2e8f0; color: var(--text-light); border-radius: 10px; padding: 2px 10px; font-size: 12px; }
.accordion-header .accordion-chevron { transition: transform 0.2s; color: var(--text-light); }
.accordion-header.open .accordion-chevron { transform: rotate(180deg); }
.accordion-body { border-top: 1px solid var(--border); }

@media (max-width: 1024px) {
    .kanban-board { padding-bottom: 8px; }
    .kanban-col { min-width: 200px; }
}

/* ── KPI Dashboard ──────────────────────────────────────────────── */
.kpi-section { margin-bottom: 24px; }
.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.kpi-header h2 { font-size: 18px; margin: 0; }
.kpi-period-selector { display: flex; }
.kpi-period-selector .btn {
    border-radius: 0; border: 1px solid var(--border); background: white;
    color: var(--text-light); padding: 5px 14px; font-size: 13px; cursor: pointer;
}
.kpi-period-selector .btn:first-child { border-radius: 6px 0 0 6px; }
.kpi-period-selector .btn:last-child { border-radius: 0 6px 6px 0; }
.kpi-period-selector .btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.kpi-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.kpi-delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
@media (max-width: 768px) {
    .kpi-charts { grid-template-columns: 1fr; }
}

/* ── Mobile/Touch Optimierung ────────────────────────────────── */

/* Touch-Targets + iOS Fixes (global) */
@media (pointer: coarse) {
    a, button, .btn, .tab-btn, .kanban-card, .kanban-group-collapsed,
    .stat-card, .dash-hint { min-height: 44px; }
    -webkit-tap-highlight-color: transparent;
    input, select, textarea { font-size: 16px !important; } /* verhindert iOS-Zoom */
}

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

/* Safe Area (Notch-Geraete) */
@supports (padding-top: env(safe-area-inset-top)) {
    .sidebar { padding-top: env(safe-area-inset-top); }
    .page-header { padding-top: max(12px, env(safe-area-inset-top)); }
    .hamburger { top: max(12px, env(safe-area-inset-top)); }
}

/* ── Kanban Mobile: Tab-basiert (max 768px) ──────────────────── */

@media (max-width: 768px) {
    .kanban-tabs-mobile {
        display: flex; overflow-x: auto; gap: 0; border-bottom: 2px solid var(--border);
        margin-bottom: 12px; -webkit-overflow-scrolling: touch;
    }
    .kanban-tab-mobile {
        flex-shrink: 0; padding: 10px 14px; font-size: 12px; font-weight: 600;
        color: var(--text-light); border: none; background: none; cursor: pointer;
        border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
        min-height: 44px; display: flex; align-items: center; gap: 6px;
    }
    .kanban-tab-mobile.active { color: var(--primary); border-bottom-color: var(--primary); }
    .kanban-tab-mobile .kanban-tab-badge {
        background: #e2e8f0; color: var(--text-light); border-radius: 10px;
        padding: 1px 7px; font-size: 10px;
    }
    .kanban-tab-mobile.active .kanban-tab-badge { background: var(--primary); color: white; }

    .kanban-board { flex-direction: column; gap: 0; overflow-x: visible; }
    .kanban-col { min-width: 100%; max-width: 100%; display: none; }
    .kanban-col.kanban-col-active { display: flex; }
    .kanban-col-body { max-height: none; }
    .kanban-col-header { display: none; } /* Tab-Leiste ersetzt Header */

    .kanban-card { padding: 12px; }
    .kanban-card-btns .btn, .kanban-card-btns button { min-height: 44px; padding: 8px 12px; }
    .kanban-group-btns button { min-height: 44px; font-size: 13px; }
}

/* Desktop: Tabs ausblenden */
.kanban-tabs-mobile { display: none; }

/* ── iPhone (max 480px) ──────────────────────────────────────── */

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr !important; gap: 8px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-icon { width: 36px; height: 36px; }

    .kpi-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .kpi-header h2 { font-size: 16px; }
    .kpi-period-selector .btn { padding: 6px 10px; font-size: 12px; }

    .page-header h1 { font-size: 18px; }
    .page-body { padding: 8px 12px; }
    .card { padding: 12px; }

    .dash-greeting h2 { font-size: 18px; }
    .dash-hint { padding: 8px 12px; }
    .hint-icon { width: 28px; height: 28px; }

    /* Coils: Card-Layout statt Grid */
    .coil-hdr-cols { display: none !important; }
    .coil-row .coil-cols {
        display: flex !important; flex-wrap: wrap; gap: 4px 12px;
        grid-template-columns: none !important;
    }
    .coil-row .coil-cols > div { font-size: 13px; }
    .coil-row .coil-cols > div:nth-child(n+6) { display: none; } /* EK/Marge/Angebote ausblenden */
}

/* ── Coils responsive (Tablet 768px) ─────────────────────────── */

@media (max-width: 768px) {
    .coil-hdr-cols, .coil-row .coil-cols {
        grid-template-columns: 1fr 1fr 100px 80px !important;
    }
    .coil-row .coil-cols > div:nth-child(n+5) { display: none; }
    .coil-row { padding: 8px; }
}
