/* ════════════════════════════════════════════════════════════════
   Chatbly — design system. Dark sidebar + light content, glassy chatbot
   preview, sh-* form controls. Shared by the dashboard, admin, and auth.
   ════════════════════════════════════════════════════════════════ */
:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-rgb: 124, 58, 237;
  --ink: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e5e7eb;
  --bg: #f4f4f6;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.12), 0 2px 8px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, 0.22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ── App shell ── */
.cb-app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: #09090b; display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 50; border-right: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-brand { display: flex; align-items: center; padding: 0 18px; height: 60px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.sidebar-brand img { width: 86px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #52525b; padding: 14px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: #a1a1aa; background: transparent; border: none; cursor: pointer;
  text-align: left; transition: color 0.15s, background 0.15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-item.active { color: #fff; background: rgba(124, 58, 237, 0.28); }
.nav-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sf-info { flex: 1; min-width: 0; }
.sf-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-sub { font-size: 10.5px; color: #71717a; text-transform: capitalize; }
.icon-btn { background: none; border: none; color: #71717a; cursor: pointer; padding: 6px; border-radius: 7px; transition: color 0.15s, background 0.15s; display: flex; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.icon-btn svg { width: 17px; height: 17px; }

.main { margin-left: 232px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 40; }
.topbar h1 { font-size: 15px; font-weight: 700; }
.topbar .sub { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.content { padding: 26px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ── Cards / panels ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.panel { display: none; }
.panel.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 14px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

/* ── Buttons ── */
.sh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s; white-space: nowrap;
}
.sh-btn svg { width: 15px; height: 15px; }
.sh-btn:hover { background: #f9fafb; }
.sh-btn:active { transform: translateY(1px); }
.sh-btn:disabled { opacity: 0.55; cursor: default; }
.sh-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(var(--primary-rgb), 0.6); }
.sh-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.sh-btn-destructive { background: #fff; border-color: #fecaca; color: var(--danger); }
.sh-btn-destructive:hover { background: #fef2f2; }
.sh-btn-ghost { background: transparent; border-color: transparent; }
.sh-btn-ghost:hover { background: #f3f4f6; }
.sh-btn-sm { padding: 6px 11px; font-size: 12px; }
.sh-btn-lg { padding: 12px 22px; font-size: 14px; }

/* ── Form controls ── */
.field { margin-bottom: 16px; }
.field label, .sh-label { display: block; font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.sh-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 5px; }
.sh-input, .sh-select, textarea.sh-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sh-input:focus, .sh-select:focus, textarea.sh-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12); }
textarea.sh-input { resize: vertical; line-height: 1.55; }
.sh-input-row { display: flex; gap: 8px; }
.sh-input-row .sh-input { flex: 1; }
.color-input { width: 46px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: #fff; }

/* Toggle switch */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { width: 40px; height: 23px; border-radius: 999px; background: #d1d5db; transition: background 0.2s; flex-shrink: 0; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.2s; }
.toggle input:checked + .track { background: var(--primary); }
.toggle input:checked + .track::after { transform: translateX(17px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tr-title { font-size: 13.5px; font-weight: 600; }
.toggle-row .tr-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-violet { background: rgba(var(--primary-rgb), 0.12); color: var(--primary-dark); }
.dot { width: 7px; height: 7px; border-radius: 50%; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 14px; border-bottom: 1px solid #f1f1f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fafafa; }
.table .row-unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table tr.unread td { background: rgba(var(--primary-rgb), 0.04); }
.table tr.unread:hover td { background: rgba(var(--primary-rgb), 0.07); }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ── Leads ── */
.leads-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.leads-toolbar .search { position: relative; flex: 1; min-width: 220px; }
.leads-toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.leads-toolbar .search input { padding-left: 34px; }
.lead-name-cell { display: flex; align-items: center; gap: 11px; }
.lead-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; background: linear-gradient(135deg, var(--primary), #9333ea); box-shadow: 0 4px 10px -3px rgba(var(--primary-rgb), 0.5); }
.lead-name { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.new-pill { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #fff; background: var(--primary); padding: 2px 7px; border-radius: 999px; }
.contact-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.contact-line + .contact-line { margin-top: 4px; }
.contact-line svg { width: 13px; height: 13px; color: var(--muted-2); flex-shrink: 0; }
.lead-msg { max-width: 300px; color: var(--muted); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Bot grid ── */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.bot-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.18s; cursor: pointer; display: flex; flex-direction: column; gap: 12px; }
.bot-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.bot-card-head { display: flex; align-items: center; gap: 12px; }
.bot-avatar { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; flex-shrink: 0; overflow: hidden; }
.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bot-card-title { font-size: 15px; font-weight: 700; }
.bot-card-sub { font-size: 12px; color: var(--muted); }
.bot-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.bot-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.bot-new { border: 2px dashed var(--line); background: #fcfcfd; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 168px; color: var(--muted); font-weight: 600; }
.bot-new:hover { border-color: var(--primary); color: var(--primary); }
.bot-new svg { width: 26px; height: 26px; }

/* ── Customizer layout ── */
.cz-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.cz-preview-col { position: sticky; top: 86px; }
@media (max-width: 1080px) { .cz-layout { grid-template-columns: 1fr; } .cz-preview-col { position: static; } }
.cz-block { margin-bottom: 22px; }
.cz-block-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* Avatar picker */
.avatar-pick { display: flex; align-items: center; gap: 14px; }
.avatar-thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; overflow: hidden; flex-shrink: 0; }
.avatar-thumb img { width: 100%; height: 100%; object-fit: cover; }
.avatar-thumb svg { width: 26px; height: 26px; }

/* Knowledge / FAQ / files */
.kb-list { display: flex; flex-direction: column; gap: 8px; }
.kb-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fcfcfd; font-size: 13px; }
.kb-item .kb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.kb-item .kb-meta { font-size: 11px; color: var(--muted-2); }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: #fcfcfd; }
.faq-item .sh-input { margin-bottom: 8px; }
.embed-box { background: #0b0f19; color: #e5e7eb; border-radius: var(--radius); padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; word-break: break-all; position: relative; }
.embed-box code { color: #c4b5fd; }

/* ── Chatbot preview (cbprev) ── */
.cbprev-wrap { background: linear-gradient(160deg, #eef2ff, #faf5ff); border: 1px solid var(--line); border-radius: 18px; padding: 22px; position: relative; min-height: 460px; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 16px; overflow: hidden; }
.cbprev { --c: #7c3aed; --crgb: 124, 58, 237; width: 100%; }
.cbprev-window { background: rgba(255, 255, 255, 0.85); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; height: 410px; }
.cbprev-head { background: var(--c); color: #fff; padding: 13px 15px; display: flex; align-items: center; gap: 11px; }
.cbprev-av { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); border: 2px solid rgba(255, 255, 255, 0.4); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.cbprev-av img { width: 100%; height: 100%; object-fit: cover; }
.cbprev-av svg { width: 19px; height: 19px; }
.cbprev-meta { flex: 1; min-width: 0; }
.cbprev-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbprev-status { font-size: 10.5px; opacity: 0.9; display: flex; align-items: center; gap: 6px; }
.cbprev-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: cbprev-pulse 2s infinite; }
@keyframes cbprev-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); } 70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.cbprev-close { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s, transform 0.2s; }
.cbprev-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); }
.cbprev-close svg { width: 16px; height: 16px; }
.cbprev-body { flex: 1; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(241, 245, 249, 0.6)); overflow-y: auto; }
.cbprev-row { display: flex; gap: 7px; align-items: flex-end; max-width: 88%; }
.cbprev-row.user { align-self: flex-end; flex-direction: row-reverse; }
.cbprev-mav { width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.cbprev-mav img { width: 100%; height: 100%; object-fit: cover; }
.cbprev-mav svg { width: 13px; height: 13px; }
.cbprev-msg { padding: 9px 13px; border-radius: 15px; font-size: 13px; line-height: 1.45; background: #fff; border: 1px solid rgba(15, 23, 42, 0.07); color: #1f2937; border-bottom-left-radius: 4px; }
.cbprev-msg-user { background: var(--c); color: #fff; border: none; border-bottom-right-radius: 4px; border-bottom-left-radius: 15px; }
.cbprev-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 11px; }
.cbprev-chips:empty { display: none; }
.cbprev-chip { max-width: 100%; border: 1px solid rgba(var(--crgb), 0.4); background: #fff; color: var(--c); font-size: 13px; font-weight: 500; line-height: 1.15; text-align: left; padding: 9px 14px; border-radius: 999px; }
.cbprev-input { display: flex; gap: 7px; padding: 11px; border-top: 1px solid rgba(15, 23, 42, 0.07); background: rgba(255, 255, 255, 0.7); align-items: center; }
.cbprev-input-box { flex: 1; font-size: 12.5px; color: var(--muted-2); padding: 9px 12px; border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 11px; background: #fff; }
.cbprev-send { width: 38px; height: 36px; border-radius: 11px; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cbprev-send svg { width: 16px; height: 16px; }
.cbprev-foot { text-align: center; font-size: 10px; color: rgba(15, 23, 42, 0.4); padding: 7px 0 9px; background: rgba(255, 255, 255, 0.65); }
.cbprev-foot a { color: inherit; text-decoration: none; }
.cbprev-toggle { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 28px -6px rgba(var(--crgb), 0.55); overflow: hidden; }
.cbprev-toggle img { width: 100%; height: 100%; object-fit: cover; }
.cbprev-toggle svg { width: 25px; height: 25px; }

/* Subscription plan cards (profile) */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.plan-card.plan-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.plan-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.plan-price { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.plan-per { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.plan-feats li { font-size: 13px; color: var(--muted); padding-left: 20px; position: relative; }
.plan-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.plan-card .sh-btn, .plan-card .badge { align-self: flex-start; }

/* Product carousel — shared by the customizer preview + playground */
.cbprev-carousel { display: flex; gap: 9px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x mandatory; max-width: 100%; }
.cbprev-carousel::-webkit-scrollbar { height: 5px; }
.cbprev-carousel::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); border-radius: 3px; }
.cbprev-card { flex: 0 0 132px; scroll-snap-align: start; background: #fff; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 13px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.cbprev-card-img { height: 92px; background-size: cover; background-position: center; background-color: #f1f5f9; }
.cbprev-card-noimg { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.cbprev-card-body { padding: 8px 9px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cbprev-card-title { font-size: 11.5px; font-weight: 600; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cbprev-card-price { font-size: 12px; font-weight: 700; color: var(--c, var(--primary)); }
.cbprev-card-btn { margin-top: auto; display: flex; align-items: center; justify-content: center; background: var(--c, var(--primary)); color: #fff; text-decoration: none; font-size: 11px; font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.pg-carousel { margin-top: 8px; --c: var(--pg); }
.pg-chip { cursor: pointer; font-family: inherit; transition: background 0.15s, transform 0.12s; }
.pg-chip:hover { background: rgba(var(--crgb, 124, 58, 237), 0.07); transform: translateY(-1px); }
/* Product list thumbnails in the customizer */
.prod-thumb { width: 30px; height: 30px; border-radius: 6px; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #f1f5f9; font-size: 15px; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Conversations inbox (two-pane: list left, transcript right) ── */
.cv-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.cv-filters .sh-btn { height: 39px; }
.cv-filters input[type="date"] { min-width: 150px; }
.conv-inbox { display: grid; grid-template-columns: 344px 1fr; min-height: 560px; padding: 0; overflow: hidden; }
.conv-pane-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; }
.conv-list-head { padding: 12px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(6px); z-index: 1; }
.conv-list-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 64px 18px; color: var(--muted-2); text-align: center; }
.conv-list-empty svg { width: 30px; height: 30px; opacity: 0.4; }
.conv-item { display: flex; gap: 11px; padding: 13px 16px; border-bottom: 1px solid #f1f1f4; cursor: pointer; transition: background 0.12s; }
.conv-item:hover { background: #fafafa; }
.conv-item.sel { background: rgba(var(--primary-rgb), 0.07); box-shadow: inset 3px 0 0 var(--primary); }
.ci-av, .cvh-av { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, var(--primary), #9333ea); box-shadow: 0 4px 10px -3px rgba(var(--primary-rgb), 0.5); }
.ci-av svg, .cvh-av svg { width: 17px; height: 17px; }
.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ci-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 11px; color: var(--muted-2); flex-shrink: 0; }
.ci-snippet { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.ci-meta { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.ci-count { font-size: 11px; color: var(--muted-2); }
.conv-pane-view { display: flex; flex-direction: column; max-height: 72vh; min-height: 0; }
.conv-view-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted-2); padding: 40px; text-align: center; }
.conv-view-empty svg { width: 34px; height: 34px; opacity: 0.35; }
.conv-view-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.conv-view-title { font-weight: 700; font-size: 14px; }
.conv-view-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.conv-view-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #fbfaff, #f5f6fb); }
.tr-back { display: none; padding: 5px 9px; }
.tr-msg { max-width: 78%; padding: 10px 14px; border-radius: 15px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-sm); }
.tr-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.tr-msg.bot { align-self: flex-start; background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
@media (max-width: 900px) {
  .conv-inbox { grid-template-columns: 1fr; }
  .conv-pane-list { border-right: none; max-height: 70vh; }
  .conv-pane-view { display: none; }
  .conv-inbox.show-view .conv-pane-list { display: none; }
  .conv-inbox.show-view .conv-pane-view { display: flex; max-height: 78vh; }
  .tr-back { display: inline-flex; }
}

/* ── Playground (test chat) ── */
.pg-chat { --pg: #7c3aed; display: flex; flex-direction: column; height: 600px; max-height: 72vh; overflow: hidden; padding: 0; }
.pg-head { display: flex; align-items: center; gap: 11px; padding: 13px 18px; background: var(--pg); color: #fff; }
.pg-hav { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); border: 2px solid rgba(255, 255, 255, 0.4); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.pg-hav img { width: 100%; height: 100%; object-fit: cover; }
.pg-hav svg { width: 18px; height: 18px; }
.pg-hname { font-weight: 700; font-size: 14px; }
.pg-hstatus { font-size: 11px; opacity: 0.92; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.pg-hstatus::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: cbprev-pulse 2s infinite; }
.pg-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(180deg, #fbfaff, #f5f6fb); }
.pg-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 90%; }
.pg-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.pg-msg.bot { align-self: flex-start; }
.pg-mav { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; background: var(--pg); color: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pg-mav img { width: 100%; height: 100%; object-fit: cover; }
.pg-mav svg { width: 14px; height: 14px; }
.pg-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-wrap: break-word; word-break: break-word; }
.pg-msg.bot .pg-bubble { background: #fff; border: 1px solid rgba(15, 23, 42, 0.07); color: #1f2937; border-bottom-left-radius: 5px; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05); }
.pg-msg.user .pg-bubble { background: var(--pg); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 6px 16px -4px rgba(var(--pg-rgb, 124, 58, 237), 0.45); }
.pg-bubble p { margin: 0 0 8px; }
.pg-bubble p:last-child { margin-bottom: 0; }
.pg-bubble strong { font-weight: 700; }
.pg-bubble em { font-style: italic; }
.pg-bubble a { color: var(--pg); text-decoration: underline; word-break: break-word; }
.pg-msg.user .pg-bubble a { color: #fff; }
.pg-bubble ul { list-style: disc outside; margin: 4px 0 8px; padding-left: 22px; }
.pg-bubble ol { list-style: decimal outside; margin: 4px 0 8px; padding-left: 22px; }
.pg-bubble li { margin-bottom: 3px; display: list-item; }
.pg-bubble code { background: rgba(15, 23, 42, 0.06); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }
.pg-lead-note { font-size: 11px; font-weight: 600; color: var(--ok); margin-top: 5px; padding-left: 4px; }
.pg-typing { display: flex; gap: 4px; align-items: center; }
.pg-typing span { width: 7px; height: 7px; border-radius: 50%; background: rgba(15, 23, 42, 0.3); animation: pg-bounce 1.2s infinite; }
.pg-typing span:nth-child(2) { animation-delay: 0.15s; }
.pg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pg-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }
.pg-foot { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.pg-foot .sh-input { flex: 1; }

/* ── Empty / loading ── */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: flex; align-items: center; justify-content: center; padding: 60px; }
.spa-loading { flex: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.spa-loading .spinner { width: 30px; height: 30px; }

/* ── Notifications dropdown ── */
.notif-wrap { position: relative; }
.notif-btn { position: relative; background: none; border: none; cursor: pointer; padding: 7px; border-radius: 8px; color: var(--muted); }
.notif-btn:hover { background: #f3f4f6; color: var(--ink); }
.notif-btn svg { width: 19px; height: 19px; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; background: var(--danger); border-radius: 8px; font-size: 9px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; padding: 0 3px; }
.notif-dropdown { position: absolute; top: 100%; right: 0; margin-top: 8px; width: 360px; max-width: 90vw; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid #f1f1f4; font-size: 13px; }
.notif-item.unread { background: rgba(var(--primary-rgb), 0.04); }
.notif-item .ni-time { font-size: 11px; color: var(--muted-2); margin-top: 3px; }

/* ── Auth screens ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, rgba(var(--primary-rgb), 0.12), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 34px 30px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-brand img { width: 112px; }
.auth-title { font-size: 21px; font-weight: 800; text-align: center; letter-spacing: -0.02em; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.auth-card .sh-btn-primary { width: 100%; padding: 12px; margin-top: 4px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.auth-foot a { color: var(--primary); font-weight: 600; }
.auth-tabs { display: flex; background: #f3f4f6; border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tab { flex: 1; padding: 9px; border: none; background: none; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── Alerts / toast ── */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 4000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #09090b; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in 0.25s ease; }
.toast.ok { background: #15803d; } .toast.err { background: #b91c1c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 3000; padding: 20px; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; animation: fade 0.2s ease; }
.modal.lg { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ── Subscribe banner ── */
.subscribe-banner { background: linear-gradient(120deg, var(--primary), #9333ea); color: #fff; border-radius: var(--radius); padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; box-shadow: var(--shadow-md); }
.subscribe-banner h3 { font-size: 16px; font-weight: 700; }
.subscribe-banner p { font-size: 13px; opacity: 0.92; margin-top: 3px; }
.subscribe-banner .sh-btn { background: #fff; color: var(--primary-dark); border-color: #fff; flex-shrink: 0; }

/* Stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .sv { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat .sl { font-size: 12px; color: var(--muted); margin-top: 2px; }

.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.wfull { width: 100%; }

/* ── Support tickets ── */
.empty-tickets svg { display: block; margin-left: auto; margin-right: auto; margin-bottom: 20px; }
.tk-subject { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tk-last { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-thread { display: flex; flex-direction: column; overflow: hidden; }
.tk-thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.tk-thread-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.tk-controls { display: flex; align-items: flex-end; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafafb; }
.tk-controls .sh-select { min-width: 130px; }
.tk-thread-body { display: flex; flex-direction: column; gap: 14px; padding: 18px; max-height: 52vh; overflow-y: auto; background: linear-gradient(180deg, #fbfaff, #f5f6fb); }
.tk-msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.tk-msg.mine { align-self: flex-end; align-items: flex-end; }
.tk-msg.staff { align-self: flex-start; align-items: flex-start; }
.tk-msg-author { font-size: 11px; color: var(--muted); padding: 0 4px; }
.tk-bubble { padding: 10px 14px; border-radius: 15px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-sm); }
.tk-msg.mine .tk-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.tk-msg.staff .tk-bubble { background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.tk-thread-foot { padding: 14px 18px; border-top: 1px solid var(--line); }
.tk-closed-note { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--muted); font-size: 13px; }
.tk-inline-check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .content { padding: 18px; }
  .tk-last { max-width: 200px; }
  .tk-msg { max-width: 92%; }
}
