/* Karma Social Autopilot OS: Kundenportal.
   Redesign 09/2026: ruhiges Produkt-Layout statt "Dashboard-Deko".
   Prinzipien:
   - Zwei Themes (dunkel = Standard, hell ueber das Zahnrad), die Menueleiste
     wechselt mit. Beide Themes teilen jeden Baustein, nur die Tokens unten
     unterscheiden sich.
   - Eine Schrift (Poppins), Zahlen mit tabular-nums statt Monospace.
   - Grosse Radien, weiche Flaechen, kaum Linien, keine Glows, keine Gradients.
   - Dunkel: Neon-Gruen #99FF66 fuehrt (Primaer-Button, Badges), Karma-Blau
     #7DC1FF dezent als Flaeche (eigene Chat-Blasen) und fuer Kanaele/Diagramme.
     Hell: Karma-Blau (abgedunkelt auf #2B7BD2 fuer Buttons, #7DC1FF als
     Flaeche) fuehrt die Interaktion, Gruen bleibt Highlight. Keine harten
     schwarzen Flaechen im Hellen. */
:root {
  --ground: #0a0a0a;
  --panel: #161616;
  --panel-2: #212121;
  --sunken: #101010;
  --line: #262626;
  --line-soft: #1f1f1f;
  --line-strong: #3a3a3a;
  --text: #f5f5f5;
  --dim: #b0b0b0;
  --muted: #7a7a7a;
  --placeholder: #5a5a5a;

  --accent: #99ff66;
  --accent-hover: #a8ff7d;
  --accent-ink: #0a0a0a;
  --accent-soft: rgba(153, 255, 102, 0.12);
  --accent-line: rgba(153, 255, 102, 0.30);

  --ok: #99ff66;
  --ok-soft: rgba(153, 255, 102, 0.12);
  --ok-line: transparent;

  --chan: #7dc1ff;
  --chan-soft: rgba(125, 193, 255, 0.14);
  --chan-line: transparent;

  --amber: #ffc46b;
  --amber-soft: rgba(255, 196, 107, 0.14);
  --amber-line: transparent;

  --chart-1: #99ff66;
  --chart-2: #7dc1ff;
  --chart-3: #ffc46b;
  --chart-4: #c9a3ff;
  --chart-grid: #232323;
  --chart-axis: #7a7a7a;
  --chart-bg: #161616;
  --chart-cross: #3a3a3a;

  /* Menueleiste (eigene Tokens, damit sie sich vom Inhalt absetzen kann) */
  --side-bg: #0a0a0a;
  --side-text: #f5f5f5;
  --side-dim: #8a8a8a;
  --side-hover: #161616;
  --side-active: #1c1c1c;
  --side-line: #1f1f1f;
  --side-accent: #99ff66;

  /* Chat: eigene Blasen dezent blau getoent statt Neon auf Schwarz */
  --me-bg: rgba(125, 193, 255, 0.16);
  --me-fg: #f5f5f5;
  --me-label: #7dc1ff;

  --upsell-bg: #212121;
  --upsell-fg: #f5f5f5;
  --upsell-dim: #a8a8a8;
  --upsell-icon-bg: rgba(255, 255, 255, 0.06);
  --upsell-icon: #99ff66;
  --upsell-btn-line: rgba(255, 255, 255, 0.18);

  --tip-bg: #0a0a0a;
  --tip-fg: #f5f5f5;
  --toast-bg: #99ff66;
  --toast-fg: #0a0a0a;
  --scroll-thumb: #2e2e2e;
  --scroll-thumb-hover: #444444;
  --schatten: none;

  --radius-xl: 22px;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Poppins", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

/* ---------------------------------------------------------- HELLES THEME */
html[data-theme="hell"] {
  --ground: #eef0f3;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --sunken: #f6f7f9;
  --line: #e6e9ee;
  --line-soft: #eef0f3;
  --line-strong: #cfd5de;
  --text: #121212;
  --dim: #4a4f58;
  --muted: #7b8290;
  --placeholder: #a5abb7;

  --accent: #2b7bd2;
  --accent-hover: #256cbb;
  --accent-ink: #ffffff;
  --accent-soft: #e6f1ff;
  --accent-line: #b9d8fb;

  /* Chat: eigene Blasen in CI-Hellblau mit dunkler Schrift */
  --me-bg: #7dc1ff;
  --me-fg: #0f1a26;
  --me-label: #0f1a26;

  /* Hinweis-Flaeche (Zusatzleistungen): weiches Blau statt Schwarz */
  --upsell-bg: #e6f1ff;
  --upsell-fg: #121212;
  --upsell-dim: #4a5a6e;
  --upsell-icon-bg: #ffffff;
  --upsell-icon: #2b7bd2;
  --upsell-btn-line: #b9d8fb;

  --ok: #2f7a17;
  --ok-soft: #e4ffd6;
  --ok-line: transparent;

  --chan: #1f5fae;
  --chan-soft: #e6f1ff;
  --chan-line: transparent;

  --amber: #9a5b06;
  --amber-soft: #fff1dc;
  --amber-line: transparent;

  --chart-1: #3aa321;
  --chart-2: #3d8fd9;
  --chart-3: #e0962a;
  --chart-4: #8b5cf6;
  --chart-grid: #e9ecf0;
  --chart-axis: #8a919e;
  --chart-bg: #ffffff;
  --chart-cross: #cfd5de;

  --side-bg: #ffffff;
  --side-text: #121212;
  --side-dim: #6d7480;
  --side-hover: #f2f4f7;
  --side-active: #eef0f3;
  --side-line: #eef0f3;
  --side-accent: #2b7bd2;

  --tip-bg: #121212;
  --tip-fg: #ffffff;
  --toast-bg: #2b7bd2;
  --toast-fg: #ffffff;
  --scroll-thumb: #d3d8e0;
  --scroll-thumb-hover: #b9c0cb;
  --schatten: 0 1px 2px rgba(18, 18, 18, 0.04), 0 8px 24px rgba(18, 18, 18, 0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground); color: var(--text);
  font-family: var(--font); font-size: 14px; font-weight: 400; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 500; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: #99ff66; color: #0a0a0a; }
.num, .tile .val, .schip .n, .top-post .num, .ad-stats b { font-variant-numeric: tabular-nums; }

* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: content-box; }

/* Logo folgt dem Theme: weiss auf Schwarz, schwarz auf Weiss */
html:not([data-theme="hell"]) .logo-hell { display: none; }
html[data-theme="hell"] .logo-dunkel { display: none; }
html[data-theme="hell"] .logo-hell { display: block; }

/* ------------------------------------------------------------ Icons */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 18px; height: 18px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--panel); border-radius: var(--radius-xl); box-shadow: var(--schatten);
  padding: 44px 40px; width: 100%; max-width: 440px;
}
.login-logo { width: 140px; height: auto; display: block; margin-bottom: 28px; }
.login-card h1 { font-size: 24px; }
.login-card h1 .dot { color: inherit; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 4px 0 28px; }
.login-card label { font-size: 12.5px; color: var(--dim); display: block; margin-bottom: 8px; }
.login-card input {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--sunken); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 13px 14px; outline: none; transition: border-color 120ms;
}
.login-card input::placeholder { color: var(--placeholder); }
.login-card input:focus { border-color: var(--line-strong); }
.login-card .btn.primary { width: 100%; margin-top: 14px; padding: 13px; font-size: 14px; justify-content: center; }
.login-msg { margin-top: 16px; font-size: 13px; color: var(--dim); min-height: 20px; }
.login-msg.ok { color: var(--ok); }

/* ------------------------------------------------------------ Shell */
.shell { display: grid; grid-template-columns: 256px 1fr; height: 100vh; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-line);
}
.brand { padding: 26px 24px 20px; }
.brand-logo { width: 124px; height: auto; display: block; margin-bottom: 16px; }
.brand-title { font-size: 12.5px; font-weight: 400; color: var(--side-dim); letter-spacing: 0.01em; }
.brand-title .dot { color: var(--side-accent); font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 6px 14px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 400;
  color: var(--side-dim); cursor: pointer; user-select: none; background: none;
  border: 0; position: relative;
  transition: color 120ms, background 120ms;
}
.nav-item:hover { color: var(--side-text); background: var(--side-hover); }
.nav-item.active { color: var(--side-text); background: var(--side-active); font-weight: 500; }
.nav-item.active .ic { color: var(--side-accent); }
.nav-item:focus-visible { outline: 2px solid var(--side-accent); outline-offset: -2px; }
.nav-item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  margin-left: auto; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums;
  background: #99ff66; color: #0a0a0a; border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.sidebar-foot { border-top: 1px solid var(--side-line); padding: 14px 16px 18px; font-size: 12px; }
.foot-settings {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; color: var(--side-dim);
  font-family: inherit; font-size: 12.5px; padding: 9px 10px;
  border-radius: 10px; margin-bottom: 8px;
}
.foot-settings:hover, .foot-settings[aria-expanded="true"] { color: var(--side-text); background: var(--side-hover); }
.foot-settings:focus-visible { outline: 2px solid var(--side-accent); outline-offset: -2px; }
.foot-settings .ic { width: 16px; height: 16px; }
.settings-panel {
  border-radius: 12px; background: var(--side-hover); padding: 12px 12px 12px; margin-bottom: 10px;
}
.sp-title { font-size: 11px; color: var(--side-dim); margin-bottom: 8px; }
.seg { display: flex; gap: 4px; background: var(--side-bg); border-radius: 10px; padding: 3px; }
.seg-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 0; border-radius: 8px; color: var(--side-dim);
  font-family: inherit; font-size: 12px; font-weight: 500; padding: 7px 4px;
}
.seg-btn .ic { width: 14px; height: 14px; }
.seg-btn:hover { color: var(--side-text); }
.seg-btn[aria-checked="true"] { background: #99ff66; color: #0a0a0a; }
.seg-btn:focus-visible { outline: 2px solid var(--side-accent); outline-offset: 1px; }
.foot-kunde { display: flex; align-items: center; gap: 11px; }
.foot-txt { flex: 1; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #99ff66; color: #0a0a0a; display: grid; place-items: center;
  font-weight: 600; font-size: 12px; flex: none;
}
.foot-name { color: var(--side-text); font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-sub { color: var(--side-dim); font-size: 11px; }
.foot-sub .chip { color: var(--side-text); font-weight: 500; text-transform: capitalize; }
.foot-out {
  background: none; border: 0; color: var(--side-dim); padding: 7px; flex: none;
  border-radius: 8px; display: grid; place-items: center;
}
.foot-out:hover { color: var(--side-text); background: var(--side-hover); }
.foot-out:focus-visible { outline: 2px solid var(--side-accent); outline-offset: 1px; }
.kunde-switch {
  width: 100%; margin-bottom: 10px; background: var(--side-hover); color: var(--side-text);
  border: 0; border-radius: 10px; font-family: inherit; font-size: 12px; padding: 8px 10px;
}

/* ------------------------------------------------------------ Main */
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 30px 40px 6px;
}
.topbar h1 { font-size: 26px; font-weight: 500; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.period {
  font-size: 12px; color: var(--dim); background: var(--panel);
  border-radius: 20px; padding: 6px 14px; box-shadow: var(--schatten);
}
.content { flex: 1; overflow-y: auto; padding: 18px 40px 48px; }
.view { max-width: 1120px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }

/* ------------------------------------------------------------ Karten */
.card {
  background: var(--panel); border-radius: var(--radius); padding: 24px 26px;
  box-shadow: var(--schatten);
}
.card h3 {
  display: flex; align-items: center; gap: 11px;
  font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 16px;
}
.card h3 .ic {
  width: 30px; height: 30px; padding: 7px; border-radius: 9px;
  background: var(--panel-2); color: var(--dim);
}
.card + .card, .grid2 + .grid2, .grid2 + .card, .card + .grid2,
.tiles + .card, .tiles + .grid2, .status-chips + .card { margin-top: 18px; }
.grid2 > .card, .grid2 > .tile { margin-top: 0; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.demo-flag {
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--amber); background: var(--amber-soft); white-space: nowrap;
  border-radius: 20px; padding: 6px 12px;
}

.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.row:first-of-type { border-top: 0; }
.row .date { font-size: 12px; color: var(--muted); min-width: 66px; font-variant-numeric: tabular-nums; }
.row .title { flex: 1; font-weight: 400; color: var(--text); }
.row .num { font-weight: 500; font-size: 15px; }
.row .ic-ok { color: var(--ok); width: 16px; height: 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 500; border-radius: 20px; padding: 4px 11px;
  white-space: nowrap; border: 0; line-height: 1.3;
}
.pill.ig, .pill.li, .pill.plan { background: var(--chan-soft); color: var(--chan); }
.pill.fb { background: var(--panel-2); color: var(--dim); }
.pill.gbp, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warte, .pill.draft { background: var(--amber-soft); color: var(--amber); }
.pill .ic { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 1px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); padding: 10px 16px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  transition: border-color 120ms, background 120ms, color 120ms;
}
.btn:hover { background: var(--panel-2); }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; }
.btn:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }

.need { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.need:first-of-type { border-top: 0; }
.need > .ic {
  width: 34px; height: 34px; padding: 8px; border-radius: 10px;
  background: var(--panel-2); color: var(--dim); margin-top: 1px;
}
.need .txt { flex: 1; min-width: 0; }
.need .txt b { font-weight: 500; color: var(--text); }
.need .txt .why { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.need .btn { flex: none; }

/* Hinweis auf Zusatzleistungen: getoente Flaeche (dunkel: Grau, hell: Karma-Blau weich) */
.upsell {
  border-radius: var(--radius); background: var(--upsell-bg); color: var(--upsell-fg);
  padding: 22px 26px; margin-top: 18px; display: flex; gap: 16px; align-items: center;
}
.upsell > .ic { width: 36px; height: 36px; padding: 9px; border-radius: 10px; background: var(--upsell-icon-bg); color: var(--upsell-icon); }
.upsell .txt { flex: 1; }
.upsell .txt b { font-weight: 500; }
.upsell .txt .why { color: var(--upsell-dim); font-size: 12.5px; margin-top: 2px; }
.upsell .btn { border-color: var(--upsell-btn-line); color: var(--upsell-fg); }
.upsell .btn:hover { background: rgba(127, 127, 127, 0.10); }
.upsell .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.upsell .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ------------------------------------------------------------ Chat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 210px); min-height: 420px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 2px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 66%; padding: 12px 16px; border-radius: 16px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: break-word; }
.msg .who { font-size: 11px; font-weight: 500; margin-bottom: 3px; white-space: normal; opacity: 0.7; }
.msg .time { font-size: 11px; margin-top: 5px; white-space: normal; opacity: 0.55; font-variant-numeric: tabular-nums; }
.msg.me { align-self: flex-end; background: var(--me-bg); color: var(--me-fg); border-bottom-right-radius: 6px; }
.msg.me .who { color: var(--me-label); }
.msg.bot { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 6px; }
.msg.bot .who { color: var(--text); }
.msg.ask { align-self: flex-start; background: var(--amber-soft); border-bottom-left-radius: 6px; }
.msg.ask .who { color: var(--amber); opacity: 1; }
.chat-input { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.chat-input textarea {
  flex: 1; resize: none; font-family: inherit; font-size: 13.5px; font-weight: 400;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--sunken); color: var(--text); outline: none;
  min-height: 46px; max-height: 130px; line-height: 1.5; transition: border-color 120ms;
}
.chat-input textarea::placeholder { color: var(--placeholder); }
.chat-input textarea:focus { border-color: var(--line-strong); }
.chat-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.typing { color: var(--muted); font-style: italic; animation: typing-pulse 1.4s ease-in-out infinite; }
@keyframes typing-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing { animation: none; } }

/* ------------------------------------------------------------ KPIs */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tile {
  background: var(--panel); border-radius: var(--radius); padding: 20px 22px 16px;
  box-shadow: var(--schatten); display: flex; flex-direction: column;
}
.tile .lbl { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.tile .val { font-size: 30px; font-weight: 500; margin-top: 6px; letter-spacing: -0.03em; line-height: 1.1; }
.tile .delta {
  display: inline-block; align-self: flex-start; margin-top: 10px;
  font-size: 11.5px; font-weight: 500; color: var(--ok); background: var(--ok-soft);
  border-radius: 20px; padding: 3px 9px;
}
.tile .delta:empty { display: none; }
.tile .delta.neutral { color: var(--dim); background: var(--panel-2); font-weight: 400; }
.tile svg { display: block; margin-top: 14px; width: 100%; height: 36px; }

.chart-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-head h3 { margin-bottom: 0; }
.legend { display: flex; gap: 18px; margin-left: auto; font-size: 12.5px; color: var(--dim); }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend .swatch { width: 8px; height: 8px; border-radius: 50%; }
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: 240px; }
.tip {
  position: absolute; pointer-events: none; background: var(--tip-bg); color: var(--tip-fg);
  border-radius: 10px; padding: 9px 12px; font-size: 12px;
  display: none; z-index: 5; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.tip .t-week { opacity: 0.6; font-size: 11px; margin-bottom: 2px; }
.tip .t-row { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.tip .t-row .swatch { width: 8px; height: 8px; border-radius: 50%; }

.top-post { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.top-post:first-of-type { border-top: 0; }
.top-post .thumb {
  width: 42px; height: 42px; border-radius: 12px; background: var(--panel-2); color: var(--dim);
  display: grid; place-items: center; flex: none;
}
.top-post .t { flex: 1; min-width: 0; }
.top-post .t .h { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-post .t .m { font-size: 12px; color: var(--muted); }
.top-post .num { font-weight: 500; font-size: 16px; text-align: right; letter-spacing: -0.01em; }
.top-post .num small { font-weight: 400; color: var(--muted); font-size: 11px; display: block; }

/* Always-On Ads: Creative-Karten mit Vorschaubild (4:5 wie im Feed) */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; margin-top: 6px; }
.ad-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: var(--panel-2); color: inherit; text-decoration: none;
  transition: transform 120ms;
}
.ad-card:hover { transform: translateY(-2px); }
.ad-thumb {
  position: relative; aspect-ratio: 4 / 5; background: var(--sunken) center / cover no-repeat;
  display: grid; place-items: center;
}
.ad-thumb.leer .ic { width: 34px; height: 34px; color: var(--muted); stroke-width: 1.3; }
.ad-thumb > .pill { position: absolute; top: 10px; width: max-content; justify-self: start; align-self: start; backdrop-filter: blur(6px); }
.ad-thumb > .pill:not(.ad-status) { left: 10px; right: auto; background: rgba(10, 10, 10, 0.7); color: #fff; }
.ad-thumb > .ad-status { right: 10px; left: auto; }
.ad-body { padding: 14px 16px 16px; }
.ad-title { font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ad-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.ad-meta .ad-note { color: var(--amber); }
.ad-stats { display: flex; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ad-stats b { display: block; font-weight: 500; font-size: 14px; }
.ad-stats small { font-size: 10.5px; color: var(--muted); }
@media (max-width: 520px) { .ad-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .ad-stats { gap: 10px; } }

/* ------------------------------------------------------------ Upload */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 16px;
  padding: 38px 20px; text-align: center; cursor: pointer;
  background: var(--sunken); transition: border-color 120ms, background 120ms;
}
.dropzone:hover, .dropzone.drag { border-color: var(--text); background: var(--panel-2); }
.dropzone:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }
.dz-ico { width: 32px; height: 32px; margin: 0 auto; color: var(--dim); stroke-width: 1.3; }
.dz-txt { margin-top: 12px; }
.dz-txt b { font-weight: 500; }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.up-row:first-of-type { margin-top: 14px; }
.up-row > .ic { color: var(--muted); }
.up-row .fn { flex: 1; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.up-row .sz { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Reports */
.report-row { cursor: pointer; }
.report-row:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.md { max-width: 740px; color: var(--dim); }
.md h2 { font-size: 20px; margin: 6px 0 10px; color: var(--text); }
.md h3 { font-size: 16px; margin: 20px 0 6px; color: var(--text); display: block; }
.md h4, .md h5 { font-size: 13.5px; margin: 14px 0 4px; color: var(--text); }
.md p { margin: 7px 0; }
.md ul { margin: 6px 0 10px; padding-left: 20px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }
.md a { text-decoration: underline; text-underline-offset: 3px; }
.md-table-wrap { overflow-x: auto; margin: 12px 0; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 320px; }
.md th, .md td { border-bottom: 1px solid var(--line-soft); padding: 8px 12px; text-align: left; }
.md th { font-weight: 500; color: var(--text); }
.md td { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Status
   Kennzahlen-Leiste wie eine Zeile: je Wert eine feine Linie links. */
.status-chips {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  background: var(--panel); border-radius: var(--radius); padding: 22px 12px; box-shadow: var(--schatten);
}
.schip { padding: 2px 16px 2px 18px; border-left: 2px solid var(--line-strong); }
.schip .n { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.schip .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.schip.hot { border-left-color: #99ff66; }
.schip.hot .n { color: var(--text); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--toast-bg); color: var(--toast-fg); border-radius: 12px; padding: 12px 18px;
  font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 180ms, transform 180ms;
  pointer-events: none; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ------------------------------------------------ Tablet / schmaler Desktop */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .status-chips { grid-template-columns: repeat(3, 1fr); row-gap: 18px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 64px 1fr; }
  .brand-title, .brand-logo, .nav-item .lbl { display: none; }
  .brand { padding: 16px 0 12px; height: 54px; }
  .nav { padding: 8px 8px; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item .badge { position: absolute; margin: 0; transform: translate(14px, -12px); }
  .sidebar-foot { padding: 12px 6px; }
  .foot-txt, .foot-out, .kunde-switch { display: none; }
  .foot-settings { justify-content: center; padding: 10px 0; margin-bottom: 4px; }
  .foot-settings .lbl { display: none; }
  .settings-panel { position: fixed; left: 70px; bottom: 14px; width: 200px; z-index: 40; box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
  .foot-kunde { justify-content: center; }
  .avatar { cursor: pointer; }
  .grid2 { grid-template-columns: 1fr; gap: 14px; }
  .status-chips { grid-template-columns: repeat(3, 1fr); }
  .content { padding: 14px 20px 32px; }
  .topbar { padding: 22px 20px 4px; }
  .topbar h1 { font-size: 22px; }
}

/* ------------------------------------------------ Handy: Tab-Leiste unten */
.tabbar, .sheet { display: none; }
@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .status-chips { grid-template-columns: repeat(2, 1fr); row-gap: 16px; padding: 18px 6px; }
  .topbar { padding: 16px 16px 2px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .topbar h1 { font-size: 20px; }
  .topbar > div:first-child { min-width: 0; }
  .demo-flag { font-size: 10px; padding: 4px 9px; }
  .topbar .sub { font-size: 12px; }
  .period { display: none; }
  .msg { max-width: 88%; }
  .chat-wrap { height: calc(100dvh - 236px - env(safe-area-inset-bottom, 0px)); min-height: 300px; }
  .chat-input { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .tile { padding: 16px 16px 14px; }
  .tile .val { font-size: 24px; }
  .card { padding: 18px 18px; }
  .view .row { flex-wrap: wrap; row-gap: 4px; }
  .view .card .row .title { flex: 1 1 100%; order: -1; }
  .upsell { flex-wrap: wrap; padding: 18px; }
  .dropzone { padding: 26px 14px; }
  .content { padding: 12px 14px calc(88px + env(safe-area-inset-bottom, 0px)); }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-soft);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tab-item {
    flex: 1; background: none; border: 0; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 0 3px; font-size: 10px; position: relative; cursor: pointer;
  }
  .tab-item .ic { width: 21px; height: 21px; }
  .tab-item.active { color: var(--text); }
  .tab-item:focus-visible { outline: 2px solid var(--line-strong); outline-offset: -2px; border-radius: 8px; }
  .tab-badge {
    position: absolute; top: 1px; left: calc(50% + 8px);
    background: #99ff66; color: #0a0a0a; font-weight: 500;
    font-size: 10px; border-radius: 20px; padding: 0 6px;
  }
  .sheet {
    display: flex; flex-direction: column; position: fixed; z-index: 29;
    left: 10px; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border-radius: var(--radius);
    padding: 6px; gap: 2px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  }
  .sheet[hidden] { display: none; }
  .sheet-item {
    display: flex; align-items: center; gap: 12px; text-align: left;
    background: none; border: 0; color: var(--text); font-family: inherit;
    font-size: 14px; padding: 12px; border-radius: var(--radius-sm); cursor: pointer;
  }
  .sheet-item .ic { color: var(--dim); }
  .sheet-item:hover, .sheet-item:focus-visible { background: var(--panel-2); outline: none; }
}
