/* TeleMatrix design system */
:root {
  --brand: #10b981; --brand-600: #059669; --brand-700: #047857; --brand-50: #ecfdf5; --brand-100: #d1fae5;
  --accent: #6366f1;
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
  --border: #e5e7eb; --border-strong: #d1d5db;
  --text: #0f172a; --text-2: #475569; --muted: #94a3b8;
  --danger: #ef4444; --danger-50: #fef2f2; --warn: #f59e0b; --warn-50: #fffbeb; --info: #3b82f6; --info-50: #eff6ff;
  --sidebar: #0b1220; --sidebar-2: #111a2e; --sidebar-text: #cbd5e1; --sidebar-muted: #64748b;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --wa-bg: #efeae2; --wa-out: #d9fdd3; --wa-in: #ffffff; --wa-text: #111b21; --wa-meta: #667781;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --surface-3: #1e293b;
  --border: #1f2937; --border-strong: #334155;
  --text: #e5e7eb; --text-2: #94a3b8; --muted: #64748b;
  --brand-50: rgba(16, 185, 129, .12); --brand-100: rgba(16, 185, 129, .2);
  --danger-50: rgba(239, 68, 68, .12); --warn-50: rgba(245, 158, 11, .12); --info-50: rgba(59, 130, 246, .12);
  --sidebar: #070b14; --sidebar-2: #0f1626;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .3);
  --wa-bg: #0b141a; --wa-out: #005c4b; --wa-in: #202c33; --wa-text: #e9edef; --wa-meta: #8696a0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; } h2 { font-size: 18px; font-weight: 700; } h3 { font-size: 15px; font-weight: 650; } h4 { font-size: 13px; font-weight: 650; }
p { margin: 0 0 .75em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; line-height: 1.55; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .tiny { font-size: 11px; } .strong { font-weight: 600; }
.text-right { text-align: right; } .text-center { text-align: center; } .nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; align-items: center; gap: 8px; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; } .gap-2 { gap: 16px; } .items-start { align-items: flex-start; }
.hidden, [hidden] { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset: 0 auto 0 0; overflow-y: auto; display: flex; flex-direction: column; z-index: 40; padding: 14px 12px; scrollbar-width: thin; scrollbar-color: #1e293b transparent; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff !important; text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; display: inline-flex; }
.brand-text { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-muted); padding: 6px 10px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; text-decoration: none !important; transition: background .15s, color .15s; }
.nav-link .icon { width: 17px; height: 17px; opacity: .8; }
.nav-link:hover { background: var(--sidebar-2); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(16, 185, 129, .22), rgba(16, 185, 129, .06)); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav-link.active .icon { color: #34d399; opacity: 1; }
.nav-count { margin-left: auto; background: var(--brand); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--sidebar-muted); padding: 12px 10px 4px; }
.main { flex: 1; margin-left: 248px; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 30; }
.topbar-org { display: flex; align-items: center; gap: 10px; min-width: 0; }
.org-name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 10px; color: var(--text); font: inherit; }
.user-chip:hover { background: var(--surface-3); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta small { color: var(--text-2); font-size: 11.5px; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1440px; margin: 0 auto; }
.content-fluid { max-width: none; padding: 0; }
.only-mobile { display: none !important; }
.sidebar-backdrop { display: none; }
.i-sun { display: none; } [data-theme="dark"] .i-sun { display: inline; } [data-theme="dark"] .i-moon { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--text-2); }

/* ---------- cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--text-2); font-size: 12.5px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.cols-side-main { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.sticky { position: sticky; top: 80px; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-sm); }
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600); flex-shrink: 0; }
.stat-icon.blue { background: var(--info-50); color: var(--info); } .stat-icon.amber { background: var(--warn-50); color: var(--warn); } .stat-icon.red { background: var(--danger-50); color: var(--danger); } .stat-icon.violet { background: rgba(99, 102, 241, .12); color: var(--accent); }
.stat-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { color: var(--text-2); font-size: 12.5px; }
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(5, 150, 105, .3); }
.btn-primary:hover { background: var(--brand-600); }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-light:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-light { background: var(--danger-50); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.sm { width: 28px; height: 28px; }
.btn-icon.sm .icon { width: 15px; height: 15px; }
.inline { display: inline; }

/* ---------- forms ---------- */
label, .label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--text); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=search], input[type=date], input[type=time], input[type=datetime-local], input[type=color], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input[type=color] { padding: 3px; width: 56px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select[multiple] { height: auto; min-height: 110px; padding: 6px; background-image: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.hint { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.hint code { font-size: 11.5px; }
.req { color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; cursor: pointer; margin-bottom: 8px; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.input-group { display: flex; }
.input-group > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.input-addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 9px 0 0 9px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 38px; height: 22px; background: var(--border-strong); border-radius: 99px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch .slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(16, 185, 129, .25); }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; background: var(--surface-2); }
.fieldset-title { font-weight: 650; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.repeater-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.repeater-item > * { flex: 1; }
.repeater-item > .btn-icon { flex: 0 0 auto; }
.media-field { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 9px; background: var(--surface-2); min-height: 52px; }
.media-field .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; overflow: hidden; }
.media-field .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-field .name { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-sm td, .table-sm th { padding: 8px 12px; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-2); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.pagination .pages { display: flex; gap: 4px; }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge-green { background: #dcfce7; color: #15803d; } .badge-blue { background: #dbeafe; color: #1d4ed8; } .badge-teal { background: #ccfbf1; color: #0f766e; }
.badge-amber { background: #fef3c7; color: #b45309; } .badge-red { background: #fee2e2; color: #b91c1c; } .badge-gray { background: var(--surface-3); color: var(--text-2); } .badge-violet { background: #ede9fe; color: #6d28d9; }
[data-theme="dark"] .badge-green { background: rgba(34, 197, 94, .15); color: #4ade80; } [data-theme="dark"] .badge-blue { background: rgba(59, 130, 246, .15); color: #60a5fa; } [data-theme="dark"] .badge-teal { background: rgba(20, 184, 166, .15); color: #2dd4bf; }
[data-theme="dark"] .badge-amber { background: rgba(245, 158, 11, .15); color: #fbbf24; } [data-theme="dark"] .badge-red { background: rgba(239, 68, 68, .15); color: #f87171; } [data-theme="dark"] .badge-violet { background: rgba(139, 92, 246, .15); color: #a78bfa; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.tag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.green { background: #22c55e; } .dot.amber { background: #f59e0b; } .dot.red { background: #ef4444; }

/* ---------- alerts / toasts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.alert-danger { background: var(--danger-50); color: #b91c1c; border-color: rgba(239, 68, 68, .25); }
.alert-warn, .alert-warning { background: var(--warn-50); color: #b45309; border-color: rgba(245, 158, 11, .3); }
.alert-info { background: var(--info-50); color: #1d4ed8; border-color: rgba(59, 130, 246, .25); }
[data-theme="dark"] .alert-success { color: #6ee7b7; } [data-theme="dark"] .alert-danger { color: #fca5a5; } [data-theme="dark"] .alert-warn { color: #fcd34d; } [data-theme="dark"] .alert-info { color: #93c5fd; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 9px; align-items: center; animation: toastIn .25s ease; max-width: 380px; }
.toast.error { background: #b91c1c; } .toast.success { background: #047857; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- tabs / dropdown ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; text-decoration: none !important; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand); }
.tabs-sm { border: 0; margin: 0; background: var(--surface-3); border-radius: 9px; padding: 3px; }
.tabs-sm .tab { padding: 5px 11px; border: 0; border-radius: 7px; font-size: 12.5px; }
.tabs-sm .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented label { margin: 0; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.segmented input { display: none; }
.segmented input:checked + span { color: var(--text); }
.segmented label:has(input:checked) { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; display: none; z-index: 60; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; gap: 9px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { margin: 4px 0; }

/* ---------- modal ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); max-height: calc(100vh - 48px); }
dialog.modal-lg { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); position: sticky; bottom: 0; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty .empty-icon { width: 60px; height: 60px; border-radius: 16px; background: var(--brand-50); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.empty .empty-icon .icon { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 440px; margin: 0 auto 16px; }
.empty-sm { padding: 20px; text-align: center; color: var(--text-2); font-size: 13px; }

/* ---------- media grid ---------- */
.picker-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; position: relative; }
.media-tile:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.media-tile .mt-thumb { height: 100px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.media-tile .mt-thumb img, .media-tile .mt-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-tile .mt-thumb .icon { width: 30px; height: 30px; }
.media-tile .mt-meta { padding: 7px 9px; font-size: 11.5px; }
.media-tile .mt-meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.media-tile .mt-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.media-tile:hover .mt-actions { opacity: 1; }
.media-tile .mt-actions .btn-icon { background: rgba(255, 255, 255, .92); color: #0f172a; width: 28px; height: 28px; }

/* ---------- WhatsApp preview ---------- */
.phone { width: 320px; max-width: 100%; margin: 0 auto; border-radius: 34px; background: #111; padding: 10px; box-shadow: var(--shadow-lg); }
.phone-screen { border-radius: 26px; overflow: hidden; background: var(--wa-bg); display: flex; flex-direction: column; height: 560px; }
.phone-head { background: #075e54; color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
[data-theme="dark"] .phone-head { background: #202c33; }
.phone-head .avatar { width: 32px; height: 32px; background: rgba(255, 255, 255, .25); }
.phone-head strong { display: block; font-size: 14px; }
.phone-head small { opacity: .8; font-size: 11px; }
.phone-body { flex: 1; overflow-y: auto; padding: 12px 10px; background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 16px 16px; }
.phone-input { background: var(--wa-bg); padding: 8px; display: flex; gap: 6px; }
.phone-input input { border-radius: 20px; height: 38px; background: var(--wa-in); border: 0; }
.phone-input button { width: 38px; height: 38px; border-radius: 50%; background: #00a884; color: #fff; border: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.wa-msg { max-width: 85%; margin-bottom: 6px; display: flex; flex-direction: column; }
.wa-msg.out { margin-left: auto; align-items: flex-end; }
.wa-bubble { background: var(--wa-in); color: var(--wa-text); padding: 6px 8px 4px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 13.5px; line-height: 1.4; position: relative; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; min-width: 60px; }
.wa-msg.out .wa-bubble { background: var(--wa-out); }
.wa-bubble .wa-media { margin: -2px -4px 5px; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, .06); }
.wa-bubble .wa-media img, .wa-bubble .wa-media video { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.wa-doc { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: rgba(0, 0, 0, .05); border-radius: 6px; margin: -2px -4px 5px; font-size: 12.5px; white-space: normal; }
.wa-doc .icon { color: #e53935; width: 26px; height: 26px; }
.wa-head { font-weight: 700; margin-bottom: 3px; white-space: normal; }
.wa-foot { font-size: 12px; color: var(--wa-meta); margin-top: 3px; }
.wa-meta { font-size: 10.5px; color: var(--wa-meta); text-align: right; margin-top: 1px; display: flex; gap: 3px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.wa-meta .icon { width: 15px; height: 15px; }
.wa-meta .read { color: #53bdeb; }
.wa-buttons { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; width: 100%; }
.wa-btn { background: var(--wa-in); color: #027eb5; text-align: center; padding: 8px; border-radius: 8px; font-size: 13.5px; font-weight: 500; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); display: flex; align-items: center; justify-content: center; gap: 6px; cursor: default; }
.wa-msg.out .wa-btn { background: var(--wa-out); }
.wa-btn.clickable { cursor: pointer; }
.wa-btn.clickable:hover { filter: brightness(.97); }
[data-theme="dark"] .wa-btn { color: #53bdeb; }
.wa-reaction { position: absolute; bottom: -12px; right: 6px; background: var(--wa-in); border-radius: 12px; padding: 0 5px; font-size: 13px; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.wa-list { margin-top: 4px; }
.wa-sys { text-align: center; margin: 8px 0; }
.wa-sys span { background: rgba(255, 255, 255, .85); color: #54656f; font-size: 11.5px; padding: 4px 10px; border-radius: 7px; display: inline-block; }
[data-theme="dark"] .wa-sys span { background: #182229; color: #8696a0; }
.wa-typing { display: inline-flex; gap: 3px; padding: 10px 12px; }
.wa-typing i { width: 6px; height: 6px; background: var(--wa-meta); border-radius: 50%; animation: blink 1.2s infinite; }
.wa-typing i:nth-child(2) { animation-delay: .2s; } .wa-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.wa-listsheet { background: var(--wa-in); border-radius: 10px; padding: 8px 0; margin-top: 4px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); color: var(--wa-text); }
.wa-listsheet .ls-sec { font-size: 11.5px; color: #008069; font-weight: 600; padding: 6px 14px 2px; }
.wa-listsheet .ls-row { padding: 7px 14px; cursor: pointer; font-size: 13.5px; }
.wa-listsheet .ls-row small { display: block; color: var(--wa-meta); font-size: 12px; }
.wa-listsheet .ls-row:hover { background: rgba(0, 0, 0, .04); }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: calc(100vh - 60px); background: var(--surface); }
.inbox-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.inbox-items { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.conv .conv-main { flex: 1; min-width: 0; }
.conv .conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv .conv-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .conv-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.conv .conv-preview { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv .conv-badges { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.conv .unread { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wa-bg); }
.chat-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.chat-head .grow strong { display: block; }
#convTabs { flex-wrap: wrap; }
@media (max-width: 1500px) { .chat-head .lbl { display: none; } }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 6%; background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 18px 18px; }
.chat-body .wa-msg { max-width: 70%; }
.chat-day { text-align: center; margin: 12px 0; }
.chat-day span { background: var(--surface); color: var(--text-2); font-size: 11.5px; padding: 4px 12px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.msg-by { font-size: 10.5px; color: var(--wa-meta); margin-bottom: 2px; display: flex; gap: 4px; align-items: center; }
.msg-err { font-size: 11.5px; color: var(--danger); margin-top: 2px; max-width: 100%; }
.msg-actions { opacity: 0; transition: opacity .15s; display: flex; gap: 2px; }
.wa-msg:hover .msg-actions { opacity: 1; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; }
.composer-bar { display: flex; gap: 6px; align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 160px; border-radius: 12px; padding: 10px 14px; resize: none; }
.composer .window-note { font-size: 12px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.composer-tools { display: flex; gap: 2px; }
.qr-popup { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; margin-bottom: 6px; z-index: 5; }
.qr-popup div { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.qr-popup div:hover, .qr-popup div.active { background: var(--brand-50); }
.qr-popup b { color: var(--brand-600); margin-right: 6px; }
.chat-side { border-left: 1px solid var(--border); overflow-y: auto; padding: 18px; }
.chat-side h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 18px 0 8px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; word-break: break-word; }
.note { background: var(--warn-50); border: 1px solid rgba(245, 158, 11, .25); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 8px; }
.note small { display: block; color: var(--text-2); margin-top: 3px; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--text-2); text-align: center; padding: 30px; }
.window-pill { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }

/* ---------- builder (chatbot) ---------- */
.builder { display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px; height: calc(100vh - 60px); background: var(--surface); }
.palette { border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; }
.palette h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 10px 4px 8px; }
.palette-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; cursor: grab; background: var(--surface); font-weight: 550; font-size: 13px; user-select: none; }
.palette-item:hover { border-color: var(--brand); background: var(--brand-50); }
.palette-item .pi-icon { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.palette-item .pi-icon .icon { width: 14px; height: 14px; }
.canvas-wrap { position: relative; overflow: hidden; background: var(--surface-2); background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 22px 22px; cursor: grab; }
.canvas-wrap.panning { cursor: grabbing; }
.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 1px; height: 1px; }
.canvas svg.edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.canvas svg.edges path { fill: none; stroke: #94a3b8; stroke-width: 2.2; pointer-events: stroke; cursor: pointer; }
.canvas svg.edges path:hover { stroke: var(--danger); stroke-width: 3; }
.canvas svg.edges path.temp { stroke: var(--brand); stroke-dasharray: 6 5; }
.node { position: absolute; width: 250px; background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); cursor: default; user-select: none; }
.node.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16, 185, 129, .2), var(--shadow); }
.node-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px 11px 0 0; color: #fff; font-weight: 650; font-size: 12.5px; cursor: move; }
.node-head .icon { width: 14px; height: 14px; }
.node-head .node-del { margin-left: auto; background: rgba(255, 255, 255, .2); border: 0; color: #fff; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.node-head .node-del .icon { width: 13px; height: 13px; }
.node-body { padding: 9px 11px; font-size: 12.5px; color: var(--text-2); max-height: 130px; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.node-body:empty::before { content: 'Click to configure'; color: var(--muted); font-style: italic; }
.node-ports { padding: 0 0 6px; }
.node-port { position: relative; display: flex; align-items: center; justify-content: flex-end; padding: 4px 22px 4px 11px; font-size: 11.5px; color: var(--text); font-weight: 550; border-top: 1px dashed var(--border); }
.node-port .port-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port-out, .port-in { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--brand); cursor: crosshair; z-index: 3; }
.port-out { right: -8px; top: 50%; transform: translateY(-50%); }
.port-out:hover, .port-in:hover { background: var(--brand); transform: translateY(-50%) scale(1.2); }
.port-in { left: -8px; top: 18px; border-color: #64748b; transform: translateY(-50%); }
.node-port.connected .port-out { background: var(--brand); }
.canvas-tools { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); z-index: 5; }
.canvas-hint { position: absolute; right: 14px; bottom: 14px; max-width: calc(100% - 150px); font-size: 11.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; z-index: 5; }
.inspector { border-left: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.inspector-body { padding: 16px; flex: 1; overflow-y: auto; }
.inspector .form-group { margin-bottom: 12px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.var-chips span { font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); cursor: pointer; font-family: ui-monospace, monospace; }
.var-chips span:hover { background: var(--brand-100); }
.builder-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.sim-panel { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: none; }
.sim-panel.open { display: block; }
.sim-panel .phone { width: 330px; }

/* ---------- misc ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.progress > span.blue { background: var(--info); } .progress > span.red { background: var(--danger); } .progress > span.violet { background: var(--accent); }
.chart { width: 100%; height: 220px; }
.chart .bar-in { fill: #6366f1; } .chart .bar-out { fill: #059669; }
.chart rect:hover, .chart path:hover { opacity: .8; }
.chart text { fill: var(--text-2); font-size: 10.5px; font-family: var(--font); }
.chart line { stroke: var(--border); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.choice-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s; display: block; margin: 0; font-weight: 400; }
.choice-card:hover { border-color: var(--brand); }
.choice-card input { display: none; }
.choice-card:has(input:checked), .choice-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); background: var(--brand-50); }
.choice-card strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13.5px; }
.choice-card span { color: var(--text-2); font-size: 12.5px; }
.steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.step b { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.step.active { color: var(--text); } .step.active b { background: var(--brand); color: #fff; }
.step + .step::before { content: ''; width: 28px; height: 2px; background: var(--border); margin-right: 4px; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: ui-monospace, monospace; font-size: 12.5px; background: var(--surface-2); }
.kbd { font-family: ui-monospace, monospace; font-size: 11px; background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px; padding: 0 5px; border-radius: 4px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters .input, .filters input, .filters select { width: auto; min-width: 150px; height: 34px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search-input input { padding-left: 34px; }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.health div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.health small { display: block; color: var(--text-2); font-size: 11.5px; }
.health strong { font-size: 14px; }
.api-method { font-family: ui-monospace, monospace; font-weight: 700; font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: #dcfce7; color: #15803d; }
.api-method.get { background: #dbeafe; color: #1d4ed8; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-hero { background: radial-gradient(1200px 600px at -10% -20%, #134e4a 0%, transparent 60%), radial-gradient(900px 500px at 120% 120%, #1e1b4b 0%, transparent 60%), #0b1220; color: #e2e8f0; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-hero .brand { padding: 0; }
.auth-hero h2 { color: #fff; font-size: 34px; line-height: 1.15; margin: auto 0 14px; max-width: 520px; letter-spacing: -.03em; }
.auth-hero h2 em { font-style: normal; background: linear-gradient(90deg, #34d399, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: #94a3b8; max-width: 480px; font-size: 15px; }
.auth-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 24px 0 auto; max-width: 520px; }
.auth-features div { display: flex; gap: 9px; align-items: center; font-size: 13.5px; color: #cbd5e1; }
.auth-features .icon { color: #34d399; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 26px; }
.install-wrap { max-width: 760px; margin: 40px auto; padding: 0 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1500px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .chat-side { display: none; }
  .inbox.show-side .chat-side { display: block; position: fixed; right: 0; top: 60px; bottom: 0; width: 320px; background: var(--surface); z-index: 20; box-shadow: var(--shadow-lg); }
}
@media (max-width: 1280px) {
  .builder { grid-template-columns: 190px minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main-side, .cols-side-main { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex !important; }
  .content { padding: 16px; }
  .cols-2, .cols-3, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .chat { display: none; }
  .inbox.chat-open .inbox-list { display: none; }
  .inbox.chat-open .chat { display: flex; }
  .builder { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .palette { display: flex; overflow-x: auto; gap: 6px; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .palette h4 { display: none; }
  .palette-item { margin: 0; white-space: nowrap; }
  .inspector { position: fixed; inset: 60px 0 0 auto; width: min(360px, 100vw); background: var(--surface); z-index: 25; box-shadow: var(--shadow-lg); display: none; }
  .inspector.open { display: flex; }
  .auth-body { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .user-meta { display: none; }
  .chat-body .wa-msg { max-width: 88%; }
}
@media (max-width: 560px) {
  .cols-4 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .topbar { padding: 0 12px; }
}

/* ---------- handoff & routing ---------- */
.avail-toggle { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.avail-toggle .dot { background: var(--muted); }
.avail-toggle.on { color: #15803d; border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .08); }
.avail-toggle.on .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
[data-theme="dark"] .avail-toggle.on { color: #4ade80; }
.conv.waiting { box-shadow: inset 3px 0 0 var(--warn); }
.conv.waiting.active { box-shadow: inset 3px 0 0 var(--brand); }
.cat-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text); }
.cat-pill i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.handoff-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--warn-50); border-bottom: 1px solid rgba(245, 158, 11, .3); font-size: 12.5px; flex-wrap: wrap; }
.handoff-bar strong { color: #b45309; }
[data-theme="dark"] .handoff-bar strong { color: #fcd34d; }
.agent-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.agent-row:last-child { border-bottom: 0; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }
@media (max-width: 900px) { .avail-toggle .lbl { display: none; } }

.ch-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; color: var(--ch); background: color-mix(in srgb, var(--ch) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ch) 30%, transparent); vertical-align: middle; }
.help-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; text-decoration: none !important; }
.help-btn:hover { color: var(--brand-600); border-color: var(--brand); }
.help-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-nav { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.help-nav a { display: flex; gap: 9px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; font-weight: 550; text-decoration: none !important; }
.help-nav a:hover { background: var(--surface-3); color: var(--text); }
.help-nav a.active { background: var(--brand-50); color: var(--brand-700); }
.help-nav .nav-label { color: var(--muted); }
.help-article { display: none; }
.help-article.show { display: block; }
.help-article h2 { font-size: 22px; margin-bottom: 6px; }
.help-article h3 { font-size: 16px; margin: 24px 0 8px; }
.help-article p, .help-article li { font-size: 14px; line-height: 1.7; color: var(--text); }
.help-article ol, .help-article ul { padding-left: 22px; }
.help-article li { margin-bottom: 6px; }
.help-article .lead { color: var(--text-2); font-size: 15px; margin-bottom: 18px; }
.help-article .tip { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 10px; padding: 12px 14px; margin: 14px 0; font-size: 13.5px; }
.help-article .warn { background: var(--warn-50); border: 1px solid rgba(245, 158, 11, .3); border-radius: 10px; padding: 12px 14px; margin: 14px 0; font-size: 13.5px; }
.help-article table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.help-article th, .help-article td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.help-article th { background: var(--surface-2); }
.help-article .go { display: inline-flex; margin-top: 8px; }
.help-search mark { background: #fde68a; color: inherit; }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } .help-nav { position: static; max-height: none; } .help-btn .lbl { display: none; } }
