/* WhatsApp-Agent Admin
   Shape rule: controls 8px · panels 12px · chat bubbles 10px · pills/avatars full.
   One accent (Wirtz red). Light/dark via prefers-color-scheme, manual override via [data-theme]. */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/admin/vendor/geist-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/admin/vendor/geist-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: 'Geist', 'Segoe UI Variable Text', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;

  --bg: #f5f5f6;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f1f1f3;
  --hover: #f3f3f5;
  --line: #e6e6e9;
  --line-strong: #d6d6db;
  --text: #17171a;
  --text-2: #55555e;
  --text-3: #85858f;
  --accent: #c8102e;
  --accent-hover: #ae0d27;
  --accent-soft: #c8102e12;
  --accent-ring: #c8102e40;
  --ok: #157a42;
  --ok-soft: #157a4214;
  --warn: #a35a00;
  --warn-soft: #d9860014;
  --err: #b42318;
  --err-soft: #b4231812;
  --info: #2b5fd9;

  --sidebar: #fbfbfc;
  --chat-bg: #efeff1;
  --chat-dots: #00000009;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --bubble-out-meta: #4f7a4b;
  --tick-read: #1d8ce0;

  --shadow-sm: 0 1px 2px #1a1a2a0d;
  --shadow: 0 1px 2px #1a1a2a0a, 0 4px 14px #1a1a2a0d;
  --shadow-lg: 0 10px 40px #1a1a2a24, 0 2px 6px #1a1a2a12;

  --r-ctl: 8px;
  --r-panel: 12px;
  --r-bubble: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d0d10;
    --surface: #151519;
    --surface-2: #19191e;
    --surface-3: #1f1f25;
    --hover: #1e1e24;
    --line: #26262d;
    --line-strong: #34343c;
    --text: #ececf0;
    --text-2: #a5a5b0;
    --text-3: #72727d;
    --accent: #ec3b54;
    --accent-hover: #f25a70;
    --accent-soft: #ec3b541c;
    --accent-ring: #ec3b5450;
    --ok: #3ccf7f;
    --ok-soft: #3ccf7f1a;
    --warn: #f0a640;
    --warn-soft: #f0a6401a;
    --err: #ff6b5e;
    --err-soft: #ff6b5e1a;
    --info: #7aa2ff;
    --sidebar: #111115;
    --chat-bg: #0f0f13;
    --chat-dots: #ffffff07;
    --bubble-in: #1f1f25;
    --bubble-out: #144d37;
    --bubble-out-meta: #9fd3b4;
    --tick-read: #53bdeb;
    --shadow-sm: 0 1px 2px #0006;
    --shadow: 0 1px 2px #0006, 0 6px 18px #0005;
    --shadow-lg: 0 16px 48px #000a, 0 2px 8px #0006;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0d0d10;
  --surface: #151519;
  --surface-2: #19191e;
  --surface-3: #1f1f25;
  --hover: #1e1e24;
  --line: #26262d;
  --line-strong: #34343c;
  --text: #ececf0;
  --text-2: #a5a5b0;
  --text-3: #72727d;
  --accent: #ec3b54;
  --accent-hover: #f25a70;
  --accent-soft: #ec3b541c;
  --accent-ring: #ec3b5450;
  --ok: #3ccf7f;
  --ok-soft: #3ccf7f1a;
  --warn: #f0a640;
  --warn-soft: #f0a6401a;
  --err: #ff6b5e;
  --err-soft: #ff6b5e1a;
  --info: #7aa2ff;
  --sidebar: #111115;
  --chat-bg: #0f0f13;
  --chat-dots: #ffffff07;
  --bubble-in: #1f1f25;
  --bubble-out: #144d37;
  --bubble-out-meta: #9fd3b4;
  --tick-read: #53bdeb;
  --shadow-sm: 0 1px 2px #0006;
  --shadow: 0 1px 2px #0006, 0 6px 18px #0005;
  --shadow-lg: 0 16px 48px #000a, 0 2px 8px #0006;
  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 13.5px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.error { color: var(--err); }
.ph { font-size: 16px; line-height: 1; flex: none; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ── Controls ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover, .btn.ghost.on { background: var(--hover); color: var(--text); }
.spin { animation: spin .9s linear infinite; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn .ph { font-size: 15px; }
.btn.busy { pointer-events: none; opacity: .75; }
.btn.busy .ph { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field small, .help { font-size: 12px; color: var(--text-3); line-height: 1.45; }
input, textarea, select {
  font: inherit; color: var(--text); width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl);
  padding: 7px 11px; min-height: 34px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
input[type='number'] { font-variant-numeric: tabular-nums; }
input[type='file'] { display: none; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .ph { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.input-icon > input { padding-left: 34px; }
.suffix { position: relative; }
.suffix > input { padding-right: 52px; }
.suffix > em { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--text-3); pointer-events: none; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { display: none; }
.switch i { width: 34px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0003; transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(14px); }

/* segmented */
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: 500 12.5px/1 var(--font); height: 28px; padding: 0 11px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .count { font-size: 11px; color: var(--text-3); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.pill .ph { font-size: 12px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.outline { background: transparent; border-color: var(--line); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 15% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 18px; animation: rise .5s var(--ease); }
.login-card .brand-mark { width: 40px; height: 40px; font-size: 18px; border-radius: 11px; }
.login-card h1 { font-size: 20px; }
.login-card .btn { height: 38px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── Shell ──────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 6px; min-height: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -0.02em; box-shadow: inset 0 -2px 0 #0002; flex: none; }
.brand b { display: block; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 11.5px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11.5px; font-weight: 500; color: var(--text-3); padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-ctl); color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13.5px; border: 0; background: none; cursor: pointer; font-family: inherit; width: 100%; text-align: left; transition: background .12s, color .12s; }
.nav-link .ph { font-size: 17px; color: var(--text-3); transition: color .12s; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.nav-link.active .ph { color: var(--accent); }
.nav-link .badge { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sys { display: flex; align-items: center; gap: 9px; padding: 8px 10px; font-size: 12px; color: var(--text-2); border-radius: var(--r-ctl); text-decoration: none; }
.sys:hover { background: var(--hover); }
.sys .state { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.sys .state.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sys .state.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.sys span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }
#view { flex: 1; min-height: 0; overflow-y: auto; }
#view.full { overflow: hidden; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; animation: fade .35s var(--ease); }
.page.narrow { max-width: 980px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 240px; }
.page-head p { color: var(--text-2); margin-top: 4px; max-width: 70ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Panels ─────────────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; }
.panel-head p { font-size: 12.5px; color: var(--text-3); }
.panel-body { padding: 18px; }
.panel + .panel { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* settings-style sections: description left, fields right */
.section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 4px; }
.section-intro h2 { margin-bottom: 4px; }
.section-intro p { color: var(--text-3); font-size: 13px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi .label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
th:first-child { border-top-left-radius: var(--r-panel); }
th:last-child { border-top-right-radius: var(--r-panel); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
td .sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
td.r, th.r { text-align: right; }
td.num, td .mono, td.r { white-space: nowrap; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; color: var(--text); }
td.err-cell { color: var(--err); font-size: 12px; max-width: 360px; }

/* empty / skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--text-2); }
.empty .ph { font-size: 28px; color: var(--text-3); background: var(--surface-3); border: 1px solid var(--line); width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 6px; }
.empty h3 { color: var(--text); font-size: 14px; }
.empty p { max-width: 42ch; font-size: 13px; }
.skel { background: linear-gradient(90deg, var(--surface-3) 0%, var(--hover) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* save bar */
.savebar { position: sticky; bottom: 16px; z-index: 5; margin-top: 20px; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; background: var(--text); color: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow-lg); transform: translateY(12px); opacity: 0; pointer-events: none; transition: transform .25s var(--ease), opacity .2s; }
.savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.savebar span { flex: 1; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.savebar .btn:not(.primary) { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 25%, transparent); box-shadow: none; }
.savebar .btn:not(.primary):hover { background: color-mix(in srgb, var(--surface) 12%, transparent); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; animation: toast-in .3s var(--ease); max-width: 380px; }
.toast .ph { font-size: 16px; }
.toast.ok .ph { color: #4ade80; }
.toast.err .ph { color: #fb7185; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(460px, calc(100vw - 32px)); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: #0b0b0f66; backdrop-filter: blur(2px); }
dialog[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.dlg-body { padding: 22px 22px 6px; display: flex; flex-direction: column; gap: 10px; }
.dlg-body .dlg-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.dlg-body .dlg-icon.danger { background: var(--err-soft); color: var(--err); }
.dlg-body .dlg-icon .ph { font-size: 20px; }
.dlg-body p { color: var(--text-2); white-space: pre-line; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

/* lightbox */
.lightbox { width: auto; max-width: calc(100vw - 48px); background: transparent; border: 0; box-shadow: none; }
.lightbox img { display: block; max-width: calc(100vw - 48px); max-height: calc(100dvh - 120px); border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox .row { justify-content: flex-end; margin-top: 10px; }

/* ── List + editor layout (Produkte, Wissen) ───────────────────────────── */
.master { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.master-list { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.items { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 5px; box-shadow: var(--shadow-sm); max-height: calc(100dvh - 210px); overflow-y: auto; }
.item { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: var(--r-ctl); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font: inherit; color: inherit; transition: background .1s; }
.item:hover { background: var(--hover); }
.item.active { background: var(--accent-soft); }
.item .thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--line); flex: none; display: grid; place-items: center; color: var(--text-3); }
.item .t { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item > div { min-width: 0; flex: 1; }

/* tiers */
.tiers td { padding: 6px 8px; }
.tiers th { padding: 8px; }
.tiers input { min-height: 32px; }
.tiers td:last-child { width: 40px; }
.quote-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.quote-total { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quote-lines { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 12.5px; }
.quote-lines dt { color: var(--text-3); }
.quote-lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* image slots */
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.slot { border: 1px dashed var(--line-strong); border-radius: var(--r-panel); background: var(--surface-2); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color .15s, background .15s; }
.slot:hover, .slot.drag { border-color: var(--accent); background: var(--accent-soft); }
.slot .img { aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--text-3); background: var(--surface-3); }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .cap { padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.slot .cap b { font-weight: 500; }
.slot .cap span { color: var(--text-3); font-size: 12px; }

/* dropzone */
.drop { border: 1px dashed var(--line-strong); border-radius: var(--r-panel); padding: 22px; display: flex; align-items: center; gap: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop .ph { font-size: 22px; color: var(--accent); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); }

/* documents */
.docs { display: flex; flex-direction: column; gap: 12px; }
.doc { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 18px; }
.doc-icon { width: 48px; height: 56px; border-radius: 8px; background: var(--err-soft); color: var(--err); display: grid; place-items: center; position: relative; }
.doc-icon .ph { font-size: 24px; }
.doc-icon small { position: absolute; bottom: 5px; font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.doc-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.doc-actions { display: flex; gap: 6px; }

/* ansprechpartner rows */
.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: grid; grid-template-columns: 44px repeat(2, minmax(0, 1fr)) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface-2); }
.person img, .person .ph-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-3); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-3); }

/* ── Conversations ──────────────────────────────────────────────────────── */
.conv { display: grid; grid-template-columns: 340px minmax(0, 1fr) 0; height: 100%; min-height: 0; transition: grid-template-columns .25s var(--ease); }
.conv.info-open { grid-template-columns: 340px minmax(0, 1fr) 320px; }
.conv-list { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.conv-list-head { padding: 20px 18px 12px; display: flex; flex-direction: column; gap: 12px; }
.conv-list-head .row h1 { flex: 1; font-size: 20px; }
.contacts { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.contact { display: flex; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; align-items: center; transition: background .1s; border: 0; background: none; width: 100%; text-align: left; font: inherit; color: inherit; }
.contact:hover { background: var(--hover); }
.contact.active { background: var(--accent-soft); }
.contact > div { flex: 1; min-width: 0; }
.contact .top { display: flex; align-items: baseline; gap: 8px; }
.contact .name { font-weight: 600; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .time { font-size: 11.5px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.contact .prev { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.contact .prev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.contact .prev .ph { font-size: 14px; color: var(--text-3); }
.contact .tags { display: flex; gap: 4px; margin-top: 5px; }

.avatar { --h: 220; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13.5px; flex: none; letter-spacing: -0.01em; background: hsl(var(--h) 42% 91%); color: hsl(var(--h) 40% 30%); }
:root[data-theme='dark'] .avatar { background: hsl(var(--h) 22% 22%); color: hsl(var(--h) 55% 80%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .avatar { background: hsl(var(--h) 22% 22%); color: hsl(var(--h) 55% 80%); } }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); position: relative; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 61px; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .back-btn { display: none; }
.chat-head .who b { display: block; font-size: 14px; font-weight: 600; }
.chat-head .who span { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; background-image: radial-gradient(var(--chat-dots) 1px, transparent 1.2px); background-size: 18px 18px; }
.chat-inner { max-width: 880px; margin: 0 auto; padding: 14px 24px 18px; display: flex; flex-direction: column; }
.older { display: flex; justify-content: center; padding: 10px 0 4px; min-height: 40px; }
.older .pill { background: var(--surface); box-shadow: var(--shadow-sm); }
.chat-start { text-align: center; font-size: 12px; color: var(--text-3); padding: 8px 0 12px; }
.day-sep { align-self: center; margin: 14px 0 8px; font-size: 11.5px; font-weight: 500; color: var(--text-2); background: var(--surface); padding: 4px 11px; border-radius: 8px; box-shadow: var(--shadow-sm); position: sticky; top: 8px; z-index: 2; }

#msgs { display: flex; flex-direction: column; }
.msg { display: flex; margin-top: 10px; }
.msg.fresh { animation: msg-in .3s var(--ease); }
.msg.cont { margin-top: 2px; }
.msg.out { justify-content: flex-end; }
.msg.event { justify-content: center; margin: 10px 0; }
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } }
.bubble { position: relative; max-width: min(560px, 78%); padding: 6px 9px 6px 10px; border-radius: var(--r-bubble); background: var(--bubble-in); box-shadow: 0 1px 0.5px #0b141a1f; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.out .bubble { background: var(--bubble-out); }
.msg:not(.cont).in .bubble { border-top-left-radius: 0; }
.msg:not(.cont).out .bubble { border-top-right-radius: 0; }
.msg:not(.cont).in .bubble::before, .msg:not(.cont).out .bubble::before { content: ''; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.msg:not(.cont).in .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg:not(.cont).out .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble .txt { white-space: pre-wrap; }
.bubble .txt a { color: var(--info); text-decoration: none; }
.bubble .txt a:hover { text-decoration: underline; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); margin: 6px 0 -3px 12px; line-height: 1; position: relative; top: 2px; font-variant-numeric: tabular-nums; }
.msg.out .bubble .meta { color: var(--bubble-out-meta); }
.bubble .meta .ph { font-size: 14px; }
.bubble .meta .read { color: var(--tick-read); }
.bubble .meta .failed { color: var(--err); }
.bubble .kind { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
.msg.out .bubble .kind { color: var(--bubble-out-meta); }
.bubble .media { display: block; width: calc(100% + 13px); aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; margin: -3px -6px 5px -7px; cursor: zoom-in; background: var(--surface-3); }
.bubble.has-media { width: 320px; }
.bubble audio { display: block; width: 260px; max-width: 100%; height: 36px; margin: 2px 0 4px; }
.bubble video { display: block; width: 300px; max-width: 100%; border-radius: 7px; margin-bottom: 4px; }
.file { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; background: #0000000a; text-decoration: none; margin: 0 -3px 4px -4px; min-width: min(240px, 100%); }
.file > div { min-width: 0; }
.msg.out .file { background: #00000010; }
.file:hover { background: #00000014; }
.file .fi { width: 34px; height: 40px; border-radius: 6px; background: var(--err); color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; flex: none; }
.file b { display: block; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file span { font-size: 11.5px; color: var(--text-3); }
.wa-buttons { display: flex; flex-direction: column; gap: 2px; margin: 6px -9px -6px -10px; border-top: 1px solid #0000000f; }
.wa-buttons div { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; color: var(--info); font-weight: 500; font-size: 13.5px; }
.wa-buttons div + div { border-top: 1px solid #0000000f; }
.wa-list { display: flex; flex-direction: column; margin: 0 -9px -6px -10px; padding: 6px 12px 8px; border-top: 1px dashed #00000014; font-size: 12.5px; }
.wa-list div { display: flex; flex-direction: column; padding: 3px 0; }
.wa-list b { font-weight: 500; }
.wa-list span { color: var(--text-3); font-size: 11.5px; }

.event-chip { display: inline-flex; align-items: flex-start; gap: 8px; max-width: min(620px, 92%); padding: 7px 12px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; line-height: 1.45; backdrop-filter: blur(4px); }
.event-chip .ph { font-size: 15px; margin-top: 1px; color: var(--text-3); }
.event-chip.err { background: color-mix(in srgb, var(--err-soft) 100%, var(--surface)); border-color: color-mix(in srgb, var(--err) 25%, transparent); color: var(--err); }
.event-chip.err .ph { color: var(--err); }
.event-chip.warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.event-chip.warn .ph { color: var(--warn); }
.event-chip.job .ph { color: var(--accent); }
.event-chip .ev-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.event-chip .ev-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.event-chip .ev-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.event-chip img { width: 180px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; cursor: zoom-in; border: 1px solid var(--line); }
.event-chip time { font-size: 11px; color: var(--text-3); margin-left: 6px; font-variant-numeric: tabular-nums; }

.new-pill { position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 4; box-shadow: var(--shadow-lg); border-radius: 99px; }
.to-bottom { position: absolute; right: 22px; bottom: 66px; z-index: 4; border-radius: 50%; width: 40px; height: 40px; box-shadow: var(--shadow); }
.chat-foot { display: flex; align-items: center; gap: 10px; padding: 11px 18px; background: var(--surface); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.chat-foot .live { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.chat-foot .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.info-pane { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; min-width: 0; }
.info-inner { width: 320px; padding: 20px 18px 32px; display: flex; flex-direction: column; gap: 22px; }
.info-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-top: 6px; }
.info-hero b { font-size: 16px; font-weight: 600; }
.info-hero span { color: var(--text-3); font-size: 12.5px; }
.info-sec h3 { font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 10px; display: flex; align-items: center; }
.info-sec h3 .spacer + * { font-weight: 400; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.logo-box { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: zoom-in; }
.logo-box img { max-width: 80%; max-height: 80%; object-fit: contain; }
.quota { display: flex; flex-direction: column; gap: 5px; }
.quota + .quota { margin-top: 12px; }
.quota .qh { display: flex; justify-content: space-between; font-size: 12.5px; gap: 8px; }
.quota .qh b { font-weight: 500; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .5s var(--ease); }
.meter i.warn { background: var(--warn); }
.meter i.err { background: var(--err); }
.quota small { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ctx-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 4px 0 10px; }
.ctx-bar i { display: block; height: 100%; }
.ctx-list { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.ctx-list div { display: flex; align-items: center; gap: 8px; }
.ctx-list .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ctx-list span:nth-child(2) { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-list b { font-weight: 500; font-variant-numeric: tabular-nums; }
.danger-zone { display: flex; flex-direction: column; gap: 8px; }
.danger-zone .btn { justify-content: flex-start; }

.chat-empty { flex: 1; display: grid; place-items: center; }

/* status page */
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.status-card { display: flex; gap: 14px; padding: 18px; }
.status-card .si { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.status-card .si.ok { background: var(--ok-soft); color: var(--ok); }
.status-card .si.err { background: var(--err-soft); color: var(--err); }
.status-card .si .ph { font-size: 20px; }
.status-card > div:last-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.status-card .val { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.copy { display: flex; align-items: center; gap: 6px; }
.copy code { flex: 1; min-width: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .conv.info-open { grid-template-columns: 300px minmax(0, 1fr) 0; }
  .conv.info-open .info-pane { position: absolute; right: 0; top: 0; bottom: 0; width: 320px; box-shadow: var(--shadow-lg); z-index: 10; }
  .conv { position: relative; grid-template-columns: 300px minmax(0, 1fr) 0; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { grid-template-columns: 1fr; gap: 14px; }
  .master { grid-template-columns: 1fr; }
  .master-list { position: static; }
  .items { max-height: 260px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
  .mobile-bar b { font-size: 14px; }
  .page { padding: 20px 16px 48px; }
  .g2, .g3, .g4, .slots, .status-grid { grid-template-columns: 1fr; }
  .conv, .conv.info-open { grid-template-columns: minmax(0, 1fr); }
  .conv .info-pane { display: none; }
  .conv .chat-pane { display: none; }
  .conv.chat-open .conv-list { display: none; }
  .conv.chat-open .chat-pane { display: flex; }
  .chat-head .back-btn { display: inline-flex; }
  #info-toggle { display: none; }
  .conv.info-open .info-pane { display: none; }
  .chat-inner { padding: 12px 12px 16px; }
  .bubble { max-width: 88%; }
  .doc { grid-template-columns: 40px minmax(0, 1fr); }
  .doc-actions { grid-column: 1 / -1; }
  .person { grid-template-columns: 44px minmax(0, 1fr); }
  .person > :last-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
