/* Karma Social Autopilot OS: Kundenportal.
   Design-Basis ist 1:1 karmamarketing.io: schwarzer Grund (#000), Karten #121212
   mit Rand #262626, Radius 12px, Neon-Gruen #99FF66 als einziger Akzent,
   Poppins, dazu Hellblau #7DC1FF als CI-Sekundaerfarbe fuer Diagramme.
   Durchgehend dunkel, keine hellen Inhaltsflaechen mehr. */
:root {
  /* DUNKEL ist der Standard (Look von karmamarketing.io).
     Das helle Theme weiter unten ueberschreibt nur diese Werte,
     kein einziger Baustein muss doppelt gepflegt werden. */
  --ground: #000000;
  --panel: #1a1a1a;
  --panel-2: #242424;
  --sunken: #0d0d0d;
  --line: #2c2c2c;
  --line-soft: #262626;
  --line-strong: #565656;
  --text: #ffffff;
  --dim: #b4b4b4;
  --muted: #767676;
  --placeholder: #5a5a5a;

  /* Interaktion: im Dunkeln fuehrt Neon-Gruen, im Hellen Blau #3772FF
     (Neon-Gruen haette auf Weiss nur rund 1,2:1 Kontrast). */
  --accent: #99ff66;
  --accent-hover: #aaff80;
  --accent-ink: #000000;
  --accent-soft: rgba(153, 255, 102, 0.12);
  --accent-line: rgba(153, 255, 102, 0.32);

  /* Erfolg/positiv, bleibt in beiden Themes gruen (im Hellen abgedunkelt) */
  --ok: #99ff66;
  --ok-soft: rgba(153, 255, 102, 0.12);
  --ok-line: rgba(153, 255, 102, 0.32);

  /* Kanal-Pills (Instagram, LinkedIn, Blog) */
  --chan: #7dc1ff;
  --chan-soft: rgba(125, 193, 255, 0.13);
  --chan-line: rgba(125, 193, 255, 0.22);

  /* Wartend/offen */
  --amber: #ffc46b;
  --amber-soft: rgba(255, 196, 107, 0.13);
  --amber-line: rgba(255, 196, 107, 0.28);

  /* Diagramme, werden von app.js ausgelesen */
  --chart-1: #99ff66;
  --chart-2: #7dc1ff;
  --chart-3: #ffc46b;
  --chart-4: #c9a3ff;
  --chart-grid: #2c2c2c;
  --chart-axis: #808080;
  --chart-bg: #1a1a1a;

  --tip-bg: #0a0a0a;
  --tip-fg: #ffffff;
  --toast-bg: #99ff66;
  --toast-fg: #000000;
  --scroll-thumb: #363636;
  --scroll-thumb-hover: #4d4d4d;
  --glow-a: rgba(153, 255, 102, 0.07);
  --glow-b: rgba(125, 193, 255, 0.05);
  --schatten: none;

  --radius: 12px;
  --radius-sm: 10px;
  --font: "Poppins", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}

/* ---------------------------------------------------------- HELLES THEME
   Gewaehlt ueber das Zahnrad in der Fusszeile, gemerkt pro Geraet
   (localStorage "autopilot-theme"). Blau #3772FF traegt die Interaktion,
   Neon-Gruen bleibt bewusst sparsam: Erfolgs-Badges und Bestaetigungen. */
html[data-theme="hell"] {
  --ground: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f1f3f7;
  --sunken: #f7f8fa;
  --line: #e2e6ee;
  --line-soft: #eef1f6;
  --line-strong: #b9c1d1;
  --text: #0d1117;
  --dim: #49505f;
  --muted: #79808f;
  --placeholder: #a2a8b5;

  --accent: #3772ff;
  --accent-hover: #2a62ea;
  --accent-ink: #ffffff;
  --accent-soft: rgba(55, 114, 255, 0.09);
  --accent-line: rgba(55, 114, 255, 0.28);

  --ok: #2f6b18;
  --ok-soft: #ecfbdd;
  --ok-line: #c4e9a5;

  --chan: #1f5bbf;
  --chan-soft: #e9f1ff;
  --chan-line: #c8dcff;

  --amber: #9a5b06;
  --amber-soft: #fdf3e3;
  --amber-line: #f2ddba;

  --chart-1: #3772ff;
  --chart-2: #2f8f1c;
  --chart-3: #b45309;
  --chart-4: #7c3aed;
  --chart-grid: #e7eaf1;
  --chart-axis: #79808f;
  --chart-bg: #ffffff;

  --tip-bg: #0d1117;
  --tip-fg: #ffffff;
  --toast-bg: #0d1117;
  --toast-fg: #ffffff;
  --scroll-thumb: #ccd2dd;
  --scroll-thumb-hover: #adb5c4;
  --glow-a: rgba(55, 114, 255, 0.05);
  --glow-b: rgba(153, 255, 102, 0.10);
  --schatten: 0 1px 2px rgba(13, 17, 23, 0.05);
}

* { 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: 300; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Scrollbalken passend zum dunklen Grund (Firefox + WebKit) */
* { 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; }

/* Dezenter Gruen-Schimmer wie im Hero auf karmamarketing.io */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 420px at 78% -8%, var(--glow-a), transparent 62%),
    radial-gradient(620px 380px at 4% 104%, var(--glow-b), transparent 60%);
}
.shell, .login-wrap, .toast { position: relative; z-index: 1; }

/* Logo folgt dem Theme: weiss auf Schwarz, schwarz auf Weiss */
/* Spezifitaet bewusst ueber html[...]: sonst gewinnt das spaetere
   .brand-logo { display: block } und beide Logos stehen uebereinander. */
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: 19px; height: 19px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  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: 1px solid var(--line); border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 420px;
}
.login-logo { width: 150px; height: auto; display: block; margin-bottom: 22px; }
.login-card h1 { font-size: 21px; }
.login-card h1 .dot { color: var(--accent); }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 26px; }
.login-card label { font-size: 12px; color: var(--dim); display: block; margin-bottom: 6px; }
.login-card input {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; outline: none;
}
.login-card input::placeholder { color: var(--placeholder); }
.login-card input:focus { border-color: var(--accent); }
.login-card .btn.primary { width: 100%; margin-top: 14px; padding: 12px; font-size: 14px; }
.login-msg { margin-top: 16px; font-size: 13px; color: var(--dim); min-height: 20px; }
.login-msg.ok { color: var(--accent); }

/* ------------------------------------------------------------ Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.brand { padding: 22px 20px 18px; }
.brand-logo { width: 132px; height: auto; display: block; margin-bottom: 14px; }
.brand-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--dim); }
.brand-title .dot { color: var(--accent); }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 400;
  color: var(--muted); cursor: pointer; user-select: none; background: none;
  border: 1px solid transparent; position: relative;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); font-weight: 500; }
.nav-item.active .ic { color: var(--accent); }
.nav-item:focus-visible { outline: 2px solid var(--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: 10.5px; font-family: var(--mono);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  border-radius: 20px; padding: 1px 7px;
}
.sidebar-foot { border-top: 1px solid var(--line); padding: 14px 16px; font-size: 12px; }
.foot-settings {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 1px solid transparent; color: var(--muted);
  font-family: inherit; font-size: 12.5px; padding: 8px 10px;
  border-radius: var(--radius-sm); margin-bottom: 8px;
}
.foot-settings:hover, .foot-settings[aria-expanded="true"] { color: var(--text); background: var(--panel-2); }
.foot-settings:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.foot-settings .ic { width: 17px; height: 17px; }
.settings-panel {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); padding: 11px 12px 12px; margin-bottom: 10px;
}
.sp-title { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.seg { display: flex; gap: 4px; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 0; border-radius: 7px; color: var(--muted);
  font-family: inherit; font-size: 12px; font-weight: 500; padding: 7px 4px;
}
.seg-btn .ic { width: 14px; height: 14px; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.foot-kunde { display: flex; align-items: center; gap: 10px; }
.foot-txt { flex: 1; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent); display: grid; place-items: center;
  font-weight: 600; font-size: 11.5px; flex: none;
}
.foot-name { color: var(--text); font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-sub { color: var(--muted); font-size: 11px; }
.foot-sub .chip { color: var(--accent); font-weight: 600; text-transform: capitalize; }
.foot-out {
  background: none; border: 0; color: var(--muted); padding: 6px; flex: none;
  border-radius: 8px; display: grid; place-items: center;
}
.foot-out:hover { color: var(--text); background: var(--panel-2); }
.foot-out:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kunde-switch {
  width: 100%; margin-bottom: 10px; background: var(--sunken); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px; padding: 7px 8px;
}

/* ------------------------------------------------------------ Main */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 30px 18px; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 21px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.period {
  font-size: 11.5px; color: var(--dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px;
}
.content { flex: 1; overflow-y: auto; padding: 24px 30px 44px; }
.view { max-width: 1080px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ------------------------------------------------------------ Karten */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--schatten);
}
.card h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 14px;
}
.card h3 .ic { color: var(--accent); width: 17px; height: 17px; }
.card + .card, .grid2 + .grid2, .grid2 + .card, .card + .grid2,
.tiles + .card, .tiles + .grid2, .status-chips + .card { margin-top: 16px; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.demo-flag {
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--amber); background: var(--amber-soft); white-space: nowrap;
  border: 1px solid var(--amber-line); border-radius: 20px; padding: 3px 10px;
}

.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.row:first-of-type { border-top: 0; }
.row .date { font-family: var(--mono); font-size: 11.5px; color: var(--muted); min-width: 62px; }
.row .title { flex: 1; font-weight: 400; color: var(--text); }
.row .num { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.row .ic-ok { color: var(--ok); width: 16px; height: 16px; }

.pill {
  font-size: 11px; font-weight: 500; border-radius: 20px; padding: 3px 10px;
  white-space: nowrap; border: 1px solid transparent;
}
.pill.ig, .pill.li { background: var(--chan-soft); color: var(--chan); border-color: var(--chan-line); }
.pill.fb { background: var(--panel-2); color: var(--dim); border-color: var(--line); }
.pill.gbp, .pill.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.warte, .pill.draft { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.pill.plan { background: var(--chan-soft); color: var(--chan); border-color: var(--chan-line); }
.pill .ic { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); padding: 9px 16px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  transition: border-color 120ms, background 120ms, color 120ms;
}
.btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); background: transparent; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.need { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.need:first-of-type { border-top: 0; }
.need > .ic { color: var(--accent); 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; }
.need .btn { flex: none; }

.upsell {
  border: 1px solid var(--accent-line); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--panel);
  padding: 18px 22px; margin-top: 16px; display: flex; gap: 14px; align-items: center;
}
.upsell > .ic { width: 22px; height: 22px; color: var(--accent); }
.upsell .txt { flex: 1; }
.upsell .txt b { font-weight: 600; }
.upsell .txt .why { color: var(--dim); font-size: 12.5px; }

/* ------------------------------------------------------------ Chat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 216px); min-height: 420px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 2px 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 68%; padding: 11px 15px; border-radius: 14px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: break-word; }
.msg .who { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 3px; white-space: normal; }
.msg .time { font-size: 10.5px; margin-top: 5px; font-family: var(--mono); white-space: normal; opacity: 0.6; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; font-weight: 400; }
.msg.me .who { color: var(--accent-ink); opacity: 0.6; }
.msg.bot { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot .who { color: var(--accent); }
.msg.ask { align-self: flex-start; background: var(--amber-soft); border: 1px solid var(--amber-line); border-bottom-left-radius: 4px; }
.msg.ask .who { color: var(--amber); }
.chat-input { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-input textarea {
  flex: 1; resize: none; font-family: inherit; font-size: 13.5px; font-weight: 300;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--sunken); color: var(--text); outline: none;
  min-height: 44px; max-height: 130px; line-height: 1.5;
}
.chat-input textarea::placeholder { color: var(--placeholder); }
.chat-input textarea:focus { border-color: var(--accent); }
.chat-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.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: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 13px; box-shadow: var(--schatten); }
.tile .lbl { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.tile .val { font-family: var(--mono); font-size: 27px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile .delta { font-size: 12px; font-weight: 500; color: var(--ok); }
.tile svg { display: block; margin-top: 8px; width: 100%; height: 34px; }

.chart-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.chart-head h3 { margin-bottom: 0; }
.legend { display: flex; gap: 16px; margin-left: auto; font-size: 12px; color: var(--dim); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; }
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: 230px; }
.tip {
  position: absolute; pointer-events: none; background: var(--tip-bg); color: var(--tip-fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-size: 12px;
  display: none; z-index: 5; white-space: nowrap;
}
.tip .t-week { color: var(--muted); font-size: 11px; }
.tip .t-row { display: flex; align-items: center; gap: 7px; font-family: var(--mono); }
.tip .t-row .swatch { width: 8px; height: 8px; border-radius: 2px; }

.top-post { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.top-post:first-of-type { border-top: 0; }
.top-post .thumb {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent-soft);
  border: 1px solid var(--accent-line); color: var(--accent);
  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-family: var(--mono); font-weight: 600; font-size: 15px; text-align: right; }
.top-post .num small { font-weight: 400; color: var(--muted); font-size: 11px; display: block; }

/* ------------------------------------------------------------ Upload */
.dropzone {
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; cursor: pointer;
  background: var(--sunken); transition: border-color 120ms, background 120ms;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-ico { width: 30px; height: 30px; margin: 0 auto; color: var(--accent); stroke-width: 1.3; }
.dz-txt { margin-top: 10px; }
.dz-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 11px 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-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------ Reports */
.report-row { cursor: pointer; }
.report-row:hover .title { color: var(--accent); }
.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(--accent); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.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: 1px solid var(--line); padding: 7px 11px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 600; color: var(--text); }
.md td { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Status */
.status-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.schip { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; box-shadow: var(--schatten); }
.schip .n { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.schip .l { font-size: 11.5px; color: var(--muted); }
.schip.hot { border-color: var(--amber-line); background: var(--amber-soft); }
.schip.hot .n { color: var(--amber); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--toast-bg); color: var(--toast-fg); border-radius: 10px; padding: 11px 18px;
  font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 180ms, transform 180ms;
  pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ------------------------------------------------ Tablet / schmaler Desktop */
@media (max-width: 900px) {
  .shell { grid-template-columns: 62px 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 .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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: 68px; bottom: 14px; width: 190px; z-index: 40; box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
  .foot-kunde { justify-content: center; }
  .avatar { cursor: pointer; }
  .grid2, .tiles, .status-chips { grid-template-columns: 1fr 1fr; gap: 12px; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 16px 16px 14px; }
}

/* ------------------------------------------------ Handy: Tab-Leiste unten */
.tabbar, .sheet { display: none; }
@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid2, .tiles, .status-chips { grid-template-columns: 1fr; }
  .tiles, .status-chips { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .topbar h1 { font-size: 17px; }
  .topbar > div:first-child { min-width: 0; }
  .demo-flag { font-size: 9.5px; padding: 3px 8px; }
  .topbar .sub { font-size: 11.5px; }
  .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 .val { size: 22px; font-size: 22px; }
  .card { padding: 16px 17px; }
  .view .row { flex-wrap: wrap; row-gap: 4px; }
  .view .card .row .title { flex: 1 1 100%; order: -1; }
  .upsell { flex-wrap: wrap; }
  .dropzone { padding: 26px 14px; }
  .content { padding: 16px 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(--ground) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    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(--accent); }
  .tab-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
  .tab-badge {
    position: absolute; top: 1px; left: calc(50% + 8px);
    background: var(--accent); color: var(--accent-ink); font-weight: 600;
    font-family: var(--mono); 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: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px; gap: 2px;
  }
  .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(--accent); }
  .sheet-item:hover, .sheet-item:focus-visible { background: var(--panel-2); outline: none; }
}
