/* ==========================================================================
   Price Tracking Dashboard  --  Styles
   Palette: BG #e4e4e4 | Akzent #e1773b | Sidebar #f8f8f8 | Cards #ffffff
   Schrift: Hanken Grotesk (charaktervoll, tabellarische Ziffern)
   ========================================================================== */

:root {
  --bg: #e4e4e4;
  --accent: #e1773b;
  --accent-ink: #b9551f;
  --accent-soft: rgba(225, 119, 59, 0.12);
  --muted-1: #8c8c8c;
  --muted-2: #7b7b7b;
  --ink: #222222;
  --ink-soft: #666666;
  --sidebar-bg: #f8f8f8;
  --card-bg: #ffffff;
  --border: rgba(34, 34, 34, 0.09);
  --border-soft: rgba(34, 34, 34, 0.06);
  --hover: rgba(34, 34, 34, 0.045);
  --green: #28c76f;
  --green-ink: #1b6e44;
  --red: #ea5455;
  --red-ink: #a52d2d;
  --green-soft: #e7f6ec;
  --red-soft: #fceaea;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow: 0 2px 14px rgba(34, 34, 34, 0.05);
  --shadow-lg: 0 18px 50px rgba(34, 34, 34, 0.22);
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 74px;
  --header-h: 60px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ----- App-Layout --------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 60;
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 4px;
  position: relative;
}
.sb-logo {
  width: 34px; height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.sb-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.sb-sub { font-size: 11px; font-weight: 400; color: var(--muted-1); white-space: nowrap; }

.sb-collapse {
  margin-left: auto;
  width: 30px; height: 30px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background 0.14s, color 0.14s;
  flex-shrink: 0;
}
.sb-brand:hover .sb-collapse { color: var(--muted-2); }
.sb-collapse:hover { background: var(--hover); color: var(--ink) !important; }

/* Sub-Kategorie (Datenschutz / Impressum) */
.sb-subcat { display: flex; flex-direction: column; gap: 3px; }
.sb-sub-item { font-size: 12.5px; color: var(--muted-2); }
.sb-sub-item .ti { font-size: 17px; }

.sb-divider { height: 1px; background: var(--border); margin: 12px 6px; border: none; }

.sb-nav { display: flex; flex-direction: column; gap: 3px; }
.sb-spacer { flex: 1; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.sb-item .ti { font-size: 19px; flex-shrink: 0; width: 22px; text-align: center; }
.sb-item:hover { background: var(--hover); color: var(--ink); }
.sb-item::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 56%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transition: transform 0.16s;
}
.sb-item:hover::before { transform: translateY(-50%) scaleY(1); }
.sb-item.active { background: rgba(34, 34, 34, 0.07); color: var(--ink); }
.sb-item.active .ti { color: var(--accent); }

.sb-label { transition: opacity 0.16s; }
body.sidebar-collapsed .sb-brand-text,
body.sidebar-collapsed .sb-label { opacity: 0; pointer-events: none; width: 0; }
/* Logo komplett ausblenden + Toggle mittig zentrieren */
body.sidebar-collapsed .sb-logo { display: none; }
body.sidebar-collapsed .sb-brand { justify-content: center; gap: 0; padding: 6px 0 4px; }
body.sidebar-collapsed .sb-collapse { margin: 0 auto; position: static; }
body.sidebar-collapsed .sb-item { justify-content: center; padding: 9px; }
body.sidebar-collapsed .sb-subcat .sb-divider { margin: 8px 14px; }

/* Tooltip im collapsed-Modus */
.sb-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 80;
}
body.sidebar-collapsed .sb-item:hover[data-tip]::after { opacity: 1; }

/* ==========================================================================
   TOPBAR (mobile)
   ========================================================================== */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 55;
}
.topbar img { width: 28px; height: 28px; object-fit: contain; }
.topbar .tb-title { font-weight: 600; font-size: 15px; }
.hamburger {
  width: 38px; height: 38px;
  border: none; background: transparent;
  font-size: 22px; color: var(--ink);
  cursor: pointer; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.hamburger:hover { background: var(--hover); }
.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 58;
}

/* ==========================================================================
   CONTENT HEADER (blauer Bereich im Layout-Bild)
   ========================================================================== */
.content-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  flex-wrap: wrap;
}
.ch-title { font-size: 19px; font-weight: 600; color: var(--ink); margin-right: auto; }

.ch-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink-soft);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.btn .ti { font-size: 16px; }
.btn:hover { background: var(--hover); color: var(--ink); border-color: var(--muted-1); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

/* Charts-Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 7px;
  min-width: 220px;
  z-index: 70;
  display: none;
  max-height: 60vh; overflow: auto;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeSlide 0.16s ease; }
.dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--ink); cursor: pointer;
}
.dd-item:hover { background: var(--hover); }
.dd-item input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.dd-empty { padding: 9px; font-size: 12px; color: var(--muted-1); }

/* "Zuletzt aktualisiert" + Pulsing Icon */
.updated-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--ink-soft);
  cursor: default;
}
.updated-pill b { color: var(--ink); font-weight: 600; }

.pulse-box {
  position: relative; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.pulse-dot {
  position: absolute; width: 8px; height: 8px;
  background: var(--green); border-radius: 50%; z-index: 2;
}
.pulse-ring {
  position: absolute; width: 8px; height: 8px;
  border: 2px solid var(--green); border-radius: 50%;
  opacity: 0; z-index: 1;
  animation: double-pulse 4s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.pulse-ring.ring-2 { animation-delay: 0.4s; }
@keyframes double-pulse {
  0% { transform: scale(1); opacity: 1; }
  20% { transform: scale(3.2); opacity: 0; }
  21%, 100% { transform: scale(3.2); opacity: 0; }
}

/* ==========================================================================
   CANVAS + CARD GRID
   ========================================================================== */
.canvas { padding: 4px 22px 30px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  align-items: start;
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

@media (max-width: 1100px) {
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 680px) {
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  [class*="span-"] { grid-column: span 1 !important; }
}

/* ----- Card --------------------------------------------------------------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.22s, transform 0.22s;
  animation: cardIn 0.4s ease both;
}
.card.is-hidden { display: none; }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  min-height: 46px;
}
.card-ic { font-size: 16px; color: var(--muted-1); flex-shrink: 0; }
.card-title { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tools { display: flex; gap: 3px; }
.ic-btn {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted-1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s, opacity 0.14s;
}
.card-head:hover .ic-btn { opacity: 1; }
.modal-head .ic-btn { opacity: 1; }
.ic-btn:hover { background: var(--hover); color: var(--ink); border-color: var(--border); }
.ic-btn .ti { pointer-events: none; }

.card-body { padding: 16px; overflow: hidden; }
.card.minimized .card-body,
.card.minimized .card-foot { display: none; }
.card-min {
  display: none;
  align-items: center; gap: 7px;
  padding: 11px 16px;
  font-size: 12px; color: var(--muted-1);
}
.card.minimized .card-min { display: flex; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 14px;
}
.link-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none;
  color: var(--accent); font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 4px 0;
}
.link-btn:hover { color: var(--accent-ink); }

/* ----- Range-Filter ------------------------------------------------------- */
.range-filter { display: inline-flex; gap: 3px; }
.range-filter button {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink-soft);
  font-size: 11.5px; font-weight: 500;
  padding: 4px 9px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.13s;
}
.range-filter button:hover { background: var(--hover); }
.range-filter button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ==========================================================================
   MODAL (maximize / Details)
   ========================================================================== */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, 0.55);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 18px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
.modal.wide { max-width: 940px; }
.modal-head {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal-head .card-ic { font-size: 18px; }
.modal-title { font-size: 15px; font-weight: 600; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }

/* ==========================================================================
   SPINNER / Loading
   ========================================================================== */
.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 30px; min-height: 80px; }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Chart-spezifische Bausteine
   ========================================================================== */
.chart-host { position: relative; width: 100%; }
.chart-host canvas { display: block; }

.legend-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.legend-row .li { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Kategorien */
.stacked-bar { display: flex; height: 11px; width: 100%; gap: 3px; margin-bottom: 22px; }
.stacked-bar .seg { height: 100%; border-radius: 3px; transition: flex-basis 0.6s ease; }
.stacked-bar .seg:first-child { border-radius: 5px 3px 3px 5px; }
.stacked-bar .seg:last-child { border-radius: 3px 5px 5px 3px; }
.cat-list { display: flex; flex-direction: column; gap: 14px; }
.cat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cat-left { display: flex; align-items: center; gap: 11px; }
.cat-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.cat-count { font-size: 11px; color: var(--muted-1); font-weight: 400; }
.cat-right { font-weight: 600; color: var(--ink); font-size: 13px; white-space: nowrap; }
.cat-pct { color: var(--muted-1); font-weight: 400; margin-left: 5px; font-size: 12px; }

/* Top Produkte */
.tp-head, .tp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.tp-head { font-size: 11px; color: var(--muted-1); padding-bottom: 9px; border-bottom: 1px solid var(--border-soft); }
.tp-head span:nth-child(2), .tp-head span:nth-child(3) { text-align: right; }
.tp-row { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.tp-row:last-child { border-bottom: none; }
.tp-row > div:first-child { min-width: 0; }
.tp-name { font-weight: 600; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.tp-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 11px; color: var(--muted-1); margin-top: 2px; }
.tp-sub .sep { width: 1px; height: 11px; background: var(--border); }
.tp-price { text-align: right; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tp-change { text-align: right; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end; white-space: nowrap; }
.up { color: var(--red-ink); }
.down { color: var(--green-ink); }
.flat { color: var(--muted-1); }

/* Preise Total */
.total-big { font-size: 30px; font-weight: 700; color: var(--ink); display: flex; align-items: baseline; gap: 4px; }
.total-big .eur { font-size: 18px; color: var(--muted-1); font-weight: 600; }
.total-delta { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; color: var(--muted-1); }
.total-delta .pct { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }

/* Verfuegbarkeit */
.gauge-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.gauge-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.gauge-legend .li { display: flex; align-items: center; gap: 8px; }
.avail-scroll { -webkit-overflow-scrolling: touch; }
.avail-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 6px; }
.avail-table th, .avail-table td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.avail-table th { color: var(--muted-1); font-weight: 500; position: sticky; top: 0; background: var(--card-bg); z-index: 2; }
/* Produktspalte beim horizontalen Scrollen sichtbar lassen */
.avail-table td:first-child, .avail-table th:first-child {
  text-align: left; font-weight: 600; color: var(--ink);
  position: sticky; left: 0; background: var(--card-bg); z-index: 1;
}
.avail-table th:first-child { z-index: 3; }
.tag { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.tag-yes { background: var(--green-soft); color: var(--green-ink); }
.tag-no { background: var(--red-soft); color: var(--red-ink); }

/* Kennzahlen */
/* auto-fit passt die Spaltenzahl an die echte Card-Breite an (Reflow statt Abschneiden) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.kpi {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 13px 12px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
/* Icon allein oben rechts, Label bekommt darunter die volle Spaltenbreite –
   so passen lange Woerter wie "Durchschnitt" ohne haesslichen Wortumbruch. */
.kpi .kpi-top { display: flex; flex-direction: column-reverse; gap: 4px; color: var(--muted-1); }
.kpi .kpi-top .ti { align-self: flex-end; font-size: 19px; color: var(--accent); flex-shrink: 0; }
.kpi-label { font-size: 11.5px; color: var(--muted-2); min-width: 0; overflow-wrap: break-word; }
/* Zahl nie mitten im Wert trennen – hoechstens vor dem Euro-Zeichen umbrechen */
.kpi-value { font-size: 18px; font-weight: 700; color: var(--ink); min-width: 0; overflow-wrap: normal; }

/* Produkt-Cards */
.prod-img-wrap { padding: 0 0 12px; }
.prod-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-md);
  background: var(--bg);
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.sep-line { border: none; border-top: 1px solid var(--border-soft); margin: 13px 0; }
.prod-price { font-size: 16px; font-weight: 700; color: var(--ink); }
.prod-price small { font-size: 11px; color: var(--muted-1); font-weight: 500; }

/* Detailtabelle (Produkt) */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; padding: 8px 9px; color: var(--muted-1); font-weight: 500; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.data-table td { padding: 9px 9px; border-bottom: 1px solid var(--border-soft); }
.data-table tr:last-child td { border-bottom: none; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.spec-table td { padding: 7px 4px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.spec-table td:first-child { color: var(--muted-2); width: 42%; }
.spec-table td:last-child { color: var(--ink); font-weight: 500; }

.info-block { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.info-block h3 { color: var(--ink); font-size: 16px; margin: 18px 0 8px; }
.info-block ul { margin: 8px 0 8px 20px; }
.info-block li { margin: 5px 0; }

/* Rechtstexte (Impressum / Datenschutz) */
.legal-block { max-width: 920px; }
.legal-block p { margin: 0 0 12px; }
.legal-block h3:first-of-type { margin-top: 4px; }
.legal-block a { color: var(--accent); word-break: break-word; }
.legal-block a:hover { color: var(--accent-ink); text-decoration: underline; }

.muted { color: var(--muted-1); }
.nowrap { white-space: nowrap; }

/* Radar (Preisabweichung) */
.radar-flex { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.radar-host { flex: 1 1 320px; min-width: 280px; max-width: 520px; }
.radar-legend { flex: 0 0 230px; display: flex; flex-direction: column; gap: 8px; }
.rl-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  background: var(--card-bg); transition: background 0.13s;
}
.rl-item:hover { background: var(--hover); }
.rl-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rl-name { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.rl-item.off .rl-name { color: var(--muted-1); text-decoration: line-through; }
@media (max-width: 680px) { .radar-legend { flex-basis: 100%; } }

/* iOS-Toggle-Switch (Akzentfarbe) */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; transition: 0.25s; border-radius: 20px;
}
.switch .slider:before {
  content: ""; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background: #fff; transition: 0.25s; border-radius: 50%;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(16px); }

/* ==========================================================================
   Animationen
   ========================================================================== */
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* gestaffelter Karten-Einzug */
.card-grid .card:nth-child(1) { animation-delay: 0.02s; }
.card-grid .card:nth-child(2) { animation-delay: 0.07s; }
.card-grid .card:nth-child(3) { animation-delay: 0.12s; }
.card-grid .card:nth-child(4) { animation-delay: 0.17s; }
.card-grid .card:nth-child(5) { animation-delay: 0.22s; }
.card-grid .card:nth-child(6) { animation-delay: 0.27s; }
.card-grid .card:nth-child(7) { animation-delay: 0.32s; }
.card-grid .card:nth-child(8) { animation-delay: 0.37s; }

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

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .sb-brand-text,
  body.sidebar-collapsed .sb-label { opacity: 1; width: auto; }
  body.sidebar-collapsed .sb-item { justify-content: flex-start; padding: 9px 11px; }
  .topbar { display: flex; }
  body.sidebar-open .scrim { display: block; }
  .content-head { padding: 14px 16px; }
  .canvas { padding: 4px 16px 26px; }
  .ch-title { width: 100%; margin-bottom: 6px; }
}
