/* AVMELIO AI dashboard — no external assets, CSP-safe (no inline styles needed). 8px grid. */
:root {
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #f1f3f8; --surface-3: #e9ecf4; --border: #e2e6ef; --border-strong: #cfd5e3;
  --text: #0f1729; --muted: #5b6478; --faint: #8891a5;
  --brand: #4f46e5; --brand-hover: #4338ca; --brand-ink: #ffffff; --brand-soft: #eceefe; --brand-text: #4338ca;
  --ai: #7c3aed; --ai-soft: #f1eafe; --ai-text: #6d28d9;
  --ok: #067647; --ok-soft: #e6f6ee; --warn: #b54708; --warn-soft: #fff4e5; --danger: #b42318; --danger-soft: #fdecea; --info: #175cd3; --info-soft: #e8f0fe;
  --bubble-in: #ffffff; --bubble-out: #4f46e5; --bubble-out-ink: #ffffff; --bubble-ai: #f1eafe; --bubble-ai-ink: #2e1065;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06); --shadow-md: 0 4px 16px rgba(16, 24, 40, .10); --shadow-lg: 0 20px 48px rgba(16, 24, 40, .22);
  --avl: 91%; --avf: 30%; --avs: 75%;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --sab: env(safe-area-inset-bottom, 0px); --sat: env(safe-area-inset-top, 0px);
  --c1: #6366f1; --c2: #7c3aed; --c3: #0e9384; --c4: #dd6b20;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --surface: #121826; --surface-2: #19223a; --surface-3: #212c47; --border: #243049; --border-strong: #33415f;
    --text: #e8ecf5; --muted: #a0aabf; --faint: #7b86a0;
    --brand: #5b5ee8; --brand-hover: #6d70f0; --brand-ink: #ffffff; --brand-soft: #1e2347; --brand-text: #aab0ff;
    --ai: #8b5cf6; --ai-soft: #251c46; --ai-text: #c4b0ff;
    --ok: #4ade80; --ok-soft: #10281c; --warn: #fbbf24; --warn-soft: #2b2110; --danger: #f87171; --danger-soft: #2f1618; --info: #7aa7ff; --info-soft: #14233f;
    --bubble-in: #19223a; --bubble-out: #4f52e0; --bubble-out-ink: #ffffff; --bubble-ai: #2a2050; --bubble-ai-ink: #ece5ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 48px rgba(0, 0, 0, .6);
    --avl: 24%; --avf: 82%; --avs: 40%;
    --c1: #818cf8; --c2: #a78bfa; --c3: #2dd4bf; --c4: #fb923c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --surface-2: #19223a; --surface-3: #212c47; --border: #243049; --border-strong: #33415f;
  --text: #e8ecf5; --muted: #a0aabf; --faint: #7b86a0;
  --brand: #5b5ee8; --brand-hover: #6d70f0; --brand-ink: #ffffff; --brand-soft: #1e2347; --brand-text: #aab0ff;
  --ai: #8b5cf6; --ai-soft: #251c46; --ai-text: #c4b0ff;
  --ok: #4ade80; --ok-soft: #10281c; --warn: #fbbf24; --warn-soft: #2b2110; --danger: #f87171; --danger-soft: #2f1618; --info: #7aa7ff; --info-soft: #14233f;
  --bubble-in: #19223a; --bubble-out: #4f52e0; --bubble-out-ink: #ffffff; --bubble-ai: #2a2050; --bubble-ai-ink: #ece5ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 48px rgba(0, 0, 0, .6);
  --avl: 24%; --avf: 82%; --avs: 40%;
  --c1: #818cf8; --c2: #a78bfa; --c3: #2dd4bf; --c4: #fb923c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h3 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ic { display: inline-flex; flex: none; line-height: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .pad { padding: 12px; }
.warn-text { color: var(--warn); } .err-text { color: var(--danger); } .pre { white-space: pre-wrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 10px; font-weight: 550; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(.92); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 16px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn.is-busy { position: relative; pointer-events: none; opacity: .7; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- form controls ---------- */
input[type=text], input[type=search], input[type=tel], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 40px; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
.select-sm { min-height: 34px; padding: 4px 8px; font-size: 13.5px; width: auto; max-width: 100%; }
.num-in { width: 80px; min-height: 34px; padding: 4px 8px; text-align: right; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--faint); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.search > .ic { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 36px; }
.search.sm { max-width: 260px; }
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { width: 44px; height: 26px; border-radius: 99px; background: var(--border-strong); transition: background .2s; position: relative; display: block; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.row-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.row-switch > div { display: flex; flex-direction: column; min-width: 0; }
.row-switch small { color: var(--muted); font-size: 13px; }
.row-switch.big { border: 0; padding: 0; align-items: flex-start; }
.row-switch.big p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; }
.segmented button { border: 0; background: transparent; min-height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 550; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button:disabled { cursor: not-allowed; opacity: .6; }
input[type=range] { width: 100%; accent-color: var(--brand); height: 28px; }
.range-row { display: flex; align-items: center; gap: 12px; } .range-row output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ticks { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); } .int-label { color: var(--brand-text); }
.taginput { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.taginput:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.taginput input { flex: 1; min-width: 120px; border: 0; background: transparent; min-height: 28px; padding: 2px 6px; box-shadow: none !important; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); color: var(--brand-text); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: 13px; }
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; line-height: 1; font-size: 16px; }
.tag button:hover { background: rgba(0,0,0,.1); }
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check span { display: flex; flex-direction: column; } .check small { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- chips, avatar, badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; background: var(--surface-3); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip-ai { background: var(--ai-soft); color: var(--ai-text); } .chip-ok { background: var(--ok-soft); color: var(--ok); } .chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); } .chip-info { background: var(--info-soft); color: var(--info); } .chip-neutral { background: var(--surface-3); color: var(--muted); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 50%; font-weight: 650; font-size: 14px; background: hsl(var(--h) var(--avs) var(--avl)); color: hsl(var(--h) 55% var(--avf)); }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; } .avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.chan { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; }
.chan-telegram { background: #229ed9; } .chan-instagram { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.chan-big { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; flex: none; }
.cell-chan { display: inline-flex; align-items: center; gap: 8px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.dot-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); } .dot-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot-state.on { color: var(--ok); } .dot-state.on::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-state:empty::before { margin: 0; }

/* ---------- skeleton / empty / spinner ---------- */
.skel-wrap { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skel { height: 56px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skel[data-i="1"] { width: 88%; } .skel[data-i="2"] { width: 72%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel-list { padding: 12px; }
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty h3 { color: var(--text); } .empty p { max-width: 420px; }
.empty-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-text); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.empty .btn { margin-top: 12px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- auth screen ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(900px 400px at 50% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-md); padding: 32px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; } .auth-card p { color: var(--muted); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #7c3aed); color: #fff; flex: none; }
.brand-mark.big { width: 64px; height: 64px; border-radius: 18px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; } .brand > div { display: flex; flex-direction: column; min-width: 0; } .brand strong { letter-spacing: -.01em; } .brand small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; text-decoration: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.side-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; } .me-text { display: flex; flex-direction: column; min-width: 0; } .me-text strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .me-text small { color: var(--muted); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.presence { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.presence.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); } .presence.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.bell-wrap { position: relative; } .bell { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.popover { position: absolute; right: 0; top: 48px; width: 360px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pop-cta { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px; border: 0; background: var(--brand-soft); color: var(--brand-text); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.pop-empty { padding: 24px; text-align: center; color: var(--muted); }
.notif-list { list-style: none; margin: 0; padding: 0; } .notif { display: flex; gap: 12px; width: 100%; padding: 12px 16px; background: transparent; border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; }
.notif:hover { background: var(--surface-2); } .notif.unread { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.notif-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; flex: none; color: var(--muted); } .notif-handoff { background: var(--warn-soft); color: var(--warn); } .notif-delivery_failed { background: var(--danger-soft); color: var(--danger); }
.notif-body { display: flex; flex-direction: column; min-width: 0; } .notif-text { font-size: 14px; overflow-wrap: anywhere; } .notif-body small { color: var(--muted); }
.banners { flex: none; } .banner { display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: 14px; border-bottom: 1px solid var(--border); }
.banner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.banner-warn { background: var(--warn-soft); color: var(--warn); } .banner-info { background: var(--info-soft); color: var(--info); } .banner-neutral { background: var(--surface-2); color: var(--muted); }
.banner .btn { flex: none; background: var(--surface); }
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; outline: none; }
.view > .stack, .view > .list-area, .view > .toolbar, .view > .tabchips { max-width: 1180px; margin-left: auto; margin-right: auto; }
.view-inbox { padding: 0; overflow: hidden; }
.tabbar { display: none; }

/* ---------- layout pieces ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.accent { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent); }
.card > h3 { margin-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; } .cards.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 14px; flex-wrap: wrap; }
.callout > div, .callout > span { flex: 1; min-width: 200px; } .callout.warn { background: var(--warn-soft); color: var(--warn); } .callout.info { background: var(--info-soft); color: var(--info); }
.callout .btn { flex: none; } ul.plain { margin: 4px 0 0; padding-left: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; margin: 12px 0; } .kv > div { display: flex; flex-direction: column; } .kv dt { font-size: 12.5px; color: var(--muted); } .kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.link-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); color: var(--brand-text); font-weight: 550; } .link-row .ic:last-child { margin-left: auto; }
h4.sub { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 8px; } h4.sub.first { margin-top: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; } .mini-list li { padding: 8px 0; border-bottom: 1px solid var(--border); } .mini-list li:last-child { border: 0; }
.mini-list a, .mini-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .mini-list small { color: var(--muted); margin-left: auto; }
.mini-list li > a { width: 100%; }
.count-line { margin-bottom: 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 0; color: var(--muted); font-size: 14px; }
.more-row { display: flex; justify-content: center; padding: 12px; }

/* ---------- tables (cards on mobile) ---------- */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.card .tbl-wrap { border: 0; border-radius: 0; background: transparent; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.card .tbl th { background: transparent; padding-left: 0; padding-right: 8px; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; } .card .tbl td { padding-left: 0; padding-right: 8px; }
.tbl tr:last-child td { border-bottom: 0; } .tbl td small { display: block; color: var(--muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: 12px; } .cell-user > div { display: flex; flex-direction: column; min-width: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; background: var(--surface); }
.inbox[data-chat="open"] { grid-template-columns: 340px minmax(0, 1fr) 320px; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.pane-list { border-right: 1px solid var(--border); } .pane-info { border-left: 1px solid var(--border); }
.inbox[data-chat="none"] .pane-info { display: none; }
.list-head { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tabchips { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 12px; scrollbar-width: none; flex: none; } .tabchips::-webkit-scrollbar { display: none; }
.view > .tabchips { padding: 0 0 12px; }
.tabchip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 550; font-size: 13.5px; cursor: pointer; }
.tabchip:hover { background: var(--surface-2); } .tabchip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tabchip .count { background: var(--surface-3); color: var(--text); border-radius: 99px; font-size: 11.5px; padding: 0 6px; line-height: 18px; font-weight: 700; } .tabchip.on .count { background: rgba(255,255,255,.25); color: #fff; }
.list-scroll { flex: 1; overflow-y: auto; border-top: 1px solid var(--border); }
.pane-scroll { overflow-y: auto; min-height: 0; flex: 1; padding: 0; } .pane-info .pane-scroll { padding: 16px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); min-height: 56px; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; position: relative; }
.conv:hover { background: var(--surface-2); text-decoration: none; } .conv.sel { background: var(--brand-soft); } .conv.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.conv-av { position: relative; flex: none; } .conv-av .chan { position: absolute; right: -4px; bottom: -2px; width: 18px; height: 18px; border: 2px solid var(--surface); box-sizing: content-box; }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.conv-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; } .conv.unread .conv-name { font-weight: 750; }
.conv-time { color: var(--faint); font-size: 12px; flex: none; }
.conv-prev { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } .conv.unread .conv-prev { color: var(--text); }
.conv-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; } .conv-asg { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex: none; min-height: 60px; }
.chat-title { display: flex; flex-direction: column; min-width: 0; flex: 1; } .chat-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .chat-title small { color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--border); flex: none; scrollbar-width: none; } .chat-actions:empty { display: none; }
.chat-banner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13.5px; font-weight: 550; flex-wrap: wrap; flex: none; }
.chat-banner.mine { background: var(--ok-soft); color: var(--ok); } .chat-banner.other { background: var(--info-soft); color: var(--info); } .chat-banner.wait { background: var(--warn-soft); color: var(--warn); } .chat-banner.ai { background: var(--ai-soft); color: var(--ai-text); } .chat-banner.neutral { background: var(--surface-2); color: var(--muted); }
.banner-sub { font-weight: 450; opacity: .85; }
.pane-chat { background: var(--bg); }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.day { display: flex; justify-content: center; margin: 12px 0 4px; } .day span { font-size: 12px; color: var(--muted); background: var(--surface-3); padding: 2px 12px; border-radius: 99px; }
.msg { display: flex; max-width: 100%; } .msg.in { justify-content: flex-start; } .msg.out { justify-content: flex-end; }
.bubble { max-width: min(560px, 82%); padding: 8px 12px; border-radius: 16px; background: var(--bubble-in); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.msg.in .bubble { border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--bubble-out); color: var(--bubble-out-ink); border-color: transparent; border-bottom-right-radius: 4px; }
.msg.out.ai .bubble { background: var(--bubble-ai); color: var(--bubble-ai-ink); border: 1px solid color-mix(in srgb, var(--ai) 30%, transparent); }
.msg.failed .bubble { outline: 2px solid var(--danger); }
.txt { white-space: pre-wrap; }
.who { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; opacity: .85; margin-bottom: 2px; } .who-ai { color: var(--ai-text); }
.msg.out:not(.ai) .who { color: rgba(255,255,255,.85); }
.media { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: rgba(127,127,127,.14); margin-bottom: 4px; min-width: 160px; font-size: 13.5px; }
.transcript { font-style: italic; font-size: 13.5px; opacity: .9; margin-bottom: 4px; } .transcript small { display: block; font-style: normal; font-weight: 700; opacity: .7; font-size: 11px; text-transform: uppercase; }
.mfoot { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11px; opacity: .7; margin-top: 2px; } .mst.failed { color: var(--danger); opacity: 1; } .msg.out:not(.ai) .mst.failed { color: #ffd1cc; }
.msg-sys { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--surface-3); padding: 4px 12px; border-radius: 99px; margin: 4px 0; max-width: 90%; text-align: center; }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px; padding-bottom: calc(12px + var(--sab)); flex: none; }
.composer-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; } .composer-row textarea { max-height: 140px; min-height: 44px; border-radius: 12px; } .composer-row .btn-icon { width: 44px; min-height: 44px; flex: none; }
.cu-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 8px; } .cu-hero small { color: var(--muted); } .cu-hero.left { flex-direction: row; gap: 16px; align-items: center; text-align: left; } .cu-hero.left > div { display: flex; flex-direction: column; } .big { font-size: 20px; letter-spacing: -.01em; }
.cu-line { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border-radius: 12px; margin-bottom: 16px; } .cu-line > div { flex: 1; display: flex; flex-direction: column; min-width: 0; } .cu-line small { color: var(--muted); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; } .stat { display: flex; flex-direction: column; padding: 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; } .stat small { color: var(--muted); font-size: 12px; } .stat strong { font-size: 15px; overflow-wrap: anywhere; }
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; } .scroll-sm { max-height: 280px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: left; } .pick:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); } .pick:disabled { opacity: .5; cursor: default; }
.pick-main { display: flex; flex-direction: column; flex: 1; min-width: 0; } .pick-main small { color: var(--muted); } .price { font-weight: 600; white-space: nowrap; font-size: 13.5px; } .price s { color: var(--faint); font-weight: 400; margin-right: 4px; }
.order-form { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chosen { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; } .chosen-row { display: grid; grid-template-columns: 1fr 72px auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 10px; } .chosen-name { display: flex; flex-direction: column; min-width: 0; } .chosen-name small { color: var(--muted); }
.chosen-row .manual { grid-column: 1 / 3; }
.total-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); margin-top: 12px; font-size: 16px; }
.items { display: flex; flex-direction: column; } .item-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); } .item-row > div { display: flex; flex-direction: column; min-width: 0; } .item-row small { color: var(--muted); }
.ord-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; } .ord-head small { color: var(--muted); }

/* ---------- channels ---------- */
.chan-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; } .chan-name { flex: 1; display: flex; flex-direction: column; min-width: 0; } .chan-name small { color: var(--muted); }
.howto { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; margin: 8px 0; font-size: 14px; } .howto summary { cursor: pointer; font-weight: 600; } .howto ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

/* ---------- AI settings / marketing ---------- */
.master { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }
.prov-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); } .prov { display: inline-flex; align-items: center; gap: 8px; } .prov small { color: var(--muted); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.style-card { text-align: left; padding: 16px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 8px; } .style-card:hover:not(:disabled) { border-color: var(--border-strong); } .style-card.on { border-color: var(--brand); background: var(--brand-soft); } .style-card q { color: var(--muted); font-size: 13.5px; font-style: italic; quotes: "“" "”"; } .style-card:disabled { cursor: default; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 5; flex-wrap: wrap; } .savebar > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; } .savebar > div { display: flex; gap: 8px; }
.sb-log { display: flex; flex-direction: column; gap: 8px; min-height: 140px; max-height: 380px; overflow-y: auto; padding: 12px; background: var(--bg); border-radius: 12px; margin: 12px 0; }
.sb-msg { display: flex; } .sb-msg.user { justify-content: flex-end; } .sb-msg.user .bubble { background: var(--bubble-out); color: #fff; border-color: transparent; } .sb-msg.ai .bubble { background: var(--bubble-ai); color: var(--bubble-ai-ink); } .sb-msg.pending .bubble { opacity: .7; font-style: italic; } .bubble.err { background: var(--danger-soft); color: var(--danger); display: flex; gap: 6px; align-items: center; }
.sb-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.promo-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.promo { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; } .promo.off { opacity: .65; }
.promo-badge { min-width: 72px; text-align: center; padding: 6px 10px; background: var(--ok-soft); color: var(--ok); border-radius: 10px; font-weight: 750; } .promo-main { flex: 1; display: flex; flex-direction: column; min-width: 160px; } .promo-main small { color: var(--muted); }
.promo-price { color: var(--ok); font-weight: 650; } .promo-price small { display: block; font-weight: 400; color: var(--muted); }

/* ---------- analytics / subscription ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); min-width: 0; } .kpi small { color: var(--muted); font-size: 13px; } .kpi strong { font-size: 24px; letter-spacing: -.02em; overflow-wrap: anywhere; } .kpi span { font-size: 12.5px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--border); stroke-width: 1; } .chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; } .chart .area { stroke: none; opacity: .12; } .chart .hit { fill: transparent; } .chart .hit:hover { fill: color-mix(in srgb, var(--brand) 8%, transparent); }
.s-c1 { stroke: var(--c1); fill: var(--c1); } .s-c2 { stroke: var(--c2); fill: var(--c2); } .s-c3 { stroke: var(--c3); fill: var(--c3); } .s-c4 { stroke: var(--c4); fill: var(--c4); } .chart .line.s-c1, .chart .line.s-c2, .chart .line.s-c3 { fill: none; }
li .sw.s-c1, .sw.s-c1 { background: var(--c1); } .sw.s-c2 { background: var(--c2); } .sw.s-c3 { background: var(--c3); } .sw.s-c4 { background: var(--c4); }
.field > .segmented { align-self: flex-start; }
.legend { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; font-size: 13px; color: var(--muted); } .legend li { display: inline-flex; align-items: center; gap: 6px; } .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; flex: 1; min-width: 120px; } .progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; } .progress.warn span { background: var(--warn); } .progress.danger span { background: var(--danger); }
.usage { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; } .usage > span { color: var(--muted); font-size: 14px; }
.pay { display: flex; flex-direction: column; gap: 8px; } .pay h4 { margin-bottom: 4px; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; } .pay-row small { color: var(--muted); flex: 0 0 100%; } .pay-row strong { flex: 1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .more-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 14px; background: var(--surface-2); color: var(--text); text-align: center; font-size: 13px; font-weight: 550; text-decoration: none; } .more-item:hover { text-decoration: none; background: var(--surface-3); } .more-item.active { background: var(--brand-soft); color: var(--brand-text); }
.more-tools { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ---------- toasts, dialogs ---------- */
#toasts { position: fixed; z-index: 400; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 420px; padding: 12px 12px 12px 16px; background: var(--text); color: var(--bg); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .2s ease; font-size: 14px; }
.toast span:nth-child(2) { flex: 1; overflow-wrap: anywhere; } .toast button { background: transparent; border: 0; color: inherit; cursor: pointer; opacity: .7; padding: 4px; } .toast-error { background: var(--danger); color: #fff; } .toast-success .ic:first-child { color: #4ade80; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
#modal-root { position: relative; z-index: 300; }
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 22, .55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; outline: none; border: 1px solid var(--border); }
.dialog.wide { max-width: 860px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); flex: none; } .dialog-head h2 { font-size: 17px; letter-spacing: -.01em; }
.dialog-body { padding: 16px 20px 20px; overflow-y: auto; min-height: 0; flex: 1; } .dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); flex: none; }
.overlay-drawer { justify-content: flex-end; padding: 0; align-items: stretch; } .dialog-drawer { max-width: 480px; height: 100dvh; max-height: none; border-radius: 0; border-width: 0 0 0 1px; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(32px); opacity: .6; } to { transform: none; opacity: 1; } }
.overlay-sheet { align-items: flex-end; padding: 0; } .dialog-sheet { max-width: 640px; border-radius: 20px 20px 0 0; max-height: 88dvh; padding-bottom: var(--sab); animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(32px); opacity: .6; } to { transform: none; opacity: 1; } }
.confirm-text { font-size: 15px; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .inbox[data-chat="open"] { grid-template-columns: 320px minmax(0, 1fr); }
  .inbox, .inbox[data-chat="none"] { grid-template-columns: 320px minmax(0, 1fr); }
  .pane-info { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); z-index: 60; transform: translateX(105%); visibility: hidden; transition: transform .2s, visibility .2s; box-shadow: none; border-left: 1px solid var(--border); }
  .show-info .pane-info { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .inbox[data-chat="none"] .pane-info { display: flex; }
}
@media (min-width: 1200px) {
  .chat-head > .btn:last-child { display: none; } .pane-info .pane-head .btn { display: none; }
}
@media (min-width: 900px) { .chat-head > .btn:first-child { display: none; } .chat-head { padding-left: 16px; } }
@media (max-width: 899px) {
  .chat-actions { flex-wrap: nowrap; }
  .shell { display: flex; flex-direction: column; }
  .sidebar { display: none; } .main { flex: 1; }
  .topbar { padding: 0 12px; height: 56px; padding-top: var(--sat); } .topbar-title { font-size: 17px; }
  .hide-sm { display: none !important; }
  .presence-label { display: none; } .presence { padding: 0 10px; }
  .view { padding: 16px; }
  .view-inbox { padding: 0; }
  .banner { padding: 10px 16px; flex-wrap: wrap; }
  .tabbar { display: flex; flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + var(--sab)); }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; position: relative; min-height: 52px; justify-content: center; cursor: pointer; border-radius: 10px; }
  .tab.active { color: var(--brand-text); } .tab:hover { text-decoration: none; }
  .tab.active::before { content: ""; position: absolute; top: -5px; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }
  .tab .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); }
  .inbox, .inbox[data-chat="open"], .inbox[data-chat="none"] { display: block; }
  .inbox[data-chat="none"] .pane-chat { display: none; } .inbox[data-chat="open"] .pane-list { display: none; }
  .pane-list, .pane-chat { height: 100%; border: 0; }
  .shell:has(.inbox[data-chat="open"]) .tabbar, .shell:has(.inbox[data-chat="open"]) .topbar, .shell:has(.inbox[data-chat="open"]) .banners { display: none; }
  .chat-head { padding-top: calc(10px + var(--sat)); }
  .pane-info { width: 100%; }
  .bubble { max-width: 88%; }
  .popover { position: fixed; top: 60px; right: 8px; left: 8px; width: auto; max-width: none; }
  .order-form { grid-template-columns: 1fr; }
  .dialog-drawer { max-width: 100%; }
  .overlay:not(.overlay-drawer):not(.overlay-sheet) { align-items: flex-end; padding: 0; } .overlay:not(.overlay-drawer):not(.overlay-sheet) .dialog { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 92dvh; }
  .card { padding: 16px; } .kpi strong { font-size: 21px; } .grid2 { grid-template-columns: 1fr; }
  #toasts { left: 16px; right: 16px; bottom: calc(72px + var(--sab)); } .toast { max-width: none; }
  .cards, .cards.two { grid-template-columns: minmax(0, 1fr); }
  /* tables become cards */
  .tbl-wrap { overflow: visible; background: transparent; border: 0; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; } .tbl thead { display: none; }
  .tbl tr { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .card .tbl tr { background: var(--surface-2); box-shadow: none; }
  .tbl td, .card .tbl td { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .tbl td:first-child { font-weight: 600; } .tbl td[data-label=""]::before { display: none; }
  .tbl td .cell-user { text-align: left; } .tbl td small { text-align: right; }
  .tbl .num { text-align: right; }
}
@media (max-width: 400px) { .more-grid { grid-template-columns: repeat(2, 1fr); } .stats3 { grid-template-columns: 1fr; } .chosen-row { grid-template-columns: 1fr 64px auto; } }
