/* ==========================================================================
   Design system — electric blue AI SaaS
   Tokens first; every component reads roles, never raw hex.
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 500px at 100% -10%, rgba(var(--brand-rgb), 0.07), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(var(--accent-rgb), 0.05), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef2f9;
  --border: #e5eaf3;
  --border-strong: #d3dbe8;
  --text: #0b1220;
  --text-2: #3b4760;
  --muted: #6b7a99;
  --faint: #98a3bb;

  /* Brand: the Super Admin can override these (System → Branding). */
  --brand-rgb: 37, 99, 255;
  --accent-rgb: 124, 58, 237;
  --brand: #2563ff;
  --accent: #7c3aed;
  --brand-mid: #5b4bff;
  --brand-deep: #1739d9;
  --brand-600: #1d4fe0;
  --brand-50: #eef3ff;
  --brand-100: #dde7ff;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 55%, var(--accent) 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--brand-rgb), 0.1), rgba(var(--accent-rgb), 0.1));
  --glow: 0 8px 24px rgba(var(--brand-rgb), 0.28);

  --good: #16a34a;
  --good-bg: #e8f7ee;
  --warn: #c2760a;
  --warn-bg: #fdf3e2;
  --bad: #dc2626;
  --bad-bg: #fdecec;
  --info: var(--brand);
  --info-bg: #eaf0ff;
  --neutral-bg: #eef1f6;

  /* chart roles (validated categorical order) */
  --series-1: #2563ff;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #8b5cf6;
  --grid: #edf1f7;
  --axis: #98a3bb;

  --sidebar: #ffffff;
  --sidebar-glow: rgba(var(--brand-rgb), 0.07);
  --sidebar-text: #4b5876;
  --sidebar-strong: #0b1220;
  --sidebar-muted: #8a96b3;
  --sidebar-hover: rgba(15, 23, 42, 0.05);
  --sidebar-border: #e5eaf3;
  --sidebar-active: #1d4fe0;
  --sidebar-active-bg: linear-gradient(90deg, rgba(var(--brand-rgb), 0.12), rgba(var(--brand-rgb), 0.03));
  --sidebar-accent: var(--brand);
  --sidebar-scrollbar: #d6deeb;
  --plan-card-bg: linear-gradient(135deg, rgba(var(--brand-rgb), 0.08), rgba(var(--accent-rgb), 0.08));
  --plan-card-border: rgba(var(--brand-rgb), 0.16);
  --plan-card-text: #4b5876;
  --plan-card-strong: #0b1220;
  --plan-card-icon: var(--brand);

  --radius-xl: 20px;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);
  --ring: 0 0 0 4px rgba(var(--brand-rgb), 0.16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sidebar-w: 264px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070b18;
    --bg-grad: radial-gradient(1200px 500px at 100% -10%, rgba(59, 111, 255, 0.14), transparent 60%),
      radial-gradient(900px 400px at -10% 110%, rgba(var(--accent-rgb), 0.1), transparent 60%);
    --surface: #0f1629;
    --surface-2: #131c33;
    --surface-3: #1a2440;
    --border: #1f2a47;
    --border-strong: #2b3860;
    --text: #e8edff;
    --text-2: #bcc6e2;
    --muted: #8795b8;
    --faint: #5f6d92;
    --brand: #4d82ff;
    --brand-600: #3a6ff5;
    --brand-50: #14204a;
    --brand-100: #1b2b62;
    --good: #34c46f;
    --good-bg: #0f2a1d;
    --warn: #f0a537;
    --warn-bg: #2d220d;
    --bad: #f26363;
    --bad-bg: #2f1418;
    --info: #6b98ff;
    --info-bg: #14204a;
    --neutral-bg: #1a2440;
    --series-1: #4d82ff;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #9085e9;
    --grid: #1a2440;
    --axis: #5f6d92;
    --sidebar: #060a17;
    --sidebar-glow: rgba(var(--brand-rgb), 0.22);
    --sidebar-text: #aab5d3;
    --sidebar-strong: #ffffff;
    --sidebar-muted: #5c688d;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-border: rgba(255, 255, 255, 0.05);
    --sidebar-active: #ffffff;
    --sidebar-active-bg: linear-gradient(90deg, rgba(var(--brand-rgb), 0.28), rgba(var(--brand-rgb), 0.06));
    --sidebar-accent: #5b8cff;
    --sidebar-scrollbar: #1d2745;
    --plan-card-bg: linear-gradient(135deg, rgba(var(--brand-rgb), 0.25), rgba(var(--accent-rgb), 0.2));
    --plan-card-border: rgba(123, 150, 255, 0.2);
    --plan-card-text: #dce4ff;
    --plan-card-strong: #ffffff;
    --plan-card-icon: #a9bcff;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
    --ring: 0 0 0 4px rgba(77, 130, 255, 0.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b18;
  --bg-grad: radial-gradient(1200px 500px at 100% -10%, rgba(59, 111, 255, 0.14), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(var(--accent-rgb), 0.1), transparent 60%);
  --surface: #0f1629;
  --surface-2: #131c33;
  --surface-3: #1a2440;
  --border: #1f2a47;
  --border-strong: #2b3860;
  --text: #e8edff;
  --text-2: #bcc6e2;
  --muted: #8795b8;
  --faint: #5f6d92;
  --brand: #4d82ff;
  --brand-600: #3a6ff5;
  --brand-50: #14204a;
  --brand-100: #1b2b62;
  --good: #34c46f;
  --good-bg: #0f2a1d;
  --warn: #f0a537;
  --warn-bg: #2d220d;
  --bad: #f26363;
  --bad-bg: #2f1418;
  --info: #6b98ff;
  --info-bg: #14204a;
  --neutral-bg: #1a2440;
  --series-1: #4d82ff;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #9085e9;
  --grid: #1a2440;
  --axis: #5f6d92;
  --sidebar: #060a17;
  --sidebar-glow: rgba(var(--brand-rgb), 0.22);
  --sidebar-text: #aab5d3;
  --sidebar-strong: #ffffff;
  --sidebar-muted: #5c688d;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --sidebar-active: #ffffff;
  --sidebar-active-bg: linear-gradient(90deg, rgba(var(--brand-rgb), 0.28), rgba(var(--brand-rgb), 0.06));
  --sidebar-accent: #5b8cff;
  --sidebar-scrollbar: #1d2745;
  --plan-card-bg: linear-gradient(135deg, rgba(var(--brand-rgb), 0.25), rgba(var(--accent-rgb), 0.2));
  --plan-card-border: rgba(123, 150, 255, 0.2);
  --plan-card-text: #dce4ff;
  --plan-card-strong: #ffffff;
  --plan-card-icon: #a9bcff;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 4px rgba(77, 130, 255, 0.25);
}

/* ---- base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
/* Inline icons default to the text size; components below size theirs explicitly. */
:where(svg:not([width]):not([height])) { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; color: var(--text); }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(var(--brand-rgb), 0.2); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[hidden] { display: none !important; }

/* ---- layout primitives ---------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 340px; }
.span-2 { grid-column: span 2; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---- app shell ------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: radial-gradient(400px 300px at 0% 0%, var(--sidebar-glow), transparent 70%), var(--sidebar);
  color: var(--sidebar-text);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.25s var(--ease), width 0.25s var(--ease);
}
.sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px 20px 14px; color: var(--sidebar-strong); }
.sidebar-brand .brand-row { display: flex; align-items: center; gap: 11px; min-width: 0; max-width: 100%; }
.sidebar-brand .brand-sub { padding-left: 2px; }
.logo-mark {
  /* --logo-h: the logo's height for this place (Super Admin → Branding). */
  --logo-h: 36px;
  width: var(--logo-h); height: var(--logo-h); border-radius: calc(var(--logo-h) * 0.3); background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(var(--brand-rgb), 0.45);
  flex-shrink: 0; position: relative; overflow: hidden;
}
.logo-mark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.25), transparent 55%); }
.logo-mark svg { width: calc(var(--logo-h) * 0.53); height: calc(var(--logo-h) * 0.53); color: #fff; position: relative; z-index: 1; }
.sidebar-brand .logo-mark { --logo-h: var(--logo-h-dashboard, 40px); }
.sidebar-brand .brand-row > div { min-width: 0; }
.auth-brand .logo-mark { --logo-h: var(--logo-h-auth, 48px); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: -0.02em; color: var(--sidebar-strong); }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); font-weight: 500; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--sidebar-scrollbar) transparent; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sidebar-muted); font-weight: 700; padding: 0 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); text-decoration: none; }
.nav-link:focus-visible { outline: 2px solid var(--sidebar-accent); outline-offset: -2px; }
.nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-accent); box-shadow: 0 0 12px var(--sidebar-accent); }
.nav-link.active svg { opacity: 1; color: var(--sidebar-accent); }
.nav-link .lock { margin-left: auto; width: 14px; height: 14px; opacity: 0.5; }
.nav-link .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.nav-link.locked { opacity: 0.55; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--sidebar-border); }
.plan-card {
  border-radius: 14px; padding: 14px; background: var(--plan-card-bg);
  border: 1px solid var(--plan-card-border); color: var(--plan-card-text);
}
.plan-card b { color: var(--plan-card-strong); font-family: var(--display); }
.plan-card svg { width: 17px; height: 17px; color: var(--plan-card-icon); }
.plan-card .bar { height: 5px; border-radius: 3px; background: var(--sidebar-hover); margin: 10px 0 6px; overflow: hidden; }
.plan-card .bar span { display: block; height: 100%; background: linear-gradient(90deg, #6aa0ff, #b18cff); border-radius: 3px; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; }
.crumbs svg { width: 14px; height: 14px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-2); position: relative; transition: all 0.15s;
  box-shadow: var(--shadow-xs); flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
.menu-toggle { display: none; }
.user-btn {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; box-shadow: var(--shadow-xs); max-width: 230px;
}
.user-btn:hover { border-color: var(--border-strong); }
.user-btn .meta { text-align: left; min-width: 0; line-height: 1.25; }
.user-btn .meta b { display: block; font-size: 13px; }
.user-btn .meta span { font-size: 11.5px; color: var(--muted); }
.user-btn > svg { width: 15px; height: 15px; color: var(--muted); }
.content { padding: 28px; width: 100%; max-width: 1480px; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(5, 8, 20, 0.5); z-index: 35; backdrop-filter: blur(2px); }

/* bot switcher */
/* chatbot selector (header) */
.bot-switch { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs); cursor: pointer; color: var(--text); font: inherit; max-width: 260px; transition: border-color .15s, box-shadow .15s; }
.bot-switch:hover, .bot-switch[aria-expanded="true"] { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.bot-switch:focus-visible { outline: none; box-shadow: var(--ring); }
.bot-switch > svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.bot-switch-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
.bot-switch-text .kicker { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.bot-switch-text b { font-size: 13.5px; max-width: 170px; }
.bot-av { position: relative; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.bot-av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.bot-av svg { width: 16px; height: 16px; }
.bot-av .status-dot { position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border: 2px solid var(--surface); box-shadow: none; }
.bot-picker { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.bot-picker .bp-head { display: flex; align-items: baseline; justify-content: space-between; padding: 13px 14px 9px; }
.bot-picker .bp-search { padding: 0 12px 8px; }
.bot-picker .bp-search .input { width: 100%; }
.bot-picker .bp-list { max-height: min(360px, 55vh); overflow-y: auto; padding: 0 6px 6px; }
.bp-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 11px; background: none; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.bp-item:hover, .bp-item:focus-visible { background: var(--surface-3); outline: none; }
.bp-item.current { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.bp-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.bp-text b { font-size: 13.5px; }
.bp-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; white-space: nowrap; }
.bp-meta .status-dot { width: 7px; height: 7px; box-shadow: none; }
.bp-check { color: var(--brand); display: grid; place-items: center; }
.bp-check svg { width: 18px; height: 18px; }
.bot-picker .bp-foot { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---- cards ----------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; min-width: 0;
}
.card.flush { padding: 0; }
.card.pad-lg { padding: 26px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-head.pad { padding: 18px 20px 0; }
.card-foot { border-top: 1px solid var(--border); padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card.hover { transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card.glow { position: relative; overflow: hidden; }
.card.glow::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* hero / banner */
.hero {
  border-radius: var(--radius-xl); padding: 26px 28px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(500px 240px at 100% 0%, rgba(var(--accent-rgb), 0.55), transparent 70%),
    radial-gradient(400px 200px at 0% 100%, rgba(6, 182, 212, 0.35), transparent 70%), linear-gradient(135deg, var(--brand-deep), var(--brand) 45%, var(--accent));
  box-shadow: 0 18px 40px rgba(var(--brand-rgb), 0.28);
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: 0.35; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.55) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 30%, #000);
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000);
}
.hero > * { position: relative; z-index: 1; }
.hero h1, .hero h2 { color: #fff; }
.hero p { color: rgba(255, 255, 255, 0.82); }
.hero .btn.light { background: #fff; color: var(--brand-600); }

/* ---- KPI / stat cards ------------------------------------------------------ */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-value { font-family: var(--display); font-size: 27px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--neutral-bg); }
.tone-blue { background: var(--info-bg); color: var(--brand); }
.tone-violet { background: color-mix(in srgb, #7c3aed 12%, var(--surface)); color: #7c3aed; }
.tone-green { background: var(--good-bg); color: var(--good); }
.tone-amber { background: var(--warn-bg); color: var(--warn); }
.tone-red { background: var(--bad-bg); color: var(--bad); }
.tone-cyan { background: color-mix(in srgb, #06b6d4 13%, var(--surface)); color: #0891b2; }
.tone-slate { background: var(--neutral-bg); color: var(--text-2); }

/* ---- buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent; background: var(--grad); color: #fff; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.2s, filter 0.15s, background 0.15s; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(var(--brand-rgb), 0.28), inset 0 1px 0 rgba(255,255,255,.18); text-decoration: none !important;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 8px 22px rgba(var(--brand-rgb), 0.34); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: 0.6; cursor: not-allowed; filter: none; }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--bad); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25); }
.btn.danger-soft { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.btn.success { background: var(--good); box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25); }
.btn.soft { background: var(--brand-50); color: var(--brand); box-shadow: none; }
.btn.soft:hover { background: var(--brand-100); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.xs svg, .btn.sm svg { width: 14px; height: 14px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn .spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.secondary .spinner, .btn.ghost .spinner, .btn.soft .spinner { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- forms ----------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error-text { font-size: 12px; color: var(--bad); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s; font-size: 14px;
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 96px; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7a99' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border-strong)); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input.invalid, .textarea.invalid { border-color: var(--bad); }
.input.sm, .select.sm { height: 34px; font-size: 13px; border-radius: 9px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-group { display: flex; }
.input-group .input { border-radius: 11px 0 0 11px; }
.input-group .btn { border-radius: 0 11px 11px 0; height: 42px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 42px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: transparent; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.pw-wrap button svg { width: 17px; height: 17px; }
.strength { display: flex; gap: 4px; margin-top: 2px; }
.strength span { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); transition: background 0.2s; }
.strength.s1 span:nth-child(-n+1) { background: var(--bad); }
.strength.s2 span:nth-child(-n+2) { background: var(--warn); }
.strength.s3 span:nth-child(-n+3) { background: #3b82f6; }
.strength.s4 span { background: var(--good); }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }
.switch.sm { width: 34px; height: 20px; }
.switch.sm .track::after { width: 14px; height: 14px; }
.switch.sm input:checked + .track::after { transform: translateX(14px); }

/* segmented control */
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all 0.15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button svg { width: 15px; height: 15px; display: block; }
[data-view] button { padding: 6px 9px; }

/* option tiles (tone picker, style picker) */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { border: 1.5px solid var(--border); border-radius: 13px; padding: 13px; cursor: pointer; background: var(--surface); transition: all 0.15s; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.tile:hover { border-color: var(--border-strong); }
.tile.active { border-color: var(--brand); background: var(--brand-50); box-shadow: var(--ring); }
.tile b { font-size: 13.5px; }
.tile span { font-size: 12px; color: var(--muted); }
.tile .emoji { font-size: 20px; }

/* color field */
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--border-strong); padding: 3px; background: var(--surface); cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }
.color-field .input { font-family: var(--mono); text-transform: uppercase; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }

/* upload */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 30px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone .dz-icon { width: 52px; height: 52px; border-radius: 15px; background: var(--grad-soft); color: var(--brand); display: grid; place-items: center; }
.dropzone .dz-icon svg { width: 24px; height: 24px; }
.image-pick { display: flex; align-items: center; gap: 12px; }
.image-pick .thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; color: var(--faint); }
.image-pick .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; box-sizing: border-box; }
.image-pick .thumb svg { width: 22px; height: 22px; }

/* ---- badges / status -------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em; background: var(--neutral-bg); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.violet { background: color-mix(in srgb, #7c3aed 13%, var(--surface)); color: #8b5cf6; }
.badge.brand { background: var(--grad); color: #fff; }
.badge.brand::before { display: none; }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.badge.outline::before { display: none; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.status-dot.info { background: var(--brand); box-shadow: 0 0 0 3px var(--info-bg); }
.status-dot.neutral { background: var(--faint); box-shadow: 0 0 0 3px var(--neutral-bg); }
.pulse-dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-weight: 600; }
.pill svg { width: 13px; height: 13px; }
.tag-source { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.tag-source.inherited { background: var(--neutral-bg); color: var(--muted); }
.tag-source.custom { background: color-mix(in srgb, #eb6834 15%, var(--surface)); color: #c2511f; }

/* avatar */
.avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; overflow: hidden; background: var(--grad); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* A chatbot's logo keeps its whole shape on a white tile. */
.avatar.bot-av.has-img { background: #fff; border: 1px solid var(--border); }
.avatar.bot-av.has-img img { object-fit: contain; padding: 3px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar.round { border-radius: 50%; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who .meta { min-width: 0; line-height: 1.3; }
.who .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .meta span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ---- tables ---------------------------------------------------------------- */
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .input-icon { flex: 1; min-width: 200px; max-width: 360px; }
.table-toolbar .select { width: auto; min-width: 140px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort { display: inline-block; width: 12px; opacity: 0.7; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.unread td { font-weight: 600; }
.table .actions-cell { text-align: right; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.pagination button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ---- tabs ------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  border: none; background: none; padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; text-decoration: none !important;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-3); padding: 1px 7px; border-radius: 999px; color: var(--text-2); }
.tabs .active .count { background: var(--brand-50); color: var(--brand); }
.tabs svg { width: 15px; height: 15px; }
.status-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.status-tab { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); display: inline-flex; gap: 7px; align-items: center; }
.status-tab.active { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.status-tab b { font-weight: 700; }

/* ---- modal / drawer -------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 8, 20, 0.55); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade 0.15s ease; }
.modal {
  background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; animation: modalIn 0.22s var(--ease); border: 1px solid var(--border);
}
.modal.wide { width: min(820px, 100%); }
.modal.narrow { width: min(440px, 100%); }
.modal-head { padding: 20px 22px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; }
.modal-icon svg { width: 22px; height: 22px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-overlay { position: fixed; inset: 0; background: rgba(5, 8, 20, 0.45); z-index: 90; animation: fade 0.15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerIn 0.25s var(--ease); border-left: 1px solid var(--border); }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: dropIn 0.15s var(--ease);
}
.dropdown-menu.left { right: auto; left: 0; }
/* Menus opened from tables and cards float above everything (see floatMenu). */
.dropdown-menu.floating { position: fixed; right: auto; z-index: 150; overflow-y: auto; overscroll-behavior: contain; }
.dropdown-menu.floating.up { animation-name: dropUp; }
@keyframes dropUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: none; background: none; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--text); text-align: left; text-decoration: none !important; }
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-item.danger { color: var(--bad); }
.dropdown-item.danger svg { color: var(--bad); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.dropdown-head { padding: 10px 11px 8px; }

/* notification panel */
.notif-panel { width: 400px; max-width: calc(100vw - 24px); padding: 0; }
.notif-panel .head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; position: relative; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.notif.unread::after { content: ""; position: absolute; right: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.notif .ic svg { width: 17px; height: 17px; }
.notif b { font-size: 13px; display: block; padding-right: 14px; }
.notif p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif time { font-size: 11.5px; color: var(--faint); }
.notif .grow { min-width: 0; }
.notif b, .notif p { overflow-wrap: anywhere; }
.notif-page { max-height: none; }
.notif-actions { align-self: center; flex-shrink: 0; }
.notif-page .notif.unread::after { right: auto; left: 6px; top: 50%; margin-top: -3px; width: 6px; height: 6px; }

/* Phones: the bell panel becomes a sheet under the top bar, and the full
   list puts each notification's buttons under its text. */
@media (max-width: 640px) {
  .notif-panel.dropdown-menu { position: fixed; top: calc(var(--topbar-h) + 6px); left: 10px; right: 10px !important; width: auto; max-width: none; bottom: auto !important; display: flex; flex-direction: column; max-height: calc(100dvh - var(--topbar-h) - 90px); }
  .notif-panel .notif-list { max-height: none; flex: 1; min-height: 0; overscroll-behavior: contain; }
  .notif-panel .head { padding: 12px 14px; }
  .notif { gap: 10px; padding: 12px 14px; }
  .notif .ic { width: 32px; height: 32px; border-radius: 10px; }
  .notif .ic svg { width: 15px; height: 15px; }
  .notif-page .notif { padding: 12px 10px 10px 16px; }
  .notif-page .notif-body time { display: block; padding-right: 84px; min-height: 36px; line-height: 1.4; padding-top: 6px; }
  .notif-page .notif-actions { position: absolute; right: 8px; bottom: 8px; gap: 2px; }
  .notif-page .notif-actions .btn.icon { width: 36px; height: 36px; }
  .notif-page .notif.unread::after { top: 24px; margin-top: 0; }
  .topbar .crumbs { display: none; }
  .topbar-actions { min-width: 0; gap: 6px; }
  .topbar-actions > * { flex-shrink: 0; }
  .topbar-actions > #botSwitch { flex-shrink: 1; min-width: 0; }
  #botSwitch .bot-switch { max-width: 100%; }
}

/* toast */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 11px; min-width: 280px; max-width: 400px; padding: 13px 14px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toastIn 0.25s var(--ease);
}
.toast.out { animation: toastOut 0.2s ease forwards; }
.toast .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast .ic svg { width: 16px; height: 16px; }
.toast b { font-size: 13.5px; display: block; }
.toast p { font-size: 12.5px; color: var(--muted); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* tooltip (positioned by core/tooltip.js so it never gets clipped) */
.tooltip {
  position: fixed; z-index: 200; pointer-events: none; max-width: min(280px, calc(100vw - 16px));
  background: #0b1220; color: #fff; font-size: 12px; font-weight: 500; padding: 6px 9px; border-radius: 8px; line-height: 1.35;
  box-shadow: var(--shadow); opacity: 0; transition: opacity 0.12s ease; white-space: normal; text-align: center;
}
.tooltip.show { opacity: 1; }
.tooltip::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%); width: 8px; height: 8px; background: inherit; transform: translateX(-50%) rotate(45deg);
}
.tooltip.above::after { bottom: -4px; }
.tooltip.below::after { top: -4px; }
:root[data-theme="dark"] .tooltip { background: #e8edf7; color: #0b1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tooltip { background: #e8edf7; color: #0b1220; } }

/* a segmented control that wraps on small screens */
.segmented.wrap-seg { flex-wrap: wrap; height: auto; }
.segmented.wrap-seg button { flex: 1 1 auto; }

/* team: clickable member rows, workload */
.click-row { cursor: pointer; transition: background .12s; }
.click-row:hover { background: var(--surface-2); }
.click-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.workload { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.workload .wl { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; transition: border-color .15s; }
.workload .wl:hover { border-color: var(--brand); }
.workload .wl b { font-size: 22px; font-family: "Plus Jakarta Sans", Inter, sans-serif; }
.workload .wl span { font-size: 12px; color: var(--muted); }
.presence-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; margin-right: 6px; vertical-align: 1px; }
.presence-dot.on { background: var(--good); opacity: 1; }
@media (max-width: 560px) { .workload { grid-template-columns: 1fr; } }

/* phone input: country + number */
.phone-field { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px; }
.phone-field .select { min-width: 0; text-overflow: ellipsis; }

/* team: automatic assignment & presence */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.auto-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.auto-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.auto-opt input { margin-top: 3px; accent-color: var(--brand); }
.auto-opt b { display: flex; gap: 6px; align-items: center; font-size: 13.5px; }
.auto-opt b svg { width: 15px; height: 15px; }
.auto-opt small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.presence { position: relative; display: inline-flex; }
.presence::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--surface); opacity: .5; }
.presence.on::after { background: var(--good); opacity: 1; }

/* live chat with a person */
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--brand); }
.transcript-col { display: flex; flex-direction: column; min-width: 0; }
.transcript-col .transcript { flex: 1; }
.live-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.live-banner > svg { width: 20px; height: 20px; flex-shrink: 0; }
.live-banner b { font-size: 14px; }
.live-banner p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.live-banner.waiting { background: var(--warn-bg); }
.live-banner.waiting > svg { color: var(--warn); animation: livePulse 1.4s ease-in-out infinite; }
.live-banner.active { background: var(--good-bg, var(--surface-2)); }
.live-banner.ended { background: var(--surface-2); }
.live-banner.ended > svg { color: var(--muted); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good, #16a34a); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good, #16a34a) 25%, transparent); animation: livePulse 1.4s ease-in-out infinite; flex-shrink: 0; }
@keyframes livePulse { 50% { opacity: 0.45; } }
.live-composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.live-composer .textarea { min-height: 42px; max-height: 140px; resize: vertical; flex: 1; }
.live-note { align-self: center; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 999px; padding: 4px 12px; max-width: 90%; text-align: center; }
.live-note svg { width: 13px; height: 13px; flex-shrink: 0; }
.live-note time { opacity: 0.7; }
.bubble.agent { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--brand-50); white-space: pre-wrap; }
.bubble.agent .by { display: block; font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.agent-av { background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.live-badge svg { width: 12px; height: 12px; }

/* free trial */
.trial-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: 12.5px; font-weight: 700; margin-bottom: 12px; }
.trial-pill svg { width: 14px; height: 14px; }
.trial-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 24px 0; padding: 10px 14px; border-radius: 12px; background: var(--grad); color: #fff; font-size: 13.5px; }
.trial-bar > svg { width: 16px; height: 16px; flex-shrink: 0; }
.trial-bar span { flex: 1; min-width: 200px; }
.trial-bar.soon { background: linear-gradient(135deg, #b45309, #d97706); }
.trial-bar.ended { background: linear-gradient(135deg, #991b1b, #dc2626); }
.trial-bar .btn.light { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.3); }
.trial-bar .btn:not(.light) { background: #fff; color: #991b1b; }
@media (max-width: 720px) { .trial-bar { margin: 10px 12px 0; } }
.trial-hero { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 16px; background: var(--grad); color: #fff; }
.trial-hero.ended { background: linear-gradient(135deg, #991b1b, #dc2626); }
.trial-hero .ic { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex-shrink: 0; }
.trial-hero .ic svg { width: 20px; height: 20px; }
.trial-hero b { font-size: 16px; }
.trial-hero p { opacity: .9; font-size: 13.5px; margin-top: 3px; }
.trial-meter { height: 5px; border-radius: 99px; background: rgba(255,255,255,.2); margin-top: 8px; overflow: hidden; }
.trial-meter span { display: block; height: 100%; background: currentColor; opacity: .85; border-radius: inherit; }

/* allowed websites (Integrations) */
.domain-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 500; }
.domain-chip > svg { width: 14px; height: 14px; color: var(--brand); }

/* conversation list filters wrap instead of squeezing */
.conv-filters { flex-wrap: wrap; }
.conv-filters .select { flex: 1 1 96px; min-width: 0; width: auto; }

/* ---- teams, roles & assignment ---------------------------------------------- */
.role-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.role-option:hover { border-color: var(--border-strong, var(--brand-100)); }
.role-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.role-option input { margin-top: 3px; accent-color: var(--brand); }
.role-option b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.role-option b svg { width: 15px; height: 15px; }
.role-option small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.team-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); min-width: 0; }
.team-card b svg { width: 15px; height: 15px; vertical-align: -2px; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack > * { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface-2); }
.avatar-stack > *:first-child { margin-left: 0; }
.role-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.role-legend b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.role-legend b svg { width: 15px; height: 15px; color: var(--brand); }
.badge svg { width: 12px; height: 12px; }
.assignee-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 170px; min-width: 0; font-size: 13px; }
.dot-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dot-avatar { overflow: hidden; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.assign-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.assign-box .kpi-label { margin: 0; white-space: nowrap; }
.assign-box .select { width: auto; min-width: 200px; max-width: 100%; flex: 1; }

/* ---- empty / skeleton / states --------------------------------------------- */
.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ill { width: 72px; height: 72px; border-radius: 22px; background: var(--grad-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 4px; position: relative; }
.empty .ill::after { content: ""; position: absolute; inset: -8px; border-radius: 28px; border: 1px dashed color-mix(in srgb, var(--brand) 30%, transparent); }
.empty .ill svg { width: 30px; height: 30px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--muted); max-width: 380px; font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-title { height: 22px; width: 40%; margin-bottom: 14px; }
.sk-block { height: 120px; }
.locked-state { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.locked-state .ill { width: 80px; height: 80px; border-radius: 24px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--glow); }
.locked-state .ill svg { width: 34px; height: 34px; }
.locked-state p { color: var(--muted); max-width: 440px; }
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; border: 1px solid transparent; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.alert.good { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.alert b { color: inherit; }
.alert .grow p { color: var(--text-2); margin-top: 2px; }

/* progress */
.progress { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 4px; background: var(--grad); transition: width 0.6s var(--ease); }
.progress.warn span { background: var(--warn); }
.progress.bad span { background: var(--bad); }
.usage-row { display: flex; flex-direction: column; gap: 6px; }
.usage-row .top { display: flex; justify-content: space-between; font-size: 12.5px; }

/* list rows */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item.link { cursor: pointer; border-radius: 10px; margin: 0 -8px; padding: 12px 8px; }
.list-item.link:hover { background: var(--surface-2); }
.feed-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.feed-ic svg { width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* stepper (approval workflow) */
.stepper { display: flex; align-items: flex-start; gap: 0; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; position: relative; min-width: 0; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 17px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px; background: var(--border-strong); border-radius: 2px; }
.step.done:not(:last-child)::after { background: var(--good); }
.step .bullet { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); border: 2px solid var(--border-strong); font-weight: 700; font-size: 13px; z-index: 1; }
.step .bullet svg { width: 17px; height: 17px; }
.step.done .bullet { background: var(--good); border-color: var(--good); color: #fff; }
.step.current .bullet { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--ring); }
.step.failed .bullet { background: var(--bad); border-color: var(--bad); color: #fff; }
.step b { font-size: 12.5px; }
.step span { font-size: 11.5px; color: var(--muted); }

/* chat transcript */
.transcript { display: flex; flex-direction: column; gap: 12px; padding: 20px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); min-height: 300px; max-height: 620px; overflow-y: auto; }
.bubble-row { display: flex; gap: 9px; align-items: flex-end; max-width: 82%; }
.bubble-row.visitor { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.55; background: var(--surface); border: 1px solid var(--border); overflow-wrap: break-word; word-break: normal; min-width: 0; }
.bubble-row.visitor .bubble { background: var(--brand); color: #fff; border-color: transparent; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.bubble-row.bot .bubble { border-bottom-left-radius: 5px; }
.bubble-row.bot .bubble.unknown { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-bg); }
.bubble time { display: block; font-size: 10.5px; opacity: 0.6; margin-top: 4px; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 18px; }
.bubble h3 { font-size: 13.5px; margin: 6px 0 4px; }
.bubble table { border-collapse: collapse; font-size: 12px; margin: 4px 0; }
.bubble td, .bubble th { border: 1px solid var(--border); padding: 3px 6px; }
.note { padding: 11px 13px; border-radius: 12px; background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 18%, transparent); font-size: 13px; }
.note .by { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }

/* split view (conversations / inbox) */
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 210px); }
.split-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.split-list .items { overflow-y: auto; flex: 1; max-height: calc(100vh - 290px); }
.split-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 11px; transition: background 0.12s; }
.split-item:hover { background: var(--surface-2); }
.split-item.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.split-item.unread b { font-weight: 800; }
.split-detail { min-width: 0; display: flex; flex-direction: column; }

/* matrix (plan permissions) */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td .limit-input { width: 110px; margin: 0 auto; text-align: center; }
.matrix tr.group td { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; padding: 8px 16px; }

/* plan cards */
.plans-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.plan { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.plan.popular { border-color: var(--brand); box-shadow: 0 16px 40px rgba(var(--brand-rgb), 0.16); }
.plan .ribbon { position: absolute; top: -11px; left: 24px; }
.plan .price { font-family: var(--display); font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.plan li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.plan li svg { width: 17px; height: 17px; color: var(--good); flex-shrink: 0; margin-top: 1px; }
.plan li.off { color: var(--faint); }
.plan li.off svg { color: var(--faint); }
.plan.selected { border-color: var(--brand); box-shadow: var(--ring); }

/* feature rows (permissions) */
.feature-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.feature-row:last-child { border-bottom: none; }
.feature-row .fi { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.feature-row .fi svg { width: 18px; height: 18px; }
.feature-row.on .fi { background: var(--brand-50); color: var(--brand); }

/* code / embed */
.code-block { position: relative; background: #0b1120; color: #c9d6ff; border-radius: 14px; padding: 16px 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid #1c2645; }
.code-block .k { color: #7ea4ff; } .code-block .s { color: #7ee2b8; } .code-block .a { color: #f5b971; }
.code-block .copy { position: absolute; top: 10px; right: 10px; }

/* chatbot preview (customise page) */
.preview-stage { border-radius: var(--radius); background: linear-gradient(135deg, #eef3ff, #f6f0ff); border: 1px solid var(--border); padding: 22px 22px 96px; min-height: 620px; position: relative; overflow: hidden; }
:root[data-theme="dark"] .preview-stage { background: linear-gradient(135deg, #0f1936, #1a1236); }
.preview-stage .browser-dots { display: flex; gap: 6px; margin-bottom: 14px; }
.preview-stage .browser-dots span { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.pv-window { width: 100%; max-width: 360px; margin-left: auto; border-radius: 18px; background: #fff; box-shadow: 0 24px 60px rgba(15,23,42,.22); overflow: hidden; display: flex; flex-direction: column; height: 520px; color: #0f172a; border: 1px solid rgba(15,23,42,.06); }
.pv-window.left { margin-left: 0; margin-right: auto; }
.pv-head { padding: 15px 16px; display: flex; gap: 11px; align-items: center; }
.pv-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.pv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pv-avatar svg { width: 18px; height: 18px; }
.pv-msgs { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.pv-msg { max-width: 82%; padding: 9px 13px; border-radius: 16px; font-size: 13px; line-height: 1.5; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chips span { font-size: 12px; padding: 5px 10px; border-radius: 14px; border: 1px solid; }
.pv-offer { border-radius: 14px; overflow: hidden; border: 1px solid rgba(15,23,42,.08); width: 200px; background: #fff; box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.pv-offer .img { height: 70px; display: grid; place-items: center; color: #fff; }
.pv-offer .img img { width: 100%; height: 100%; object-fit: cover; }
.pv-offer .b { padding: 9px 10px; font-size: 12px; }
.pv-offer .cta { margin-top: 6px; text-align: center; color: #fff; padding: 6px; border-radius: 8px; font-weight: 600; font-size: 11.5px; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 10px 5px; border-top: 1px solid rgba(15,23,42,.06); }
.pv-actions span { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 7px; border: 1px solid; border-radius: 999px; background: #fff; font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.pv-actions svg { width: 11px; height: 11px; }
.pv-composer { padding: 10px 12px; display: flex; gap: 8px; border-top: 1px solid rgba(15,23,42,.06); }
.pv-composer div { flex: 1; border: 1px solid #e2e8f0; border-radius: 20px; padding: 9px 14px; font-size: 12.5px; color: #94a3b8; background: #f8fafc; }
.pv-composer span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.pv-composer span svg { width: 16px; height: 16px; }
.pv-socials { display: flex; gap: 6px; padding: 0 14px 10px; }
.pv-socials span { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; }
.pv-socials svg { width: 13px; height: 13px; }
.pv-launcher { position: absolute; bottom: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 10px 26px rgba(37,99,255,.4); }
.pv-launcher.left { right: auto; left: 22px; }
.pv-launcher svg { width: 24px; height: 24px; }

/* offer cards (dashboard) */
.offer-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.offer-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.offer-card .img { height: 150px; background: var(--grad); display: grid; place-items: center; color: #fff; position: relative; }
.offer-card .img img { width: 100%; height: 100%; object-fit: cover; }
.offer-card .img svg { width: 36px; height: 36px; opacity: 0.85; }
.offer-card .img .badge { position: absolute; top: 12px; left: 12px; }
.offer-card .img .state { position: absolute; top: 12px; right: 12px; }
.offer-card .body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.offer-card .foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* faq / qa items */
.qa-item { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; }
.qa-item:last-child { border-bottom: none; }
.qa-item .q { font-weight: 600; font-size: 14px; }
.qa-item .a { color: var(--text-2); font-size: 13.5px; margin-top: 4px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qa-item.disabled .q, .qa-item.disabled .a { opacity: 0.55; }
.qa-num { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* file rows */
.file-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; flex-shrink: 0; letter-spacing: 0.03em; }
.file-ic.pdf { background: linear-gradient(135deg, #ef4444, #f97316); }
.file-ic.word { background: linear-gradient(135deg, #2563ff, #3b82f6); }
.file-ic.text { background: linear-gradient(135deg, #64748b, #94a3b8); }
.file-ic.other { background: linear-gradient(135deg, #7c3aed, #a855f7); }

/* ---- charts ---------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--axis); font-size: 11px; font-family: var(--font); }
.chart .val-text { fill: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: var(--shadow-lg); padding: 9px 11px; font-size: 12px; z-index: 5; min-width: 130px; transition: opacity 0.1s; white-space: nowrap;
}
.chart-tip .t { font-weight: 700; margin-bottom: 5px; color: var(--text); }
.chart-tip .r { display: flex; align-items: center; gap: 7px; color: var(--text-2); margin-top: 3px; }
.chart-tip .r b { margin-left: auto; padding-left: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .sw { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; width: 14px; border-radius: 2px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 160px; }
.donut-legend .it { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.donut-legend .it i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .it b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-legend .it span.p { color: var(--muted); font-size: 12px; width: 44px; text-align: right; }
.spark { display: block; }
.view-toggle { display: inline-flex; }
.data-table-view { margin-top: 12px; }

/* ---- auth pages ------------------------------------------------------------ */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-visual {
  position: relative; overflow: hidden; color: #fff; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 400px at 90% 0%, rgba(var(--accent-rgb), 0.55), transparent 65%),
    radial-gradient(600px 400px at 0% 100%, rgba(6, 182, 212, 0.3), transparent 60%), linear-gradient(160deg, #0a1233, color-mix(in srgb, var(--brand-deep) 45%, #0a1233) 45%, var(--brand-deep));
}
.auth-visual::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.28) 1px, transparent 1px); background-size: 26px 26px; mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%); -webkit-mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual h1 { color: #fff; font-size: 40px; line-height: 1.12; max-width: 520px; font-weight: 800; }
.auth-visual p.lead { color: rgba(226, 232, 255, 0.82); font-size: 16px; max-width: 460px; margin-top: 16px; }
.auth-brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 800; font-size: 18px; }
.auth-brand-top { display: none; }
.auth-points { display: grid; gap: 12px; margin-top: 30px; max-width: 460px; }
.auth-point { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(8px); }
.auth-point .ic { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex-shrink: 0; }
.auth-point .ic svg { width: 17px; height: 17px; }
.auth-point b { display: block; font-size: 14px; }
.auth-point span { font-size: 12.5px; color: rgba(226, 232, 255, 0.72); }
.auth-chat { margin-top: 28px; max-width: 360px; background: rgba(255,255,255,.95); border-radius: 18px; padding: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); color: #0f172a; animation: float 6s ease-in-out infinite; }
.auth-chat .m { font-size: 12.5px; padding: 8px 11px; border-radius: 13px; margin: 6px 0; max-width: 85%; }
.auth-chat .m.b { background: #eef2ff; }
.auth-chat .m.u { background: var(--brand); color: #fff; margin-left: auto; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.auth-foot { font-size: 12.5px; color: rgba(226, 232, 255, 0.6); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: min(440px, 100%); }
.auth-card.wide { width: min(640px, 100%); }
.auth-card h2 { font-size: 26px; font-weight: 800; }
.auth-card .sub { color: var(--muted); margin: 6px 0 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 20px; }
.plan-pick { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan-opt { border: 1.5px solid var(--border-strong); border-radius: 14px; padding: 12px; cursor: pointer; background: var(--surface); transition: all 0.15s; position: relative; text-align: left; }
.plan-opt:hover { border-color: var(--brand); }
.plan-opt.active { border-color: var(--brand); background: var(--brand-50); box-shadow: var(--ring); }
.plan-opt b { display: block; font-size: 13.5px; }
.plan-opt .p { font-family: var(--display); font-weight: 800; font-size: 19px; margin-top: 2px; }
.plan-opt .p small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.plan-opt .pop { position: absolute; top: -9px; right: 10px; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 700; }
.steps-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.steps-dots span { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps-dots span.on { background: var(--grad); }
.result-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 18px; }
.result-icon svg { width: 30px; height: 30px; }

/* pending page */
.pending-hero { text-align: center; padding: 40px 24px 28px; }
.pending-hero .ill { width: 88px; height: 88px; border-radius: 28px; background: var(--grad); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; box-shadow: var(--glow); }
.pending-hero .ill svg { width: 40px; height: 40px; }

/* ---- responsive ------------------------------------------------------------ */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 264px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-brand-top { display: flex; justify-content: center; margin-bottom: 26px; min-width: 0; }
}
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.has-detail .split-list { display: none; }
  .split:not(.has-detail) .split-detail { display: none; }
  .split-list .items { max-height: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .content { padding: 18px 16px 96px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .user-btn .meta, .topbar .hide-sm { display: none; }
  .user-btn { padding: 3px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-icon { width: 32px; height: 32px; }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 16px; }
  .page-head .actions { width: 100%; }
  .card { padding: 16px; }
  .hero { padding: 22px 20px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .stepper { flex-direction: column; gap: 14px; align-items: stretch; }
  .step { flex-direction: row; text-align: left; }
  .step:not(:last-child)::after { display: none; }
  .plan-pick { grid-template-columns: minmax(0, 1fr); }
  /* responsive tables become cards */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive td { border: none; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex-shrink: 0; }
  .table.responsive td.primary-cell { display: block; text-align: left; padding-bottom: 8px; }
  .table.responsive td.primary-cell::before { display: none; }
  .table.responsive td.actions-cell { justify-content: flex-end; }
  .table.responsive td.actions-cell::before { display: none; }
  .table-toolbar .input-icon { max-width: none; min-width: 100%; }
  .table-toolbar .select { flex: 1; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 2px; border-radius: 10px; text-decoration: none !important; position: relative; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav a.active::before { content: ""; position: absolute; top: -6px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .toast-stack { left: 12px; right: 12px; bottom: 84px; }
  .toast { min-width: 0; max-width: none; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; }
  .preview-stage { min-height: 0; padding: 14px; }
  .pv-window { height: 460px; }
  .bot-switch { padding: 4px 8px 4px 4px; gap: 7px; }
  .bot-switch-text .kicker { display: none; }
  .bot-switch-text b { max-width: 96px; font-size: 13px; }
  .bot-av { width: 26px; height: 26px; }
  .bot-picker { position: fixed; left: 12px; right: 12px; top: 62px; width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.pv-avatar.contain img { object-fit: contain; padding: 5px; box-sizing: border-box; }
/* FAQ / Q&A option previews — variables come from core/faqTheme.js */
.faq-chips { display: flex; flex-wrap: wrap; flex-direction: var(--fq-dir, row); align-items: flex-start; gap: var(--fq-gap, 8px); }
.faq-chips[style*="column"] { align-items: stretch; }
.faq-chips .fq { font: inherit; font-size: var(--fq-size); font-weight: var(--fq-weight); line-height: 1.35; text-align: left; padding: var(--fq-pad); border-radius: var(--fq-radius); border: var(--fq-bw) solid var(--fq-border); background: var(--fq-bg); color: var(--fq-text); cursor: pointer; max-width: 100%; transition: background .15s, color .15s, border-color .15s, transform .1s; }
.faq-chips .fq:hover { background: var(--fq-hbg); color: var(--fq-htext); border-color: var(--fq-hborder); }
.faq-chips .fq:active { transform: scale(.97); }
.faq-chips .fq.selected, .faq-chips .fq:active { background: var(--fq-sbg); color: var(--fq-stext); border-color: var(--fq-sbg); }
.faq-chips .fq.more { background: transparent; border-style: dashed; }
/* "Test chatbot" popup */
.modal.test-modal { width: min(420px, 100%); height: min(760px, calc(100vh - 40px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.test-modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: #0a1022; color: #fff; }
.test-modal-head .logo-mark { --logo-h: var(--logo-h-chatbot, 32px); }
.test-modal-head .btn.ghost { color: #c9d6ff; }
.test-modal-head .btn.ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.test-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: #9fb0d9; }
.test-live .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.22); }
.test-modal-frame { flex: 1; width: 100%; border: 0; display: block; background: #f8fafc; }
.test-modal-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
.test-modal-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.test-modal-foot svg { width: 13px; height: 13px; }
@media (max-width: 520px) {
  .modal-overlay:has(.test-modal) { padding: 0; }
  .modal.test-modal { width: 100%; height: 100%; max-height: none; border-radius: 0; }
}

/* Wide record drawers (leads, tickets, contacts) */
.drawer.wide { width: min(780px, 100%); }
.drawer .tabs.sticky { position: sticky; top: -20px; z-index: 2; background: var(--surface); margin: -20px -22px 18px; padding: 12px 22px 0; }

/* Shared notes */
.notes-panel .note { position: relative; }
.notes-panel .note .text { white-space: pre-wrap; word-break: break-word; }
.notes-panel .note .by { gap: 8px; align-items: center; flex-wrap: wrap; }
.notes-panel .note .acts { display: flex; gap: 2px; margin-left: auto; }
.notes-panel .note-edit textarea { min-height: 70px; }
.sync-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sync-hint svg { width: 14px; height: 14px; }

/* Contacts */
.contact-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-cell b { display: block; }
.chk { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.export-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.export-cols { display: flex; flex-wrap: wrap; gap: 6px; }
.export-cols code { font-size: 11.5px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.perm-grid label.check { padding: 9px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.perm-grid label.check.off { opacity: 0.5; }
.count-pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: 11px; font-weight: 700; margin-left: 4px; }

/* An uploaded platform logo replaces the sparkle mark. */
/* An uploaded logo keeps its proportions: the height is set, the width follows
   (a square logo stays square, a wide wordmark shows wide, never stretched). */
/* The tile behind an uploaded logo. Each place sets these variables from
   Super Admin → Branding (see logoStyleCss); the defaults are a plain white tile. */
.logo-mark.has-logo { --logo-bg: #fff; --logo-pad: 0.1; --logo-bw: 0px; --logo-shadow: none; --logo-radius: calc(var(--logo-h) * 0.28);
  display: flex; align-items: center; justify-content: center; background: var(--logo-bg); box-shadow: var(--logo-shadow); border: var(--logo-bw) solid rgba(15, 23, 42, 0.14); border-radius: var(--logo-radius);
  padding: calc(var(--logo-h) * var(--logo-pad)); width: auto; min-width: var(--logo-h); max-width: min(calc(var(--logo-h) * 5), 100%); }
.logo-mark.has-logo::after { display: none; }
/* An explicit height (not 100%) so a large image can never size the box itself. */
.logo-mark.has-logo img { height: calc(var(--logo-h) * (1 - 2 * var(--logo-pad)) - 2 * var(--logo-bw)); width: auto; max-width: 100%; min-width: 0; object-fit: contain; display: block; flex: none; }

/* Branding page live preview (uses the brand tokens set on the element) */
.brand-preview { display: grid; grid-template-columns: 150px minmax(0, 1fr); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); min-height: 280px; }
.bp-side { background: var(--sidebar); border-right: 1px solid var(--sidebar-border); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.bp-brand { display: flex; align-items: center; gap: 8px; color: var(--sidebar-strong); font-size: 13px; min-width: 0; }
.bp-brand-wrap { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.bp-sub { font-size: 10px; color: var(--sidebar-muted); font-weight: 500; }
.tagline-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.tagline-row .logo-style-switch { align-items: flex-start; }
@media (max-width: 640px) { .tagline-row { grid-template-columns: 1fr; } }
.bp-brand .logo-mark { --logo-h: 28px; }
.bp-link { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 8px; border-radius: 8px; color: var(--sidebar-text); }
.bp-link svg { width: 14px; height: 14px; }
.bp-link.active { background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.14), rgba(var(--brand-rgb), 0.03)); color: var(--brand); font-weight: 600; }
.bp-main { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bp-hero { border-radius: 12px; padding: 14px; color: #fff; background: radial-gradient(260px 120px at 100% 0%, rgba(var(--accent-rgb), 0.55), transparent 70%), linear-gradient(135deg, var(--brand-deep), var(--brand) 45%, var(--accent)); display: flex; flex-direction: column; gap: 2px; }
.bp-hero small { opacity: 0.8; font-size: 11px; }
.bp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.bp-kpi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.bp-kpi svg { width: 16px; height: 16px; }
.bp-bar { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bp-bar span { display: block; width: 62%; height: 100%; background: var(--grad); }
@media (max-width: 520px) { .brand-preview { grid-template-columns: minmax(0, 1fr); } .bp-side { display: none; } }
.submitted-card { padding: 14px 16px; background: var(--surface-2); }
.submitted-card .kv dd { word-break: break-word; }
.table tbody tr.selected td { background: var(--brand-soft, var(--surface-2)); }

/* My Chatbots cards */
.bot-card { display: flex; flex-direction: column; gap: 14px; }
.bot-card.selected { border-color: var(--brand); box-shadow: var(--ring); }
.bot-card .selected-flag { display: flex; align-items: center; gap: 7px; margin: -4px 0 -2px; font-size: 12.5px; font-weight: 600; color: var(--brand); }
.bot-card .selected-flag svg { width: 16px; height: 16px; }
.bot-states { display: grid; grid-template-columns: 70px 1fr; gap: 7px 10px; margin: 0; align-items: center; }
.bot-states dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.bot-states dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.bot-states .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card .team-bots { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; padding-top: 4px; border-top: 1px dashed var(--border); }
.team-card .team-bots .pill svg { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; }
.pill.warn-pill { background: var(--warn-bg); color: var(--warn); }

/* crawl progress */
.crawl-steps { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.crawl-steps span { display: inline-flex; align-items: center; gap: 6px; }
.crawl-steps b, .crawl-steps svg { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; background: var(--surface-3); color: var(--muted); }
.crawl-steps .now { color: var(--text); font-weight: 600; }
.crawl-steps .now b { background: var(--brand); color: #fff; }
.crawl-steps .done { color: var(--good); }
.crawl-steps .done svg { background: var(--good-bg); color: var(--good); padding: 3px; }
.crawl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.crawl-stats div { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; }
.crawl-stats span { font-size: 11.5px; color: var(--muted); }
.crawl-stats b { font-size: 17px; }
@media (max-width: 720px) { .crawl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.crawl-summary { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-top: 4px; }
.crawl-summary > svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.crawl-summary.complete { background: var(--good-bg); }
.crawl-summary.complete > svg { color: var(--good); }
.crawl-summary.partial { background: var(--warn-bg); }
.crawl-summary.partial > svg { color: var(--warn); }
.crawl-summary p { margin: 2px 0 0; }

/* Logos on small screens: a large setting never crowds the layout. */
@media (max-width: 720px) {
  .auth-brand .logo-mark { --logo-h: min(var(--logo-h-auth, 48px), 56px); }
}

/* Super Admin → Branding: logo size per place */
.logo-size-list { display: flex; flex-direction: column; gap: 4px; }
.logo-size-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(150px, 0.9fr); gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.logo-size-row:first-child { border-top: 0; }
.logo-size-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logo-size-preview { min-height: 52px; display: flex; align-items: center; min-width: 0; overflow: hidden; background: var(--surface-2); border-radius: 12px; padding: 8px 12px; }
.logo-size-sample { display: flex; align-items: center; gap: 9px; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 14px; }
.logo-size-sample .logo-mark { --logo-h: inherit; }
.logo-size-control { display: flex; align-items: center; gap: 10px; }
.logo-size-control input[type=range] { flex: 1; accent-color: var(--brand); }
.logo-size-value { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; min-width: 40px; text-align: right; }
.logo-style-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: -4px; }
.logo-display { display: inline-flex; align-items: center; gap: 6px; }
.logo-display .select { width: auto; min-width: 140px; }
.logo-style-panel { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.logo-style-panel[hidden] { display: none; }
.logo-style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.logo-style-grid .field[hidden] { display: none; }
.logo-style-switch { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; min-height: 40px; cursor: pointer; }
@media (max-width: 720px) { .logo-size-row { grid-template-columns: 1fr; gap: 8px; } .logo-style-bar { margin-top: 0; } }

/* ---- Email Center ------------------------------------------------------------------------- */
.mail { display: grid; grid-template-columns: 210px 340px minmax(0, 1fr); min-height: calc(100vh - 230px); }
.mail-rail { border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mail-rail > .select { margin-bottom: 8px; }
.mail-account { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 8px 10px; }
.mail-account svg { width: 15px; height: 15px; flex-shrink: 0; }
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folder { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 9px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; text-decoration: none !important; }
.mail-folder svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.mail-folder span { flex: 1; min-width: 0; }
.mail-folder:hover { background: var(--surface-2); }
.mail-folder.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.mail-folder.active svg { color: var(--brand); }
.mail-count { font-size: 11.5px; font-weight: 700; color: var(--brand); }
.mail-rail > .mail-folder { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0 0 9px 9px; padding-top: 12px; }
.mail-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.mail-search { padding: 12px; border-bottom: 1px solid var(--border); }
.mail-items { overflow-y: auto; flex: 1; max-height: calc(100vh - 290px); }
.mail-item { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; transition: background 0.12s; }
.mail-item:hover { background: var(--surface-2); }
.mail-item.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.mail-item.unread b { font-weight: 800; }
.mail-detail { min-width: 0; display: flex; flex-direction: column; }
.mail-thread { display: flex; flex-direction: column; min-height: 100%; }
.mail-thread-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.mail-subject { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.mail-back { display: none; }
.mail-related { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.mail-related .badge { text-decoration: none; }
.mail-messages { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; overflow-y: auto; max-height: calc(100vh - 330px); }
.mail-msg { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.mail-msg.out { border-color: color-mix(in srgb, var(--brand) 22%, var(--border)); }
.mail-msg-head { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; }
.mail-msg-snippet { display: none; }
.mail-msg.collapsed .mail-msg-body, .mail-msg.collapsed .mail-msg-to { display: none; }
.mail-msg.collapsed .mail-msg-snippet { display: block; }
.mail-msg-body { padding: 0 14px 12px 50px; display: flex; flex-direction: column; gap: 10px; }
.mail-body { width: 100%; border: 0; min-height: 40px; height: 120px; background: #fff; border-radius: 8px; color-scheme: light; }
.mail-text { white-space: pre-wrap; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.mail-images { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 9px; padding: 6px 10px; }
.mail-images svg { width: 15px; height: 15px; }
.mail-attachments, .mail-files { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-attachment, .mail-file { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text); text-decoration: none !important; background: var(--surface-2); }
.mail-attachment:hover { border-color: var(--brand); }
.mail-attachment svg, .mail-file svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.mail-msg-actions { gap: 4px; }
.mail-reply-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; }
.mail-acct { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; }
.mail-acct-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.mail-acct-ic svg { width: 18px; height: 18px; }
.mail-connect { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mail-connect-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.mail-connect-opt:hover:not(:disabled) { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.mail-connect-opt:disabled { opacity: 0.6; cursor: not-allowed; }
.mail-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.mail-steps code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
@media (max-width: 1180px) {
  .mail { grid-template-columns: 300px minmax(0, 1fr); }
  .mail-rail { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px; }
  .mail-rail > .select { margin: 0; width: auto; max-width: 240px; }
  .mail-account { padding: 0 8px 0 4px; }
  .mail-folders { flex-direction: row; flex-wrap: wrap; }
  .mail-folder { width: auto; padding: 6px 10px; }
  .mail-rail > .mail-folder { margin: 0; border: 0; border-radius: 9px; padding: 6px 10px; }
}
@media (max-width: 860px) {
  .mail { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .mail-rail { overflow-x: auto; flex-wrap: nowrap; }
  .mail-folders { flex-wrap: nowrap; }
  .mail-folder { white-space: nowrap; }
  .mail-list { border-right: 0; }
  .mail.has-detail .mail-list, .mail.has-detail .mail-rail { display: none; }
  .mail:not(.has-detail) .mail-detail { display: none; }
  .mail-back { display: inline-flex; }
  .mail-items, .mail-messages { max-height: none; }
  .mail-msg-body { padding-left: 14px; }
  .mail-thread-head { padding: 12px; }
  .mail-messages { padding: 12px; }
  .mail-reply-bar { padding: 10px 12px; }
  .mail-reply-bar .btn { flex: 1; justify-content: center; }
  .mail-acct { flex-wrap: wrap; }
}

/* ---- Channels (Messenger, Instagram, WhatsApp) -------------------------------------------- */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.ch-card { display: flex; flex-direction: column; gap: 12px; }
.ch-card .btn { align-self: flex-start; margin-top: auto; }
.ch-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; color: #fff; }
.ch-ic svg { width: 19px; height: 19px; }
.ch-ic img { width: 100%; height: 100%; object-fit: cover; }
.ch-ic.messenger { background: linear-gradient(135deg, #0a7cff, #a033ff); }
.ch-ic.instagram { background: linear-gradient(135deg, #feda75, #d62976 55%, #4f5bd5); }
.ch-ic.whatsapp { background: #25d366; }
.ch-field { display: flex; flex-direction: column; gap: 3px; }
.ch-field .select { min-width: 200px; }
.ch-pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.ch-pick:hover { border-color: var(--brand); }
.ch-notes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.ch-setup { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ch-setup li { display: flex; align-items: center; gap: 10px; }
.conv-av { position: relative; flex-shrink: 0; }
.conv-channel { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 2px solid var(--surface); }
.conv-channel svg { width: 9px; height: 9px; }
.conv-channel.messenger { background: #0a7cff; }
.conv-channel.instagram { background: #d62976; }
.conv-channel.whatsapp { background: #25d366; }
.conv-channel.email { background: #ea580c; }
.conv-channel.site { background: #0d9488; }
.conv-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.conv-status { font-size: 10.5px; font-weight: 600; margin-left: 4px; opacity: .85; }
.conv-status.read { color: #2563eb; opacity: 1; }
.conv-status.failed { color: var(--bad); opacity: 1; }
.conv-status.queued, .conv-status.sending { font-style: italic; }
.conv-failed { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); font-size: 12px; }
.conv-failed svg { width: 14px; height: 14px; }
.conv-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.conv-img { max-width: 220px; max-height: 220px; border-radius: 10px; display: block; }
.conv-window, .conv-ai { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.conv-window svg, .conv-ai svg { width: 14px; height: 14px; flex-shrink: 0; }
.conv-window.closed { color: var(--warn); }
.conv-ai .btn { margin-left: auto; }
.channel-composer { align-items: flex-end; }
.conv-tpl { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; white-space: pre-wrap; }
@media (max-width: 720px) {
  .ch-field .select { min-width: 0; width: 100%; }
  .ch-field { flex: 1 1 100%; }
  .channel-composer { flex-wrap: wrap; }
}
/* The message on its own full-width row; attach and Suggest below it, Send on the right. */
.channel-composer { flex-wrap: wrap; align-items: center; }
.channel-composer > .grow { flex: 1 1 100%; order: -1; min-width: 0; }
.channel-composer textarea { width: 100%; }
.channel-composer > button[type=submit] { margin-left: auto; }
.conv-filters { flex-wrap: wrap; }
.conv-filters > .select { flex: 1 1 120px; min-width: 0; }
/* Channel icons above the conversation list (All, Website, Messenger, Instagram, WhatsApp). */
.conv-channels { display: flex; gap: 8px; flex-wrap: wrap; }
.conv-ch { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: border-color .15s, background .15s, color .15s, box-shadow .15s; }
.conv-ch svg { width: 18px; height: 18px; }
.conv-ch:hover { border-color: var(--border-strong); color: var(--text); }
.conv-ch:focus-visible { outline: none; box-shadow: var(--ring); }
.conv-ch.active { color: #fff; border-color: transparent; box-shadow: 0 4px 12px -4px rgba(15, 23, 42, .35); }
.conv-ch.all.active { background: var(--brand); }
.conv-ch.web.active { background: #475569; }
.conv-ch.messenger.active { background: linear-gradient(135deg, #0a7cff, #a033ff); }
.conv-ch.instagram.active { background: linear-gradient(135deg, #feda75, #d62976 55%, #4f5bd5); }
.conv-ch.whatsapp.active { background: #25d366; }
.conv-ch.email.active { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.conv-ch.site.active { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.conv-ch:not(.active).messenger svg { color: #0a7cff; }
.conv-ch:not(.active).instagram svg { color: #d62976; }
.conv-ch:not(.active).whatsapp svg { color: #1fa855; }
.conv-ch:not(.active).email svg { color: #ea580c; }
.split-detail .mail-thread { flex: 1; }
.conv-ch-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

/* Super Admin → Settings: Messenger, Instagram & WhatsApp switch */
.omni-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.omni-mode { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.omni-mode input { position: absolute; opacity: 0; pointer-events: none; }
.omni-mode:hover { border-color: var(--border-strong); }
.omni-mode.active { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand) inset; }
.omni-mode:focus-within { box-shadow: var(--ring); }
@media (max-width: 760px) { .omni-modes { grid-template-columns: minmax(0, 1fr); } }

/* Website Crawler: secure browser panel (verification step) */
.grid-side.verify-open { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); }
.verify-panel h3 { display: flex; align-items: center; gap: 8px; }
.verify-panel h3 svg { width: 18px; height: 18px; color: var(--brand); }
.verify-bar { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.verify-addr { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); padding: 0 8px; }
.verify-screen { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f1f5f9; aspect-ratio: 16 / 10; outline: none; }
.verify-screen:focus-visible { box-shadow: var(--ring); }
.verify-screen img { display: block; width: 100%; height: 100%; object-fit: contain; cursor: pointer; user-select: none; }
@media (max-width: 1100px) { .grid-side.verify-open { grid-template-columns: minmax(0, 1fr); } }

/* Conversations: products the chatbot recommended */
.conv-products { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.conv-product { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; font-size: 12.5px; min-width: 0; }
.conv-product:hover { border-color: var(--border-strong); text-decoration: none; }
.conv-product img, .conv-product svg { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.conv-product b { margin-left: auto; flex-shrink: 0; }

/* Website Crawler: WordPress website card */
.wp-option { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.wp-key { padding: 10px; border-radius: 10px; background: var(--brand-50); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.wp-highlight { border-color: color-mix(in srgb, var(--brand) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }

.btn-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* The page area is focused after each page change (for screen readers); no visible ring around it. */
.content:focus, .content:focus-visible { outline: none; box-shadow: none; }

/* ---- Website Crawler: one screen ------------------------------------------------------------------
   A compact import bar, then three cards of the same height (crawl status, online store, WordPress),
   each with a header, a body that scrolls if it must, and its actions pinned at the bottom. */
.kc { display: flex; flex-direction: column; gap: 16px; }
.kc-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: center; padding: 18px 20px; }
.kc-hero-text { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.kc-hero-text h3 { margin: 0; font-size: 16px; }
.kc-hero-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.kc-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.kc-ic svg { width: 18px; height: 18px; }
.kc-url { display: flex; gap: 8px; align-items: center; min-width: 0; }
.kc-url .input-group { flex: 1; min-width: 0; }
.kc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; height: var(--kc-h, 460px); }
.kc-verify:empty { display: none; }
.kc-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kc-grid > div { min-height: 0; display: flex; }
.kc-card { display: flex; flex-direction: column; padding: 0; width: 100%; min-height: 0; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.kc-card:hover { border-color: var(--border-strong); }
.kc-card.attn { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
.kc-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.kc-head h4 { margin: 0; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-head .sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.kc-head .grow { min-width: 0; }
.kc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 18px 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.kc-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.kc-foot .push { margin-left: auto; }
.kc-stats { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 8px; }
.kc-stats > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kc-stats span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-stats b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -0.01em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-stats b.sm { font-size: 14px; margin-top: 6px; }
.kc-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); }
.kc-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.kc-note b { display: block; font-size: 13px; }
.kc-note.good { background: var(--good-bg); border-color: transparent; } .kc-note.good svg { color: var(--good); }
.kc-note.warn { background: var(--warn-bg); border-color: transparent; } .kc-note.warn svg { color: var(--warn); }
.kc-note.bad { background: var(--bad-bg); border-color: transparent; } .kc-note.bad svg { color: var(--bad); }
.kc-note.info { background: var(--info-bg); border-color: transparent; } .kc-note.info svg { color: var(--brand); }
.kc-note .act { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.kc-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.kc-switch b { font-size: 13px; display: block; }
.kc-switch span.tiny { display: block; color: var(--muted); }
.kc-opt { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.kc-opt h5 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kc-opt p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.kc-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.kc-empty .kc-ic { width: 46px; height: 46px; border-radius: 14px; }
.kc-progress { display: flex; flex-direction: column; gap: 10px; }
.kc-progress .now { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-recent { display: flex; flex-direction: column; gap: 2px; }
.kc-recent > span { margin-bottom: 4px; }
.kc-recent a { display: flex; gap: 8px; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.kc-recent a:hover { background: var(--surface-2); color: var(--text); }
.kc-recent svg { width: 13px; height: 13px; color: var(--muted); flex-shrink: 0; }
.kc-pages a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; font-size: 13px; color: var(--text); }
.kc-pages a:hover { background: var(--surface-2); }
.kc-pages svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 1180px) { .kc-hero { grid-template-columns: minmax(0, 1fr); gap: 12px; } }
@media (max-width: 1100px) { .kc-grid, .kc-grid.two { grid-template-columns: minmax(0, 1fr); height: auto; } .kc-body { overflow: visible; } }
@media (max-width: 560px) { .kc-url { flex-wrap: wrap; } .kc-url .input-group { flex-basis: 100%; } .kc-url > .btn { flex: 1; } }

/* Knowledge → Products: a click anywhere on a row selects it. */
.pick-row { cursor: pointer; transition: background .12s; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.picked { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.pick-row.picked td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* With the secure browser open the import bar sits in a narrow column: stack it. */
.verify-open .kc-hero { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.verify-open .kc-url { flex-wrap: wrap; }
.verify-open .kc-url .input-group { flex-basis: 100%; }

/* Floating "Test Chatbot" on every dashboard page (the chatbot picked in the top bar). */
.test-fab { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; background: var(--grad); color: #fff; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 38%, transparent), 0 2px 6px rgba(15, 23, 42, .18); transition: transform .18s var(--ease), box-shadow .18s; }
.test-fab svg { width: 18px; height: 18px; }
.test-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px color-mix(in srgb, var(--brand) 45%, transparent), 0 3px 8px rgba(15, 23, 42, .2); }
.test-fab:focus-visible { outline: none; box-shadow: var(--ring), 0 10px 28px color-mix(in srgb, var(--brand) 38%, transparent); }
.test-fab[hidden] { display: none; }
/* Toasts sit above it, and the page leaves room so it never covers the last buttons. */
.has-test-fab .toast-stack { bottom: 82px; }
.has-test-fab .content { padding-bottom: 84px; }
@media (max-width: 1024px) {
  /* Tablets and phones: a round icon. */
  .test-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; padding: 0; justify-content: center; }
  .test-fab span { display: none; }
  .test-fab svg { width: 22px; height: 22px; }
}
@media (max-width: 720px) {
  /* Phones: above the bottom navigation. */
  .test-fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .has-test-fab .toast-stack { bottom: calc(140px + env(safe-area-inset-bottom)); }
  .has-test-fab .content { padding-bottom: 150px; }
}

/* Conversations on desktop: the inbox fills the screen; the list, the messages and the details scroll inside it. */
@media (min-width: 1101px) {
  .conv-split { height: var(--split-h, calc(100vh - 230px)); min-height: 0; }
  .conv-split .split-list { min-height: 0; }
  .conv-split .split-list .items { max-height: none; min-height: 0; }
  .conv-split .split-detail { min-height: 0; overflow: hidden; }
  .conv-split .split-detail > .grid-side { min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .conv-split .transcript-col { min-height: 0; }
  .conv-split .transcript { max-height: none; min-height: 0; }
  .conv-split .split-detail > .grid-side > div:last-child { overflow-y: auto; min-height: 0; }
  .conv-split .mail-messages { max-height: none; }
}
@media (min-width: 1101px) { .conv-split .mail-thread { height: 100%; min-height: 0; } }

/* Live chat reviews in Conversations. */
.rating-badge { color: #b45309; background: color-mix(in srgb, #f59e0b 14%, var(--surface)); letter-spacing: 1px; }
.review-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.review-box .stars { color: #f59e0b; font-size: 17px; letter-spacing: 2px; }

/* Super Admin → Website. */
.type-preview { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; background: #fff; color: #0b1220; font-family: Inter, system-ui, sans-serif; max-height: 420px; overflow: auto; }
.type-preview h1, .type-preview h2, .type-preview h3, .type-preview h4, .type-preview h5, .type-preview h6 { font-family: "Inter Tight", Inter, system-ui, sans-serif; letter-spacing: -0.02em; }
.type-preview p { color: #475467; line-height: 1.6; }
.post-thumb { width: 64px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--border); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb svg { width: 18px; height: 18px; color: var(--muted); }
.post-preview { border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; min-height: 420px; background: var(--surface); line-height: 1.7; }
.post-preview img { max-width: 100%; border-radius: 10px; }
.unread-card { border-left: 3px solid var(--brand); }
.input-group .input-addon { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-size: 13.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.input-group .input-addon + .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* The dark mode logo (Branding): shown instead of the logo whenever the page is dark. */
.logo-mark.has-logo img.lm-dark { display: none; }
/* A light logo on the default white tile would vanish, so in dark mode the tile steps back. */
:root[data-theme="dark"] .logo-mark.has-dark.has-logo.has-logo[data-place] { --logo-bg: transparent; --logo-shadow: none; }
:root[data-theme="dark"] .logo-mark.has-dark img.lm-light { display: none; }
:root[data-theme="dark"] .logo-mark.has-dark img.lm-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-mark.has-dark.has-logo.has-logo[data-place] { --logo-bg: transparent; --logo-shadow: none; }
  :root:not([data-theme="light"]) .logo-mark.has-dark img.lm-light { display: none; }
  :root:not([data-theme="light"]) .logo-mark.has-dark img.lm-dark { display: block; }
}
.image-pick .thumb.dark-thumb { background: #0b1220; border-color: #1f2a44; color: #8b98ad; }
/* The sign-in pages' brand panel is always dark: it always uses the dark mode logo. */
.auth-visual .logo-mark.has-dark.has-logo.has-logo[data-place] { --logo-bg: transparent; --logo-shadow: none; }
.auth-visual .logo-mark.has-dark img.lm-light { display: none; }
.auth-visual .logo-mark.has-dark img.lm-dark { display: block; }

/* Website Settings → Announcement bar */
.ann-row { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface-2, var(--surface)); }
.ann-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ann-row-head .btn { padding-inline: 8px; }
.ann-preview { display: grid; gap: 6px; }
.ann-preview-bar { background: var(--ann-background, #0b1220); color: var(--ann-text, rgba(255,255,255,.85)); border-radius: 10px; overflow: hidden; font-size: var(--ann-size, 13px); }
.ann-preview-track { display: flex; width: max-content; gap: 48px; padding: 9px 16px; animation: ann-preview 18s linear infinite; }
.ann-preview-bar:hover .ann-preview-track { animation-play-state: paused; }
.ann-preview-item { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.ann-preview-item .pill { background: var(--ann-badge, var(--brand)); color: var(--ann-badgeText, #fff); font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.ann-preview-item u { color: var(--ann-link, #fff); font-weight: 600; text-decoration: none; }
@keyframes ann-preview { from { transform: translateX(40%); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ann-preview-track { animation: none; flex-wrap: wrap; width: auto; } }

/* Fields that wrap instead of scrolling sideways (core/fields.js) */
.input.autogrow, .textarea.autogrow { height: auto; min-height: 42px; padding: 10px 13px; line-height: 1.45; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; display: block; }
.textarea.autogrow { min-height: 64px; }

/* Keywords as capsules, inside one field that wraps onto new lines */
.tags-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; width: 100%; padding: 6px 8px; box-sizing: border-box;
  border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface); cursor: text; transition: border-color .15s, box-shadow .15s;
}
.tags-field:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border-strong)); }
.tags-field:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.tags-field.full { border-color: var(--bad); animation: tags-shake .3s; }
@keyframes tags-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 4px 4px 11px; border-radius: 999px;
  background: var(--grad, linear-gradient(135deg, var(--brand), var(--accent))); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.3;
  box-shadow: 0 4px 10px -6px color-mix(in srgb, var(--brand) 70%, transparent); overflow-wrap: anywhere;
}
.tag-x { display: grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0; border: 0; border-radius: 50%; padding: 0; cursor: pointer; background: rgba(255,255,255,.22); color: #fff; }
.tag-x:hover { background: rgba(255,255,255,.4); }
.tag-x svg { width: 11px; height: 11px; stroke-width: 2.6; }
.tags-entry { flex: 1 1 140px; min-width: 120px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; padding: 5px 4px; }

/* Sign up and log in before the script draws them (search engines read this). */
.auth-prerender { max-width: 560px; margin: 12vh auto 0; padding: 0 20px; text-align: center; color: var(--text-2, #475467); font: 15px/1.6 Inter, system-ui, sans-serif; }
/* With scripts on, the form replaces it in a moment: don't flash the plain text first. */
.js .auth-prerender { visibility: hidden; }
.auth-prerender h1 { font-size: 28px; line-height: 1.2; color: var(--text, #0b1220); margin: 0 0 12px; }

/* Website questions in the inbox: the reply box under the question */
.site-reply { display: grid; gap: 8px; padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.ann-style { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.ann-style summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.ann-style summary svg { width: 15px; height: 15px; vertical-align: -2px; }

/* Contacts: how each person reached the business */
.cat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: color-mix(in srgb, var(--cat, #64748b) 12%, transparent); color: color-mix(in srgb, var(--cat, #64748b) 80%, var(--text)); border: 1px solid color-mix(in srgb, var(--cat, #64748b) 25%, transparent); }
.cat-chip svg { width: 12px; height: 12px; }
.cat-chip.blue { --cat: #2563eb; } .cat-chip.green { --cat: #16a34a; } .cat-chip.red { --cat: #dc2626; } .cat-chip.cyan { --cat: #0891b2; }
.cat-chip.orange { --cat: #ea580c; } .cat-chip.violet { --cat: #7c3aed; } .cat-chip.teal { --cat: #0d9488; }
.feed-ic.tone-orange { background: color-mix(in srgb, #ea580c 14%, transparent); color: #ea580c; }
.feed-ic.tone-teal { background: color-mix(in srgb, #0d9488 14%, transparent); color: #0d9488; }
.site-q .bubble .by { display: block; margin-bottom: 4px; }
.site-q .bubble { white-space: pre-wrap; }
.tags-field.plain .tag-chip { text-transform: none; letter-spacing: 0; font-weight: 600; }
