:root {
    --bg: #f6f6f4;
    --surface: #fff;
    --text: #1d1d1b;
    --muted: #6b6b66;
    --border: #e2e2dd;
    --accent: #d9480f;
    --accent-soft: #fde4d6;
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161615;
        --surface: #1f1f1d;
        --text: #ececea;
        --muted: #9a9a94;
        --border: #33332f;
        --accent: #ff7a3d;
        --accent-soft: #4a2412;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
main, .top { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-top: 24px; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-weight: normal; }

.filters {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin: 20px 0; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters label.grow { flex: 1 1 220px; }
input, select, button, .button {
    font: inherit; color: var(--text);
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
button, .button {
    cursor: pointer; text-decoration: none; display: inline-block;
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.actions { display: flex; gap: 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.kpi span { font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 22px; font-variant-numeric: tabular-nums; }

.table-wrap {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    overflow-x: auto; margin-bottom: 40px;
}
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 16px; border-top: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
th[data-dir="asc"]::after { content: " ▲"; }
th[data-dir="desc"]::after { content: " ▼"; }
tbody tr:hover { background: var(--bg); }
tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Produktname füllt den freien Platz und wird erst am Tabellenrand mit … gekürzt */
td.name { width: 100%; max-width: 0; min-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); }
.share { position: relative; min-width: 120px; }
/* Balken bleibt innerhalb des Zellen-Innenabstands (16px links/rechts) */
.share .bar { position: absolute; left: 16px; width: calc((100% - 32px) * var(--w, 0)); top: 6px; bottom: 6px; background: var(--accent-soft); border-radius: 3px; z-index: 0; }
.share { isolation: isolate; }
.share .bar { z-index: -1; }
.empty { padding: 24px 16px; color: var(--muted); }

.logout { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login-box {
    width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.error { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--text); }
