/* ============================================================
   WhatsApp Platform — Design System
   Pure CSS. No build step. Inspired by Meta Business Suite,
   Stripe, Linear, Notion & Vercel.
   ============================================================ */

:root {
    --wa-green:#25D366; --wa-green-dark:#1da851; --wa-green-soft:#e7f9ef;
    --meta-blue:#1877F2; --meta-blue-dark:#0e5fcc; --meta-blue-soft:#e8f1fe;

    --ink-900:#0b0d12; --ink-700:#2c3340; --ink-500:#5b6472; --ink-400:#828b99; --ink-300:#aab2be;
    --surface:#ffffff; --surface-2:#f7f8fa; --surface-3:#eef0f4; --line:#e6e8ee; --line-strong:#d7dae2;

    --success:#16a34a; --warning:#d97706; --error:#dc2626;

    --radius-sm:10px; --radius:16px; --radius-lg:22px;
    --shadow-xs:0 1px 2px rgba(16,24,40,.05);
    --shadow-sm:0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.04);
    --shadow-md:0 8px 24px rgba(16,24,40,.08), 0 2px 6px rgba(16,24,40,.04);
    --shadow-lg:0 24px 60px rgba(16,24,40,.12), 0 8px 20px rgba(16,24,40,.06);
    --ring:0 0 0 4px rgba(24,119,242,.14);
    --ease:cubic-bezier(.2,.8,.2,1);
}

*,*::before,*::after { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body { font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; color:var(--ink-700); background:var(--surface-2); -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
a { color:inherit; }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes pulse { 0%{transform:scale(.6);opacity:.9;} 100%{transform:scale(1.8);opacity:0;} }

/* ---------- Buttons ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; font:inherit; font-size:14px; font-weight:600; letter-spacing:.01em; padding:12px 20px; border-radius:12px; border:1.5px solid transparent; cursor:pointer; transition:transform .14s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease); text-decoration:none; white-space:nowrap; }
.btn svg { width:17px; height:17px; }
.btn:active { transform:translateY(1px) scale(.99); }
.btn-primary { color:#fff; background:linear-gradient(135deg,var(--wa-green),var(--wa-green-dark)); box-shadow:0 8px 20px rgba(37,211,102,.34), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { box-shadow:0 12px 28px rgba(37,211,102,.42); transform:translateY(-1px); }
.btn-secondary { color:var(--ink-700); background:var(--surface); border-color:var(--line-strong); box-shadow:var(--shadow-xs); }
.btn-secondary:hover { background:var(--surface-2); border-color:var(--ink-300); transform:translateY(-1px); }
.btn-ghost { color:var(--ink-500); background:transparent; }
.btn-ghost:hover { background:var(--surface-3); color:var(--ink-900); }
.btn-block { width:100%; }

/* ============================================================
   TOP NAVIGATION (dashboard / connect)
   ============================================================ */
.topbar { position:sticky; top:0; z-index:40; background:rgba(255,255,255,.85); backdrop-filter:saturate(1.4) blur(10px); border-bottom:1px solid var(--line); }
.topbar-inner { max-width:1180px; margin:0 auto; padding:0 24px; height:64px; display:flex; align-items:center; gap:22px; }
.nav-brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:15px; color:var(--ink-900); text-decoration:none; letter-spacing:-.01em; }
.nav-brand .glyph { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 6px 14px rgba(37,211,102,.35); }
.nav-brand .glyph svg { width:20px; height:20px; }
.nav-links { display:flex; align-items:center; gap:4px; margin-left:14px; }
.nav-links a { font-size:14px; font-weight:550; color:var(--ink-500); text-decoration:none; padding:8px 13px; border-radius:9px; transition:background .16s var(--ease), color .16s var(--ease); }
.nav-links a:hover { color:var(--ink-900); background:var(--surface-3); }
.nav-links a.active { color:var(--ink-900); background:var(--surface-3); font-weight:600; }
.nav-right { margin-left:auto; display:flex; align-items:center; gap:12px; }
.nav-user { display:flex; align-items:center; gap:10px; padding:5px 6px 5px 12px; border:1px solid var(--line); border-radius:999px; background:var(--surface); }
.nav-user .uname { font-size:13.5px; font-weight:600; color:var(--ink-700); }
.nav-user .avatar { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-size:12.5px; font-weight:700; color:#fff; background:linear-gradient(145deg,var(--meta-blue),#0e5fcc); }
.logout-btn { border:none; background:transparent; cursor:pointer; color:var(--ink-400); padding:8px; border-radius:9px; display:grid; place-items:center; transition:background .16s var(--ease), color .16s var(--ease); }
.logout-btn:hover { color:var(--error); background:#fef2f2; }
.logout-btn svg { width:18px; height:18px; }
@media (max-width:760px){ .topbar-inner { padding:0 16px; gap:12px; } .nav-links { display:none; } .nav-user .uname { display:none; } }

/* ============================================================
   APP SHELL + LEFT SIDEBAR
   ============================================================ */
.app-shell { display:flex; min-height:100vh; }
.app-main { flex:1; min-width:0; display:flex; flex-direction:column; }

.sidebar { flex:0 0 264px; width:264px; background:var(--surface); border-right:1px solid var(--line); position:sticky; top:0; height:100vh; display:flex; flex-direction:column; z-index:50; }
.sb-brand { display:flex; align-items:center; gap:10px; padding:20px 20px 16px; font-weight:700; font-size:15px; color:var(--ink-900); text-decoration:none; letter-spacing:-.01em; }
.sb-brand .glyph { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 6px 14px rgba(37,211,102,.35); }
.sb-brand .glyph svg { width:20px; height:20px; }
.sb-brand-tx { display:flex; flex-direction:column; line-height:1.15; }
.sb-brand-tx small { font-size:10.5px; font-weight:500; color:var(--ink-400); letter-spacing:.01em; margin-top:1px; }

.sb-cta { margin:4px 16px 14px; }
.sb-cta a { display:flex; align-items:center; justify-content:center; gap:8px; font-size:13.5px; font-weight:650; color:#fff; text-decoration:none; padding:11px 14px; border-radius:11px; background:linear-gradient(135deg,var(--wa-green),var(--wa-green-dark)); box-shadow:0 8px 18px rgba(37,211,102,.30); transition:transform .14s var(--ease), box-shadow .18s var(--ease); }
.sb-cta a:hover { transform:translateY(-1px); box-shadow:0 12px 24px rgba(37,211,102,.4); }
.sb-cta a svg { width:16px; height:16px; }

.sb-nav { flex:1; overflow-y:auto; padding:6px 12px 12px; }
.sb-label { font-size:11px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-300); margin:14px 12px 7px; }
.sb-label:first-child { margin-top:4px; }
.sb-link { display:flex; align-items:center; gap:12px; padding:9px 12px; border-radius:10px; font-size:14px; font-weight:550; color:var(--ink-500); text-decoration:none; position:relative; transition:background .15s var(--ease), color .15s var(--ease); margin-bottom:2px; }
.sb-link svg { width:18px; height:18px; flex:0 0 auto; color:var(--ink-400); transition:color .15s var(--ease); }
.sb-link:hover { background:var(--surface-2); color:var(--ink-900); }
.sb-link:hover svg { color:var(--ink-700); }
.sb-link.active { background:var(--wa-green-soft); color:#0f7a3d; font-weight:650; }
.sb-link.active svg { color:var(--wa-green-dark); }
.sb-link.active::before { content:""; position:absolute; left:-12px; top:50%; transform:translateY(-50%); width:3px; height:20px; border-radius:0 3px 3px 0; background:var(--wa-green); }
.sb-link .count { margin-left:auto; font-size:11px; font-weight:700; min-width:20px; height:20px; padding:0 6px; border-radius:999px; display:inline-grid; place-items:center; background:var(--meta-blue); color:#fff; }
.sb-link .tag { margin-left:auto; font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; padding:3px 7px; border-radius:6px; background:var(--surface-3); color:var(--ink-400); }

.sb-foot { border-top:1px solid var(--line); padding:12px; }
.sb-user { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:11px; text-decoration:none; transition:background .15s var(--ease); }
.sb-user:hover { background:var(--surface-2); }
.sb-user .avatar { width:34px; height:34px; border-radius:50%; flex:0 0 auto; display:grid; place-items:center; font-size:13px; font-weight:700; color:#fff; background:linear-gradient(145deg,var(--meta-blue),#0e5fcc); }
.sb-user .who { min-width:0; flex:1; }
.sb-user .who strong { display:block; font-size:13.5px; font-weight:650; color:var(--ink-900); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sb-user .who span { font-size:12px; color:var(--ink-400); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
.sb-user .out { color:var(--ink-300); flex:0 0 auto; }
.sb-user .out svg { width:17px; height:17px; }
.sb-user:hover .out { color:var(--error); }

/* mobile top bar + off-canvas */
.main-top { display:none; align-items:center; gap:12px; height:58px; padding:0 16px; background:rgba(255,255,255,.9); backdrop-filter:saturate(1.4) blur(10px); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:30; }
.hamburger { width:38px; height:38px; border-radius:10px; border:1px solid var(--line); background:var(--surface); display:grid; place-items:center; cursor:pointer; color:var(--ink-700); }
.hamburger svg { width:20px; height:20px; }
.main-top .mt-brand { display:flex; align-items:center; gap:9px; font-weight:700; font-size:14.5px; color:var(--ink-900); }
.main-top .mt-brand .glyph { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); }
.main-top .mt-brand .glyph svg { width:18px; height:18px; }
.sb-overlay { display:none; position:fixed; inset:0; background:rgba(11,13,18,.45); z-index:45; opacity:0; transition:opacity .2s var(--ease); }

@media (max-width:1024px){
    .sidebar { position:fixed; left:0; top:0; transform:translateX(-100%); transition:transform .25s var(--ease); box-shadow:var(--shadow-lg); }
    .app-shell.nav-open .sidebar { transform:translateX(0); }
    .app-shell.nav-open .sb-overlay { display:block; opacity:1; }
    .main-top { display:flex; }
}

/* ============================================================
   AUTH (login / register)
   ============================================================ */
.auth-wrap { display:grid; grid-template-columns:1.05fr 1fr; min-height:100vh; }
.auth-wrap.solo { grid-template-columns:1fr; }
.auth-wrap.solo .mobile-logo { display:inline-flex; align-items:center; gap:10px; margin-bottom:26px; font-weight:700; font-size:16px; color:var(--ink-900); text-decoration:none; }
.auth-wrap.solo .mobile-logo .glyph { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 6px 16px rgba(37,211,102,.35); }
.auth-wrap.solo .mobile-logo .glyph svg { width:22px; height:22px; }
.auth-brand { position:relative; overflow:hidden; color:#fff; padding:56px 56px 48px; display:flex; flex-direction:column; background:linear-gradient(155deg,#0e7a3a 0%,#149048 38%,#1aa855 100%); }
.auth-brand::before { content:""; position:absolute; inset:0; background:radial-gradient(700px 400px at 85% 10%, rgba(255,255,255,.16), transparent 60%), radial-gradient(600px 500px at 0% 100%, rgba(24,119,242,.30), transparent 55%); }
.auth-brand > * { position:relative; z-index:1; }
.brand-logo { display:inline-flex; align-items:center; gap:12px; font-weight:700; font-size:17px; letter-spacing:-.01em; text-decoration:none; color:#fff; }
.brand-logo .glyph { width:44px; height:44px; border-radius:13px; display:grid; place-items:center; background:rgba(255,255,255,.16); box-shadow:inset 0 0 0 1px rgba(255,255,255,.22); }
.brand-logo .glyph svg { width:26px; height:26px; }
.brand-hero { margin-top:auto; }
.brand-hero h2 { font-size:34px; line-height:1.18; letter-spacing:-.025em; font-weight:750; margin:0 0 16px; max-width:460px; }
.brand-hero p { font-size:16px; line-height:1.6; color:rgba(255,255,255,.82); margin:0; max-width:440px; }
.brand-stats { display:flex; gap:36px; margin-top:38px; }
.brand-stats .stat strong { display:block; font-size:26px; font-weight:750; letter-spacing:-.02em; }
.brand-stats .stat span { font-size:13px; color:rgba(255,255,255,.72); }
.brand-foot { margin-top:40px; font-size:13px; color:rgba(255,255,255,.65); display:flex; align-items:center; gap:8px; }
.brand-foot svg { width:15px; height:15px; }

.auth-form-panel { display:flex; align-items:center; justify-content:center; padding:40px 24px; background:radial-gradient(700px 360px at 100% -10%, rgba(37,211,102,.07), transparent 60%), radial-gradient(620px 340px at -10% 110%, rgba(24,119,242,.06), transparent 55%), var(--surface); }
.auth-card { width:100%; max-width:400px; }
.auth-card .mobile-logo { display:none; }
.auth-head { margin-bottom:28px; }
.auth-head h1 { margin:0 0 8px; font-size:26px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); }
.auth-head p { margin:0; font-size:14.5px; color:var(--ink-500); }
.auth-head p a { color:var(--meta-blue); font-weight:600; text-decoration:none; }
.auth-head p a:hover { text-decoration:underline; }

.field { margin-bottom:18px; }
.auth-card label.lbl { display:flex; align-items:center; justify-content:space-between; font-size:13px; font-weight:600; color:var(--ink-700); margin-bottom:8px; }
.auth-card label.lbl a { font-size:12.5px; font-weight:600; color:var(--meta-blue); text-decoration:none; }
.auth-card label.lbl a:hover { text-decoration:underline; }
.auth-card .control { position:relative; }
.auth-card .control .lead-ic { position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--ink-400); pointer-events:none; display:grid; place-items:center; }
.auth-card .control .lead-ic svg { width:17px; height:17px; }
.auth-card .control input { width:100%; font:inherit; font-size:14.5px; color:var(--ink-900); background:var(--surface-2); border:1.5px solid var(--line); border-radius:11px; padding:13px 14px 13px 42px; outline:none; transition:border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease); }
.auth-card .control.with-reveal input { padding-right:46px; }
.auth-card .control input::placeholder { color:var(--ink-300); }
.auth-card .control input:hover { border-color:var(--line-strong); }
.auth-card .control input:focus { background:var(--surface); border-color:var(--meta-blue); box-shadow:var(--ring); }
.auth-card .control input:focus ~ .lead-ic { color:var(--meta-blue); }
.reveal { position:absolute; right:8px; top:50%; transform:translateY(-50%); width:30px; height:30px; display:grid; place-items:center; border:none; background:transparent; color:var(--ink-400); cursor:pointer; border-radius:8px; }
.reveal:hover { color:var(--ink-700); background:var(--surface-3); }
.reveal svg { width:17px; height:17px; }
.check-row { display:flex; align-items:center; gap:8px; font-size:13.5px; color:#4b5563; margin-bottom:22px; }
.check-row input { width:16px; height:16px; accent-color:var(--wa-green); }
.btn-submit { width:100%; display:inline-flex; align-items:center; justify-content:center; gap:8px; font:inherit; font-size:15px; font-weight:650; color:#fff; padding:13px 20px; border:none; border-radius:12px; cursor:pointer; background:linear-gradient(135deg,var(--wa-green),var(--wa-green-dark)); box-shadow:0 8px 20px rgba(37,211,102,.34), inset 0 1px 0 rgba(255,255,255,.25); transition:transform .14s var(--ease), box-shadow .18s var(--ease); }
.btn-submit:hover { transform:translateY(-1px); box-shadow:0 12px 28px rgba(37,211,102,.42); }
.btn-submit:active { transform:translateY(0); }
.btn-submit svg { width:17px; height:17px; }
.demo-hint { margin-top:22px; padding:12px 14px; border-radius:11px; background:var(--surface-2); border:1px dashed var(--line-strong); font-size:12.5px; color:var(--ink-500); line-height:1.5; }
.demo-hint b { color:var(--ink-900); }
.auth-err { display:flex; gap:9px; align-items:flex-start; padding:11px 14px; border-radius:11px; background:#fef4f4; border:1px solid #f6caca; color:#b42318; font-size:13px; line-height:1.45; margin-bottom:18px; }
.auth-err svg { width:16px; height:16px; flex:0 0 auto; margin-top:1px; }
.control.invalid input, .card-body .control.invalid input { border-color:var(--error); background:#fef4f4; }
.field-err { display:block; margin:6px 2px 0; font-size:12px; color:var(--error); }
.set-field input.is-error { border-color:var(--error); background:#fef4f4; }
.field-hint { display:block; margin:6px 2px 0; font-size:12px; color:var(--ink-400); }
.muted-terms { margin-top:20px; font-size:12.5px; color:var(--ink-400); line-height:1.5; text-align:center; }
.muted-terms a { color:var(--meta-blue); text-decoration:none; }

@media (max-width:880px){
    .auth-wrap { grid-template-columns:1fr; }
    .auth-brand { display:none; }
    .auth-card .mobile-logo { display:inline-flex; align-items:center; gap:10px; margin-bottom:26px; font-weight:700; font-size:16px; color:var(--ink-900); text-decoration:none; }
    .auth-card .mobile-logo .glyph { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 6px 16px rgba(37,211,102,.35); }
    .auth-card .mobile-logo .glyph svg { width:22px; height:22px; }
}
@media (max-width:420px){ .auth-form-panel { padding:28px 18px; } }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash { background:radial-gradient(800px 400px at 90% -10%, rgba(37,211,102,.07), transparent 60%), linear-gradient(180deg,#fcfdff,#f7f8fa); min-height:calc(100vh - 64px); padding:36px 24px 80px; }
.dash-shell { max-width:1180px; margin:0 auto; }
.dash-greet { font-size:24px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); margin:0 0 4px; }
.dash-sub { font-size:14.5px; color:var(--ink-500); margin:0 0 28px; }
.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:24px; }
.stat-card { background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:var(--shadow-sm); transition:transform .18s var(--ease), box-shadow .18s var(--ease); }
.stat-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-md); }
.stat-card .top { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.stat-card .ic { width:40px; height:40px; border-radius:11px; display:grid; place-items:center; }
.stat-card .ic svg { width:20px; height:20px; }
.stat-card .ic.green { background:var(--wa-green-soft); color:var(--wa-green-dark); }
.stat-card .ic.blue { background:var(--meta-blue-soft); color:var(--meta-blue); }
.stat-card .ic.violet { background:#f0ecfe; color:#6d3bef; }
.stat-card .ic.amber { background:#fff4e5; color:#d97706; }
.stat-card .trend { font-size:12px; font-weight:600; padding:3px 8px; border-radius:999px; background:var(--wa-green-soft); color:#0f7a3d; }
.stat-card h3 { margin:0; font-size:28px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); }
.stat-card p { margin:3px 0 0; font-size:13px; color:var(--ink-400); }
.dash-grid { display:grid; grid-template-columns:minmax(0,1fr) 360px; gap:22px; align-items:start; }
.panel { background:var(--surface); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow-sm); overflow:hidden; }
.panel-head { padding:20px 24px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px; }
.panel-head h2 { margin:0; font-size:16px; font-weight:700; color:var(--ink-900); letter-spacing:-.01em; }
.panel-head p { margin:2px 0 0; font-size:13px; color:var(--ink-400); }
.panel-body { padding:24px; }
.conn { display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.conn .conn-ic { width:56px; height:56px; border-radius:16px; flex:0 0 auto; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 8px 20px rgba(37,211,102,.34); }
.conn .conn-ic svg { width:30px; height:30px; }
.conn .conn-meta { flex:1 1 200px; }
.conn .conn-meta .name { font-size:16px; font-weight:700; color:var(--ink-900); display:flex; align-items:center; gap:9px; }
.conn .conn-meta .desc { font-size:13.5px; color:var(--ink-500); margin-top:3px; }
.pill { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:4px 10px; border-radius:999px; }
.pill .dot { width:7px; height:7px; border-radius:50%; }
.pill.connected { background:var(--wa-green-soft); color:#0f7a3d; } .pill.connected .dot { background:var(--success); }
.pill.pending { background:#fff4ed; color:#b4530f; } .pill.pending .dot { background:var(--warning); }
.pill.error { background:#fef4f4; color:#b42318; } .pill.error .dot { background:var(--error); }
.meta-list { list-style:none; margin:18px 0 0; padding:18px 0 0; border-top:1px solid var(--line); display:grid; grid-template-columns:1fr 1fr; gap:14px 24px; }
.meta-list li { font-size:13px; }
.meta-list .k { color:var(--ink-400); display:block; margin-bottom:2px; }
.meta-list .v { color:var(--ink-900); font-weight:600; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; }
.empty { text-align:center; padding:10px 10px 6px; }
.empty .big-ic { width:64px; height:64px; border-radius:18px; margin:0 auto 16px; display:grid; place-items:center; background:var(--surface-2); border:1px solid var(--line); color:var(--ink-300); }
.empty .big-ic svg { width:30px; height:30px; }
.empty h3 { margin:0 0 6px; font-size:16px; color:var(--ink-900); font-weight:700; }
.empty p { margin:0 auto 18px; font-size:13.5px; color:var(--ink-500); max-width:320px; line-height:1.5; }
.act-list { list-style:none; margin:0; padding:0; }
.act-list li { display:flex; gap:12px; padding:13px 0; border-bottom:1px solid var(--line); }
.act-list li:last-child { border-bottom:none; padding-bottom:0; }
.act-list .a-ic { width:32px; height:32px; border-radius:9px; flex:0 0 auto; display:grid; place-items:center; background:var(--surface-2); color:var(--ink-500); }
.act-list .a-ic svg { width:16px; height:16px; }
.act-list .a-txt { font-size:13.5px; color:var(--ink-700); line-height:1.4; }
.act-list .a-txt b { color:var(--ink-900); font-weight:600; }
.act-list .a-time { font-size:12px; color:var(--ink-400); margin-top:2px; }
@media (max-width:980px){ .dash-grid { grid-template-columns:1fr; } .stat-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .stat-grid { grid-template-columns:1fr; } .meta-list { grid-template-columns:1fr; } .dash { padding:24px 16px 64px; } }

/* ============================================================
   WHATSAPP CONNECT PAGE
   ============================================================ */
.wa-page { color:var(--ink-700); background:radial-gradient(900px 460px at 88% -8%, rgba(37,211,102,.10), transparent 60%), radial-gradient(820px 420px at 5% 0%, rgba(24,119,242,.09), transparent 55%), linear-gradient(180deg,#fcfdff 0%,#f7f8fa 100%); min-height:100vh; padding:28px 24px 96px; }
.wa-shell { max-width:1180px; margin:0 auto; }
.wa-breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:500; color:var(--ink-400); margin-bottom:26px; flex-wrap:wrap; }
.wa-breadcrumb a { color:var(--ink-500); text-decoration:none; padding:4px 8px; border-radius:8px; transition:background .18s var(--ease), color .18s var(--ease); }
.wa-breadcrumb a:hover { color:var(--ink-900); background:var(--surface-3); }
.wa-breadcrumb .sep { color:var(--ink-300); }
.wa-breadcrumb .current { color:var(--ink-900); font-weight:600; }
.wa-header { display:flex; align-items:flex-start; gap:20px; margin-bottom:32px; flex-wrap:wrap; }
.wa-logo { flex:0 0 auto; width:60px; height:60px; border-radius:18px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 10px 26px rgba(37,211,102,.38), inset 0 1px 0 rgba(255,255,255,.35); position:relative; }
.wa-logo svg { width:34px; height:34px; }
.wa-logo::after { content:""; position:absolute; inset:0; border-radius:18px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.18); }
.wa-header-text { flex:1 1 320px; }
.wa-title { margin:0; font-size:30px; line-height:1.15; letter-spacing:-.02em; font-weight:750; color:var(--ink-900); display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.wa-subtitle { margin:8px 0 0; font-size:15px; line-height:1.55; color:var(--ink-500); max-width:620px; }
.wa-header-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.wa-pill { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; font-weight:600; letter-spacing:.01em; padding:6px 12px 6px 10px; border-radius:999px; border:1px solid transparent; white-space:nowrap; }
.wa-pill .dot { width:8px; height:8px; border-radius:50%; position:relative; }
.wa-pill.is-disconnected { background:#fff4ed; color:#b4530f; border-color:#fcd9bd; }
.wa-pill.is-disconnected .dot { background:var(--warning); }
.wa-pill.is-connected { background:var(--wa-green-soft); color:#0f7a3d; border-color:#b8ecca; }
.wa-pill.is-connected .dot { background:var(--success); }
.wa-pill.is-connected .dot::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:2px solid rgba(22,163,74,.4); animation:pulse 1.8s var(--ease) infinite; }
.wa-grid { display:grid; grid-template-columns:minmax(0,1fr) 348px; gap:24px; align-items:start; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); overflow:hidden; }
.card + .card { margin-top:24px; }
.card-head { padding:22px 26px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:14px; }
.card-head .ic { width:38px; height:38px; border-radius:11px; flex:0 0 auto; display:grid; place-items:center; background:var(--meta-blue-soft); color:var(--meta-blue); }
.card-head .ic svg { width:20px; height:20px; }
.card-head h2 { margin:0; font-size:16px; font-weight:700; color:var(--ink-900); letter-spacing:-.01em; }
.card-head p { margin:3px 0 0; font-size:13px; color:var(--ink-400); }
.card-head .step-tag { margin-left:auto; font-size:11.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--meta-blue); background:var(--meta-blue-soft); padding:5px 10px; border-radius:8px; }
.card-body { padding:26px; }
.stepper { display:flex; align-items:center; gap:0; margin-bottom:4px; }
.step { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.step .bubble { width:30px; height:30px; border-radius:50%; flex:0 0 auto; display:grid; place-items:center; font-size:13px; font-weight:700; background:var(--surface); border:2px solid var(--line-strong); color:var(--ink-400); transition:all .25s var(--ease); }
.step .label { font-size:13px; font-weight:600; color:var(--ink-400); white-space:nowrap; }
.step .connector { flex:1; height:2px; background:var(--line); margin:0 14px; border-radius:2px; min-width:18px; }
.step.is-done .bubble { background:var(--wa-green); border-color:var(--wa-green); color:#fff; box-shadow:0 4px 10px rgba(37,211,102,.35); }
.step.is-done .label { color:var(--ink-700); }
.step.is-active .bubble { background:var(--meta-blue); border-color:var(--meta-blue); color:#fff; box-shadow:var(--ring); }
.step.is-active .label { color:var(--ink-900); }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.card-body label.lbl { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--ink-700); margin-bottom:8px; }
.card-body label.lbl .req { color:var(--error); }
.hint-ic { width:15px; height:15px; border-radius:50%; display:inline-grid; place-items:center; background:var(--surface-3); color:var(--ink-400); font-size:10px; font-weight:700; cursor:help; }
.card-body .control { position:relative; }
.card-body .control input, .card-body .control textarea { width:100%; font:inherit; font-size:14px; color:var(--ink-900); background:var(--surface-2); border:1.5px solid var(--line); border-radius:var(--radius-sm); padding:12px 14px; transition:border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease); outline:none; }
.card-body .control.has-icon input { padding-left:42px; }
.card-body .control.has-reveal input { padding-right:92px; }
.card-body .control input::placeholder { color:var(--ink-300); }
.card-body .control input:hover { border-color:var(--line-strong); }
.card-body .control input:focus { background:var(--surface); border-color:var(--meta-blue); box-shadow:var(--ring); }
.card-body .control .lead-ic { position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--ink-400); pointer-events:none; display:grid; place-items:center; }
.card-body .control .lead-ic svg { width:17px; height:17px; }
.card-body .control input:focus ~ .lead-ic { color:var(--meta-blue); }
.reveal-btn { position:absolute; right:8px; top:50%; transform:translateY(-50%); display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600; color:var(--ink-500); background:var(--surface-3); border:1px solid var(--line); padding:6px 9px; border-radius:8px; cursor:pointer; transition:all .15s var(--ease); }
.reveal-btn:hover { color:var(--ink-900); background:var(--surface); border-color:var(--line-strong); }
.reveal-btn svg { width:14px; height:14px; }
.card-body .desc { margin:7px 2px 0; font-size:12px; color:var(--ink-400); line-height:1.45; }
.card-body .desc a { color:var(--meta-blue); text-decoration:none; font-weight:500; }
.card-body .desc a:hover { text-decoration:underline; }
.copy-field { display:flex; align-items:center; gap:10px; background:var(--surface-2); border:1.5px dashed var(--line-strong); border-radius:var(--radius-sm); padding:11px 11px 11px 14px; }
.copy-field code { flex:1; font-family:ui-monospace,'Cascadia Code',Menlo,Consolas,monospace; font-size:13px; color:var(--ink-700); overflow-x:auto; white-space:nowrap; }
.copy-btn { flex:0 0 auto; display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color:#fff; background:var(--ink-900); border:none; padding:8px 12px; border-radius:8px; cursor:pointer; transition:transform .12s var(--ease), background .15s var(--ease); }
.copy-btn:hover { background:#1a1f29; transform:translateY(-1px); } .copy-btn:active { transform:translateY(0); }
.copy-btn svg { width:14px; height:14px; } .copy-btn.copied { background:var(--success); }
.card-foot { display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding:18px 26px; background:var(--surface-2); border-top:1px solid var(--line); }
.card-foot .spacer { flex:1; }
.card-foot .note { font-size:12.5px; color:var(--ink-400); display:inline-flex; align-items:center; gap:6px; }
.card-foot .note svg { width:14px; height:14px; color:var(--success); }
.side-card .card-body { padding:22px; }
.side-title { font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-400); margin:0 0 16px; }
.check-list { list-style:none; margin:0; padding:0; display:grid; gap:14px; }
.check-list li { display:flex; gap:11px; font-size:13.5px; line-height:1.5; color:var(--ink-700); }
.check-list .ck { flex:0 0 auto; width:20px; height:20px; border-radius:50%; display:grid; place-items:center; background:var(--wa-green-soft); color:var(--wa-green-dark); }
.check-list .ck svg { width:12px; height:12px; } .check-list b { color:var(--ink-900); font-weight:600; }
.resource { display:flex; align-items:center; gap:13px; padding:13px 14px; border-radius:12px; text-decoration:none; border:1px solid var(--line); background:var(--surface); transition:all .18s var(--ease); margin-bottom:10px; }
.resource:last-child { margin-bottom:0; }
.resource:hover { border-color:var(--line-strong); box-shadow:var(--shadow-sm); transform:translateY(-2px); }
.resource .r-ic { width:36px; height:36px; border-radius:10px; display:grid; place-items:center; flex:0 0 auto; }
.resource .r-ic svg { width:18px; height:18px; }
.resource .r-ic.blue { background:var(--meta-blue-soft); color:var(--meta-blue); }
.resource .r-ic.green { background:var(--wa-green-soft); color:var(--wa-green-dark); }
.resource .r-ic.violet { background:#f0ecfe; color:#6d3bef; }
.resource .r-txt { flex:1; min-width:0; }
.resource .r-txt strong { display:block; font-size:13.5px; color:var(--ink-900); font-weight:600; }
.resource .r-txt span { font-size:12px; color:var(--ink-400); }
.resource .arrow { color:var(--ink-300); transition:transform .18s var(--ease), color .18s var(--ease); }
.resource:hover .arrow { transform:translateX(3px); color:var(--ink-500); }
.resource .arrow svg { width:16px; height:16px; }
.support-card { background:linear-gradient(150deg,#0b0d12,#1b2230); border:none; color:#fff; }
.support-card .side-title { color:rgba(255,255,255,.55); }
.support-card p { font-size:13.5px; line-height:1.55; color:rgba(255,255,255,.78); margin:0 0 16px; }
.support-card .btn-secondary { background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.18); color:#fff; }
.support-card .btn-secondary:hover { background:rgba(255,255,255,.16); }
.alert { display:flex; gap:12px; padding:14px 16px; border-radius:12px; font-size:13.5px; line-height:1.5; margin-bottom:24px; border:1px solid; }
.alert svg { width:18px; height:18px; flex:0 0 auto; margin-top:1px; }
.alert.info { background:var(--meta-blue-soft); border-color:#c5ddfc; color:#1257b0; }
.alert.info b { color:#0e4a99; }

/* ---------- Embedded Signup hero (Continue with Facebook) ---------- */
.connect-hero { text-align:center; padding:44px 36px 38px; position:relative; overflow:hidden; }
.connect-hero::before { content:""; position:absolute; inset:0; background:radial-gradient(520px 200px at 50% -20%, rgba(24,119,242,.10), transparent 70%); pointer-events:none; }
.connect-hero > * { position:relative; }
.hero-badges { display:inline-flex; align-items:center; gap:0; margin-bottom:22px; }
.hero-badges .b { width:60px; height:60px; border-radius:18px; display:grid; place-items:center; box-shadow:var(--shadow-md); }
.hero-badges .b svg { width:32px; height:32px; }
.hero-badges .b.wa { background:linear-gradient(145deg,#2bdc70,#1cb257); transform:rotate(-6deg); }
.hero-badges .b.fb { background:linear-gradient(145deg,#3b8bf5,#0e5fcc); transform:rotate(6deg); margin-left:-14px; }
.hero-badges .link { width:30px; height:30px; border-radius:50%; background:var(--surface); border:1px solid var(--line); display:grid; place-items:center; color:var(--ink-400); margin:0 -10px; z-index:2; box-shadow:var(--shadow-xs); }
.hero-badges .link svg { width:15px; height:15px; }
.connect-hero h2 { margin:0 0 8px; font-size:22px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); }
.connect-hero p.lead { margin:0 auto 26px; font-size:14.5px; line-height:1.55; color:var(--ink-500); max-width:430px; }
.btn-facebook { display:inline-flex; align-items:center; justify-content:center; gap:11px; font:inherit; font-size:15.5px; font-weight:650; color:#fff; padding:14px 28px; border:none; border-radius:13px; cursor:pointer; background:linear-gradient(135deg,#1c8bff,#1877F2 55%,#0e5fcc); box-shadow:0 10px 24px rgba(24,119,242,.36), inset 0 1px 0 rgba(255,255,255,.25); transition:transform .14s var(--ease), box-shadow .18s var(--ease); }
.btn-facebook:hover { transform:translateY(-1px); box-shadow:0 14px 32px rgba(24,119,242,.46); }
.btn-facebook:active { transform:translateY(0); }
.btn-facebook svg { width:21px; height:21px; }
.hero-secure { display:flex; align-items:center; justify-content:center; gap:7px; margin-top:16px; font-size:12.5px; color:var(--ink-400); }
.hero-secure svg { width:14px; height:14px; color:var(--success); }
.hero-perms { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.perm-chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:550; color:var(--ink-500); background:var(--surface-2); border:1px solid var(--line); padding:6px 11px; border-radius:999px; }
.perm-chip svg { width:13px; height:13px; color:var(--meta-blue); }

/* ---------- How it works (3 steps) ---------- */
.how-steps { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.how-step { position:relative; padding:18px 16px; border-radius:14px; background:var(--surface-2); border:1px solid var(--line); }
.how-step .n { width:26px; height:26px; border-radius:8px; display:grid; place-items:center; font-size:13px; font-weight:700; color:#fff; background:linear-gradient(145deg,var(--meta-blue),#0e5fcc); margin-bottom:11px; }
.how-step h4 { margin:0 0 4px; font-size:13.5px; font-weight:650; color:var(--ink-900); }
.how-step p { margin:0; font-size:12.5px; line-height:1.45; color:var(--ink-500); }

/* ---------- Advanced (manual) disclosure ---------- */
.advanced { margin-top:24px; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); box-shadow:var(--shadow-sm); overflow:hidden; }
.advanced > summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:12px; padding:18px 22px; font-size:14px; font-weight:600; color:var(--ink-700); user-select:none; transition:background .15s var(--ease); }
.advanced > summary::-webkit-details-marker { display:none; }
.advanced > summary:hover { background:var(--surface-2); }
.advanced > summary .s-ic { width:34px; height:34px; border-radius:10px; flex:0 0 auto; display:grid; place-items:center; background:var(--surface-3); color:var(--ink-500); }
.advanced > summary .s-ic svg { width:18px; height:18px; }
.advanced > summary .s-txt { flex:1; }
.advanced > summary .s-txt small { display:block; font-size:12px; font-weight:500; color:var(--ink-400); margin-top:2px; }
.advanced > summary .chev { color:var(--ink-400); transition:transform .2s var(--ease); }
.advanced > summary .chev svg { width:18px; height:18px; display:block; }
.advanced[open] > summary { border-bottom:1px solid var(--line); }
.advanced[open] > summary .chev { transform:rotate(180deg); }
.advanced .adv-body { padding:22px; background:var(--surface-2); }
.advanced .adv-body .card:first-child { margin-top:0; }
.divider-or { display:flex; align-items:center; gap:14px; margin:22px 2px; color:var(--ink-300); font-size:12px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; }
.divider-or::before, .divider-or::after { content:""; flex:1; height:1px; background:var(--line); }

@media (max-width:980px){ .wa-grid { grid-template-columns:1fr; } .wa-sidebar { order:-1; } .wa-sidebar .card { margin-top:0; } .wa-sidebar .card + .card { margin-top:24px; } }
@media (max-width:560px){ .how-steps { grid-template-columns:1fr; } .connect-hero { padding:34px 20px 30px; } }
@media (max-width:680px){ .wa-page { padding:20px 16px 64px; } .wa-title { font-size:24px; } .field-row { grid-template-columns:1fr; } .wa-header-actions { margin-left:0; width:100%; } .stepper { overflow-x:auto; padding-bottom:8px; } .step .label { display:none; } .card-body,.card-head { padding-left:18px; padding-right:18px; } .card-foot { padding-left:18px; padding-right:18px; } .card-foot .btn { width:100%; } .card-foot .spacer { display:none; } }

/* ============================================================
   GALLERY (index)
   ============================================================ */
.gallery { max-width:1080px; margin:0 auto; padding:64px 24px; }
.gallery h1 { font-size:30px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); margin:0 0 6px; }
.gallery .lead { font-size:15px; color:var(--ink-500); margin:0 0 36px; }
.gallery-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:22px; }
.gallery-card { display:block; text-decoration:none; background:var(--surface); border:1px solid var(--line); border-radius:18px; overflow:hidden; box-shadow:var(--shadow-sm); transition:transform .18s var(--ease), box-shadow .18s var(--ease); }
.gallery-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-lg); }
.gallery-card .thumb { height:150px; display:grid; place-items:center; color:#fff; }
.gallery-card .thumb svg { width:46px; height:46px; opacity:.95; }
.gallery-card .t-green { background:linear-gradient(145deg,#2bdc70,#149048); }
.gallery-card .t-blue { background:linear-gradient(145deg,#3b8bf5,#0e5fcc); }
.gallery-card .t-dark { background:linear-gradient(145deg,#1b2230,#0b0d12); }
.gallery-card .t-violet { background:linear-gradient(145deg,#8b5cf6,#6d3bef); }
.gallery-card .meta { padding:18px 20px; }
.gallery-card .meta strong { display:block; font-size:16px; color:var(--ink-900); font-weight:700; }
.gallery-card .meta span { font-size:13px; color:var(--ink-400); }
@media (max-width:680px){ .gallery-grid { grid-template-columns:1fr; } }

/* ============================================================
   CHAT / INBOX
   ============================================================ */
.chat { display:flex; height:100vh; background:var(--surface); }
.chat-list { flex:0 0 340px; width:340px; border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:0; }
.chat-list-head { padding:18px 18px 12px; border-bottom:1px solid var(--line); }
.chat-list-head h2 { margin:0 0 12px; font-size:18px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); display:flex; align-items:center; gap:8px; }
.chat-list-head h2 .count { font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px; background:var(--wa-green-soft); color:#0f7a3d; }
.chat-search { position:relative; }
.chat-search svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--ink-400); }
.chat-search input { width:100%; font:inherit; font-size:13.5px; padding:10px 12px 10px 36px; border:1.5px solid var(--line); border-radius:10px; background:var(--surface-2); outline:none; transition:border-color .15s var(--ease), box-shadow .15s var(--ease); }
.chat-search input:focus { border-color:var(--meta-blue); box-shadow:var(--ring); background:var(--surface); }
.conv-list { flex:1; overflow-y:auto; padding:8px; display:flex; flex-direction:column; }
.conv-empty { margin:auto; display:flex; flex-direction:column; align-items:center; text-align:center; padding:24px; max-width:260px; }
.conv-empty .ce-ic { width:56px; height:56px; border-radius:16px; display:grid; place-items:center; background:var(--surface-2); border:1px solid var(--line); color:var(--ink-300); margin-bottom:14px; }
.conv-empty .ce-ic svg { width:26px; height:26px; }
.conv-empty strong { font-size:14.5px; font-weight:650; color:var(--ink-700); margin-bottom:5px; }
.conv-empty > span { font-size:13px; color:var(--ink-400); line-height:1.5; }
.conv { display:flex; gap:12px; padding:11px 12px; border-radius:12px; cursor:pointer; text-decoration:none; transition:background .14s var(--ease); }
.conv:hover { background:var(--surface-2); }
.conv.active { background:var(--wa-green-soft); }
.conv .av { width:44px; height:44px; border-radius:50%; flex:0 0 auto; display:grid; place-items:center; font-size:15px; font-weight:700; color:#fff; }
.conv .av.c1 { background:linear-gradient(145deg,#f59e0b,#d97706); }
.conv .av.c2 { background:linear-gradient(145deg,#6d3bef,#8b5cf6); }
.conv .av.c3 { background:linear-gradient(145deg,#1877F2,#0e5fcc); }
.conv .av.c4 { background:linear-gradient(145deg,#25D366,#1da851); }
.conv .av.c5 { background:linear-gradient(145deg,#ef4444,#b91c1c); }
.conv .cmeta { flex:1; min-width:0; }
.conv .crow { display:flex; align-items:center; gap:8px; }
.conv .cname { font-size:14px; font-weight:650; color:var(--ink-900); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.conv .ctime { font-size:11.5px; color:var(--ink-400); flex:0 0 auto; }
.conv .cprev { font-size:13px; color:var(--ink-500); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; display:flex; align-items:center; gap:6px; }
.conv .cprev .unread { margin-left:auto; flex:0 0 auto; min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:var(--wa-green); color:#fff; font-size:11px; font-weight:700; display:inline-grid; place-items:center; }
.conv .cprev .tick { color:var(--meta-blue); }

.chat-thread { flex:1; display:flex; flex-direction:column; min-width:0; min-height:0; background:#efe7df; background-image:linear-gradient(rgba(245,240,235,.6), rgba(245,240,235,.6)); }
.thread-head { display:flex; align-items:center; gap:12px; padding:12px 18px; background:var(--surface); border-bottom:1px solid var(--line); }
.thread-head .av { width:40px; height:40px; border-radius:50%; display:grid; place-items:center; font-size:14px; font-weight:700; color:#fff; background:linear-gradient(145deg,#f59e0b,#d97706); flex:0 0 auto; }
.thread-head .th-meta { flex:1; min-width:0; }
.thread-head .th-meta strong { display:block; font-size:14.5px; font-weight:650; color:var(--ink-900); }
.thread-head .th-meta span { font-size:12.5px; color:var(--success); display:flex; align-items:center; gap:5px; }
.thread-head .th-meta span .dot { width:6px; height:6px; border-radius:50%; background:var(--success); }
.thread-head .th-act { display:flex; gap:4px; }
.thread-head .th-act button { width:36px; height:36px; border-radius:9px; border:none; background:transparent; color:var(--ink-500); cursor:pointer; display:grid; place-items:center; transition:background .14s var(--ease); }
.thread-head .th-act button:hover { background:var(--surface-3); color:var(--ink-900); }
.thread-head .th-act svg { width:18px; height:18px; }
.thread-body { flex:1; overflow-y:auto; padding:24px 24px 8px; display:flex; flex-direction:column; gap:8px; }
.day-sep { align-self:center; font-size:11.5px; font-weight:600; color:var(--ink-500); background:rgba(255,255,255,.8); padding:4px 12px; border-radius:8px; margin:6px 0; box-shadow:var(--shadow-xs); }
.msg { max-width:74%; padding:8px 12px; border-radius:12px; font-size:13.5px; line-height:1.45; color:var(--ink-900); position:relative; box-shadow:0 1px 1px rgba(16,24,40,.06); }
.msg .t { display:block; font-size:10.5px; color:var(--ink-400); text-align:right; margin-top:3px; }
.msg.in { align-self:flex-start; background:#fff; border-top-left-radius:3px; }
.msg.out { align-self:flex-end; background:#d9fdd3; border-top-right-radius:3px; }
.msg.out .t { color:#5a8a52; display:flex; align-items:center; justify-content:flex-end; gap:4px; }
.msg.out .t svg { width:14px; height:14px; color:var(--meta-blue); }
.msg .bd { white-space:pre-wrap; word-break:break-word; }
.msg a { color:#1257b0; text-decoration:underline; }
.msg.out a { color:#0f7a3d; }
.thread-compose { display:flex; align-items:center; gap:10px; padding:12px 18px; background:var(--surface); border-top:1px solid var(--line); }
.thread-compose .ic-btn { width:40px; height:40px; flex:0 0 auto; border-radius:10px; border:none; background:transparent; color:var(--ink-400); cursor:pointer; display:grid; place-items:center; }
.thread-compose .ic-btn:hover { background:var(--surface-3); color:var(--ink-700); }
.thread-compose .ic-btn svg { width:20px; height:20px; }
.thread-compose .ci { flex:1; }
.thread-compose input { width:100%; font:inherit; font-size:14px; padding:12px 16px; border:1.5px solid var(--line); border-radius:999px; background:var(--surface-2); outline:none; transition:border-color .15s var(--ease), box-shadow .15s var(--ease); }
.thread-compose input:focus { border-color:var(--meta-blue); box-shadow:var(--ring); background:var(--surface); }
.thread-compose .send { width:44px; height:44px; flex:0 0 auto; border-radius:50%; border:none; cursor:pointer; display:grid; place-items:center; color:#fff; background:linear-gradient(135deg,var(--wa-green),var(--wa-green-dark)); box-shadow:0 6px 14px rgba(37,211,102,.34); transition:transform .14s var(--ease); }
.thread-compose .send:hover { transform:translateY(-1px); }
.thread-compose .send svg { width:19px; height:19px; }
@media (max-width:1024px){ .chat { height:calc(100vh - 58px); } }
@media (max-width:720px){ .chat-list { flex-basis:100%; width:100%; } .chat-thread { display:none; } }

/* ============================================================
   CREATE TEMPLATE
   ============================================================ */
.tpl { padding:30px 24px 64px; background:linear-gradient(180deg,#fcfdff,#f7f8fa); min-height:100vh; }
.tpl-shell { max-width:1180px; margin:0 auto; }
.tpl-head { margin-bottom:24px; }
.tpl-head h1 { margin:0 0 4px; font-size:24px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); }
.tpl-head p { margin:0; font-size:14.5px; color:var(--ink-500); }
.tpl-grid { display:grid; grid-template-columns:minmax(0,1fr) 380px; gap:24px; align-items:start; }
.tpl-field { margin-bottom:20px; }
.tpl-field:last-child { margin-bottom:0; }
.tpl-field > label { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--ink-700); margin-bottom:8px; }
.tpl-field .req { color:var(--error); }
.tpl-field input[type=text], .tpl-field select, .tpl-field textarea { width:100%; font:inherit; font-size:14px; color:var(--ink-900); background:var(--surface-2); border:1.5px solid var(--line); border-radius:var(--radius-sm); padding:12px 14px; outline:none; transition:border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease); }
.tpl-field select { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23828b99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; padding-right:38px; }
.tpl-field textarea { resize:vertical; min-height:120px; line-height:1.5; }
.tpl-field input:focus, .tpl-field select:focus, .tpl-field textarea:focus { border-color:var(--meta-blue); box-shadow:var(--ring); background:var(--surface); }
.tpl-field .help { margin:7px 2px 0; font-size:12px; color:var(--ink-400); }
.tpl-field .charcount { float:right; font-size:11.5px; color:var(--ink-400); font-weight:500; }
.seg { display:flex; gap:8px; flex-wrap:wrap; }
.seg label { flex:1; min-width:120px; cursor:pointer; }
.seg input { position:absolute; opacity:0; pointer-events:none; }
.seg .opt { display:flex; align-items:center; gap:9px; padding:12px 14px; border:1.5px solid var(--line); border-radius:12px; background:var(--surface); transition:all .15s var(--ease); }
.seg .opt .o-ic { width:30px; height:30px; border-radius:8px; display:grid; place-items:center; background:var(--surface-3); color:var(--ink-500); flex:0 0 auto; }
.seg .opt .o-ic svg { width:16px; height:16px; }
.seg .opt .o-tx strong { display:block; font-size:13px; font-weight:600; color:var(--ink-900); }
.seg .opt .o-tx span { font-size:11.5px; color:var(--ink-400); }
.seg label:hover .opt { border-color:var(--line-strong); }
.seg input:checked + .opt { border-color:var(--meta-blue); background:var(--meta-blue-soft); box-shadow:var(--ring); }
.seg input:checked + .opt .o-ic { background:var(--meta-blue); color:#fff; }
.var-chip { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600; font-family:ui-monospace,Menlo,Consolas,monospace; padding:5px 9px; border-radius:7px; background:var(--meta-blue-soft); color:var(--meta-blue); border:none; cursor:pointer; transition:background .14s var(--ease); }
.var-chip:hover { background:#d6e6fd; }
.var-chip:disabled { opacity:.45; cursor:not-allowed; background:var(--surface-3); color:var(--ink-400); }
.var-chip svg { width:12px; height:12px; }

/* header type selector */
.type-seg { display:inline-flex; flex-wrap:wrap; gap:6px; background:var(--surface-3); border-radius:11px; padding:4px; }
.type-seg label { cursor:pointer; margin:0; }
.type-seg input { position:absolute; opacity:0; width:0; height:0; pointer-events:none; }
.type-seg span { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--ink-500); padding:7px 12px; border-radius:8px; transition:all .14s var(--ease); }
.type-seg span svg { width:15px; height:15px; }
.type-seg label:hover span { color:var(--ink-900); }
.type-seg input:checked + span { background:var(--surface); color:var(--ink-900); box-shadow:var(--shadow-xs); }

/* preview media header */
.pb-media:empty { display:none; }
.pb-media { margin-bottom:8px; }
.pb-media.bleed { margin:-9px -10px 8px; border-radius:7px 7px 0 0; overflow:hidden; }
.pb-media .ph { display:flex; align-items:center; justify-content:center; height:150px; color:rgba(255,255,255,.92); position:relative; }
.pb-media .ph.img { background:linear-gradient(135deg,#9ec1f5,#5b8def); }
.pb-media .ph.video { background:linear-gradient(135deg,#374151,#111827); }
.pb-media .ph svg { width:40px; height:40px; }
.pb-media img { width:100%; height:150px; object-fit:cover; display:block; }
.pb-media .play { position:absolute; width:52px; height:52px; border-radius:50%; background:rgba(0,0,0,.45); display:grid; place-items:center; }
.pb-media .play svg { width:24px; height:24px; margin-left:2px; }
.pb-doc { display:flex; align-items:center; gap:10px; background:#f5f6f6; border-radius:8px; padding:9px 11px; }
.pb-doc .d-ic { width:34px; height:34px; border-radius:8px; background:#fff; display:grid; place-items:center; color:#e11d48; flex:0 0 auto; }
.pb-doc .d-ic svg { width:18px; height:18px; }
.pb-doc .d-tx { min-width:0; }
.pb-doc .d-tx strong { display:block; font-size:12.5px; color:#111b21; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pb-doc .d-tx span { font-size:11px; color:#667781; }
.pb-media .ph.map { background:linear-gradient(135deg,#cfe8d4,#9fd3ab); color:#1b6b34; }

/* body formatting toolbar */
.editor-toolbar { display:flex; align-items:center; gap:3px; padding:6px 8px; border:1.5px solid var(--line); border-bottom:none; border-radius:var(--radius-sm) var(--radius-sm) 0 0; background:var(--surface-2); position:relative; flex-wrap:wrap; }
.editor-toolbar button { min-width:30px; height:30px; padding:0 8px; border:none; background:transparent; border-radius:7px; color:var(--ink-700); font-size:14px; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:5px; transition:background .14s var(--ease); }
.editor-toolbar button:hover { background:var(--surface-3); color:var(--ink-900); }
.editor-toolbar .tb-add { font-size:12.5px; color:var(--meta-blue); font-weight:600; }
.editor-toolbar .tb-add:hover { background:var(--meta-blue-soft); }
.editor-toolbar .tb-add svg { width:14px; height:14px; }
.editor-toolbar .tb-div { width:1px; height:18px; background:var(--line-strong); margin:0 4px; }
#tpl_body { border-top-left-radius:0; border-top-right-radius:0; }
.emoji-pop { position:absolute; top:44px; left:8px; z-index:20; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow-md); padding:8px; display:grid; grid-template-columns:repeat(8,1fr); gap:2px; }
.emoji-pop[hidden] { display:none; }
.emoji-pop button { font-size:18px; width:32px; height:32px; border:none; background:transparent; border-radius:8px; cursor:pointer; }
.emoji-pop button:hover { background:var(--surface-3); }

/* placeholder token in preview */
.ph-var { font-weight:600; color:#1f6fd6; }

/* sample content rows */
.sample-row { display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.sample-row .sample-lab { flex:0 0 96px; font-size:12.5px; font-weight:600; color:var(--ink-500); font-family:ui-monospace,Menlo,Consolas,monospace; }
.sample-row input { flex:1; }
.tpl-foot { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-top:22px; }
.tpl-foot .spacer { flex:1; }

/* phone preview */
.tpl-preview { position:sticky; top:24px; }
.preview-title { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-400); margin:0 0 14px; text-align:center; }
.wa-phone { background:#0b141a; border-radius:34px; padding:12px; box-shadow:var(--shadow-lg); }
.wa-phone-inner { border-radius:24px; overflow:hidden; background:#e5ddd5; background-image:radial-gradient(circle at 20% 20%, rgba(255,255,255,.4), transparent 40%); }
.wa-phone-bar { display:flex; align-items:center; gap:10px; padding:14px 14px 12px; background:linear-gradient(135deg,#1da851,#149048); color:#fff; }
.wa-phone-bar .pav { width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.22); display:grid; place-items:center; flex:0 0 auto; }
.wa-phone-bar .pav svg { width:20px; height:20px; }
.wa-phone-bar .pname strong { display:block; font-size:13.5px; font-weight:650; }
.wa-phone-bar .pname span { font-size:11px; color:rgba(255,255,255,.8); }
.wa-phone-body { padding:18px 14px 22px; min-height:300px; }
.preview-bubble { background:#fff; border-radius:10px; border-top-left-radius:3px; padding:9px 10px 7px; max-width:88%; box-shadow:0 1px 1px rgba(0,0,0,.12); font-size:13px; line-height:1.5; color:#111b21; }
.preview-bubble .pb-head { font-weight:700; margin-bottom:6px; color:#111b21; overflow-wrap:anywhere; word-break:break-word; }
.preview-bubble .pb-body { white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; }
.preview-bubble .pb-foot { overflow-wrap:anywhere; word-break:break-word; }
.preview-bubble .pb-body b { font-weight:700; }
.preview-bubble .pb-foot { margin-top:8px; font-size:11px; color:#667781; }
.preview-bubble .pb-time { text-align:right; font-size:10.5px; color:#667781; margin-top:2px; }
.preview-bubble.has-btns { padding-bottom:2px; }
.preview-btns { margin-top:6px; border-top:1px solid #e9edef; }
.preview-btns a { display:flex; align-items:center; justify-content:center; gap:7px; padding:9px; font-size:13px; font-weight:550; color:#0096de; text-decoration:none; border-top:1px solid #e9edef; }
.preview-btns a:first-child { border-top:none; }
.preview-btns a svg { width:15px; height:15px; }
/* template buttons editor */
.btn-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.btn-row .btn-type { flex:0 0 140px; width:140px; }
.btn-row .btn-text { flex:1 1 110px; min-width:0; }
.btn-row .btn-extra { flex:1 1 130px; min-width:0; }
.btn-remove { flex:0 0 auto; width:42px; height:44px; border:1.5px solid var(--line); background:var(--surface); border-radius:var(--radius-sm); color:var(--ink-400); cursor:pointer; display:grid; place-items:center; transition:all .14s var(--ease); }
.btn-remove:hover { color:var(--error); border-color:#f6caca; background:#fef4f4; }
.btn-remove svg { width:16px; height:16px; }
.btn-add-row { display:inline-flex; align-items:center; gap:7px; font:inherit; font-size:13px; font-weight:600; color:var(--meta-blue); background:var(--meta-blue-soft); border:1px dashed #bcd8fb; padding:9px 14px; border-radius:10px; cursor:pointer; margin-top:4px; transition:background .14s var(--ease); }
.btn-add-row:hover { background:#d6e6fd; }
.btn-add-row:disabled { opacity:.5; cursor:not-allowed; }
.btn-add-row svg { width:15px; height:15px; }
@media (max-width:480px){ .btn-row { flex-wrap:wrap; } .btn-row .btn-type { flex:1 1 100%; width:100%; } }

@media (max-width:980px){ .tpl-grid { grid-template-columns:1fr; } .tpl-preview { position:static; max-width:340px; margin:0 auto; } }

/* ============================================================
   SHARED PAGE CHROME (Campaigns / Contacts / Analytics / Settings)
   ============================================================ */
.page { background:radial-gradient(800px 400px at 92% -10%, rgba(37,211,102,.06), transparent 60%), linear-gradient(180deg,#fcfdff,#f7f8fa); min-height:100vh; padding:32px 24px 72px; }
.page-shell { max-width:1180px; margin:0 auto; }
.page-head { display:flex; align-items:flex-start; gap:16px; flex-wrap:wrap; margin-bottom:24px; }
.page-head .ph-text h1 { margin:0 0 5px; font-size:24px; font-weight:750; letter-spacing:-.02em; color:var(--ink-900); }
.page-head .ph-text p { margin:0; font-size:14.5px; color:var(--ink-500); }
.page-head .ph-actions { margin-left:auto; display:flex; gap:10px; flex-wrap:wrap; }
@media (max-width:560px){ .page { padding:22px 16px 56px; } .page-head .ph-actions { margin-left:0; width:100%; } .page-head .ph-actions .btn { flex:1; } }

/* toolbar (search + filter chips) */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.tb-search { position:relative; flex:1; min-width:200px; max-width:340px; }
.tb-search svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--ink-400); }
.tb-search input { width:100%; font:inherit; font-size:13.5px; padding:10px 12px 10px 36px; border:1.5px solid var(--line); border-radius:10px; background:var(--surface); outline:none; transition:border-color .15s var(--ease), box-shadow .15s var(--ease); }
.tb-search input:focus { border-color:var(--meta-blue); box-shadow:var(--ring); }
.filter-tabs { display:inline-flex; background:var(--surface-3); border-radius:10px; padding:3px; gap:2px; }
.filter-tabs a { font-size:13px; font-weight:600; color:var(--ink-500); text-decoration:none; padding:7px 13px; border-radius:8px; transition:all .14s var(--ease); }
.filter-tabs a:hover { color:var(--ink-900); }
.filter-tabs a.active { background:var(--surface); color:var(--ink-900); box-shadow:var(--shadow-xs); }
.tb-spacer { flex:1; }

/* extra pill colors */
.pill.info { background:var(--meta-blue-soft); color:#1257b0; } .pill.info .dot { background:var(--meta-blue); }
.pill.neutral { background:var(--surface-3); color:var(--ink-500); } .pill.neutral .dot { background:var(--ink-300); }
.pill.warn { background:#fff4ed; color:#b4530f; } .pill.warn .dot { background:var(--warning); }

/* data table */
.tbl-wrap { background:var(--surface); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow-sm); overflow:hidden; }
.tbl-scroll { overflow-x:auto; }
.tbl { width:100%; border-collapse:collapse; min-width:680px; }
.tbl th { text-align:left; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-400); padding:14px 18px; border-bottom:1px solid var(--line); background:var(--surface-2); white-space:nowrap; }
.tbl td { padding:14px 18px; border-bottom:1px solid var(--line); font-size:13.5px; color:var(--ink-700); white-space:nowrap; }
.tbl tbody tr:last-child td { border-bottom:none; }
.tbl tbody tr { transition:background .14s var(--ease); }
.tbl tbody tr:hover { background:var(--surface-2); }
.tbl .u { display:flex; align-items:center; gap:11px; }
.tbl .u .av { width:36px; height:36px; border-radius:50%; flex:0 0 auto; display:grid; place-items:center; font-size:13px; font-weight:700; color:#fff; }
.tbl .u .un strong { display:block; font-size:13.5px; font-weight:600; color:var(--ink-900); }
.tbl .u .un span { font-size:12px; color:var(--ink-400); }
.tbl .muted { color:var(--ink-400); }
.tbl .num { font-variant-numeric:tabular-nums; font-weight:600; color:var(--ink-900); }
.tbl .row-act { width:18px; height:18px; color:var(--ink-300); cursor:pointer; }
.tbl .row-act:hover { color:var(--ink-700); }
.av.c1 { background:linear-gradient(145deg,#f59e0b,#d97706); }
.av.c2 { background:linear-gradient(145deg,#6d3bef,#8b5cf6); }
.av.c3 { background:linear-gradient(145deg,#1877F2,#0e5fcc); }
.av.c4 { background:linear-gradient(145deg,#25D366,#1da851); }
.av.c5 { background:linear-gradient(145deg,#ef4444,#b91c1c); }
.av.c6 { background:linear-gradient(145deg,#0ea5e9,#0369a1); }
.tag-chip { display:inline-block; font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:999px; background:var(--surface-3); color:var(--ink-500); margin-right:4px; }
.tag-chip.green { background:var(--wa-green-soft); color:#0f7a3d; }
.tag-chip.blue { background:var(--meta-blue-soft); color:#1257b0; }
.tag-chip.violet { background:#f0ecfe; color:#6d3bef; }

/* table pager */
.pager { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:18px; }
.pager .pg { font-size:13px; font-weight:600; color:var(--ink-700); text-decoration:none; padding:8px 16px; border:1px solid var(--line); border-radius:9px; background:var(--surface); box-shadow:var(--shadow-xs); transition:all .14s var(--ease); }
.pager .pg:hover { border-color:var(--line-strong); color:var(--ink-900); }
.pager .pg.disabled { opacity:.45; pointer-events:none; }
.pager .pg-info { font-size:12.5px; color:var(--ink-400); }

/* campaign variable body preview */
.vars-preview { margin:0 0 16px; padding:12px 14px; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; font-size:13px; line-height:1.55; color:var(--ink-700); }
.vars-preview:empty { display:none; }

/* campaign contact picker */
.contact-pick { max-height:280px; overflow-y:auto; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.cp-row { display:flex; align-items:center; gap:11px; padding:9px 13px; border-bottom:1px solid var(--line); cursor:pointer; margin:0; transition:background .12s var(--ease); }
.cp-row:last-child { border-bottom:none; }
.cp-row:hover { background:var(--surface-2); }
.cp-row input { width:16px; height:16px; accent-color:var(--wa-green); flex:0 0 auto; }
.cp-av { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-size:11px; font-weight:700; color:#fff; flex:0 0 auto; }
.cp-meta { display:flex; flex-direction:column; min-width:0; flex:1; }
.cp-meta strong { font-size:13.5px; color:var(--ink-900); font-weight:600; }
.cp-meta span { font-size:12px; color:var(--ink-400); }
.cp-warn { font-size:10.5px; font-weight:600; color:#b45309; background:#fef3c7; padding:2px 7px; border-radius:999px; flex:0 0 auto; }

/* disabled campaign template option */
.seg .opt-disabled .opt { opacity:.5; cursor:not-allowed; }
.seg .opt-disabled .o-count { background:var(--surface-3); color:var(--ink-400); }

/* icon-only action button (table rows) */
.icon-btn { background:none; border:none; cursor:pointer; padding:7px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; transition:background .14s var(--ease); }
.icon-btn:hover { background:var(--surface-3); }

/* toggle switch */
.switch { position:relative; display:inline-block; width:42px; height:24px; flex:0 0 auto; }
.switch input { opacity:0; width:0; height:0; }
.switch .track { position:absolute; inset:0; border-radius:999px; background:var(--line-strong); transition:background .2s var(--ease); cursor:pointer; }
.switch .track::before { content:""; position:absolute; left:3px; top:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:var(--shadow-sm); transition:transform .2s var(--ease); }
.switch input:checked + .track { background:var(--wa-green); }
.switch input:checked + .track::before { transform:translateX(18px); }

/* automation cards */
.auto-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:18px; }
.auto-card { background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:var(--shadow-sm); transition:box-shadow .18s var(--ease); }
.auto-card:hover { box-shadow:var(--shadow-md); }
.auto-card .ac-top { display:flex; align-items:flex-start; gap:13px; margin-bottom:14px; }
.auto-card .ac-ic { width:42px; height:42px; border-radius:12px; flex:0 0 auto; display:grid; place-items:center; }
.auto-card .ac-ic svg { width:21px; height:21px; }
.auto-card .ac-ic.green { background:var(--wa-green-soft); color:var(--wa-green-dark); }
.auto-card .ac-ic.blue { background:var(--meta-blue-soft); color:var(--meta-blue); }
.auto-card .ac-ic.violet { background:#f0ecfe; color:#6d3bef; }
.auto-card .ac-ic.amber { background:#fff4e5; color:#d97706; }
.auto-card .ac-ic.rose { background:#ffe9ef; color:#e11d6f; }
.auto-card .ac-head { flex:1; min-width:0; }
.auto-card .ac-head strong { display:block; font-size:14.5px; font-weight:650; color:var(--ink-900); }
.auto-card .ac-head .pill { margin-top:5px; }
.auto-card p { margin:0 0 16px; font-size:13px; line-height:1.5; color:var(--ink-500); }
.auto-card .ac-foot { display:flex; align-items:center; gap:14px; padding-top:14px; border-top:1px solid var(--line); }
.auto-card .ac-stat { font-size:12.5px; color:var(--ink-400); }
.auto-card .ac-stat b { color:var(--ink-900); font-weight:700; }
.auto-card .ac-foot .edit { margin-left:auto; font-size:13px; font-weight:600; color:var(--meta-blue); text-decoration:none; }
.auto-card .ac-foot .edit:hover { text-decoration:underline; }

/* mini bar chart */
.chart-card { background:var(--surface); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow-sm); padding:22px 24px; }
.chart-head { display:flex; align-items:center; margin-bottom:18px; }
.chart-head h2 { margin:0; font-size:16px; font-weight:700; color:var(--ink-900); }
.chart-head .legend { margin-left:auto; display:flex; gap:14px; font-size:12.5px; color:var(--ink-500); }
.chart-head .legend i { width:10px; height:10px; border-radius:3px; display:inline-block; margin-right:5px; vertical-align:-1px; }
.bars { display:flex; align-items:flex-end; gap:10px; height:200px; padding-top:10px; }
.bars .col { flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; height:100%; justify-content:flex-end; }
.bars .stack { width:60%; max-width:34px; display:flex; flex-direction:column; justify-content:flex-end; gap:3px; height:100%; }
.bars .b { width:100%; border-radius:5px 5px 0 0; transition:opacity .15s var(--ease); }
.bars .b.sent { background:linear-gradient(180deg,#3b8bf5,#1877F2); border-radius:5px; }
.bars .b.read { background:linear-gradient(180deg,#2bdc70,#1da851); }
.bars .col:hover .b { opacity:.85; }
.bars .lbl { font-size:11.5px; color:var(--ink-400); font-weight:500; }

/* breakdown rows */
.bd-list { list-style:none; margin:0; padding:0; }
.bd-list li { padding:13px 0; border-bottom:1px solid var(--line); }
.bd-list li:last-child { border-bottom:none; }
.bd-row { display:flex; align-items:center; gap:10px; font-size:13.5px; margin-bottom:7px; }
.bd-row .name { color:var(--ink-700); font-weight:550; }
.bd-row .val { margin-left:auto; font-weight:700; color:var(--ink-900); }
.bd-row .pct { color:var(--ink-400); font-size:12.5px; width:42px; text-align:right; }
.bd-bar { height:7px; border-radius:999px; background:var(--surface-3); overflow:hidden; }
.bd-bar span { display:block; height:100%; border-radius:999px; }
.bd-bar span.g { background:linear-gradient(90deg,#2bdc70,#1da851); }
.bd-bar span.b { background:linear-gradient(90deg,#3b8bf5,#1877F2); }
.bd-bar span.a { background:linear-gradient(90deg,#fbbf24,#d97706); }
.bd-bar span.r { background:linear-gradient(90deg,#f87171,#dc2626); }

/* settings */
.settings-grid { display:grid; grid-template-columns:230px minmax(0,1fr); gap:24px; align-items:start; }
.settings-nav { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:8px; box-shadow:var(--shadow-sm); position:sticky; top:24px; }
.settings-nav a { display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:10px; font-size:13.5px; font-weight:550; color:var(--ink-500); text-decoration:none; transition:all .14s var(--ease); }
.settings-nav a svg { width:17px; height:17px; color:var(--ink-400); }
.settings-nav a:hover { background:var(--surface-2); color:var(--ink-900); }
.settings-nav a.active { background:var(--wa-green-soft); color:#0f7a3d; font-weight:650; }
.settings-nav a.active svg { color:var(--wa-green-dark); }
.set-section { margin-bottom:26px; }
.set-section:last-child { margin-bottom:0; }
.set-row { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.set-field { margin-bottom:18px; }
.set-field > label { display:block; font-size:13px; font-weight:600; color:var(--ink-700); margin-bottom:8px; }
.set-field input[type=text], .set-field input[type=email], .set-field select, .set-field textarea { width:100%; font:inherit; font-size:14px; color:var(--ink-900); background:var(--surface-2); border:1.5px solid var(--line); border-radius:var(--radius-sm); padding:11px 14px; outline:none; transition:border-color .15s var(--ease), box-shadow .15s var(--ease); }
.set-field input:focus, .set-field select:focus, .set-field textarea:focus { border-color:var(--meta-blue); box-shadow:var(--ring); background:var(--surface); }
.set-toggle-row { display:flex; align-items:center; gap:14px; padding:14px 0; border-bottom:1px solid var(--line); }
.set-toggle-row:last-child { border-bottom:none; }
.set-toggle-row .stt { flex:1; }
.set-toggle-row .stt strong { display:block; font-size:13.5px; font-weight:600; color:var(--ink-900); }
.set-toggle-row .stt span { font-size:12.5px; color:var(--ink-400); }
.set-avatar { display:flex; align-items:center; gap:16px; margin-bottom:22px; }
.set-avatar .big { width:64px; height:64px; border-radius:50%; display:grid; place-items:center; font-size:24px; font-weight:700; color:#fff; background:linear-gradient(145deg,var(--meta-blue),#0e5fcc); }
.set-panel { display:none; }
.set-panel.active { display:block; }
.set-h3 { font-size:14px; font-weight:700; color:var(--ink-900); margin:0 0 6px; }
.plan-card { display:flex; align-items:center; gap:16px; padding:18px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); margin-bottom:18px; }
.plan-card .pc-ic { width:46px; height:46px; border-radius:12px; flex:0 0 auto; display:grid; place-items:center; background:var(--wa-green-soft); color:var(--wa-green-dark); }
.plan-card .pc-ic svg { width:22px; height:22px; }
.plan-card .pc-meta { flex:1; }
.plan-card .pc-meta strong { display:block; font-size:15px; color:var(--ink-900); font-weight:700; }
.plan-card .pc-meta span { font-size:13px; color:var(--ink-400); }
@media (max-width:860px){ .settings-grid { grid-template-columns:1fr; } .settings-nav { position:static; display:flex; overflow-x:auto; } .set-row { grid-template-columns:1fr; } }
@media (max-width:680px){ .auto-grid { grid-template-columns:1fr; } }

/* ============================================================
   CAMPAIGN BUILDER
   ============================================================ */
.back-link { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--ink-500); text-decoration:none; margin-bottom:14px; transition:color .14s var(--ease); }
.back-link:hover { color:var(--ink-900); }
.back-link svg { width:16px; height:16px; }
.step-label { font-size:14.5px; font-weight:700; color:var(--ink-900); margin:0 0 14px; display:flex; align-items:center; gap:10px; }
.step-label .n { width:24px; height:24px; border-radius:8px; background:linear-gradient(145deg,var(--meta-blue),#0e5fcc); color:#fff; font-size:12.5px; font-weight:700; display:grid; place-items:center; flex:0 0 auto; }
.build-section { padding:24px 26px; border-bottom:1px solid var(--line); }
.build-section:last-child { border-bottom:none; }
.seg.stack { flex-direction:column; }
.seg.stack label { width:100%; min-width:0; }
.seg.stack .opt .o-tx { flex:1; }
.seg.stack .opt .o-count { font-size:12.5px; font-weight:700; color:var(--ink-500); background:var(--surface-3); padding:3px 9px; border-radius:999px; }
.seg input:checked + .opt .o-count { background:var(--meta-blue); color:#fff; }
.schedule-when { margin-top:14px; display:none; }
.summary-card .meta-list { margin-top:0; padding-top:0; border-top:none; grid-template-columns:1fr; gap:13px; }
.summary-card .meta-list .v { font-family:inherit; }
.sum-total { display:flex; align-items:center; gap:12px; padding:14px 16px; border-radius:12px; background:var(--wa-green-soft); margin-bottom:18px; }
.sum-total .st-ic { width:38px; height:38px; border-radius:10px; background:var(--wa-green); color:#fff; display:grid; place-items:center; flex:0 0 auto; }
.sum-total .st-ic svg { width:20px; height:20px; }
.sum-total strong { display:block; font-size:20px; font-weight:750; color:#0f7a3d; letter-spacing:-.01em; }
.sum-total span { font-size:12.5px; color:#0f7a3d; }

/* ============================================================
   MODAL / DIALOG
   ============================================================ */
.modal { position:fixed; inset:0; z-index:100; display:none; align-items:center; justify-content:center; padding:20px; }
.modal.open { display:flex; }
.modal-overlay { position:absolute; inset:0; background:rgba(11,13,18,.5); backdrop-filter:blur(2px); animation:mfade .2s var(--ease); }
@keyframes mfade { from { opacity:0; } to { opacity:1; } }
.modal-card { position:relative; width:100%; max-width:480px; max-height:90vh; display:flex; flex-direction:column; background:var(--surface); border-radius:20px; box-shadow:var(--shadow-lg); overflow:hidden; animation:mpop .22s var(--ease); }
@keyframes mpop { from { transform:translateY(14px) scale(.98); opacity:0; } to { transform:none; opacity:1; } }
.modal-head { display:flex; align-items:flex-start; gap:14px; padding:22px 24px 18px; border-bottom:1px solid var(--line); }
.modal-head .m-ic { width:42px; height:42px; border-radius:12px; flex:0 0 auto; display:grid; place-items:center; background:var(--wa-green-soft); color:var(--wa-green-dark); }
.modal-head .m-ic svg { width:21px; height:21px; }
.modal-head .m-tx { flex:1; min-width:0; }
.modal-head h2 { margin:0; font-size:17px; font-weight:700; color:var(--ink-900); letter-spacing:-.01em; }
.modal-head p { margin:3px 0 0; font-size:13px; color:var(--ink-400); }
.modal-close { width:32px; height:32px; flex:0 0 auto; border:none; background:var(--surface-2); border-radius:9px; color:var(--ink-500); cursor:pointer; display:grid; place-items:center; transition:all .14s var(--ease); }
.modal-close:hover { background:var(--surface-3); color:var(--ink-900); }
.modal-close svg { width:18px; height:18px; }
.modal-body { padding:22px 24px; overflow-y:auto; }
.modal-foot { display:flex; align-items:center; gap:10px; padding:16px 24px; border-top:1px solid var(--line); background:var(--surface-2); }
.modal-foot .spacer { flex:1; }

/* dropzone (CSV import) */
.dropzone { display:block; width:100%; position:relative; border:2px dashed var(--line-strong); border-radius:14px; padding:30px 20px; text-align:center; background:var(--surface-2); cursor:pointer; transition:border-color .15s var(--ease), background .15s var(--ease); }
.dropzone input[type=file] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.dropzone .dz-ic, .dropzone > span:not(.dz-ic) { position:relative; pointer-events:none; }
.dropzone:hover { border-color:var(--meta-blue); background:var(--meta-blue-soft); }
.dropzone input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }
.dropzone .dz-ic { width:48px; height:48px; border-radius:50%; margin:0 auto 12px; display:grid; place-items:center; background:var(--surface); border:1px solid var(--line); color:var(--meta-blue); }
.dropzone .dz-ic svg { width:22px; height:22px; }
.dropzone strong { display:block; font-size:14px; font-weight:650; color:var(--ink-900); }
.dropzone span { font-size:12.5px; color:var(--ink-400); }
.dropzone.has-file { border-style:solid; border-color:var(--wa-green); background:var(--wa-green-soft); }
.dropzone.has-file .dz-ic { color:var(--wa-green-dark); border-color:transparent; }
.dz-help { margin:14px 0 0; font-size:12.5px; color:var(--ink-400); line-height:1.5; }
.dz-help a { color:var(--meta-blue); text-decoration:none; font-weight:600; }

/* toast */
.toast-wrap { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:200; display:flex; flex-direction:column; gap:10px; align-items:center; pointer-events:none; }
.toast { display:flex; align-items:center; gap:10px; background:var(--ink-900); color:#fff; font-size:13.5px; font-weight:550; padding:12px 18px; border-radius:12px; box-shadow:var(--shadow-lg); animation:tin .25s var(--ease); }
.toast svg { width:17px; height:17px; flex:0 0 auto; }
.toast .tk { color:#4ade80; }
@keyframes tin { from { transform:translateY(12px); opacity:0; } to { transform:none; opacity:1; } }
.toast.out { animation:tout .25s var(--ease) forwards; }
@keyframes tout { to { transform:translateY(12px); opacity:0; } }

/* ============================================================
   QR OPT-IN PAGE
   ============================================================ */
.qr-grid { display:grid; grid-template-columns:minmax(0,1fr) 400px; gap:24px; align-items:start; }
.qr-preview { position:sticky; top:24px; }
.preview-title.center { text-align:center; }
.qr-card { background:#fff; border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow-md); padding:30px 26px; text-align:center; }
.qr-card .kh { display:inline-flex; align-items:center; gap:8px; font-weight:700; font-size:15px; color:var(--ink-900); margin-bottom:16px; letter-spacing:-.01em; }
.qr-card .kh .g { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; background:linear-gradient(145deg,#2bdc70,#1cb257); box-shadow:0 5px 12px rgba(37,211,102,.34); }
.qr-card .kh .g svg { width:18px; height:18px; }
.qr-card h3 { margin:0 0 5px; font-size:20px; font-weight:750; color:var(--ink-900); letter-spacing:-.02em; line-height:1.2; }
.qr-card p.sub { margin:0 0 20px; font-size:13.5px; color:var(--ink-500); line-height:1.45; }
.qr-img-wrap { width:230px; height:230px; margin:0 auto; border-radius:18px; overflow:hidden; background:var(--surface-2); display:grid; place-items:center; border:1px solid var(--line); position:relative; }
.qr-img-wrap img { width:100%; height:100%; display:block; }
.qr-img-wrap .qr-loading { position:absolute; font-size:12px; color:var(--ink-400); }
.qr-card .scan { margin-top:18px; display:inline-flex; align-items:center; gap:7px; font-size:13px; font-weight:650; color:var(--wa-green-dark); background:var(--wa-green-soft); padding:8px 15px; border-radius:999px; }
.qr-card .scan svg { width:15px; height:15px; }
.qr-actions { display:flex; gap:10px; margin-top:18px; }
.qr-actions .btn { flex:1; }
.qr-note { margin-top:14px; font-size:12px; color:var(--ink-400); text-align:center; line-height:1.5; }
@media (max-width:980px){ .qr-grid { grid-template-columns:1fr; } .qr-preview { position:static; max-width:400px; margin:0 auto; } }

/* generated QR list */
.qr-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:20px; }
.qr-card-dyn { background:var(--surface); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow-sm); padding:16px; }
.qr-card-dyn .qr-card { box-shadow:none; border:none; padding:14px 6px 6px; }
.qr-card-dyn .qr-img-wrap { width:200px; height:200px; }
.qr-meta { padding:14px 8px 4px; border-top:1px solid var(--line); margin-top:14px; }
.qr-meta .qr-msg { margin:0 0 12px; font-size:13.5px; color:var(--ink-700); font-style:italic; line-height:1.45; }
.qr-meta .qr-actions { margin-top:14px; align-items:center; }
.qr-meta .qr-actions .btn { flex:0 0 auto; }
textarea.is-error { border-color:var(--error); background:#fef4f4; }
