/* PCHM Live-Dashboard -- nach DESIGN.md (24.09.2026):
   neutrale Flaechen, Violett nur auf Bedienelementen, Statusfarben gedeckt,
   keine Verlaeufe/Leuchtschatten, Inter, hoechstens 700.
   Diagrammfarben gegen die Kartenflaeche geprueft (validate_palette):
   dunkel #9A6BFF/#3E9CC2 auf #1F1F1F, hell #7C3AED/#0A7FA6 auf #FFFFFF. */
:root {
  --bg: #121212;
  --surface: #1F1F1F;
  --surface-2: #272727;
  --surface-3: #2E2E2E;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --grid: rgba(255, 255, 255, 0.07);
  --text: #FFFFFF;
  --text-2: #D4D4D4;
  --muted: #A3A3A3;
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --accent-text: #B794FF;
  --s1: #9A6BFF;          /* aktueller Zeitraum */
  --s2: #3E9CC2;          /* Vergleich */
  --s3: #737373;          /* Vorwoche (Kontext, gestrichelt) */
  --good: #6EC58C;
  --warn: #D9A047;
  --bad: #E06C75;
  --bad-text: #FF9AAB;
  --info: #84AFD1;
  --good-bg: rgba(110, 197, 140, 0.14);
  --bad-bg: rgba(224, 108, 117, 0.14);
  --warn-bg: rgba(217, 160, 71, 0.14);
  --info-bg: rgba(132, 175, 209, 0.14);
  --flash: rgba(255, 255, 255, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.22);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FAF9F7;
    --surface: #FFFFFF;
    --surface-2: #F6F5F2;
    --surface-3: #EFEDE9;
    --line: rgba(28, 25, 23, 0.14);
    --line-strong: rgba(28, 25, 23, 0.22);
    --grid: rgba(28, 25, 23, 0.08);
    --text: #1C1917;
    --text-2: #44403C;
    --muted: #57534E;
    --accent-text: #5B21B6;
    --s1: #7C3AED;
    --s2: #0A7FA6;
    --s3: #A8A29E;
    --good: #15803D;
    --warn: #B45309;
    --bad: #DC2626;
    --bad-text: #991B1B;
    --info: #0E7490;
    --good-bg: rgba(21, 128, 61, 0.1);
    --bad-bg: rgba(220, 38, 38, 0.08);
    --warn-bg: rgba(180, 83, 9, 0.1);
    --info-bg: rgba(14, 116, 144, 0.09);
    --flash: rgba(28, 25, 23, 0.05);
    --shadow: 0 1px 2px rgba(28, 25, 23, 0.07), 0 6px 18px rgba(28, 25, 23, 0.05);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { margin: 0; }
.num, .hero-value, .kpi strong, .feed .total, .toplist .rev, .bars .val, .tile strong, .open-grid strong, .month-big, table {
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
a { color: var(--accent-text); }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 8px; }
.brand strong { display: block; font-size: 15px; font-weight: 700; }
.live-state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.live-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live-state em { font-style: normal; }
.live-state.ok i { background: var(--good); }
.live-state.err i { background: var(--bad); }

.ranges {
  display: flex; gap: 2px; margin-left: auto; overflow-x: auto; max-width: 100%; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px;
}
.ranges::-webkit-scrollbar { display: none; }
.ranges button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 7px;
  color: var(--text-2); white-space: nowrap; font-weight: 600; font-size: 13px;
}
.ranges button:hover { color: var(--text); background: var(--surface-2); }
.ranges button.active { background: var(--accent); color: #fff; }
.tools { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; color: var(--text-2);
}
a.icon-btn { text-decoration: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); }
#btn-sound .on { display: none; }
#btn-sound[aria-pressed="true"] .on { display: inline; }
#btn-sound[aria-pressed="true"] .off { display: none; }
#btn-refresh.spin svg { animation: spin .8s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Raster ---------- */
.grid {
  display: grid; gap: 16px; padding: 20px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  max-width: 1640px; margin: 0 auto;
}
.card {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0;
  box-shadow: var(--shadow);
}
.grid > .card { grid-column: span 4; }
.grid > .hero { grid-column: span 3; }
.grid > .kpis { grid-column: span 6; }
.grid > .tracker { grid-column: span 3; }
.grid > .chart-card { grid-column: span 8; }
.grid > .feed-card { grid-column: span 4; grid-row: span 2; display: flex; flex-direction: column; }
.grid > .orders-card { grid-column: 1 / -1; }
@media (max-width: 1380px) {
  .grid > .hero { grid-column: span 4; }
  .grid > .kpis { grid-column: span 8; }
  .grid > .tracker { grid-column: span 12; }
  .tracker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  /* Reihenfolge wichtig: erst die allgemeine Regel, dann die breiten Karten */
  .grid > .card { grid-column: span 6; }
  .grid > .hero, .grid > .kpis, .grid > .chart-card, .grid > .tracker, .grid > .orders-card { grid-column: span 12; }
  .grid > .feed-card { grid-column: span 12; grid-row: auto; }
  .feed { max-height: 560px; }
  .ranges { margin-left: 0; order: 3; width: 100%; }
  .tools { margin-left: auto; }
}
@media (max-width: 760px) {
  .grid { padding: 12px 16px 24px; gap: 12px; }
  .grid > .card { grid-column: span 12; }
  .card { padding: 16px; }
  .topbar { gap: 10px; padding-left: 16px; padding-right: 16px; }
  .tools { gap: 4px; }
  .icon-btn { width: 34px; height: 34px; }
  .brand img { width: 28px; height: 28px; }
  #chart-sub { display: none; }
  .tracker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-head small { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 13px; }
.sub-head { margin-top: 24px; }
.pill { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.hero-value { margin: 8px 0 12px; font-size: clamp(32px, 3.3vw, 44px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.hero-deltas { display: grid; gap: 6px; }
.hero-progress { margin-top: auto; padding-top: 16px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--s1); transition: width .5s ease; }
.hero-progress p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.delta-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad-text); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--surface-2); }

/* ---------- KPI-Kacheln ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.kpi > span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi strong { display: block; font-size: 24px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -0.015em; line-height: 1.15; }
.kpi .kpi-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 10px; min-width: 0; }
.kpi .kpi-row strong { flex: 0 0 auto; }
.kpi .spark { flex: 1 1 64px; min-width: 64px; max-width: 130px; height: 28px; margin: 0 0 8px auto; pointer-events: none; overflow: visible; }
.kpi .spark path.l { fill: none; stroke: var(--s1); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.kpi .delta-row { font-size: 12px; margin-top: auto; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: auto; }

/* ---------- Live-Tracker ---------- */
.tracker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: grid; grid-template-columns: 34px 1fr; gap: 0 10px; align-items: center;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0;
}
.tile .ico { grid-row: span 2; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tile .ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile strong { font-size: 20px; font-weight: 700; line-height: 1.15; }
.tile span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Diagramm ---------- */
.seg { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-2); border-radius: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--text-2); margin: -4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 0; border-top: 2px solid; border-radius: 2px; }
.legend i.dash { border-top-style: dashed; }
.chart-wrap { position: relative; height: 300px; }
@media (max-width: 760px) { .chart-wrap { height: 240px; } }
#chart { width: 100%; height: 100%; display: block; overflow: visible; }
#chart .gridline { stroke: var(--grid); stroke-width: 1; }
#chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
#chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#chart .cross { stroke: var(--line-strong); stroke-width: 1; }
#chart .dot { stroke: var(--surface); stroke-width: 2; }
#chart .endlabel { font-size: 12px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.tooltip {
  position: absolute; top: 0; pointer-events: none; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; font-size: 12px; min-width: 190px; box-shadow: var(--shadow);
}
.tooltip b { display: block; margin-bottom: 5px; font-weight: 600; }
.tooltip div { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); padding: 1px 0; }
.tooltip div span { display: inline-flex; align-items: center; gap: 6px; }
.tooltip div i { width: 10px; height: 0; border-top: 2px solid; }
.tooltip div strong { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

.table-wrap { max-height: 300px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }

/* ---------- Live-Eingang (Zeitleiste) ---------- */
.feed { list-style: none; margin: 0; padding: 0 6px 0 0; overflow-y: auto; flex: 1; max-height: 860px; margin-right: -8px; scrollbar-width: thin; }
.feed > li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 11px 10px 12px 24px; border-radius: 10px; }
.feed > li::before { content: ""; position: absolute; left: 8px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.feed > li::after { content: ""; position: absolute; left: 11px; top: 29px; bottom: -11px; width: 1px; background: var(--line); }
.feed > li:last-child::after { display: none; }
.feed > li.storno::before { background: var(--bad); }
.feed > li.new::before { background: var(--good); }
.feed > li.new { animation: flash 3.5s ease-out; }
@keyframes flash { 0%, 40% { background: var(--flash); } 100% { background: transparent; } }
.feed .no { font-weight: 600; }
.feed .no small { color: var(--muted); font-weight: 400; margin-left: 7px; }
.feed .total { font-weight: 700; text-align: right; }
.feed .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 4px; }
.feed .pos, .feed .payline { grid-column: 1 / -1; }
.tag { font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag.new-customer { color: var(--info); background: var(--info-bg); }
.tag.storno { color: var(--bad-text); background: var(--bad-bg); }
.tag.wait { color: var(--warn); background: var(--warn-bg); }

/* Positionen mit Einzelteilen (Feed + Bestellliste) */
.pos { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.pos > li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; color: var(--text); }
.pos > li > .pn { overflow-wrap: anywhere; font-weight: 500; }
.pos > li > .pp { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos .parts { grid-column: 1 / -1; list-style: none; margin: 3px 0 2px 1px; padding: 0 0 0 11px; border-left: 2px solid var(--line-strong); color: var(--text-2); font-size: 12px; display: grid; gap: 1px; }
.pos .parts li { overflow-wrap: anywhere; }
.pos .extra, .pos .extra .pn { color: var(--muted); font-weight: 400; }
.payline { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--muted); }
.payline b { color: var(--text-2); font-weight: 600; }

/* ---------- Toplisten & Balken ---------- */
.toplist { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.toplist li { display: grid; grid-template-columns: 24px 1fr auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); counter-increment: top; align-items: baseline; }
.toplist li:last-child { border-bottom: 0; }
.toplist li::before { content: counter(top); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.toplist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.toplist .rev { font-weight: 700; }
.toplist .sub { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }

.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 13px; }
.bar-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-row .val { font-weight: 600; }
.bar-row .track { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--s1); border-radius: 0 3px 3px 0; transition: width .5s ease; }
.bar-row.clickable { cursor: pointer; border-radius: 6px; }
.bar-row.clickable:hover .label { color: var(--text); }
.bar-row.active .label { color: var(--accent-text); font-weight: 600; }

/* ---------- Monat & Ziel ---------- */
.ghost-btn.small { padding: 4px 10px; font-size: 12px; }
.month-big { font-size: 28px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.month-head p { margin: 2px 0 12px; color: var(--muted); font-size: 12.5px; }
.month-rows { display: grid; gap: 0; margin-top: 14px; }
.month-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.month-rows div:last-child { border-bottom: 0; }
.month-rows span { color: var(--muted); }
.month-rows b { font-weight: 600; font-variant-numeric: tabular-nums; }
.month-progress p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.goal-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: -4px 0 14px; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.goal-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); flex: 1 1 160px; }
.goal-form input { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.primary-btn { border: 0; background: var(--accent); color: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.primary-btn:hover { background: var(--accent-hover); }

/* ---------- Herkunft ---------- */
.src-table { display: grid; gap: 2px; }
.src-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 58px 62px; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.src-row:last-child { border-bottom: 0; }
.src-row.head { color: var(--muted); font-size: 12px; padding-top: 0; }
.src-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.src-row .v { display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.src-row .v small { color: var(--muted); font-size: 11.5px; }
.src-row .o, .src-row .c { text-align: right; font-variant-numeric: tabular-nums; }
.src-row .o { font-weight: 600; }
.src-row .c { color: var(--text-2); }
.src-row.head .o, .src-row.head .c { font-weight: 400; color: var(--muted); }
.src-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Heatmap ---------- */
.heat { display: grid; grid-template-columns: 24px repeat(24, minmax(0, 1fr)); gap: 2px; }
.heat .dl { font-size: 11px; color: var(--muted); align-self: center; }
.heat .cell { aspect-ratio: 1 / 1; border-radius: 3px; background: var(--surface-2); min-width: 0; }
.heat .hl { font-size: 10px; color: var(--muted); text-align: center; grid-row: 8; }
.heat-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.heat-legend .sw { width: 14px; height: 14px; border-radius: 3px; }
.heat-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Regionen ---------- */
.regions-grid { display: grid; gap: 18px; }
.regions-grid h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---------- Offen & Produktion ---------- */
.open-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.open-grid div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.open-grid span { display: block; font-size: 12px; color: var(--muted); }
.open-grid strong { font-size: 22px; font-weight: 700; }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pipeline li { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 13px; color: var(--text-2); }
.pipeline li .track { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pipeline li .fill { height: 100%; background: var(--s2); border-radius: 0 3px 3px 0; }
.pipeline li strong { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.pipeline .foot { color: var(--muted); font-size: 12px; display: block; }

.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* ---------- Bestellliste mit Filtern ---------- */
.ghost-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; }
.ghost-btn:hover { color: var(--text); border-color: var(--line-strong); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0; }
.filters input, .filters select { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.filters select { max-width: 220px; }
.filters .f-search { flex: 1 1 240px; }
.filters .f-num input { width: 92px; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
@media (max-width: 760px) { .filters label { flex: 1 1 45%; } .filters select { max-width: none; width: 100%; } .filters .f-num input { width: 100%; } }
.orders-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.orders-summary b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.orders-list { border-top: 1px solid var(--line); }
.orow { border-bottom: 1px solid var(--line); }
.orow > button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 120px 90px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) 110px 18px; gap: 10px; align-items: center; padding: 10px 8px; font-size: 13px; border-radius: 8px; }
.orow > button:hover { background: var(--surface-2); }
.orow > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.orow .c-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.orow .c-no { font-weight: 600; }
.orow .c-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.orow .c-pay, .orow .c-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.orow .c-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.orow .chev { color: var(--muted); transition: transform .15s; }
.orow.open .chev { transform: rotate(90deg); }
.orow.open > button { background: var(--surface-2); }
.orow .detail { padding: 6px 8px 16px; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.orow .detail .meta-list { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); align-content: start; }
.orow .detail .meta-list b { color: var(--text); font-weight: 600; }
.orow .detail .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
@media (max-width: 900px) {
  .orow > button { grid-template-columns: 1fr auto 18px; }
  .orow .c-date, .orow .c-where { display: none; }
  .orow .c-no { grid-column: 1; }
  .orow .c-items { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .orow .c-pay { grid-column: 1 / -1; grid-row: 3; }
  .orow .c-total { grid-column: 2; grid-row: 1; }
  .orow .chev { grid-column: 3; grid-row: 1; }
  .orow .detail { grid-template-columns: 1fr; }
}
.more-btn { display: block; margin: 14px auto 0; }

/* ---------- Ladezustand ---------- */
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -50% 0; } }
.grid.is-refreshing .chart-card, .grid.is-refreshing .orders-card, .grid.is-refreshing .toplist, .grid.is-refreshing .bars, .grid.is-refreshing #sources, .grid.is-refreshing #regions { opacity: .55; transition: opacity .2s; }

/* ---------- Zustand / Login ---------- */
.state-msg { max-width: 520px; margin: 80px auto; padding: 24px; text-align: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.state-msg strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); z-index: 50; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.login-logo { height: 44px; width: 44px; border-radius: 10px; justify-self: start; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.login-card p { margin: 0; color: var(--text-2); }
.login-card label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.login-card input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card button { margin-top: 4px; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; }
.login-card button:hover { background: var(--accent-hover); }
.login-card button:disabled { opacity: .6; }
.login-error { color: var(--bad-text) !important; font-size: 13px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); display: grid; gap: 10px; z-index: 40; max-width: calc(100vw - 32px); }
.toast { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; min-width: 270px; max-width: 380px; box-shadow: var(--shadow); animation: toast-in .3s ease-out; }
.toast b { display: block; margin-bottom: 2px; font-weight: 600; }
.toast span { color: var(--text-2); font-size: 13px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.month-rows b.ok { color: var(--good); }
