/* Bestellverwaltung admin.reifen-pneu24.ch – Oberflaeche
   Gestaltung angelehnt an TailAdmin: helle Seitenleiste, Karten, viel Weissraum.
   Grosse Schrift und hohe Kontraste, Bedienung fuer aeltere Nutzer. */

:root {
    --brand: #465fff;
    --brand-hover: #3641f5;
    --brand-ink: #ffffff;
    --brand-soft: #ecf3ff;
    --brand-soft-ink: #2f46d8;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f6;
    --border: #e4e7ec;
    --border-strong: #cfd5de;
    --text: #101828;
    --text-2: #344054;
    --text-3: #5f6b7d;
    --good: #0f7a3f;
    --good-soft: #e3f7ec;
    --info: #1d4ed8;
    --info-soft: #e6eeff;
    --warning: #9a5b00;
    --warning-soft: #fff1d6;
    --danger: #b42318;
    --danger-soft: #fde8e6;
    --muted-soft: #eceff3;
    --bar: #465fff;
    --bar-hover: #2f46d8;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
    --radius: 14px;
    --radius-sm: 10px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --sidebar-w: 280px;
    --base: 17px;
}
html[data-font="small"] { --base: 15px; }
html[data-font="large"] { --base: 19px; }
html[data-font="xlarge"] { --base: 21px; }

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --brand: #7c92ff; --brand-hover: #98aaff; --brand-ink: #0b1220; --brand-soft: #1c2650; --brand-soft-ink: #b9c6ff;
        --bg: #0f1216; --surface: #171b21; --surface-2: #1d2229; --surface-3: #242a33;
        --border: #2b3139; --border-strong: #3b434e;
        --text: #eceff3; --text-2: #c3cad4; --text-3: #8f99a8;
        --good: #6fd39a; --good-soft: #15301f; --info: #8db0ff; --info-soft: #1b2a4a;
        --warning: #f3b95f; --warning-soft: #3a2a10; --danger: #ff8f86; --danger-soft: #3a1b1a; --muted-soft: #262c35;
        --bar: #6f8bff; --bar-hover: #a1b4ff;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
    }
}
html[data-theme="dark"] {
    --brand: #7c92ff; --brand-hover: #98aaff; --brand-ink: #0b1220; --brand-soft: #1c2650; --brand-soft-ink: #b9c6ff;
    --bg: #0f1216; --surface: #171b21; --surface-2: #1d2229; --surface-3: #242a33;
    --border: #2b3139; --border-strong: #3b434e;
    --text: #eceff3; --text-2: #c3cad4; --text-3: #8f99a8;
    --good: #6fd39a; --good-soft: #15301f; --info: #8db0ff; --info-soft: #1b2a4a;
    --warning: #f3b95f; --warning-soft: #3a2a10; --danger: #ff8f86; --danger-soft: #3a1b1a; --muted-soft: #262c35;
    --bar: #6f8bff; --bar-hover: #a1b4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { font-size: var(--base); }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-soft-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h2 .icon { color: var(--brand); }
p { margin: 0 0 .6rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.lead { color: var(--text-2); font-size: 1rem; margin: 4px 0 0; }
.muted { color: var(--text-3); }
.small { font-size: .88rem; }
.mono { font-family: var(--mono); font-size: .95em; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.center { text-align: center; }
.text-warning { color: var(--warning); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem; z-index: 100; }
.skip:focus { left: .5rem; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
kbd { font: .85em var(--mono); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; background: var(--surface-2); }

/* ---------- Layout ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 16px; gap: 10px; z-index: 40; overflow-y: auto; }
.content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.header { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 12px 28px; }
.main { flex: 1; padding: 28px; max-width: 1500px; width: 100%; }
.footer { padding: 0 28px 20px; display: flex; justify-content: space-between; color: var(--text-3); font-size: .85rem; gap: 12px; flex-wrap: wrap; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); z-index: 35; }
.menu-btn { display: none; }
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .content { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .header, .main { padding-left: 16px; padding-right: 16px; }
    .footer { padding-left: 16px; padding-right: 16px; }
}

/* Marke */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 6px 8px 14px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.brand-text small { font-weight: 500; color: var(--text-3); font-size: .8rem; }
.brand-lg .brand-mark { width: 48px; height: 48px; }

/* Navigation */
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; margin: 6px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: 1rem; }
.nav-item .icon { width: 1.45em; height: 1.45em; color: var(--text-3); }
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand-soft-ink); }
.nav-item.is-active .icon { color: var(--brand-soft-ink); }
.nav-badge { margin-left: auto; background: var(--brand); color: var(--brand-ink); font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; min-width: 28px; text-align: center; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-soft-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.sidebar-user-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-user-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text small { color: var(--text-3); font-size: .8rem; }

/* Kopfzeile */
.search { flex: 1 1 520px; max-width: 720px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; padding: 4px 4px 4px 14px; }
.search .icon { color: var(--text-3); }
.search input { flex: 1; border: 0; background: transparent; padding: 9px 4px; font: inherit; color: var(--text); min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.font-tools { display: flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.font-tools-label { display: inline-flex; padding: 0 4px; color: var(--text-3); }
.header-help { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; font-weight: 600; color: var(--text-2); }
.header-help:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 1.35em; height: 1.35em; }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm .icon { width: 1.1em; height: 1.1em; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .icon-sun { display: none; } html:not([data-theme="light"]) .icon-moon { display: block; } }
@media (max-width: 760px) { .header-help span, .font-tools { display: none; } .search { flex-basis: 200px; } }

/* ---------- Seiten ---------- */
.page { display: flex; flex-direction: column; gap: 20px; }
.page-narrow { max-width: 640px; margin: 40px auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.grid-order { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: 1fr; } .grid-order { grid-template-columns: 1fr; } .grid-main-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.card-sub { color: var(--text-3); font-size: .9rem; margin: 2px 0 0; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-message { border-left: 5px solid var(--warning); }
.card-partner { border-left: 5px solid var(--brand); }
.card-details summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; list-style: none; }
.card-details summary::-webkit-details-marker { display: none; }
.card-details summary .icon { color: var(--text-3); }
.card-details[open] summary { margin-bottom: 14px; }
.card.is-highlight { box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow-lg); border-color: var(--brand); transition: box-shadow .3s; }
.empty { padding: 26px 18px; color: var(--text-3); text-align: center; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 1rem; }
.empty .icon { width: 2em; height: 2em; opacity: .5; }

/* Aufgaben-Hinweise */
.todo-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.todo { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.todo:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.todo-info { border-color: var(--info); background: var(--info-soft); }
.todo-warning { border-color: var(--warning); background: var(--warning-soft); }
.todo-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); flex: none; }
.todo-icon .icon { width: 1.7em; height: 1.7em; }
.todo-info .todo-icon { color: var(--info); }
.todo-warning .todo-icon { color: var(--warning); }
.todo-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-text b { font-size: 1.1rem; }
.todo-text small { color: var(--text-2); font-size: .92rem; }
.todo-go { margin-left: auto; color: var(--text-3); }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; color: var(--text); box-shadow: var(--shadow); position: relative; }
.kpi-link:hover { text-decoration: none; border-color: var(--brand); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); margin-bottom: 10px; }
.kpi-icon .icon { width: 1.5em; height: 1.5em; }
.kpi-icon-warning { background: var(--warning-soft); color: var(--warning); }
.kpi-label { font-size: .92rem; color: var(--text-3); font-weight: 600; }
.kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi-value small { font-size: .9rem; font-weight: 500; color: var(--text-3); }
.kpi-sub { font-size: .95rem; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.delta-up { color: var(--good); background: var(--good-soft); }
.delta-down { color: var(--danger); background: var(--danger-soft); }

/* Diagramm */
.chart { margin: 0; padding: 14px 22px 10px; }
.chart-svg { width: 100%; height: 230px; display: block; }
.chart-svg-tall { height: 260px; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis { fill: var(--text-3); font-size: 12px; font-family: var(--font); }
.chart-svg .bar { fill: var(--bar); transition: fill .15s; }
.chart-svg .bar-hit { fill: transparent; }
.chart-svg .bar-group:hover .bar { fill: var(--bar-hover); }
.chart-table { margin-top: 10px; }
.chart-table summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: .92rem; }

/* Listen */
.order-list { list-style: none; margin: 0; padding: 0; }
.order-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--border); }
.order-list li:last-child { border-bottom: 0; }
.order-list-main { display: flex; flex-direction: column; color: var(--text); min-width: 0; }
.order-list-main:hover { text-decoration: none; }
.order-list-main:hover .order-name { text-decoration: underline; color: var(--brand-soft-ink); }
.order-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-meta { font-size: .88rem; color: var(--text-3); }
.order-list-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.order-total { font-family: var(--mono); font-weight: 700; }
.order-date { font-size: .85rem; color: var(--text-3); }
.glance { list-style: none; margin: 0; padding: 6px 0; }
.glance li a { display: flex; align-items: center; gap: 12px; padding: 12px 22px; color: var(--text); border-bottom: 1px solid var(--border); }
.glance li:last-child a { border-bottom: 0; }
.glance li a:hover { background: var(--surface-2); text-decoration: none; }
.glance .icon { color: var(--brand); width: 1.4em; height: 1.4em; }
.glance b { margin-left: auto; font-size: 1.15rem; display: inline-flex; align-items: center; }
.hint-list, .help-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hint-list li { display: flex; align-items: center; gap: 8px; }
.help-list { padding-left: 1.2em; list-style: disc; }
.help-steps { padding-left: 1.4em; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.help-dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; align-items: center; }
.help-dl dd { margin: 0; }
.bars { list-style: none; margin: 0; padding: 12px 22px 16px; display: flex; flex-direction: column; gap: 12px; }
.bars li { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; }
.bars-label { font-weight: 600; }
.bars-track { height: 14px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bars-fill { display: block; height: 100%; background: var(--bar); border-radius: 999px; }
.bars-value { font-size: .9rem; color: var(--text-2); white-space: nowrap; }

/* Badges, Pills */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 9px; border-radius: 999px; font-size: .88rem; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.badge .icon { width: 1.15em; height: 1.15em; }
.badge-lg { font-size: 1rem; padding: 6px 14px 6px 10px; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--muted-soft); color: var(--text-2); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--muted-soft); color: var(--text-2); margin-right: 4px; white-space: nowrap; }
.pill .icon { width: 1.05em; height: 1.05em; }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-good { background: var(--good-soft); color: var(--good); }

/* ---------- Formulare & Knoepfe ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; min-height: 46px;
}
.input-lg { min-height: 52px; font-size: 1.05rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
textarea { resize: vertical; min-height: 70px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; color: var(--text-2); font-weight: 600; }
label.check-inline { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--text); }
label.check-inline input { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.inline-label { flex-direction: row; align-items: center; gap: 10px; }
.inline-label select { width: auto; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 48px; }
.input-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; min-width: 260px; }
.actions-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .95rem; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; line-height: 1.2; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--text-3); }
.btn .icon { width: 1.25em; height: 1.25em; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .88rem; }
.btn-lg { padding: 14px 20px; min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-left { justify-content: flex-start; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.btn-soft-info:hover { background: var(--info); color: #fff; }
.btn-soft-good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.btn-soft-good:hover { background: var(--good); color: #fff; }
.btn.is-disabled, .btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; }

/* Meldungen */
.flash { display: flex; align-items: flex-start; gap: 12px; padding: 14px 48px 14px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid transparent; font-size: 1rem; font-weight: 500; position: relative; }
.flash .icon { width: 1.4em; height: 1.4em; flex: none; margin-top: 1px; }
.flash-success { background: var(--good-soft); color: var(--good); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }
.flash-muted { background: var(--muted-soft); color: var(--text-2); }
.flash-close { position: absolute; right: 6px; top: 6px; background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; border-radius: 8px; }
.flash-close:hover { background: rgba(0, 0, 0, .08); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 600; z-index: 90; box-shadow: var(--shadow-lg); }

/* Filter */
.filters { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.status-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: .95rem; font-weight: 600; }
.chip:hover { text-decoration: none; background: var(--surface-2); }
.chip b { font-weight: 700; color: var(--text-3); background: var(--surface-3); padding: 0 8px; border-radius: 999px; }
.chip.is-on { border-color: transparent; background: var(--brand-soft); color: var(--brand-soft-ink); }
.chip.is-on b { color: inherit; background: rgba(255, 255, 255, .5); }
.chip-good.is-on { background: var(--good-soft); color: var(--good); }
.chip-info.is-on { background: var(--info-soft); color: var(--info); }
.chip-warning.is-on { background: var(--warning-soft); color: var(--warning); }
.chip-muted.is-on { background: var(--muted-soft); color: var(--text); }
html[data-theme="dark"] .chip.is-on b { background: rgba(0, 0, 0, .25); }
.filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-row label { flex: 0 1 200px; }
.filter-row label.grow { flex: 1 1 320px; }
.filter-buttons { display: flex; gap: 8px; }
.filter-more summary { cursor: pointer; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; list-style: none; }
.filter-more summary::-webkit-details-marker { display: none; }
.filter-more summary .icon { transition: transform .15s; }
.filter-more[open] summary .icon { transform: rotate(180deg); }
.filter-more[open] summary { margin-bottom: 12px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; white-space: nowrap; background: var(--surface-2); }
.table thead th:first-child { border-top-left-radius: var(--radius); }
.table thead th:last-child { border-top-right-radius: var(--radius); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .check { width: 44px; padding-right: 0; }
.table-compact th, .table-compact td { padding: 8px 12px; }
.table .empty { text-align: center; }
.table-orders tbody tr.row-link { cursor: pointer; }
.table-orders tbody tr.row-link:hover { background: var(--surface-2); }
.table-orders tbody tr.is-selected { background: var(--brand-soft); }
.table-orders tbody tr.row-warning td:first-child { box-shadow: inset 4px 0 0 var(--warning); }
.table-orders .actions-col { white-space: nowrap; width: 1%; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { display: inline; }
.order-no { font-weight: 700; font-size: 1.05rem; }
.cell-main { display: block; font-weight: 500; }
.cell-sub { display: block; font-size: .85rem; color: var(--text-3); margin-top: 2px; }
.cell-items { max-width: 360px; }
.sort { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sort.is-active { color: var(--brand-soft-ink); }
.table-lines tfoot td { border: 0; padding-top: 5px; padding-bottom: 5px; }
.table-lines tfoot tr.total td { border-top: 2px solid var(--text); font-weight: 800; font-size: 1.15rem; padding-top: 10px; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copy-wrap { display: inline-flex; align-items: center; gap: 4px; }

/* Sammelaktionen */
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 12px; background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 12px; flex-wrap: wrap; }
.bulk-bar select { width: auto; }
.bulk-count { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* Detailseite */
.stepper-card { padding: 14px 22px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); }
.step-icon { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; background: var(--surface); }
.step-icon .icon { width: 1.4em; height: 1.4em; }
.step-text { display: flex; flex-direction: column; line-height: 1.2; }
.step-text b { color: var(--text-2); }
.step-text small { font-size: .85rem; }
.step.is-done { background: var(--good-soft); color: var(--good); }
.step.is-done .step-icon { background: var(--good); border-color: var(--good); color: #fff; }
.step.is-done .step-text b { color: var(--good); }
.step.is-next { background: var(--brand-soft); color: var(--brand-soft-ink); }
.step.is-next .step-icon { border-color: var(--brand); color: var(--brand); border-style: dashed; }
.step.is-next .step-text b { color: var(--brand-soft-ink); }
@media (max-width: 760px) { .stepper { grid-template-columns: 1fr; } }
.card-actions { border-top: 5px solid var(--brand); }
.action-stack { display: flex; flex-direction: column; gap: 14px; }
.action-group { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.action-label { display: flex; align-items: center; gap: 6px; font-weight: 700; margin: 0; color: var(--text-2); }
.done-note { display: flex; align-items: center; gap: 8px; color: var(--good); font-weight: 700; background: var(--good-soft); padding: 12px 14px; border-radius: 10px; margin: 0; }
.address { font-style: normal; line-height: 1.55; margin-bottom: 10px; font-size: 1rem; }
.contact { display: flex; flex-direction: column; gap: 6px; }
.contact a { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 12px; font-size: .95rem; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; word-break: break-word; font-weight: 500; }
.note-form { display: flex; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--border); align-items: flex-start; flex-wrap: wrap; }
.note-form textarea { flex: 1 1 300px; min-height: 60px; }
.timeline { list-style: none; margin: 0; padding: 6px 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--border); font-size: .95rem; }
.timeline li:last-child { border-bottom: 0; }
.tl-when { color: var(--text-2); font-weight: 600; display: flex; flex-direction: column; line-height: 1.3; }
.tl-when small { color: var(--text-3); font-weight: 400; }
.tl-what { display: flex; flex-direction: column; gap: 3px; }
.tl-what b { font-weight: 700; }
.tl-change { display: inline-flex; align-items: center; gap: 4px; }
.tl-note { color: var(--text-2); }
.tl-who { color: var(--text-3); font-size: .85rem; }
.tl-cancel .tl-what b { color: var(--danger); }
.tl-status .tl-what b { color: var(--brand-soft-ink); }
.payrexx-result { margin-top: 10px; font-size: .95rem; color: var(--text-2); font-weight: 500; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* Tooltip & Dialog */
.tooltip { position: fixed; z-index: 95; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: .95rem; font-weight: 500; line-height: 1.4; pointer-events: none; max-width: 360px; box-shadow: var(--shadow-lg); }
.tooltip::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--text); border-bottom: 0; }
.tooltip.is-below::after { bottom: auto; top: -6px; border-top: 0; border-bottom: 6px solid var(--text); }
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .55); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 16px; padding: 26px 28px; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); }
.modal-card h2 { font-size: 1.3rem; }
.modal-text { font-size: 1.05rem; color: var(--text-2); margin-bottom: 20px; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 1.5rem; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--text-3); margin: 0; letter-spacing: -.03em; }

@media print { .sidebar, .header, .footer, .page-actions, .note-form, form, .tooltip, .toast, .modal { display: none !important; } .content { margin: 0; } .card { box-shadow: none; } }
