/* =========================================================
   WatiPortal — styles.css
   Modern, friendly, dynamic WhatsApp campaign console.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --brand: #14b8a6;
  --brand-600: #0d9488;
  --brand-700: #0f766e;
  --brand-soft: #ccfbf1;
  --accent-pink: #ec4899;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-sky: #0ea5e9;
  --accent-violet: #8b5cf6;

  --bg: #f4f6fb;
  --bg-grid: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f0;
  --border-strong: #d5dae5;
  --text: #1e2534;
  --text-soft: #5c6577;
  --text-mut: #8a93a6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px -4px rgba(16, 24, 40, .10);
  --shadow-lg: 0 18px 45px -12px rgba(16, 24, 40, .22);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --topbar-h: 68px;
  --ok: #10b981; --warn: #f59e0b; --err: #ef4444; --info: #0ea5e9;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-grid: #0e1526;
  --surface: #131a2b;
  --surface-2: #0f1626;
  --border: #23304b;
  --border-strong: #2c3a58;
  --text: #e7ecf5;
  --text-soft: #a3adc2;
  --text-mut: #6f7c96;
  --brand-soft: #10352f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 20px -6px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 55px -12px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(20,184,166,.08), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
.ic { width: 20px; height: 20px; display: block; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mut); background-clip: content-box; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.sidebar__brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 11px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
}
.brand__logo { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-700)); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px; box-shadow: 0 6px 14px -6px rgba(20,184,166,.8); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__name { font-weight: 800; font-size: 15px; letter-spacing: -.3px; color: var(--text); white-space: nowrap; }
.brand__name .amp { color: var(--brand); }
.brand__tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--text-mut); font-weight: 700; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px; color: var(--text-soft);
  font-weight: 500; cursor: pointer; position: relative;
  transition: background .16s, color .16s, transform .08s;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item:active { transform: scale(.98); }
.nav__item .ic { color: var(--text-mut); transition: color .16s; }
.nav__item:hover .ic { color: var(--brand); }
.nav__item.active { background: linear-gradient(90deg, rgba(20,184,166,.14), rgba(20,184,166,.05)); color: var(--brand-700); font-weight: 650; }
[data-theme="dark"] .nav__item.active { color: var(--brand); }
.nav__item.active .ic { color: var(--brand); }
.nav__item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav__badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--brand-soft); color: var(--brand-700); padding: 2px 8px; border-radius: 20px; }
[data-theme="dark"] .nav__badge { color: var(--brand); }
.nav__section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-mut); font-weight: 700; padding: 16px 14px 6px; }

.sidebar__footer { padding: 14px; border-top: 1px solid var(--border); }
.mini-card { background: linear-gradient(135deg, var(--brand-700), var(--brand)); color: #fff; border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.mini-card__title { font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.mini-card__value { font-size: 17px; font-weight: 800; margin: 2px 0 8px; }
.mini-card__bar { height: 6px; background: rgba(255,255,255,.25); border-radius: 20px; overflow: hidden; }
.mini-card__bar span { display: block; height: 100%; background: #fff; border-radius: 20px; }
.mini-card__hint { font-size: 11px; opacity: .85; margin-top: 7px; }

/* ---------- Topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__title { font-size: 19px; font-weight: 750; margin: 0; letter-spacing: -.3px; white-space: nowrap; }
.topbar__search { flex: 1; max-width: 460px; position: relative; }
.topbar__search input {
  width: 100%; height: 42px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 12px; padding: 0 14px 0 40px; color: var(--text); font-size: 13.5px; font-family: inherit;
  transition: border .15s, box-shadow .15s, background .15s;
}
.topbar__search::before { content: ""; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; opacity: .5;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6577' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E"); }
.topbar__search input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px rgba(20,184,166,.14); }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-soft); cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border .15s, transform .08s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--surface); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); border: 2px solid var(--surface); }

.topbar__user { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 40px; cursor: pointer; transition: background .15s; }
.topbar__user:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-indigo), var(--brand)); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.topbar__user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.topbar__user-name { font-weight: 650; font-size: 13.5px; }
.topbar__user-role { font-size: 11.5px; color: var(--text-mut); }

/* ---------- Content ---------- */
.content { padding: 26px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { margin: 0 0 4px; font-size: 24px; font-weight: 780; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--text-soft); font-size: 13.5px; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.fade-in { animation: fadeUp .45s cubic-bezier(.2,.7,.3,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }
.stagger > *:nth-child(1){animation-delay:.02s}.stagger > *:nth-child(2){animation-delay:.06s}
.stagger > *:nth-child(3){animation-delay:.10s}.stagger > *:nth-child(4){animation-delay:.14s}
.stagger > *:nth-child(5){animation-delay:.18s}.stagger > *:nth-child(6){animation-delay:.22s}
.stagger > *:nth-child(7){animation-delay:.26s}.stagger > *:nth-child(8){animation-delay:.30s}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; font-family: inherit;
  transition: background .15s, border .15s, transform .08s, box-shadow .15s; white-space: nowrap;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-600)); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -8px rgba(20,184,166,.7); }
.btn--primary:hover { filter: brightness(1.04); background: linear-gradient(135deg, var(--brand), var(--brand-600)); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--border)); }
.btn--danger:hover { background: color-mix(in srgb, var(--err) 10%, var(--surface)); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn--block { width: 100%; justify-content: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card__head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-mut); }
.card__body { padding: 20px; }

/* ---------- Stat cards (dashboard) ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat__top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mut); font-weight: 700; }
.stat__value { font-size: 34px; font-weight: 820; letter-spacing: -1px; margin: 8px 0 2px; line-height: 1; }
.stat__link { font-size: 12.5px; color: var(--brand-700); font-weight: 650; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
[data-theme="dark"] .stat__link { color: var(--brand); }
.stat__link:hover { text-decoration: underline; }
.stat__icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; color: #fff; box-shadow: var(--shadow); }
.stat__icon .ic { width: 24px; height: 24px; }
.stat__spark { position: absolute; right: 0; bottom: 0; left: 0; height: 34px; opacity: .5; }
.chip-delta { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 20px; display: inline-flex; align-items: center; gap: 2px; }
.chip-delta--up { color: var(--accent-green); background: color-mix(in srgb, var(--accent-green) 12%, transparent); }
.chip-delta--down { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }

.bg-teal { background: linear-gradient(135deg,#14b8a6,#0d9488); }
.bg-indigo { background: linear-gradient(135deg,#6366f1,#4f46e5); }
.bg-pink { background: linear-gradient(135deg,#ec4899,#db2777); }
.bg-amber { background: linear-gradient(135deg,#f59e0b,#d97706); }
.bg-green { background: linear-gradient(135deg,#10b981,#059669); }
.bg-sky { background: linear-gradient(135deg,#0ea5e9,#0284c7); }
.bg-violet { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.bg-rose { background: linear-gradient(135deg,#f43f5e,#e11d48); }

/* ---------- Dashboard layout ---------- */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-top: 18px; }
.chart-wrap { padding: 8px 8px 0; }
.legend { display: flex; gap: 16px; padding: 0 12px 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.activity { display: flex; flex-direction: column; }
.activity__row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity__row:last-child { border-bottom: 0; }
.activity__dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.activity__dot .ic { width: 17px; height: 17px; }
.activity__meta { min-width: 0; flex: 1; }
.activity__title { font-weight: 600; font-size: 13px; }
.activity__sub { font-size: 11.5px; color: var(--text-mut); }
.activity__time { font-size: 11.5px; color: var(--text-mut); white-space: nowrap; }

/* Quick start */
.quickstart { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.qs-step { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); transition: border .15s, transform .12s; cursor: pointer; }
.qs-step:hover { border-color: var(--brand); transform: translateY(-2px); }
.qs-num { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-700); font-weight: 800; display: grid; place-items: center; flex: none; }
[data-theme="dark"] .qs-num { color: var(--brand); }
.qs-step h4 { margin: 2px 0 3px; font-size: 13.5px; }
.qs-step p { margin: 0; font-size: 12px; color: var(--text-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mut); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 34px; height: 34px; font-size: 12px; }
.cell-strong { font-weight: 650; }
.cell-mut { color: var(--text-mut); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 4px 10px; border-radius: 20px; border: 1px solid transparent; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--green { color: var(--accent-green); background: color-mix(in srgb, var(--accent-green) 12%, transparent); }
.badge--amber { color: var(--accent-amber); background: color-mix(in srgb, var(--accent-amber) 14%, transparent); }
.badge--blue { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.badge--red { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.badge--gray { color: var(--text-soft); background: var(--surface-2); border-color: var(--border); }
.badge--violet { color: var(--accent-violet); background: color-mix(in srgb, var(--accent-violet) 12%, transparent); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer; display: grid; place-items: center; transition: all .13s; }
.row-btn:hover { color: var(--brand); border-color: var(--brand); }
.row-btn.danger:hover { color: var(--err); border-color: var(--err); }
.row-btn .ic { width: 16px; height: 16px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-mini { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search-mini input { width: 100%; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 0 12px 0 36px; color: var(--text); font-size: 13px; font-family: inherit; }
.search-mini input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.search-mini .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-mut); }
.select { height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 0 32px 0 12px; color: var(--text); font-size: 13px; font-family: inherit; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.select:focus { outline: none; border-color: var(--brand); }
.spacer { flex: 1; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--text-soft); }
.field .hint { font-size: 11.5px; color: var(--text-mut); }
.input, .textarea, select.input {
  height: 44px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 11px;
  padding: 0 13px; color: var(--text); font-size: 13.5px; font-family: inherit; transition: border .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, select.input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: repeat(3, 1fr); }
.field-lock { position: relative; }
.field-lock .lock-note { position: absolute; right: 12px; top: 38px; font-size: 11px; color: var(--warn); }

/* ---------- Templates gallery ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tpl-card { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s, border .15s; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tpl-card__head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.tpl-card__name { font-weight: 700; font-size: 14px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tpl-preview { margin: 16px; padding: 14px 16px; background: #dcf8c6; color: #111; border-radius: 12px 12px 12px 4px; font-size: 12.5px; line-height: 1.55; position: relative; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .tpl-preview { background: #1f3d2e; color: #d7f0dd; }
.tpl-preview::after { content: ""; position: absolute; left: -7px; bottom: 0; border: 7px solid transparent; border-right-color: #dcf8c6; border-bottom: 0; }
[data-theme="dark"] .tpl-preview::after { border-right-color: #1f3d2e; }
.tpl-var { color: var(--brand-700); font-weight: 700; }
[data-theme="dark"] .tpl-var { color: #7ee0d3; }
.tpl-card__foot { margin-top: auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-mut); }

/* ---------- Modal ---------- */
.modal-host { position: fixed; inset: 0; z-index: 90; display: none; }
.modal-host.open { display: block; }
.modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); animation: fadeIn .2s both; }
.modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .28s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%,-46%) scale(.96); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal__head h3 { margin: 0; font-size: 17px; font-weight: 750; }
.modal__body { padding: 22px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 18px 18px; }

/* Wizard steps */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step-pill { flex: 1; height: 6px; border-radius: 20px; background: var(--border); overflow: hidden; }
.step-pill.done, .step-pill.active { background: var(--brand); }
.step-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-mut); margin-bottom: 18px; font-weight: 600; }
.step-label span.active { color: var(--brand-700); }
[data-theme="dark"] .step-label span.active { color: var(--brand); }

.pick-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border .13s, background .13s; }
.pick:hover { border-color: var(--brand); background: var(--surface-2); }
.pick.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); box-shadow: 0 0 0 3px rgba(20,184,166,.1); }
.pick__radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; }
.pick.selected .pick__radio { border-color: var(--brand); }
.pick.selected .pick__radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.pick__body { flex: 1; min-width: 0; }
.pick__title { font-weight: 650; font-size: 13.5px; }
.pick__sub { font-size: 12px; color: var(--text-mut); }

/* review summary */
.summary-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row .k { color: var(--text-mut); }
.summary-row .v { font-weight: 650; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 11px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px; animation: slideIn .3s cubic-bezier(.2,.8,.3,1) both; }
.toast.out { animation: slideOut .3s ease-in both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }
.toast--ok { border-left-color: var(--ok); }
.toast--err { border-left-color: var(--err); }
.toast--warn { border-left-color: var(--warn); }
.toast__icon { width: 22px; height: 22px; flex: none; }
.toast--ok .toast__icon { color: var(--ok); } .toast--err .toast__icon { color: var(--err); } .toast--warn .toast__icon { color: var(--warn); } .toast--info .toast__icon { color: var(--info); }
.toast__msg { font-size: 13px; font-weight: 550; }
.toast__title { font-weight: 700; font-size: 13px; }

/* ---------- Connection status card ---------- */
.conn { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.conn__badge { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.conn__state { font-weight: 750; font-size: 15px; }
.conn__desc { font-size: 12.5px; color: var(--text-soft); }
.dot-pulse { position: relative; }
.dot-pulse::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: currentColor; opacity: .3; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .4; } 100% { transform: scale(2.2); opacity: 0; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-mut); }
.empty .ic { width: 46px; height: 46px; margin: 0 auto 14px; opacity: .5; }
.empty h3 { margin: 0 0 4px; color: var(--text); font-size: 16px; }

/* ---------- QR + Chat placeholders ---------- */
.qr-shell { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.qr-box { display: grid; place-items: center; padding: 30px; }
.qr-face { width: 220px; height: 220px; border-radius: 18px; padding: 14px; background: #fff; box-shadow: var(--shadow); }
.chat-shell { display: grid; grid-template-columns: 300px 1fr; height: 560px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-conv { display: flex; flex-direction: column; background:
  radial-gradient(circle at 20% 20%, rgba(20,184,166,.05), transparent 40%), var(--surface-2); }
.chat-thread-item { display: flex; gap: 10px; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.chat-thread-item:hover, .chat-thread-item.active { background: var(--surface-2); }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: var(--surface); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 68%; padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #dcf8c6; color: #0b141a; border-bottom-right-radius: 4px; }
[data-theme="dark"] .bubble.out { background: #1f3d2e; color: #d7f0dd; }
.bubble__time { display: block; font-size: 10px; color: var(--text-mut); margin-top: 4px; text-align: right; }
.chat-compose { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--surface); }
.chat-compose input { flex: 1; height: 42px; border: 1px solid var(--border); border-radius: 22px; padding: 0 16px; background: var(--surface-2); color: var(--text); font-family: inherit; }
.chat-compose input:focus { outline: none; border-color: var(--brand); }

/* ---------- Subscription ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.plan-card { border: 1px solid var(--border); border-radius: 18px; padding: 24px; background: var(--surface); position: relative; transition: transform .15s, box-shadow .15s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,184,166,.16); }
.plan-tag { position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 700; color: var(--brand-700); background: var(--brand-soft); padding: 3px 10px; border-radius: 20px; }
.plan-price { font-size: 34px; font-weight: 820; letter-spacing: -1px; margin: 10px 0 2px; }
.plan-price small { font-size: 14px; font-weight: 600; color: var(--text-mut); }
.plan-feat { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.plan-feat li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-soft); }
.plan-feat .ic { width: 17px; height: 17px; color: var(--accent-green); }
.usage-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent-green)); border-radius: 20px; }

/* ---------- Bot replies ---------- */
.bot-rule { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.switch { width: 44px; height: 26px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .18s; }
.switch.on { background: var(--brand); }
.switch.on::after { left: 21px; }

/* ---------- Utility ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mt-18 { margin-top: 18px; } .mt-24 { margin-top: 24px; }
.text-mut { color: var(--text-mut); } .text-soft { color: var(--text-soft); }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.pill-tabs { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; gap: 4px; }
.pill-tab { padding: 7px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer; transition: all .13s; }
.pill-tab.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .pill-tab.active { color: var(--brand); }
.kpi-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.kpi-inline .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mut); font-weight: 700; }
.kpi-inline .v { font-size: 22px; font-weight: 780; }

.backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .tpl-grid, .quickstart, .plan-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .backdrop.show { display: block; }
  .topbar__menu { display: inline-flex; }
  .topbar__search { display: none; }
  .topbar__user-meta { display: none; }
  .qr-shell, .chat-shell, .grid-2 { grid-template-columns: 1fr; }
  .chat-shell { height: auto; }
}
@media (max-width: 560px) {
  .stats-grid, .tpl-grid, .quickstart, .plan-grid, .two-col, .three-col { grid-template-columns: 1fr; }
  .content { padding: 18px 14px; }
  .stat__value { font-size: 28px; }
  .auth-card { padding: 26px 22px; }
}

/* ---------- Sidebar account footer ---------- */
.account { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.account .avatar { width: 38px; height: 38px; font-size: 13px; }
.account__meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.account__name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__role { font-size: 11px; color: var(--text-mut); }
.account__out { width: 36px; height: 36px; flex: none; }
.account__out:hover { color: var(--err); border-color: var(--err); }

/* ---------- Login gate ---------- */
#authGate { position: fixed; inset: 0; z-index: 200; display: none; }
.auth-bg { position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(20,184,166,.18), transparent 55%),
    radial-gradient(800px 500px at 90% 90%, rgba(99,102,241,.16), transparent 55%),
    var(--bg);
}
.auth-card {
  position: relative; z-index: 1; width: min(420px, calc(100vw - 32px));
  margin: max(6vh, 40px) auto 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow-lg); padding: 32px 30px;
}
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.brand__logo--lg { width: 52px; height: 52px; border-radius: 15px; font-size: 19px; }
.auth-brand__name { font-weight: 820; font-size: 18px; letter-spacing: -.4px; }
.auth-brand__tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--text-mut); font-weight: 700; }
.auth-title { margin: 4px 0 4px; font-size: 22px; font-weight: 780; letter-spacing: -.4px; }
.auth-sub { margin: 0 0 22px; color: var(--text-soft); font-size: 13.5px; line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .field label { font-size: 12.5px; }
.auth-submit { height: 46px; margin-top: 4px; font-size: 14px; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { flex: 1; padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-mut); cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--brand); background: var(--surface-2); }
.pw-toggle.active { color: var(--brand); }
.pw-toggle .ic { width: 18px; height: 18px; }
.auth-error { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--err);
  background: color-mix(in srgb, var(--err) 10%, transparent); border: 1px solid color-mix(in srgb, var(--err) 28%, transparent);
  padding: 10px 12px; border-radius: 11px; }
.auth-error .ic { width: 16px; height: 16px; flex: none; }
.auth-link { margin: 16px auto 0; display: block; background: none; border: 0; color: var(--text-soft); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.auth-link:hover { color: var(--brand); }
.auth-foot { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--text-mut); z-index: 1; }

/* ============================================================
   WhatsApp Chat — 3-column real-platform layout
   ============================================================ */
.wa-page { height: 100%; }
.wa {
  display: grid; grid-template-columns: 340px 1fr 320px;
  height: calc(100vh - var(--topbar-h) - 52px); min-height: 560px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.wa-list { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; background: var(--surface); }
.wa-list__top { padding: 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.wa-list__top h3 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.wa-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-soft); }
.wa-help { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; color: var(--text-mut); cursor: help; }
.switch.small { width: 38px; height: 22px; }
.switch.small::after { width: 16px; height: 16px; }
.switch.small.on::after { left: 19px; }
.wa-tabs { display: flex; gap: 6px; }
.wa-tab { padding: 7px 15px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-soft); cursor: pointer; font-family: inherit; transition: all .14s; }
.wa-tab:hover { border-color: var(--brand); }
.wa-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.wa-labels { text-align: left; padding: 9px 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); font-size: 13px; color: var(--text-soft); cursor: pointer; font-family: inherit; }
.wa-labels span { color: var(--brand); font-weight: 700; font-size: 11px; vertical-align: super; }
.wa-search { max-width: none; width: 100%; }
.wa-search input { height: 42px; border-radius: 22px; background: var(--surface-2); }
.wa-threads { flex: 1; overflow-y: auto; }
.wa-thread { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .12s; }
.wa-thread:hover { background: var(--surface-2); }
.wa-thread.active { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.wa-av { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #00a884; color: #fff; font-weight: 700; font-size: 15px; }
.wa-thread__main { flex: 1; min-width: 0; }
.wa-thread__name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-thread__meta { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--border); }
.wa-thread__ago { font-size: 11.5px; color: var(--text-mut); }
.wa-unread { margin-left: auto; align-self: flex-start; background: #00a884; color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px; display: grid; place-items: center; }

.wa-conv-col { display: flex; flex-direction: column; min-width: 0; background: #efeae2; }
.wa-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; color: #fff; background: linear-gradient(180deg, #12b886, #0e9f78); }
.wa-av--head { background: rgba(255,255,255,.22); width: 42px; height: 42px; }
.wa-head__meta { flex: 1; min-width: 0; }
.wa-head__line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wa-head__name { font-weight: 700; font-size: 15.5px; }
.wa-head__phone { font-size: 13px; color: rgba(255,255,255,.85); }
.wa-head__status { font-size: 12px; color: rgba(255,255,255,.9); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.wa-head__status i { width: 7px; height: 7px; border-radius: 50%; background: #b6f5c8; display: inline-block; }
.wa-head__warn { color: #ffe08a; font-size: 12.5px; font-weight: 600; margin-top: 3px; line-height: 1.35; }
.wa-icon { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.wa-icon:hover { background: rgba(255,255,255,.15); }
.wa-body {
  flex: 1; overflow-y: auto; padding: 18px clamp(14px, 6%, 70px);
  display: flex; flex-direction: column; gap: 6px; background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%230b141a' stroke-opacity='0.045' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 44 h40 a8 8 0 0 1 8 8 v18 a8 8 0 0 1 -8 8 h-24 l-12 9 v-9 h-4 a8 8 0 0 1 -8 -8 v-18 a8 8 0 0 1 8 -8 z'/%3E%3Cpath d='M182 44 c-6 -10 -22 -6 -22 6 c0 10 14 18 22 23 c8 -5 22 -13 22 -23 c0 -12 -16 -16 -22 -6 z'/%3E%3Ccircle cx='120' cy='120' r='20'/%3E%3Ccircle cx='113' cy='115' r='1.6'/%3E%3Ccircle cx='127' cy='115' r='1.6'/%3E%3Cpath d='M112 127 q8 8 16 0'/%3E%3Crect x='28' y='168' width='44' height='32' rx='6'/%3E%3Ccircle cx='50' cy='184' r='9'/%3E%3Cpath d='M38 168 l5 -7 h14 l5 7'/%3E%3Cpath d='M188 150 l6 13 14 1 -10 9 3 14 -13 -7 -13 7 3 -14 -10 -9 14 -1 z'/%3E%3Cpath d='M120 28 c-10 0 -18 8 -18 18 c0 12 18 26 18 26 c0 0 18 -14 18 -26 c0 -10 -8 -18 -18 -18 z'/%3E%3Ccircle cx='120' cy='46' r='6'/%3E%3Cpath d='M58 118 l8 -4 6 8 -6 5 c4 8 10 14 18 18 l5 -6 8 6 -4 8 c-2 3 -6 4 -9 3 -18 -6 -30 -18 -36 -36 -1 -3 0 -7 3 -9 z'/%3E%3C/g%3E%3C/svg%3E");
}
.wa-date { align-self: center; background: #ffffffd9; color: #54656f; font-size: 11.5px; font-weight: 600; padding: 5px 13px; border-radius: 8px; margin: 8px 0; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-msg { max-width: 66%; padding: 6px 9px 7px; border-radius: 9px; font-size: 13.6px; line-height: 1.45; color: #111b21; box-shadow: 0 1px .5px rgba(11,20,26,.13); position: relative; word-wrap: break-word; }
.wa-msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-msg.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.wa-msg.rtl { direction: rtl; text-align: right; }
.wa-msg__time { display: block; font-size: 10.5px; color: #667781; text-align: right; margin-top: 3px; user-select: none; }
.wa-msg.rtl .wa-msg__time { text-align: left; }
.wa-checks { color: #53bdeb; font-size: 11px; }
.wa-compose { display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: #f0f2f5; border-top: 1px solid var(--border); }
.wa-emoji { font-size: 20px; cursor: pointer; opacity: .7; }
.wa-compose input { flex: 1; height: 44px; border: 0; border-radius: 22px; padding: 0 18px; background: #fff; font-family: inherit; font-size: 14px; color: #111b21; }
.wa-compose input:focus { outline: none; }
.wa-send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #00a884; color: #fff; cursor: pointer; display: grid; place-items: center; transition: filter .14s, transform .08s; }
.wa-send:hover { filter: brightness(1.05); } .wa-send:active { transform: scale(.94); }
.wa-send .ic { width: 20px; height: 20px; }
.wa-closed { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: #fff7e6; border-top: 1px solid #ffe1a8; color: #8a6d3b; font-size: 13px; font-weight: 500; }

.wa-info { border-left: 1px solid var(--border); background: var(--surface); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wa-info__card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.wa-info__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.wa-info__title { background: var(--surface-2); border: 1px solid var(--border); border-radius: 22px; padding: 7px 16px; font-weight: 700; font-size: 13px; }
.wa-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 22px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer; font-family: inherit; }
.wa-chip:hover { border-color: var(--brand); color: var(--brand); }
.wa-chip .ic { width: 15px; height: 15px; }
.wa-field { margin-bottom: 13px; }
.wa-field:last-child { margin-bottom: 0; }
.wa-field label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.wa-field div { font-size: 13.5px; color: var(--text-soft); }
.wa-mut { color: var(--text-mut) !important; }
.wa-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; cursor: pointer; }
.wa-check input { width: 17px; height: 17px; accent-color: var(--brand); }

@media (max-width: 1200px) { .wa { grid-template-columns: 300px 1fr; } .wa-info { display: none; } }
@media (max-width: 820px) {
  .wa { grid-template-columns: 1fr; height: auto; }
  .wa-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 320px; }
  .wa-conv-col { min-height: 480px; }
}

/* ============================================================
   WhatsApp Chat — modern 2-column (restored + refined)
   ============================================================ */
.chat-shell--tall { display: flex; width: 100%; height: calc(100vh - var(--topbar-h) - 172px); min-height: 560px; box-shadow: var(--shadow); }
.chat-shell--tall .chat-list { width: 340px; flex: 0 0 340px; }
.chat-shell--tall .chat-conv { flex: 1 1 auto; }
.chat-list { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-list__search { padding: 12px; border-bottom: 1px solid var(--border); }
.chat-list__search .search-mini { max-width: none; width: 100%; }
.chat-list__search input { height: 42px; border-radius: 22px; background: var(--surface-2); }
.chat-threads { flex: 1; overflow-y: auto; }
.chat-thread-item { padding: 12px 14px; }
.chat-thread__body { flex: 1; min-width: 0; }
.chat-thread__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-thread__name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread__time { font-size: 11px; color: var(--text-mut); flex: none; }
.chat-thread-item.active .chat-thread__time { color: var(--brand-700); }
[data-theme="dark"] .chat-thread-item.active .chat-thread__time { color: var(--brand); }
.chat-thread__bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 3px; }
.chat-thread__preview { font-size: 12.5px; color: var(--text-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread { background: #00a884; color: #fff; font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 20px; display: grid; place-items: center; flex: none; }

.chat-head { padding: 11px 16px; }
.chat-head__av { width: 42px; height: 42px; font-size: 14px; }
.chat-head__meta { flex: 1; min-width: 0; }
.chat-head__name { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.chat-head__status { font-size: 12px; color: var(--text-mut); display: flex; align-items: center; gap: 6px; }
.chat-head__status i { width: 7px; height: 7px; border-radius: 50%; background: #31c48d; display: inline-block; }
.chat-head__actions { display: flex; gap: 2px; margin-left: auto; }
.chat-ic { width: 38px; height: 38px; border: 0; background: transparent; color: var(--text-soft); cursor: pointer; border-radius: 50%; display: grid; place-items: center; transition: background .13s, color .13s, transform .08s; }
.chat-ic:hover { background: var(--surface-2); color: var(--brand); }
.chat-ic:active { transform: scale(.9); }
.chat-ic .ic { width: 19px; height: 19px; }
.chat-ic--muted { font-size: 20px; color: var(--text-mut); }

.chat-day { align-self: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-mut); font-size: 11.5px; font-weight: 600; padding: 4px 13px; border-radius: 20px; margin: 2px 0 8px; box-shadow: var(--shadow-sm); }
.bubble.rtl { direction: rtl; text-align: right; }
.bubble.rtl .bubble__time { text-align: left; }
.chat-tick { color: #53bdeb; font-size: 11px; margin-left: 4px; }

.chat-compose { align-items: center; gap: 6px; padding: 10px 14px; }
.chat-send { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 16px -8px rgba(20,184,166,.75); transition: filter .14s, transform .08s; }
.chat-send:hover { filter: brightness(1.06); }
.chat-send:active { transform: scale(.92); }
.chat-send .ic { width: 20px; height: 20px; }

.chat-typing { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; border-radius: 14px; padding: 12px 14px; display: inline-flex; gap: 4px; box-shadow: var(--shadow-sm); }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mut); animation: typing 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .18s; }
.chat-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

@media (max-width: 820px) {
  .chat-shell--tall { flex-direction: column; height: auto; }
  .chat-shell--tall .chat-list { width: 100%; flex: none; max-height: 300px; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-shell--tall .chat-conv { min-height: 460px; }
}

/* ============================================================
   Campaigns list + Campaign Dashboard
   ============================================================ */
.spill { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: #fff; white-space: nowrap; }
.spill--executed { background: #f97316; }
.spill--scheduled { background: #0ea5e9; }
.spill--running { background: #f59e0b; }
.spill--draft { background: #94a3b8; }
.spill--archived { background: #64748b; }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-700); font-size: 10.5px; font-weight: 700; margin-left: 5px; }
[data-theme="dark"] .tab-count { color: var(--brand); }

.camp-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.btn-dash { display: inline-flex; align-items: center; gap: 7px; background: #1f2937; color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; transition: filter .13s, transform .08s; }
.btn-dash:hover { filter: brightness(1.18); }
.btn-dash:active { transform: translateY(1px); }
.btn-dash .ic { width: 15px; height: 15px; }
[data-theme="dark"] .btn-dash { background: #0b1120; border: 1px solid var(--border); }
.btn-arch { background: #ec4899; color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: filter .13s; }
.btn-arch:hover { filter: brightness(1.07); }

.camp-head__label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mut); font-weight: 700; }
.camp-head__name { font-size: 32px; font-weight: 820; letter-spacing: -.6px; margin: 4px 0 0; }
.camp-head__took { font-size: 13.5px; color: var(--text-soft); font-style: italic; margin: 6px 0 0; max-width: 640px; line-height: 1.5; }
.camp-head__took b { color: var(--text); font-style: normal; }
.camp-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.camp-head__meta { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.camp-head__meta .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mut); font-weight: 700; margin-bottom: 3px; }
.camp-head__meta .v { font-size: 14px; font-weight: 650; }

.kpi { display: flex; flex-direction: column; }
.kpi .stat__value { font-size: 30px; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.kpi__foot .cell-mut { font-size: 12px; }
.recamp { background: var(--brand); color: #fff; border: 0; border-radius: 20px; padding: 6px 14px; font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit; transition: filter .13s; white-space: nowrap; }
.recamp:hover { filter: brightness(1.07); }

.dstat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dstat__msg { font-size: 12px; color: var(--text-mut); max-width: 420px; }
.dstat__msg--err { color: var(--err); }

/* ============================================================
   Settings — sub-nav, API & Webhook page
   ============================================================ */
.settings-nav { display: flex; flex-wrap: wrap; margin-bottom: 20px; }
.settings-label { font-size: 14px; font-weight: 750; color: var(--text); letter-spacing: -.2px; }
.soft-hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

pre.code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin: 10px 0 0; overflow-x: auto; white-space: pre;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.65; color: var(--text-soft);
}
[data-theme="dark"] pre.code { background: #0a0f1c; }
.card__body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; color: var(--text); }

.copyfield { display: flex; align-items: stretch; }
.copyfield input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; background: var(--surface-2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.copybtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-left: 0; background: var(--surface); color: var(--text-soft); padding: 0 16px; border-radius: 0 11px 11px 0; cursor: pointer; font-weight: 600; font-size: 13px; font-family: inherit; white-space: nowrap; transition: background .13s, color .13s; }
.copybtn:hover { background: var(--surface-2); color: var(--brand); }
.copybtn .ic { width: 15px; height: 15px; }

.var-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.var-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--accent-pink); background: color-mix(in srgb, var(--accent-pink) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent-pink) 25%, transparent); padding: 4px 10px; border-radius: 8px; }

/* ============================================================
   Login — "Account Access" card
   ============================================================ */
.acc-card {
  position: relative; z-index: 1; width: min(440px, calc(100vw - 32px));
  margin: max(7vh, 44px) auto 0; background: #ffffff; border: 1px solid #eceff4;
  border-radius: 16px; box-shadow: 0 20px 48px -14px rgba(16,24,40,.28); overflow: hidden;
}
.acc-head { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 22px 24px; border-bottom: 1px solid #eef1f6; }
.acc-head h2 { margin: 0; font-size: 23px; font-weight: 750; color: #2d3344; letter-spacing: -.3px; }
.acc-head svg { flex: none; }
.acc-body { padding: 26px; }
.acc-intro { font-size: 13.5px; color: #6b7280; line-height: 1.55; margin-bottom: 18px; }
.acc-form { display: flex; flex-direction: column; gap: 14px; }

.acc-field { display: flex; align-items: stretch; border: 1px solid #e4e9f2; border-radius: 12px; overflow: hidden; background: #eaf0fb; transition: border-color .15s, box-shadow .15s; }
.acc-field:focus-within { border-color: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.acc-ic { width: 54px; flex: none; display: grid; place-items: center; background: #f6f8fc; color: #9aa4b6; border-right: 1px solid #e4e9f2; }
.acc-ic .ic { width: 20px; height: 20px; }
.acc-input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 14px; height: 56px; font-size: 15px; color: #1e2534; outline: none; font-family: inherit; }
.acc-input::placeholder { color: #98a2b3; }
.acc-eye { flex: none; width: 48px; border: 0; background: transparent; color: #9aa4b6; cursor: pointer; display: grid; place-items: center; }
.acc-eye:hover, .acc-eye.active { color: #22c55e; }
.acc-eye .ic { width: 18px; height: 18px; }
.acc-hint { font-size: 12px; color: #98a2b3; margin: -7px 2px 0; }

.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0; }
.acc-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #6b7280; cursor: pointer; user-select: none; }
.acc-check input { width: 18px; height: 18px; accent-color: #22c55e; }
.acc-forgot { border: 0; background: none; color: #16a34a; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; padding: 0; }
.acc-forgot:hover { text-decoration: underline; }

.acc-btn { margin-top: 8px; height: 52px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #35d67f, #22b566); color: #fff; font-size: 15.5px; font-weight: 700; cursor: pointer; font-family: inherit; box-shadow: 0 12px 22px -10px rgba(34,181,102,.75); transition: filter .14s, transform .08s; }
.acc-btn:hover { filter: brightness(1.04); }
.acc-btn:active { transform: translateY(1px); }
.acc-btn--danger { background: linear-gradient(180deg, #f87171, #ef4444); box-shadow: 0 12px 22px -10px rgba(239,68,68,.6); }

