/* ============================================================
   WA SaaS — design system
   ============================================================ */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #eef2f0;
  --border: #e3e8e6;
  --border-strong: #cfd8d4;
  --text: #0e1a17;
  --text-2: #4a5a55;
  --text-3: #7c8b86;

  --brand: #0f9d76;
  --brand-600: #0b8062;
  --brand-50: #e8f7f1;
  --brand-100: #c9eedf;
  --brand-ink: #ffffff;
  --accent: #14342b;

  --ok: #11845b;      --ok-bg: #e5f6ee;
  --warn: #a45b00;    --warn-bg: #fff3dc;
  --bad: #c62f35;     --bad-bg: #fdecec;
  --info: #2a68c8;    --info-bg: #e9f1fd;

  --chart-1: #0f9d76;
  --grid: #e8edeb;

  --shadow-sm: 0 1px 2px rgba(14, 26, 23, .06);
  --shadow: 0 1px 3px rgba(14, 26, 23, .06), 0 8px 24px -8px rgba(14, 26, 23, .10);
  --shadow-lg: 0 24px 60px -12px rgba(14, 26, 23, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: #0f211c;
  --sidebar-text: #b9cbc4;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(45, 212, 160, .14);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1311; --surface: #131c19; --surface-2: #17221e; --surface-3: #1d2a26;
    --border: #243330; --border-strong: #31443f;
    --text: #e8efec; --text-2: #a9bab4; --text-3: #7a8d87;
    --brand: #2cbf92; --brand-600: #25a880; --brand-50: #13302a; --brand-100: #1b4439; --brand-ink: #04140f;
    --accent: #cfeee3;
    --ok: #45c98f; --ok-bg: #133027; --warn: #f0b04a; --warn-bg: #33270f;
    --bad: #f17378; --bad-bg: #3a1a1c; --info: #6ea4f5; --info-bg: #15253d;
    --chart-1: #2cbf92; --grid: #22302c;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
    --sidebar: #0a1210;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1311; --surface: #131c19; --surface-2: #17221e; --surface-3: #1d2a26;
  --border: #243330; --border-strong: #31443f;
  --text: #e8efec; --text-2: #a9bab4; --text-3: #7a8d87;
  --brand: #2cbf92; --brand-600: #25a880; --brand-50: #13302a; --brand-100: #1b4439; --brand-ink: #04140f;
  --accent: #cfeee3;
  --ok: #45c98f; --ok-bg: #133027; --warn: #f0b04a; --warn-bg: #33270f;
  --bad: #f17378; --bad-bg: #3a1a1c; --info: #6ea4f5; --info-bg: #15253d;
  --chart-1: #2cbf92; --grid: #22302c;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  --sidebar: #0a1210;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: var(--brand-100); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.stack > * + * { margin-top: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s, opacity .15s;
  text-decoration: none !important; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); }
[data-theme="dark"] .btn-soft, :root:not([data-theme="light"]) .btn-soft { color: var(--brand); }
.btn-soft:hover:not(:disabled) { background: var(--brand-100); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 36px; padding: 0; height: 36px; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input::placeholder { color: var(--text-3); }
.input-group { position: relative; }
.input-group .input { padding-left: 40px; }
.input-group svg.i { position: absolute; left: 12px; top: 12px; color: var(--text-3); }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: var(--shadow-sm); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.card-body { padding: 20px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.stat .label .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.meter { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand); }
.badge.pulse .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: none; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: var(--surface-2); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-50); color: var(--brand); }
.empty .big svg.i { width: 26px; height: 26px; }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: #fff; padding: 4px 8px 20px; letter-spacing: -0.02em; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2cd4a0, #0f9d76); display: grid; place-items: center; color: #04140f; box-shadow: 0 6px 16px -6px rgba(44, 212, 160, .6); }
.brand .logo svg { width: 20px; height: 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .sect { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5f7a71; padding: 16px 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--sidebar-text); font-weight: 600; font-size: 14px; text-decoration: none; transition: background .12s, color .12s; }
.nav a:hover { background: var(--sidebar-hover); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #5ee6bb; }
.nav a .count { margin-left: auto; background: #f0b04a; color: #221500; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); font-size: 12.5px; }
.side-foot b { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 18px; }
.topbar .menu-btn { display: none; }
.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; }
.page-head p { color: var(--text-2); margin-top: 4px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; animation: pop .14s ease-out; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font: 600 13.5px var(--font); background: none; border: 0; cursor: pointer; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); }
.dropdown .who { padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 600; font-size: 13.5px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner .btn { margin-left: auto; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 60; transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 20px 16px 60px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
}

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(6, 14, 12, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); border: 1px solid var(--border); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 280px; max-width: 420px; padding: 13px 14px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: slidein .25s cubic-bezier(.2,.9,.3,1.1); }
.toast svg.i { margin-top: 1px; }
.toast.ok svg.i { color: #45c98f; }
.toast.bad svg.i { color: #ff8a8f; }
.toast.out { animation: slideout .2s forwards; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes slideout { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Tabs / segmented ---------- */
.tabs { display: inline-flex; background: var(--surface-3); padding: 4px; border-radius: 11px; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 7px 13px; border-radius: 8px; font: 600 13px var(--font); color: var(--text-2); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Code ---------- */
.code { position: relative; background: #0d1a16; color: #d6efe6; border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; border: 1px solid #1d312b; }
.code pre { margin: 0; white-space: pre; }
.code .copy { position: absolute; top: 10px; right: 10px; }
.code .k { color: #6ee7c0; } .code .s { color: #f5c983; } .code .c { color: #6b8a80; }
.keybox { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 8px 8px 8px 14px; border-radius: 11px; font-family: var(--mono); font-size: 13px; }
.keybox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { fill: var(--text-3); font: 600 11px var(--font); }
.chart .bar { fill: var(--chart-1); transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart g:hover .bar { opacity: .82; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 8px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 10px)); z-index: 5; }
.tip b { font-size: 14px; }

/* ---------- Number cards ---------- */
.num-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.num-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: box-shadow .2s, transform .2s; }
.num-card:hover { box-shadow: var(--shadow); }
.num-card .top { display: flex; gap: 12px; align-items: center; }
.num-card .ph { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.num-card h4 { font-size: 15px; }
.num-card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; background: var(--surface-2); border-radius: 10px; font-size: 12.5px; }
.num-card .meta b { display: block; font-size: 15px; color: var(--text); }
.add-card { border: 2px dashed var(--border-strong); background: transparent; display: grid; place-items: center; min-height: 220px; cursor: pointer; color: var(--text-2); font-weight: 700; transition: border-color .15s, color .15s, background .15s; border-radius: var(--radius); }
.add-card:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

.qr-box { display: grid; place-items: center; width: 280px; height: 280px; margin: 0 auto; border-radius: 16px; background: #fff; border: 1px solid var(--border); position: relative; overflow: hidden; }
.qr-box img { width: 260px; height: 260px; }
.qr-box .loader { width: 40px; height: 40px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.qr-steps { counter-reset: s; list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.qr-steps li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.qr-steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.success-pop { text-align: center; padding: 20px 0; }
.success-pop .tick { width: 76px; height: 76px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 16px; animation: pop .3s cubic-bezier(.2,.9,.3,1.4); }
.success-pop .tick svg.i { width: 38px; height: 38px; stroke-width: 2.5; }

/* ---------- Plans ---------- */
.plans { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan { padding: 24px; display: flex; flex-direction: column; gap: 14px; position: relative; transition: transform .2s, box-shadow .2s, border-color .2s; }
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.plan.popular { border: 2px solid var(--brand); }
.plan.selected { border: 2px solid var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.plan .tag { position: absolute; top: -12px; left: 24px; background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 99px; letter-spacing: .02em; }
.plan h3 { font-size: 17px; }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.plan .price small { font-size: 14px; color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.plan li { display: flex; gap: 9px; align-items: flex-start; }
.plan li svg.i { color: var(--brand); width: 17px; height: 17px; margin-top: 2px; }
.plan .btn { margin-top: auto; }

/* ---------- Dropzone / progress ---------- */
.drop { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 30px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-50); }
.drop .big { width: 52px; height: 52px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; margin: 0 auto 10px; color: var(--brand); box-shadow: var(--shadow-sm); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; transition: width .5s; }
.progress .s { background: var(--brand); }
.progress .f { background: var(--bad); }

/* ---------- Chat preview ---------- */
.phone-prev { background: #e6ddd4; border-radius: 16px; padding: 16px; min-height: 160px; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; }
[data-theme="dark"] .phone-prev { background-color: #0b141a; background-image: radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px); }
.bubble { max-width: 88%; margin-left: auto; background: #d9fdd3; color: #111b21; padding: 8px 10px 6px; border-radius: 10px 2px 10px 10px; box-shadow: 0 1px 1px rgba(0,0,0,.1); white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; line-height: 1.45; }
[data-theme="dark"] .bubble { background: #005c4b; color: #e9edef; }
.bubble .time { display: block; text-align: right; font-size: 10.5px; color: #667781; margin-top: 2px; }
[data-theme="dark"] .bubble .time { color: #aebac1; }

/* ---------- Skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.divider { height: 1px; background: var(--border); margin: 18px 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; background: var(--surface-3); border-radius: 7px; font-family: var(--mono); font-size: 12px; cursor: pointer; border: 1px solid var(--border); }
.chip:hover { border-color: var(--brand); color: var(--brand); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .topbar #planPill, .topbar .user-name { display: none; }
  .page-head { align-items: stretch; }
  .page-head > .btn, .page-head > a.btn { flex: 1; }
  .page-head .spacer { display: none; }
  .modal-body, .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal .stats { grid-template-columns: 1fr 1fr !important; }
  .card-head { flex-wrap: wrap; }
  .kv { grid-template-columns: 110px 1fr; }
}
.num-card .actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Chats ---------- */
.chat-shell { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 210px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.chat-tools { padding: 12px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 11px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer; font: inherit; color: inherit; align-items: center; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.on { background: var(--brand-50); }
.chat-item .avatar { width: 42px; height: 42px; }
.ci-mid { flex: 1; min-width: 0; }
.ci-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ci-time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ci-time.hot { color: var(--brand); font-weight: 700; }
.ci-last { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ci-unread { background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.ci-num { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-empty { margin: auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-back { display: none; transform: rotate(180deg); }
.chat-msgs { flex: 1; overflow-y: auto; border-radius: 0; padding: 16px 6%; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.chat-msgs .bubble { max-width: 72%; margin-left: auto; }
.chat-msgs .bubble.in { margin-left: 0; margin-right: auto; background: #fff; border-radius: 2px 10px 10px 10px; }
[data-theme="dark"] .chat-msgs .bubble.in { background: #202c33; color: #e9edef; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-msgs .bubble.in { background: #202c33; color: #e9edef; } :root:not([data-theme="light"]) .bubble { background: #005c4b; color: #e9edef; } :root:not([data-theme="light"]) .phone-prev { background-color: #0b141a; } }
.chat-msgs .bubble a { color: #027eb5; }
.bubble .via { font-size: 10px; background: rgba(0,0,0,.07); border-radius: 4px; padding: 0 4px; margin-right: 5px; }
.chat-day { align-self: center; background: rgba(255,255,255,.9); color: #54656f; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 8px; margin: 8px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
[data-theme="dark"] .chat-day { background: #182229; color: #8696a0; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-input textarea.input { min-height: 42px; height: 42px; resize: none; padding-top: 10px; }
.chat-input .btn { height: 42px; width: 42px; flex: none; }
@media (max-width: 760px) {
  .chat-shell { grid-template-columns: 1fr; height: calc(100vh - 190px); }
  .chat-pane { display: none; }
  .chat-shell.open .chat-list { display: none; }
  .chat-shell.open .chat-pane { display: flex; }
  .chat-back { display: inline-flex; }
  .chat-msgs .bubble { max-width: 86%; }
}
.plan .price small { display: block; margin-top: 2px; }
/* .badge.brand shares the "brand" class name with the logo block — restore badge look */
.badge.brand { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-50); letter-spacing: 0; }
.plans { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.plans .plan { padding: 22px 16px; }
.plans .plan .price { font-size: 28px; }

/* ---------- Period tabs + plan grid ---------- */
.period-wrap { display: flex; justify-content: center; margin-bottom: 26px; }
.period-tabs { padding: 5px; border-radius: 14px; }
.period-tabs button { padding: 10px 18px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; }
.save-pill { font-size: 11px; font-weight: 800; color: var(--ok); background: var(--ok-bg); padding: 2px 7px; border-radius: 99px; }
.plans.plan-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 360px)); justify-content: center; gap: 20px; }
.plans.plan-grid .plan { padding: 26px 24px; }
.plans.plan-grid .plan .price { font-size: 38px; margin-top: 2px; }
.plans.plan-grid .plan .price small { display: inline; margin-left: 4px; }
.plan-nums { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.plan-nums svg.i { color: var(--brand); width: 17px; height: 17px; }
.per-month { font-size: 13px; color: var(--text-3); margin-top: -8px; }
@media (max-width: 520px) { .period-tabs button { padding: 9px 11px; font-size: 13px; } }
.period-tabs { flex-wrap: nowrap; max-width: 100%; }
@media (max-width: 520px) { .period-tabs button { padding: 8px 9px; gap: 5px; } .save-pill { padding: 1px 5px; font-size: 10.5px; } }

/* ---------- UPI image ---------- */
.upi-up { display: flex; gap: 14px; align-items: center; }
.upi-prev { width: 110px; height: 110px; flex: none; border-radius: 12px; border: 1px dashed var(--border-strong); background: #fff; display: grid; place-items: center; overflow: hidden; }
.upi-prev img { width: 100%; height: 100%; object-fit: contain; }
.upi-show { display: inline-block; background: #fff; padding: 10px; border-radius: 16px; border: 1px solid var(--border); }
.upi-show img { display: block; max-width: 260px; max-height: 340px; width: 100%; height: auto; object-fit: contain; }
.test-ribbon { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 300; background: #b45309; color: #fff; padding: 7px 16px; border-radius: 99px; font: 600 12.5px var(--font); box-shadow: 0 6px 20px -6px rgba(0,0,0,.4); white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* ---------- Pairing code (link with phone number) ---------- */
.pair-code { font: 800 36px/1.1 var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); letter-spacing: 6px; color: var(--text); background: var(--brand-50); border: 1px dashed var(--brand); border-radius: 14px; padding: 16px 18px; margin: 10px auto 10px; display: inline-block; }
@media (max-width: 420px) { .pair-code { font-size: 28px; letter-spacing: 4px; padding: 12px 14px; } }
.num-card .actions { flex-wrap: wrap; row-gap: 8px; }
