/* PCHM Live-Dashboard -- PCHM-Farbwelt (Violett/Cyan), dunkel als Standard.
   Ruhige Flaechen, feine Kanten, eine Akzentfarbe; Zahlen tabellarisch. */
:root {
  --bg: #08070d;
  --bg-glow-1: rgba(144, 19, 254, 0.16);
  --bg-glow-2: rgba(18, 162, 189, 0.08);
  --surface: #110f19;
  --surface-2: #17141f;
  --surface-3: #1e1a29;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --grid: rgba(255, 255, 255, 0.055);
  --text: #f4f2fa;
  --text-2: #b7b1c9;
  --muted: #847e98;
  --brand: #9013fe;
  --brand-2: #b06bff;
  --s1: #a56bff;          /* aktueller Zeitraum */
  --s2: #12a2bd;          /* Vergleich */
  --s3: #6f6a84;          /* Vorwoche (Kontext, gestrichelt) */
  --good: #3ccf86;
  --bad: #ff6272;
  --warn: #f2b53a;
  --good-bg: rgba(60, 207, 134, 0.12);
  --bad-bg: rgba(255, 98, 114, 0.12);
  --flash: rgba(165, 107, 255, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.8);
  --font: "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: "Manrope", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f3f8;
    --bg-glow-1: rgba(144, 19, 254, 0.08);
    --bg-glow-2: rgba(10, 137, 168, 0.05);
    --surface: #ffffff;
    --surface-2: #f7f6fb;
    --surface-3: #efedf6;
    --line: rgba(20, 16, 40, 0.08);
    --line-strong: rgba(20, 16, 40, 0.14);
    --grid: rgba(20, 16, 40, 0.07);
    --text: #17132a;
    --text-2: #4b4562;
    --muted: #767089;
    --s1: #9013fe;
    --s2: #0a89a8;
    --s3: #a39fb3;
    --good: #138a50;
    --bad: #d62839;
    --warn: #a86b00;
    --good-bg: rgba(19, 138, 80, 0.1);
    --bad-bg: rgba(214, 40, 57, 0.09);
    --flash: rgba(144, 19, 254, 0.08);
    --shadow: 0 1px 2px rgba(20, 16, 40, 0.04), 0 10px 30px -20px rgba(20, 16, 40, 0.35);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at -10% -20%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  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 {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 6px; }

/* ---------- 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: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 10px; box-shadow: 0 0 0 1px var(--line-strong), 0 6px 18px -8px var(--brand); }
.brand strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.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); animation: pulse 2.4s infinite; }
.live-state.err i { background: var(--bad); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.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: 999px; padding: 4px;
  box-shadow: var(--shadow);
}
.ranges::-webkit-scrollbar { display: none; }
.ranges button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 999px;
  color: var(--text-2); white-space: nowrap; font-weight: 650; font-size: 13px;
  transition: color .15s, background .15s;
}
.ranges button:hover { color: var(--text); }
.ranges button.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 6px 16px -8px var(--brand);
}
.tools { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s;
}
a.icon-btn { text-decoration: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.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(--s1); border-color: color-mix(in srgb, var(--s1) 45%, transparent); background: color-mix(in srgb, var(--s1) 10%, var(--surface)); }
#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 cubic-bezier(.4, 0, .2, 1); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Raster ---------- */
.grid {
  display: grid; gap: 18px; padding: 20px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  max-width: 1640px; margin: 0 auto;
}
.card {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #fff 3%), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 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 > .wide { grid-column: span 6; }
.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 > .wide { 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 > .wide { grid-column: span 12; }
  .card { padding: 16px; border-radius: 16px; }
  .ranges { margin-left: 0; order: 3; width: 100%; }
  .topbar { gap: 10px; padding-left: 16px; padding-right: 16px; }
  .tools { margin-left: auto; gap: 4px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .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: 16px; }
.card-head h2 { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.card-head small { color: var(--muted); font-weight: 550; margin-left: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.sub-head { margin-top: 26px; }
.pill { font-size: 12px; font-weight: 650; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 11px; border-radius: 999px; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(420px 220px at 0% 0%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, #fff 4%), var(--surface));
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
  display: flex; flex-direction: column;
}
.eyebrow { margin: 0; color: var(--text-2); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.hero-value { margin: 10px 0 14px; font-size: clamp(34px, 3.6vw, 50px); font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.hero-deltas { display: grid; gap: 7px; }
.hero-progress { margin-top: auto; padding-top: 18px; }
.hero-progress .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hero-progress .bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.hero-progress p { margin: 7px 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: 750; display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--surface-3); }

/* ---------- KPI-Kacheln ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #fff 3%), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px 14px; min-width: 0;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.kpi > span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.kpi strong { display: block; font-size: 26px; font-weight: 800; margin: 6px 0 6px; letter-spacing: -0.025em; line-height: 1.1; }
.kpi .delta-row { font-size: 12px; margin-top: auto; position: relative; }
.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: 30px; margin: 0 0 8px auto; pointer-events: none; overflow: visible; }
.kpi .spark path.l { fill: none; stroke: var(--s1); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; opacity: .9; }
.kpi .spark path.a { stroke: none; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: auto; position: relative; }

/* ---------- Live-Tracker ---------- */
.tracker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: grid; grid-template-columns: 38px 1fr; gap: 0 11px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; min-width: 0;
}
.tile .ico {
  grid-row: span 2; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 30%, transparent), color-mix(in srgb, var(--brand-2) 12%, transparent));
  color: var(--brand-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-2) 25%, transparent);
}
.tile .ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile strong { font-size: 21px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.tile span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Diagramm ---------- */
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 11px; font-size: 12px; font-weight: 650; color: var(--text-2); border-radius: 7px; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: var(--text-2); margin: -6px 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: 310px; }
@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; stroke-dasharray: 2 4; }
#chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-num); }
#chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#chart .line.main { stroke-width: 2.4; }
#chart .cross { stroke: var(--line-strong); stroke-width: 1; }
#chart .dot { stroke: var(--surface); stroke-width: 2.5; }
#chart .endlabel { font-size: 12px; font-weight: 800; fill: var(--text); font-family: var(--font-num); }
.tooltip {
  position: absolute; top: 0; pointer-events: none;
  background: color-mix(in srgb, var(--surface-3) 88%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; font-size: 12px; min-width: 190px;
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55);
}
.tooltip b { display: block; margin-bottom: 6px; font-weight: 750; }
.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; }

.table-wrap { max-height: 310px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
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: 700; position: sticky; top: 0; background: var(--surface); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Live-Eingang (Zeitleiste) ---------- */
.feed { list-style: none; margin: 0; padding: 0 6px 0 0; overflow-y: auto; flex: 1; max-height: 820px; margin-right: -8px; scrollbar-width: thin; }
.feed > li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 12px 10px 13px 26px; border-radius: 12px; }
.feed > li::before { content: ""; position: absolute; left: 9px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--s1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s1) 18%, transparent); }
.feed > li::after { content: ""; position: absolute; left: 12.5px; top: 30px; bottom: -12px; width: 1px; background: var(--line-strong); }
.feed > li:last-child::after { display: none; }
.feed > li.storno::before { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.feed > li.new { animation: flash 3.5s ease-out; }
@keyframes flash { 0%, 40% { background: var(--flash); } 100% { background: transparent; } }
.feed .no { font-weight: 750; }
.feed .no small { color: var(--muted); font-weight: 550; margin-left: 7px; }
.feed .total { font-weight: 800; text-align: right; letter-spacing: -0.01em; }
.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: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.tag.new-customer { color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 13%, transparent); }
.tag.storno { color: var(--bad); background: var(--bad-bg); }
.tag.wait { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }

/* 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: 600; }
.pos > li > .pp { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos .parts { grid-column: 1 / -1; list-style: none; margin: 3px 0 2px 1px; padding: 0 0 0 11px; border-left: 2px solid color-mix(in srgb, var(--s1) 35%, var(--line)); 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: 500; }
.payline { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--muted); }
.payline b { color: var(--text-2); font-weight: 700; }

/* ---------- Toplisten & Balken ---------- */
.toplist { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.toplist li { display: grid; grid-template-columns: 26px 1fr auto; gap: 2px 10px; padding: 10px 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, decimal-leading-zero); color: var(--muted); font-weight: 750; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.toplist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.toplist .rev { font-weight: 800; }
.toplist .sub { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }

.bars { display: grid; gap: 12px; }
.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); font-weight: 600; }
.bar-row .val { font-weight: 800; }
.bar-row .track { grid-column: 1 / -1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 0 4px 4px 0; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar-row.clickable { cursor: pointer; border-radius: 8px; }
.bar-row.clickable:hover .label { color: var(--text); }
.bar-row.active .label { color: var(--brand-2); font-weight: 750; }

/* ---------- Offen & Produktion ---------- */
.open-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.open-grid div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.open-grid span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.open-grid strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.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); }
.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-2); color: var(--text-2); border-radius: 10px; padding: 7px 13px; font-size: 12.5px; font-weight: 650; transition: color .15s, border-color .15s; }
.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: 1px solid var(--line); border-radius: var(--radius-sm); }
.filters label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 750; letter-spacing: .05em; text-transform: uppercase; min-width: 0; }
.filters input, .filters select { font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 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 color-mix(in srgb, var(--s1) 70%, transparent); 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-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: 11px 8px; font-size: 13px; border-radius: 10px; transition: background .12s; }
.orow > button:hover { background: var(--surface-2); }
.orow > button:focus-visible { outline: 2px solid var(--s1); outline-offset: -2px; }
.orow .c-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.orow .c-no { font-weight: 750; }
.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: 800; 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: 650; }
.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: 8px; 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 { opacity: .55; transition: opacity .2s; }

/* ---------- Zustand / Login ---------- */
.state-msg { max-width: 520px; margin: 80px auto; padding: 26px; 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: radial-gradient(800px 500px at 20% 0%, var(--bg-glow-1), transparent 60%), var(--bg); z-index: 50; }
.login-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; display: grid; gap: 13px; box-shadow: var(--shadow); }
.login-logo { height: 46px; width: 46px; border-radius: 12px; justify-self: start; box-shadow: 0 8px 20px -10px var(--brand); }
.login-card h1 { font-size: 23px; letter-spacing: -0.02em; }
.login-card p { margin: 0; color: var(--text-2); }
.login-card label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.login-card input { font: inherit; text-transform: none; letter-spacing: 0; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.login-card input:focus { outline: 2px solid var(--s1); outline-offset: 1px; }
.login-card button { margin-top: 6px; padding: 12px; border: 0; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 750; box-shadow: 0 10px 22px -12px var(--brand); }
.login-card button:disabled { opacity: .6; }
.login-error { color: var(--bad) !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: color-mix(in srgb, var(--surface-3) 90%, transparent); backdrop-filter: blur(14px); border: 1px solid color-mix(in srgb, var(--s1) 40%, var(--line)); border-radius: 14px; padding: 13px 15px; min-width: 270px; max-width: 380px; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6); animation: toast-in .35s cubic-bezier(.2, .8, .2, 1); }
.toast b { display: block; margin-bottom: 2px; }
.toast span { color: var(--text-2); font-size: 13px; }
@keyframes toast-in { from { transform: translateY(14px) scale(.98); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
