/* ============================================================
   Explisium AI — Design System
   Premium SaaS. Mobile-first. Light + dark themes.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;

  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --violet-500: #8b5cf6;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --sky-500: #0ea5e9;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, .08), 0 8px 8px -4px rgba(16, 24, 40, .03);

  --sidebar-w: 264px;
  --topbar-h: 64px;

  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e9ecf5;
  --border: #e4e7ef;
  --border-strong: #d3d8e6;
  --text: #0f172a;
  --text-2: #475069;
  --text-3: #6b7488;
  --text-inverse: #ffffff;
  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft: var(--brand-50);
  --success: var(--emerald-600);
  --success-soft: #e7f7f0;
  --warning: #b45309;
  --warning-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info-soft: #e6f4fd;
  --ring: rgba(79, 70, 229, .35);
}

[data-theme='dark'] {
  --bg: #0b0d14;
  --surface: #141824;
  --surface-2: #1b2030;
  --surface-3: #232a3d;
  --border: #262d40;
  --border-strong: #333c54;
  --text: #f1f3f9;
  --text-2: #aab2c8;
  --text-3: #7b8399;
  --primary: var(--brand-500);
  --primary-hover: var(--brand-400);
  --primary-soft: #1e2340;
  --success-soft: #10281f;
  --warning-soft: #2b2110;
  --danger-soft: #2c1416;
  --info-soft: #0f2233;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, .5);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
input, textarea, select, button { font-size: 15px; }
h1, h2, h3, h4, h5 { margin: 0 0 .4em; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); padding: .12em .4em; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.flex { display: flex; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.semibold { font-weight: 600; }
.mono { font-family: var(--font-mono); }
.center-text { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer { cursor: pointer; }
.full { width: 100%; }
.caps { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 9px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: all .14s ease;
  white-space: nowrap; user-select: none; line-height: 1.2;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 24px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-icon { padding: 9px; width: 38px; height: 38px; }
.btn-icon.btn-sm { width: 32px; height: 32px; padding: 6px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.input, .textarea, .select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  transition: border-color .14s, box-shadow .14s; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 14px; }
.checkbox input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .18s; cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: var(--shadow-xs); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Cards / surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-hover { transition: transform .14s, box-shadow .14s, border-color .14s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-title h2, .section-title h3 { margin: 0; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); line-height: 1.5; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--sky-500); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.live { background: var(--emerald-500); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.dot.warn { background: var(--amber-500); }
.dot.err { background: var(--rose-500); }

/* ---------- Avatars ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; overflow: hidden; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
[data-theme='dark'] .avatar { background: var(--brand-800); color: var(--brand-100); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 200; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; animation: pop .18s ease; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 20px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 400; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 13px 15px; display: flex; gap: 10px; align-items: flex-start; animation: slidein .2s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast .t-title { font-weight: 600; font-size: 14px; }
.toast .t-body { font-size: 13px; color: var(--text-2); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }
@media (max-width: 520px) { .toast-wrap { left: 12px; right: 12px; top: 12px; max-width: none; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--text-3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty .icon { font-size: 34px; margin-bottom: 10px; opacity: .8; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--radius-sm); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.center-load { display: flex; align-items: center; justify-content: center; padding: 60px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--violet-500)); border-radius: 999px; transition: width .3s ease; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step-pip { flex: 1; min-width: 22px; height: 5px; border-radius: 999px; background: var(--surface-3); }
.step-pip.done { background: var(--primary); }
.step-pip.active { background: var(--brand-400); }

/* ============================================================
   Marketing
   ============================================================ */
.mk-nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.mk-nav .inner { max-width: 1160px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mk-links { display: flex; gap: 22px; align-items: center; }
.mk-links a { color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.mk-links a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 820px) { .mk-links .hide-sm { display: none; } }

.hero { max-width: 1160px; margin: 0 auto; padding: 76px 20px 40px; text-align: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 13px; margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); letter-spacing: -.03em; max-width: 900px; margin: 0 auto 18px; }
.hero p.lead { font-size: clamp(1rem, 2.4vw, 1.25rem); color: var(--text-2); max-width: 660px; margin: 0 auto 30px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.grad-text { background: linear-gradient(120deg, var(--brand-600), var(--violet-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-shot { max-width: 1080px; margin: 46px auto 0; border-radius: var(--radius-xl); border: 1px solid var(--border); box-shadow: var(--shadow-xl); overflow: hidden; background: var(--surface); }
.mk-section { max-width: 1160px; margin: 0 auto; padding: 64px 20px; }
.mk-section > .head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.mk-section > .head h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.price-card { position: relative; }
.price-card.pop { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.price-card .amt { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }
.price-card .amt span { font-size: .95rem; font-weight: 500; color: var(--text-3); }
.price-card ul { list-style: none; padding: 0; margin: 16px 0 0; }
.price-card li { padding: 7px 0; display: flex; gap: 9px; align-items: flex-start; font-size: 14px; border-bottom: 1px dashed var(--border); }
.price-card li:last-child { border-bottom: 0; }
.check { color: var(--success); font-weight: 700; }
.mk-foot { border-top: 1px solid var(--border); background: var(--surface); }
.mk-foot .inner { max-width: 1160px; margin: 0 auto; padding: 36px 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--text-3); font-size: 13.5px; }

/* ============================================================
   Auth
   ============================================================ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { background: linear-gradient(150deg, var(--brand-700), var(--brand-900) 60%, #1e1b4b); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.5), transparent 70%); bottom: -120px; right: -120px; }
.auth-aside h2 { font-size: 1.9rem; }
.auth-aside .brand { color: #fff; }
.auth-aside .brand .logo { background: #fff; border-radius: 10px; padding: 4px; box-sizing: border-box; }
.auth-aside .quote { font-size: 1.1rem; line-height: 1.6; opacity: .95; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.nav { padding: 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 8px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; font-size: 14px; cursor: pointer; margin-bottom: 2px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; flex: none; }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 700; background: var(--danger); color: #fff; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 40; }
.topbar .search { position: relative; flex: 1; max-width: 440px; }
.topbar .search input { padding-left: 38px; }
.topbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.content { padding: 24px; flex: 1; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; margin: 0; }
.page-head .sub { color: var(--text-3); font-size: 14px; margin-top: 3px; }

.bottom-nav { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 16px 14px 84px; }
  .topbar { padding: 0 14px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 62px; background: var(--surface); border-top: 1px solid var(--border); z-index: 60; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-3); font-size: 10.5px; font-weight: 600; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a .ico { font-size: 19px; }
}

/* ---------- Stat cards ---------- */
.stat { padding: 18px; }
.stat .label { font-size: 13px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; }
.stat .delta { font-size: 12.5px; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: 220px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark .bar { flex: 1; background: var(--brand-300); border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 10px; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .col .b { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); border-radius: 6px 6px 0 0; transition: height .4s ease; }
.bar-chart .col .lbl { font-size: 10.5px; color: var(--text-3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px 1fr 320px; height: calc(100vh - var(--topbar-h) - 48px); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.conv-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.conv-list .head { padding: 12px; border-bottom: 1px solid var(--border); }
.conv-list .scroll { overflow-y: auto; flex: 1; }
.conv-item { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 11px; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-soft); }
.conv-item .meta { min-width: 0; flex: 1; }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .name { font-weight: 600; font-size: 14px; }
.conv-item .time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.conv-item .preview { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; position: relative; box-shadow: var(--shadow-xs); }
.msg.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.out.human { background: var(--emerald-600); }
.msg .t { font-size: 10.5px; opacity: .7; margin-top: 4px; display: block; text-align: right; }
.msg .who { font-size: 11px; font-weight: 700; opacity: .85; margin-bottom: 2px; }
.chat-foot { padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-foot .row { display: flex; gap: 10px; align-items: flex-end; }
.chat-foot textarea { min-height: 42px; max-height: 140px; }
.chat-side { border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; }
@media (max-width: 1100px) { .inbox { grid-template-columns: 300px 1fr; } .chat-side { display: none; } }
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 100px); }
  .conv-list { display: none; }
  .inbox.show-list .conv-list { display: flex; }
  .inbox.show-list .chat { display: none; }
}
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { min-width: 240px; flex: 1; background: var(--surface-2); border-radius: var(--radius-lg); padding: 10px; }
.kcol .khead { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; font-weight: 700; font-size: 13px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 9px; cursor: grab; box-shadow: var(--shadow-xs); }
.kcard:hover { box-shadow: var(--shadow-sm); }
.kcard.dragging { opacity: .5; }
.kcol.dragover { outline: 2px dashed var(--primary); outline-offset: -4px; }

/* ---------- Misc ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 500; border: 1px solid transparent; cursor: pointer; }
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: var(--brand-200); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-3); }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius); font-size: 13.5px; }
.banner.info { background: var(--info-soft); color: var(--text); }
.banner.warn { background: var(--warning-soft); }
.banner.success { background: var(--success-soft); }
.banner.danger { background: var(--danger-soft); }
.banner .bi { font-size: 18px; flex: none; }
.avatar-upload { display: flex; align-items: center; gap: 16px; }
.otp-input { letter-spacing: .3em; text-align: center; font-size: 20px; font-weight: 700; }
.hero-mock { padding: 22px; }
.mock-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
.mock-bubble { padding: 8px 12px; border-radius: 12px; font-size: 13px; max-width: 70%; }
.mock-bubble.in { background: var(--surface-2); }
.mock-bubble.out { background: var(--primary); color: #fff; margin-left: auto; }

/* ---------- Extra utilities ---------- */
.mb-3 { margin-bottom: 12px; }
.ml-2 { margin-left: 8px; }
.mr-2 { margin-right: 8px; }
.table-wrap { overflow-x: auto; }

/* ---------- Onboarding wizard ---------- */
.onb-wrap { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.onb-head {
  display: flex; align-items: center; gap: 24px; padding: 16px 24px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.onb-head .brand { font-weight: 800; font-size: 18px; color: var(--text); display: flex; align-items: center; gap: 9px; text-decoration: none; }
.onb-head .brand .logo { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; }
.onb-progress { flex: 1; max-width: 420px; margin: 0 auto; }
.onb-progress .steps { margin-top: 6px; }
.onb-body { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.onb-title h1 { font-size: 1.7rem; margin-bottom: 4px; }
.onb-title .sub { margin-bottom: 22px; }
.onb-card { animation: onb-in .28s ease; }
@keyframes onb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.onb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 620px) {
  .onb-head { flex-wrap: wrap; gap: 12px; }
  .onb-progress { order: 3; flex-basis: 100%; max-width: none; }
  .onb-body { padding: 24px 16px 90px; }
  .onb-foot { flex-direction: column-reverse; }
  .onb-foot > * { width: 100%; }
  .onb-foot .flex { width: 100%; }
  .onb-foot .btn { flex: 1; }
}
