/* =====================================================================
   BAConnect — design system
   Light, calm, tactile. Desktop = floating console. Mobile = native iOS.
   ===================================================================== */

:root {
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --surface-3: #EEF1F6;
  --ink: #0B1220;
  --ink-2: #394154;
  --muted: #7B8398;
  --faint: #A9B0C0;
  --line: #E7EAF1;
  --hair: rgba(11, 18, 32, .07);

  --brand: #0DB488;
  --brand-ink: #07785B;
  --brand-2: #0A84D6;
  --brand-soft: #E2F7F0;
  --grad: linear-gradient(135deg, #1BD6A4 0%, #0DB488 42%, #0A84D6 100%);
  --grad-soft: linear-gradient(135deg, rgba(27,214,164,.14), rgba(10,132,214,.12));

  --violet: #7A5AF8; --violet-soft: #F0ECFF;
  --amber: #F2A20C;  --amber-soft: #FFF5E0;
  --rose: #F0445F;   --rose-soft: #FFEDF0;
  --sky: #1296E8;    --sky-soft: #E6F4FE;
  --slate: #64708A;  --slate-soft: #EEF1F6;

  --r-xs: 10px; --r-sm: 13px; --r: 18px; --r-lg: 24px; --r-xl: 30px;
  --sh-1: 0 1px 2px rgba(16,24,40,.04), 0 0 0 1px var(--hair);
  --sh-2: 0 1px 2px rgba(16,24,40,.04), 0 10px 30px -10px rgba(16,24,40,.10), 0 0 0 1px var(--hair);
  --sh-3: 0 30px 70px -20px rgba(16,24,40,.25), 0 0 0 1px var(--hair);
  --sh-brand: 0 10px 24px -8px rgba(13,180,136,.55), inset 0 1px 0 rgba(255,255,255,.25);

  --side-w: 272px;
  --nav-h: 52px;
  --tab-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --bs-body-font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-link-color: var(--brand-ink);
  --bs-link-hover-color: var(--brand);
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--bs-body-font-family);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -.025em; font-weight: 700; color: var(--ink); }
a { text-decoration: none; }
::selection { background: rgba(13,180,136,.2); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.text-brand { color: var(--brand) !important; }
.text-muted, .muted { color: var(--muted) !important; }
.op-50 { opacity: .5; }
.fw-800 { font-weight: 800; }
.small, small { font-size: 12.5px; }

/* ---------- Icons ---------- */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 26px; height: 26px; }

/* ---------- Ambient background ---------- */
.bg-aurora {
  position: fixed; inset: 0 0 auto 0; height: 520px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 280px at 18% -40px, rgba(27,214,164,.16), transparent 70%),
    radial-gradient(520px 260px at 82% -60px, rgba(10,132,214,.12), transparent 70%),
    radial-gradient(420px 220px at 55% 0, rgba(122,90,248,.07), transparent 70%);
}

/* =====================================================================
   Shell
   ===================================================================== */
.shell { position: relative; z-index: 1; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 12px auto 12px 12px; width: var(--side-w);
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px 14px;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 4px; color: var(--ink); }
.brand img { border-radius: 11px; box-shadow: 0 6px 14px -6px rgba(10,132,214,.55); }
.brand span { font-weight: 800; font-size: 18px; letter-spacing: -.035em; line-height: 1.05; display: flex; flex-direction: column; }
.brand small { font-weight: 500; font-size: 11.5px; color: var(--muted); letter-spacing: 0; margin-top: 2px; }

.ws-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-1); transition: .2s var(--ease);
}
.ws-btn:not(:disabled):hover { box-shadow: var(--sh-2); }
.ws-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ws-meta b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-meta small { color: var(--muted); font-size: 11.5px; }
.ws-dot {
  --c: var(--brand);
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; letter-spacing: 0;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 10px -4px var(--c);
}
.ws-dot.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.ws-dot.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 18px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.side-nav a .ic { color: var(--muted); transition: .2s var(--ease); }
.side-nav a:hover { background: rgba(11,18,32,.04); color: var(--ink); }
.side-nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.side-nav a.active .ic { color: var(--brand); }
.side-nav a.active::before {
  content: ""; position: absolute; left: -4px; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--grad);
}
.side-nav .count {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--rose); padding: 2px 7px; border-radius: 99px; min-width: 20px; text-align: center;
}
.side-foot { margin-top: auto; }
.me-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  padding: 8px; border-radius: var(--r-sm); text-align: left; transition: .2s;
}
.me-btn:hover { background: rgba(11,18,32,.04); }
.me-btn > span:not(.avatar) { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-btn b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn small { color: var(--muted); }

.main { position: relative; margin-left: calc(var(--side-w) + 24px); min-height: 100vh; }
.content { padding: 8px 32px 48px; max-width: 1480px; }

/* ---------- Top bar ---------- */
.navbar-ios {
  position: sticky; top: 0; z-index: 20;
  padding: 18px 32px 14px;
  background: rgba(243,245,249,.78);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  transition: box-shadow .25s var(--ease);
}
body.scrolled .navbar-ios { box-shadow: 0 1px 0 var(--hair); }
.navbar-ios .nb-left, .navbar-ios .nb-title, .navbar-ios .nb-right { display: none; }
.tb-desktop { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; max-width: 1480px; }
.tb-title h1 { font-size: 26px; margin: 0; font-weight: 800; letter-spacing: -.035em; }
.tb-title p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.tb-title .crumb { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.tb-title .crumb:hover { color: var(--brand); }
.tb-title .crumb .ic { width: 16px; height: 16px; }
.tb-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.large-title { display: none; }

/* =====================================================================
   Components
   ===================================================================== */

/* ---------- Cards ---------- */
.card-x {
  position: relative; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); padding: 22px;
}
.card-x.flat { box-shadow: var(--sh-1); }
.card-x.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { font-size: 16px; margin: 0; font-weight: 700; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-x.hover { transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.card-x.hover:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }

.glass {
  background: rgba(255,255,255,.66);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 18px 18px 16px; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .k-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.kpi .k-label { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 14px; }
.kpi .k-val { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 48px; opacity: .9; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 700; padding: 3px 7px; border-radius: 99px; }
.delta.up { color: var(--brand-ink); background: var(--brand-soft); }
.delta.down { color: var(--rose); background: var(--rose-soft); }

.bg-brand-soft { background: var(--brand-soft); color: var(--brand-ink); }
.bg-violet-soft { background: var(--violet-soft); color: var(--violet); }
.bg-amber-soft { background: var(--amber-soft); color: #B77400; }
.bg-rose-soft { background: var(--rose-soft); color: var(--rose); }
.bg-sky-soft { background: var(--sky-soft); color: var(--sky); }
.bg-slate-soft { background: var(--slate-soft); color: var(--slate); }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 650; border-radius: 12px; padding: 9px 16px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, color .2s, opacity .2s; letter-spacing: -.01em; white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn .ic { width: 18px; height: 18px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { padding: 13px 20px; font-size: 15.5px; border-radius: 15px; }
.btn-brand { color: #fff; background: var(--grad); border: 0; box-shadow: var(--sh-brand); }
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.05) saturate(1.05); box-shadow: 0 14px 28px -10px rgba(13,180,136,.65), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-brand:disabled { color: #fff; opacity: .55; }
.btn-dark { background: var(--ink); border: 0; color: #fff; box-shadow: 0 8px 20px -8px rgba(11,18,32,.5); }
.btn-dark:hover { background: #1b2436; }
.btn-light, .btn-white { background: var(--surface); border: 0; color: var(--ink); box-shadow: var(--sh-1); }
.btn-light:hover, .btn-white:hover { background: var(--surface); box-shadow: var(--sh-2); color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); border: 0; }
.btn-soft:hover { background: #d3f2e8; color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 0; }
.btn-ghost:hover { background: rgba(11,18,32,.05); color: var(--ink); }
.btn-danger-soft { background: var(--rose-soft); color: var(--rose); border: 0; }
.btn-danger-soft:hover { background: #ffdfe5; color: #d42f4b; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 12px; }
.btn-icon.sm { width: 32px; height: 32px; border-radius: 10px; }
.btn.loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) transparent transparent; animation: spin .7s linear infinite; }
.btn-light.loading::after, .btn-soft.loading::after, .btn-ghost.loading::after { border-color: var(--brand) var(--brand) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.form-control, .form-select {
  border-radius: 12px; border: 1px solid var(--line); background-color: var(--surface-2);
  padding: 10px 13px; font-size: 14.5px; color: var(--ink); transition: .2s var(--ease);
}
.form-control::placeholder { color: var(--faint); }
.form-control:hover, .form-select:hover { border-color: #d7dce7; }
.form-control:focus, .form-select:focus { background-color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13,180,136,.14); }
.form-text { color: var(--muted); font-size: 12px; }
textarea.form-control { min-height: 110px; line-height: 1.55; }
.input-ic { position: relative; }
.input-ic > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; width: 18px; height: 18px; }
.input-ic > .form-control { padding-left: 40px; }
.search-pill { max-width: 320px; }
.search-pill .form-control { border-radius: 99px; background: var(--surface); box-shadow: var(--sh-1); border-color: transparent; }
.form-check-input { width: 1.15em; height: 1.15em; border-radius: 6px !important; border-color: #cfd5e1; cursor: pointer; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(13,180,136,.15); border-color: var(--brand); }

/* iOS switch */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #E3E6EC; border-radius: 99px; transition: .3s var(--ease); cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.08); transition: .3s var(--spring); }
.switch input:checked + span { background: #34C759; }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px rgba(52,199,89,.25); }

/* Segmented control */
.seg { display: inline-flex; position: relative; padding: 3px; background: rgba(118,118,128,.12); border-radius: 11px; gap: 0; }
.seg a, .seg button, .seg label {
  position: relative; z-index: 1; border: 0; background: transparent; padding: 6px 14px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); border-radius: 8px; white-space: nowrap; transition: color .2s; cursor: pointer;
}
.seg .active, .seg input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 3px 8px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.04); }
.seg input { display: none; }
.seg.full { display: flex; }
.seg.full > * { flex: 1; text-align: center; }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--sh-1); border: 0; transition: .2s var(--ease); cursor: pointer;
}
.chip:hover { color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; box-shadow: none; }
.chip em { font-style: normal; opacity: .55; font-weight: 700; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--slate-soft); color: var(--slate); margin: 1px 2px 1px 0; }

/* Status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--brand-soft); color: var(--brand-ink); }
.pill-info { background: var(--sky-soft); color: #0B6FB3; }
.pill-warn { background: var(--amber-soft); color: #A86600; }
.pill-bad { background: var(--rose-soft); color: #D12F4B; }
.pill-violet { background: var(--violet-soft); color: var(--violet); }
.pill-mute { background: var(--slate-soft); color: var(--slate); }
.pill-live { background: var(--brand-soft); color: var(--brand-ink); }
.pill-live i { animation: pulse 1.6s infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(13,180,136,.6); } 70% { box-shadow: 0 0 0 6px rgba(13,180,136,0); } 100% { box-shadow: 0 0 0 0 rgba(13,180,136,0); } }

/* Avatar */
.avatar {
  --h: 160; width: 40px; height: 40px; flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: 0;
  color: hsl(var(--h) 55% 32%);
  background: linear-gradient(145deg, hsl(var(--h) 85% 93%), hsl(var(--h) 70% 84%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 50% 50% / .12);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xs { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }

/* ---------- iOS grouped lists ---------- */
.ios-list { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden; }
.ios-list + .ios-list { margin-top: 14px; }
.ios-section-title { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 22px 16px 8px; }
.ios-row {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px;
  color: var(--ink); background: transparent; border: 0; width: 100%; text-align: left;
}
.ios-row + .ios-row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--line); transform: scaleY(.6); }
.ios-row.has-ic + .ios-row::before, .ios-list.inset-ic .ios-row + .ios-row::before { left: 60px; }
.ios-row.link { cursor: pointer; transition: background .15s; }
.ios-row.link:hover { background: var(--surface-2); color: var(--ink); }
.ios-row.link:active { background: var(--surface-3); }
.ios-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ios-row .grow b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-row .grow small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-row .chev { color: #C4C8D2; width: 18px; height: 18px; }
.ios-row .trail { color: var(--muted); font-size: 13px; white-space: nowrap; }
.row-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.row-ic .ic { width: 18px; height: 18px; }
.bg-green { background: linear-gradient(145deg, #3ee08f, #22c06f); } .bg-blue { background: linear-gradient(145deg, #3aa8ff, #1a80f0); }
.bg-violet { background: linear-gradient(145deg, #9d84ff, #7456f0); } .bg-orange { background: linear-gradient(145deg, #ffb547, #ff9110); }
.bg-rose { background: linear-gradient(145deg, #ff7189, #f0445f); } .bg-slate { background: linear-gradient(145deg, #9aa3b8, #6c768d); }
.bg-teal { background: linear-gradient(145deg, #2fe0c0, #10b59a); } .bg-ink { background: linear-gradient(145deg, #3b4459, #0b1220); }

/* ---------- Tables → cards on mobile ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: var(--r-lg); } .tbl th:last-child { border-top-right-radius: var(--r-lg); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #FAFBFD; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tbl .who b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .who small { color: var(--muted); }
.tbl-wrap { overflow-x: auto; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .8s var(--ease); }
.bar.thin { height: 5px; }
.stack-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack-bar i { display: block; height: 100%; transition: width .8s var(--ease); }
.ring { --p: 0; --c: var(--brand); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-size: 14px; font-weight: 800; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; }
.empty-art { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; background: var(--grad-soft); color: var(--brand); position: relative; }
.empty-art::after { content: ""; position: absolute; inset: -10px; border-radius: 30px; border: 1px dashed rgba(13,180,136,.3); }
.empty-art .ic { width: 34px; height: 34px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 18px; }

/* ---------- Dropdown ---------- */
.glass-menu {
  border: 0; border-radius: 16px; padding: 6px; min-width: 240px;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--sh-3); animation: pop .2s var(--ease);
}
.glass-menu .dropdown-item { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 9px 10px; font-weight: 550; font-size: 14px; color: var(--ink); }
.glass-menu .dropdown-item:hover { background: rgba(11,18,32,.05); }
.glass-menu .dropdown-item.active, .glass-menu .dropdown-item:active { background: var(--brand-soft); color: var(--ink); }
.glass-menu .dropdown-item .ic { width: 18px; height: 18px; color: var(--muted); }
.glass-menu .menu-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px 4px; }
.dropdown-divider { border-color: var(--line); margin: 5px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Modals (desktop dialog, mobile sheet) ---------- */
.modal-backdrop.show { opacity: 1; background: rgba(11,18,32,.28); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-content { border: 0; border-radius: var(--r-xl); box-shadow: var(--sh-3); background: var(--surface); }
.modal-header { border: 0; padding: 22px 24px 10px; align-items: flex-start; }
.modal-title { font-weight: 800; font-size: 19px; letter-spacing: -.03em; }
.modal-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 12px 24px 18px; }
.modal-footer { border: 0; padding: 6px 24px 22px; gap: 8px; }
.modal-footer > * { margin: 0; }
.btn-close-ios { width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(118,118,128,.12); color: var(--muted); display: grid; place-items: center; margin-left: auto; flex: none; transition: .2s; }
.btn-close-ios:hover { background: rgba(118,118,128,.2); color: var(--ink); }
.btn-close-ios .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.sheet-grab { display: none; }
.modal.fade .modal-dialog { transform: translateY(14px) scale(.98); transition: transform .35s var(--ease); }
.modal.show .modal-dialog { transform: none; }

/* ---------- Toasts (iOS banner) ---------- */
.toast-stack { position: fixed; z-index: 2000; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.ba-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px;
  padding: 12px 16px 12px 12px; border-radius: 18px;
  background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--sh-3); font-weight: 600; font-size: 14px;
  animation: toastIn .45s var(--spring);
}
.ba-toast.out { animation: toastOut .3s var(--ease) forwards; }
.ba-toast .t-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.ba-toast .t-ic .ic { width: 18px; height: 18px; stroke-width: 2.2; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* ---------- iOS alert ---------- */
.ios-alert { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgba(11,18,32,.3); backdrop-filter: blur(3px); animation: fadeIn .2s; padding: 20px; }
.ios-alert .box { width: 290px; border-radius: 16px; overflow: hidden; background: rgba(250,250,252,.94); backdrop-filter: blur(30px); text-align: center; animation: alertIn .3s var(--spring); box-shadow: var(--sh-3); }
.ios-alert .body { padding: 20px 18px 16px; }
.ios-alert h4 { font-size: 17px; margin: 0 0 4px; font-weight: 700; }
.ios-alert p { font-size: 13px; color: var(--ink-2); margin: 0; }
.ios-alert .acts { display: flex; border-top: 1px solid rgba(60,60,67,.18); }
.ios-alert .acts button { flex: 1; border: 0; background: transparent; padding: 12px; font-size: 16px; color: #007AFF; font-weight: 500; }
.ios-alert .acts button + button { border-left: 1px solid rgba(60,60,67,.18); }
.ios-alert .acts button.primary { font-weight: 700; }
.ios-alert .acts button.danger { color: #FF3B30; font-weight: 700; }
.ios-alert .acts button:active { background: rgba(0,0,0,.05); }
@keyframes alertIn { from { opacity: 0; transform: scale(1.12); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Page entrance ---------- */
.page-enter > * { animation: rise .55s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: .04s; } .page-enter > *:nth-child(3) { animation-delay: .08s; }
.page-enter > *:nth-child(4) { animation-delay: .12s; } .page-enter > *:nth-child(5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, #f6f7fa 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =====================================================================
   Feature-specific
   ===================================================================== */

/* Hero / greeting */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 26px 28px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #0A84D6 0%, transparent 55%), radial-gradient(90% 120% at 0% 100%, #19D3A2 0%, transparent 60%), #0B8F79;
  box-shadow: 0 30px 60px -30px rgba(10,132,214,.6);
}
.hero::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.08'%3E%3Ccircle cx='60' cy='60' r='58'/%3E%3Ccircle cx='60' cy='60' r='38'/%3E%3C/g%3E%3C/svg%3E") right -30px top -30px / 260px no-repeat; pointer-events: none; }
.hero h2 { color: #fff; font-size: 24px; font-weight: 800; margin: 0; }
.hero p { color: rgba(255,255,255,.8); margin: 4px 0 0; }
.hero .hero-stats { display: flex; gap: 28px; margin-top: 20px; flex-wrap: wrap; }
.hero .hero-stats b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.hero .hero-stats small { color: rgba(255,255,255,.72); font-weight: 600; }
.hero .btn-glass { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(10px); }
.hero .btn-glass:hover { background: rgba(255,255,255,.28); color: #fff; }

/* Setup checklist */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; color: var(--ink); transition: .2s; }
.step:hover { background: var(--surface-2); color: var(--ink); }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed #CDD3DF; flex: none; }
.step.done .dot { border: 0; background: var(--grad); color: #fff; }
.step.done .dot .ic { width: 15px; height: 15px; stroke-width: 3; }
.step.done span { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.2); }

/* Charts */
.chart { width: 100%; height: 240px; position: relative; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis text { fill: var(--faint); font-size: 11px; font-weight: 600; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: 10px; box-shadow: var(--sh-3); white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .15s; z-index: 5; }
.chart .tip.show { opacity: 1; }
.chart .tip i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 6px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 150px; height: 150px; flex: none; position: relative; }
.donut .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .c b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; display: block; line-height: 1; }
.donut .c small { color: var(--muted); font-weight: 600; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel .f-row { display: grid; grid-template-columns: 96px 1fr 70px; align-items: center; gap: 12px; font-size: 13px; }
.funnel .f-row b { text-align: right; font-variant-numeric: tabular-nums; }
.funnel .f-bar { height: 30px; border-radius: 9px; background: var(--surface-3); overflow: hidden; }
.funnel .f-bar i { display: flex; align-items: center; height: 100%; border-radius: 9px; padding-left: 10px; color: #fff; font-weight: 700; font-size: 12px; transition: width 1s var(--ease); }

/* Workspace cards */
.ws-card { display: flex; flex-direction: column; gap: 14px; }
.ws-card .ws-top { display: flex; align-items: center; gap: 12px; }
.ws-card .ws-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ws-card .ws-stats div { background: var(--surface-2); border-radius: 12px; padding: 10px; }
.ws-card .ws-stats b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.ws-card .ws-stats small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.ws-card.current { box-shadow: 0 0 0 2px var(--brand), var(--sh-2); }

/* WhatsApp message preview */
.wa-phone {
  position: relative; border-radius: 34px; padding: 10px; background: #0f1115;
  box-shadow: 0 30px 60px -25px rgba(11,18,32,.5), inset 0 0 0 1.5px #2a2e37;
  max-width: 330px; margin: 0 auto;
}
.wa-screen { border-radius: 26px; overflow: hidden; background: #EFE7DD; min-height: 460px; display: flex; flex-direction: column; }
.wa-top { background: #F7F7F7; padding: 30px 14px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(0,0,0,.06); }
.wa-top b { font-size: 14px; display: block; line-height: 1.1; } .wa-top small { color: #8a8f98; font-size: 11px; }
.wa-body { flex: 1; padding: 16px 12px; background-color: #EFE7DD; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; }
.wa-bubble { position: relative; background: #fff; border-radius: 4px 14px 14px 14px; padding: 8px 10px 6px; max-width: 94%; box-shadow: 0 1px .5px rgba(0,0,0,.12); font-size: 13.5px; line-height: 1.45; color: #111b21; word-wrap: break-word; }
.wa-bubble .h { font-weight: 700; margin-bottom: 4px; }
.wa-bubble .f { color: #8696a0; font-size: 12px; margin-top: 4px; }
.wa-bubble .t { text-align: right; color: #8696a0; font-size: 10.5px; margin-top: 2px; }
.wa-bubble .var { background: rgba(13,180,136,.14); color: var(--brand-ink); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.wa-btns { max-width: 94%; display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.wa-btns span { background: #fff; border-radius: 10px; text-align: center; padding: 8px; color: #009DE2; font-size: 13.5px; font-weight: 500; box-shadow: 0 1px .5px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; gap: 6px; }
.wa-btns .ic { width: 15px; height: 15px; }

/* Template cards */
.tpl-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tpl-card .tpl-prev { background: #EFE7DD; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; padding: 18px 16px; height: 210px; overflow: hidden; position: relative; }
.tpl-card .tpl-prev::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, #EFE7DD); }
.tpl-card .tpl-meta { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tpl-card .tpl-meta b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 600; }

/* Campaign list */
.camp-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 1fr 1.4fr 1fr 40px; align-items: center; gap: 16px; padding: 16px 20px; color: var(--ink); transition: background .15s; }
.camp-row + .camp-row { border-top: 1px solid var(--line); }
.camp-row:hover { background: var(--surface-2); color: var(--ink); }
.camp-row .c-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.camp-row .c-name b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-row .c-name small { color: var(--muted); }
.camp-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.camp-row .c-metric b { font-size: 15px; font-weight: 800; display: block; }
.camp-row .c-metric small { color: var(--muted); font-size: 11.5px; font-weight: 600; }

/* Stepper (campaign wizard) */
.stepper { display: flex; gap: 6px; margin-bottom: 20px; }
.stepper div { flex: 1; }
.stepper i { display: block; height: 4px; border-radius: 99px; background: var(--surface-3); transition: .4s var(--ease); }
.stepper div.on i { background: var(--grad); }
.stepper small { display: block; margin-top: 6px; font-weight: 700; color: var(--faint); font-size: 11.5px; }
.stepper div.on small { color: var(--ink); }
.wiz-step { display: none; animation: rise .35s var(--ease); }
.wiz-step.on { display: block; }
.pick-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); cursor: pointer; transition: .2s var(--ease); background: var(--surface); }
.pick-card:hover { border-color: #cfd6e3; }
.pick-card.on, .pick-card:has(input:checked) { border-color: var(--brand); background: linear-gradient(0deg, rgba(13,180,136,.05), rgba(13,180,136,.05)), #fff; box-shadow: 0 0 0 4px rgba(13,180,136,.1); }
.pick-card input { margin-top: 3px; }
.aud-count { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; background: var(--grad-soft); }
.aud-count b { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: calc(100vh - 128px); min-height: 460px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden; }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ib-list-head { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.ib-items { overflow-y: auto; flex: 1; padding: 0 8px 10px; }
.ib-item { display: flex; gap: 11px; padding: 11px 10px; border-radius: 14px; color: var(--ink); cursor: pointer; position: relative; transition: background .15s; }
.ib-item:hover { background: var(--surface-2); }
.ib-item.active { background: var(--brand-soft); }
.ib-item .meta { flex: 1; min-width: 0; }
.ib-item .top { display: flex; justify-content: space-between; gap: 8px; }
.ib-item .top b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item .top time { color: var(--muted); font-size: 12px; flex: none; }
.ib-item .prev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.ib-item.unread .top b, .ib-item.unread .prev { color: var(--ink); font-weight: 650; }
.ib-item .badge-u { background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; flex: none; }
.ib-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #F6F7F9; }
.ib-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: rgba(255,255,255,.9); backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); }
.ib-chat-head .who { flex: 1; min-width: 0; line-height: 1.25; }
.ib-chat-head .who b { display: block; }
.ib-chat-head .who small { color: var(--muted); }
.ib-back { display: none; border: 0; background: transparent; padding: 4px; margin-left: -4px; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 10px; box-shadow: none; }
.ib-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); }
.ib-thread { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 4px;
  background-image: radial-gradient(rgba(11,18,32,.035) 1px, transparent 1px); background-size: 16px 16px; }
.msg { max-width: min(560px, 78%); padding: 8px 12px 6px; border-radius: 18px; font-size: 14px; line-height: 1.45; position: relative; word-wrap: break-word; animation: msgIn .3s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.msg.out { align-self: flex-end; background: linear-gradient(145deg, #D9F8EC, #C9F1E3); color: #0b2d24; border-bottom-right-radius: 6px; }
.msg.out.tpl { background: linear-gradient(145deg, #E4F1FE, #D6E9FC); color: #0b2440; }
.msg.note { align-self: center; background: #FFF6DC; color: #6d5210; border-radius: 12px; font-size: 13px; max-width: 80%; border: 1px dashed #F2D27A; }
.msg .m-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 10.5px; color: rgba(11,18,32,.45); margin-top: 2px; }
.msg .m-meta .ic { width: 15px; height: 15px; }
.msg .m-meta .read { color: #1296E8; }
.msg .m-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .55; margin-bottom: 2px; display: flex; align-items: center; gap: 4px; }
.msg .m-kind .ic { width: 12px; height: 12px; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.85); padding: 4px 12px; border-radius: 99px; margin: 12px 0 8px; box-shadow: var(--sh-1); }
.ib-compose { padding: 12px 16px 14px; background: #fff; border-top: 1px solid var(--line); }
.compose-box { display: flex; align-items: flex-end; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 22px; padding: 6px 6px 6px 14px; transition: .2s; }
.compose-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13,180,136,.12); background: #fff; }
.compose-box textarea { flex: 1; border: 0; background: transparent; resize: none; outline: none; min-height: 24px; max-height: 140px; padding: 6px 0; font-size: 14.5px; line-height: 1.45; }
.compose-box .send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: var(--sh-brand); transition: transform .2s var(--spring); }
.compose-box .send:active { transform: scale(.9); }
.compose-box .send .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.compose-tools { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.compose-tools .seg a, .compose-tools .seg button { padding: 4px 12px; font-size: 12.5px; }
.compose-box.note-mode { background: #FFFBEE; border-color: #F2D27A; }
.window-note { display: flex; align-items: center; gap: 10px; background: var(--amber-soft); color: #7a5100; border-radius: 14px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.ib-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 18px; background: #fff; }
.ib-side:empty { padding: 0; }
.inbox:not(.has-chat) { grid-template-columns: 340px minmax(0, 1fr) 0; }
.inbox:not(.has-chat) .ib-side { border: 0; }
.ib-side .prof { text-align: center; margin-bottom: 18px; }
.ib-side .prof h3 { font-size: 17px; margin: 10px 0 2px; }
.ib-side dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; margin: 0; }
.ib-side dt { color: var(--muted); font-weight: 600; }
.ib-side dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }
.canned-pop { position: absolute; bottom: 100%; left: 16px; right: 16px; margin-bottom: 8px; background: rgba(255,255,255,.95); backdrop-filter: blur(20px); border-radius: 16px; box-shadow: var(--sh-3); padding: 6px; max-height: 240px; overflow: auto; display: none; }
.canned-pop.show { display: block; animation: pop .2s var(--ease); }
.canned-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; }
.canned-pop button:hover, .canned-pop button.on { background: var(--brand-soft); }
.canned-pop button b { color: var(--brand-ink); margin-right: 6px; }

/* Leads kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.k-col { background: rgba(255,255,255,.55); border-radius: var(--r-lg); padding: 12px; box-shadow: inset 0 0 0 1px var(--hair); min-height: 300px; display: flex; flex-direction: column; gap: 10px; transition: background .2s; }
.k-col.drag-over { background: var(--brand-soft); }
.k-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 2px; font-weight: 700; font-size: 13.5px; }
.k-col-head i { width: 8px; height: 8px; border-radius: 50%; }
.k-col-head em { font-style: normal; color: var(--muted); font-weight: 700; margin-left: auto; font-size: 12px; background: var(--surface); border-radius: 99px; padding: 1px 8px; box-shadow: var(--sh-1); }
.k-card { background: var(--surface); border-radius: 16px; padding: 12px; box-shadow: var(--sh-1); cursor: grab; transition: box-shadow .2s, transform .2s var(--ease); }
.k-card:hover { box-shadow: var(--sh-2); }
.k-card.dragging { opacity: .5; transform: rotate(2deg); }
.k-card .q { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 7px 9px; margin: 8px 0; }

/* More sheet grid */
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; }
.more-grid a { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.app-ic { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px -8px rgba(11,18,32,.35), inset 0 1px 0 rgba(255,255,255,.3); }
.app-ic .ic { width: 26px; height: 26px; }
.ic-templates { background: linear-gradient(145deg, #3aa8ff, #1a6ff0); } .ic-leads { background: linear-gradient(145deg, #ff8a5c, #f0445f); }
.ic-automations { background: linear-gradient(145deg, #a48bff, #6a4af0); } .ic-analytics { background: linear-gradient(145deg, #ffc046, #f08a10); }
.ic-clients { background: linear-gradient(145deg, #2fe0c0, #0d9f86); } .ic-settings { background: linear-gradient(145deg, #a2abbf, #5d6780); }

/* Automation cards */
.auto-card { display: flex; flex-direction: column; gap: 12px; }
.auto-card .a-top { display: flex; align-items: center; gap: 12px; }
.auto-card .a-reply { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); white-space: pre-line; max-height: 110px; overflow: hidden; }
.kw { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--violet-soft); color: var(--violet); padding: 2px 8px; border-radius: 7px; font-weight: 600; margin: 0 4px 4px 0; display: inline-block; }

/* Code / copy field */
.copy-field { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.copy-field span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropzone */
.dropzone { border: 2px dashed #D3D9E4; border-radius: 20px; padding: 30px 20px; text-align: center; transition: .2s var(--ease); cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .ic { width: 34px; height: 34px; color: var(--brand); }

/* Callouts */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; font-size: 13.5px; }
.callout .ic { flex: none; margin-top: 1px; }
.callout.info { background: var(--sky-soft); color: #0b4e7d; }
.callout.warn { background: var(--amber-soft); color: #6f4a00; }
.callout.ok { background: var(--brand-soft); color: #075a45; }
.callout.bad { background: var(--rose-soft); color: #8d1d31; }

/* Portal */
.portal-banner { display: flex; align-items: center; gap: 14px; }

/* =====================================================================
   Auth pages
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art {
  position: relative; overflow: hidden; padding: 44px; color: #fff; display: flex; flex-direction: column;
  background: radial-gradient(80% 60% at 100% 0%, #0A84D6 0%, transparent 60%), radial-gradient(70% 70% at 0% 100%, #1BD6A4 0%, transparent 60%), linear-gradient(160deg, #0a9b7c, #07615a);
}
.auth-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, #000, transparent 70%); }
.auth-art .brand-w { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; position: relative; letter-spacing: -.03em; }
.auth-art .brand-w img { width: 40px; height: 40px; border-radius: 12px; background: #fff; padding: 3px; }
.auth-art h2 { color: #fff; font-size: 40px; line-height: 1.08; font-weight: 800; letter-spacing: -.045em; margin: auto 0 14px; position: relative; max-width: 480px; }
.auth-art p.lead { color: rgba(255,255,255,.8); font-size: 16px; position: relative; max-width: 440px; }
.float-stack { position: relative; margin: 34px 0 10px; height: 250px; }
.float-card { position: absolute; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: 20px; padding: 14px 16px; box-shadow: 0 20px 40px -20px rgba(0,0,0,.35); animation: float 6s ease-in-out infinite; }
.float-card b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.float-card small { color: rgba(255,255,255,.75); font-weight: 600; }
.float-card.c1 { left: 0; top: 10px; width: 250px; }
.float-card.c2 { left: 210px; top: 90px; width: 220px; animation-delay: -2s; }
.float-card.c3 { left: 40px; top: 160px; width: 280px; animation-delay: -4s; }
.float-card .bubble { background: #fff; color: #111b21; border-radius: 4px 14px 14px 14px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }
@keyframes float { 50% { transform: translateY(-10px); } }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .app-icon { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 14px 30px -12px rgba(10,132,214,.6); margin-bottom: 22px; }
.auth-box h1 { font-size: 30px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 28px; }
.auth-box .form-control { padding: 13px 14px; border-radius: 14px; font-size: 15px; }
.auth-box .input-ic > .form-control { padding-left: 42px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 8px; }
.demo-box { margin-top: 26px; padding: 14px; border-radius: 16px; background: var(--surface-2); font-size: 13px; }
.demo-box button { border: 0; background: var(--surface); box-shadow: var(--sh-1); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; margin: 6px 6px 0 0; }
.demo-box button:hover { box-shadow: var(--sh-2); }

/* =====================================================================
   Tablet
   ===================================================================== */
@media (max-width: 1399.98px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .ib-side { display: none; }
  .ib-side.open { display: block; position: absolute; right: 0; top: 0; bottom: 0; width: 320px; z-index: 5; box-shadow: var(--sh-3); }
  .inbox { position: relative; }
}
@media (max-width: 1199.98px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camp-row { grid-template-columns: minmax(0, 2fr) 1fr 1fr 40px; }
  .camp-row .c-hide-md { display: none; }
}

/* =====================================================================
   Mobile — native iOS feel
   ===================================================================== */
@media (max-width: 991.98px) {
  body { font-size: 15px; background: #F2F2F7; overflow-x: hidden; }
  .bg-aurora { display: none; }
  .shell { z-index: auto; }                       /* let pushed chat screens sit above the tab bar */
  .is-full .page-enter > * { animation: none; }   /* a transform here would trap position:fixed children */
  .toolbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar .seg::-webkit-scrollbar { display: none; }
  .sidebar { display: none; }
  .main { margin: 0; padding-top: calc(var(--nav-h) + var(--safe-t)); padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px); }
  .content { padding: 4px 16px 24px; }

  .navbar-ios {
    position: fixed; top: 0; left: 0; right: 0; height: calc(var(--nav-h) + var(--safe-t)); padding: var(--safe-t) 8px 0;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    background: rgba(242,242,247,.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: .5px solid transparent; transition: border-color .2s, background .2s;
  }
  body.scrolled .navbar-ios, body.is-full .navbar-ios { border-bottom-color: rgba(60,60,67,.2); background: rgba(249,249,251,.82); }
  .navbar-ios .nb-left, .navbar-ios .nb-right { display: flex; align-items: center; gap: 4px; }
  .navbar-ios .nb-right { justify-content: flex-end; }
  .navbar-ios .nb-title { display: block; font-weight: 700; font-size: 17px; letter-spacing: -.02em; opacity: 0; transform: translateY(4px); transition: .25s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
  body.scrolled .nb-title, body.is-full .nb-title { opacity: 1; transform: none; }
  .tb-desktop { display: none; }
  .nb-back { display: flex; align-items: center; color: #007AFF; font-size: 17px; font-weight: 400; margin-left: -4px; }
  .nb-back .ic { width: 28px; height: 28px; stroke-width: 2.4; }
  .nb-ws { border: 0; background: transparent; padding: 6px; }
  .nb-btn { border: 0; background: transparent; color: #007AFF; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
  .nb-btn .ic { width: 24px; height: 24px; stroke-width: 2; }
  .nb-btn:active { background: rgba(0,122,255,.1); }
  .nb-btn.filled { background: #007AFF; color: #fff; width: 32px; height: 32px; }
  .nb-btn.filled .ic { width: 18px; height: 18px; stroke-width: 2.6; }

  .large-title { display: block; padding: 4px 16px 12px; }
  .large-title h1 { font-size: 34px; font-weight: 800; letter-spacing: -.04em; margin: 0; line-height: 1.1; }
  .large-title p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

  /* tab bar */
  .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    display: flex; background: rgba(249,249,251,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid rgba(60,60,67,.2);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8E8E93; font-size: 10.5px; font-weight: 600; letter-spacing: 0; }
  .tabbar a .tb-ic { position: relative; }
  .tabbar a .ic { width: 26px; height: 26px; stroke-width: 1.7; transition: transform .3s var(--spring); }
  .tabbar a:active .ic { transform: scale(.85); }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active .ic { stroke-width: 2.1; }
  .tabbar em { position: absolute; top: -4px; right: -10px; font-style: normal; background: #FF3B30; color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; padding: 0 5px; border: 1.5px solid #F9F9FB; }

  /* cards become iOS inset groups */
  .card-x { border-radius: 16px; padding: 16px; box-shadow: none; }
  .card-x.pad-0 { padding: 0; }
  .card-x.hover:hover { transform: none; box-shadow: none; }
  .kpis { gap: 10px; }
  .kpi { border-radius: 16px; box-shadow: none; padding: 14px; }
  .kpi .k-val { font-size: 24px; }
  .kpi .k-ic { width: 32px; height: 32px; border-radius: 9px; }
  .kpi .k-ic .ic { width: 18px; height: 18px; }
  .kpi .spark { display: none; }
  .ios-list { box-shadow: none; border-radius: 12px; }
  .toolbar { margin-bottom: 12px; }
  .search-pill { max-width: none; flex: 1 1 100%; }
  .search-pill .form-control { border-radius: 11px; background: rgba(118,118,128,.12); box-shadow: none; padding-top: 9px; padding-bottom: 9px; }
  .search-pill .form-control:focus { background: rgba(118,118,128,.16); box-shadow: none; border-color: transparent; }
  .hide-mobile { display: none !important; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { box-shadow: none; background: #fff; flex: none; }

  /* tables → grouped rows */
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tr, .tbl-stack td { display: block; width: 100%; }
  .tbl-stack tr { position: relative; padding: 12px 16px; border-bottom: .5px solid var(--line); }
  .tbl-stack tr:last-child { border-bottom: 0; }
  .tbl-stack td { padding: 0; border: 0; font-size: 14px; }
  .tbl-stack td[data-label] { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0 0 51px; font-size: 13px; color: var(--ink-2); }
  .tbl-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 500; }
  .tbl-stack td.m-hide { display: none; }
  .tbl-stack td.m-corner { position: absolute; top: 12px; right: 12px; width: auto; padding: 0; }
  .tbl-stack td.m-check { position: absolute; left: -2px; top: 24px; width: auto; }
  .tbl-stack tbody tr:hover { background: transparent; }

  .camp-row { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; gap: 10px; }
  .camp-row .c-metric, .camp-row .c-prog, .camp-row .c-arrow { display: none; }
  .camp-row .c-status { justify-self: end; }

  /* sheets */
  .modal.sheet .modal-dialog, .modal .modal-dialog { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; max-width: none; transform: translateY(100%); transition: transform .42s cubic-bezier(.32,.72,0,1); }
  .modal.show .modal-dialog { transform: none; }
  .modal-content { border-radius: 14px 14px 0 0; max-height: calc(100vh - 44px - var(--safe-t)); overflow: hidden; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 12px; }
  .modal-header { padding: 6px 16px 10px; }
  .modal-footer { padding: 8px 16px calc(14px + var(--safe-b)); background: var(--surface); box-shadow: 0 -1px 0 var(--line); }
  .modal-footer .btn { flex: 1; padding: 13px; font-size: 16px; border-radius: 14px; }
  .sheet-grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: #D1D1D6; margin: 7px auto 2px; flex: none; }
  .modal-dialog-scrollable .modal-content { max-height: calc(100vh - 44px); }

  .toast-stack { left: 10px; right: 10px; top: calc(var(--safe-t) + 8px); align-items: stretch; }
  .ba-toast { max-width: none; min-width: 0; border-radius: 20px; }

  .hero { border-radius: 20px; padding: 20px; }
  .hero h2 { font-size: 21px; }
  .hero .hero-stats { gap: 18px; }
  .hero .hero-stats b { font-size: 19px; }

  /* inbox: iOS push navigation */
  .is-full .main { padding-bottom: 0; }
  .is-full .content { padding: 0; }
  .inbox { display: block; height: calc(100dvh - var(--nav-h) - var(--safe-t) - var(--tab-h) - var(--safe-b)); border-radius: 0; box-shadow: none; position: relative; overflow: hidden; background: #F2F2F7; }
  .ib-list { border: 0; height: 100%; background: #fff; }
  .ib-list-head { padding: 10px 16px 8px; background: #F2F2F7; }
  .ib-items { padding: 0; background: #fff; }
  .ib-item { border-radius: 0; padding: 11px 16px; }
  .ib-item + .ib-item::before { content: ""; position: absolute; top: 0; left: 67px; right: 0; height: .5px; background: var(--line); }
  .ib-item.active { background: transparent; }
  /* the chat is pushed over the whole screen like a UINavigationController */
  .ib-chat { position: fixed; inset: 0; z-index: 60; transform: translateX(100%); transition: transform .45s cubic-bezier(.32,.72,0,1); box-shadow: -10px 0 30px rgba(0,0,0,.08); visibility: hidden; }
  .inbox.chat-open .ib-chat { transform: none; visibility: visible; }
  .inbox.chat-open .ib-list { transform: translateX(-28%); }
  .ib-list { transition: transform .45s cubic-bezier(.32,.72,0,1); }
  .ib-chat-head { padding: calc(6px + var(--safe-t)) 10px 8px; background: rgba(249,249,251,.9); }
  .ib-back { display: inline-flex; align-items: center; color: #007AFF; }
  .ib-back .ic { width: 28px; height: 28px; stroke-width: 2.4; }
  .ib-thread { padding: 14px 12px; }
  .msg { max-width: 84%; font-size: 15px; }
  .ib-compose { padding: 8px 10px calc(8px + var(--safe-b)); }
  .ib-side.open { position: fixed; inset: 0; width: 100%; z-index: 70; padding-top: calc(16px + var(--safe-t)); }

  .kanban { grid-template-columns: repeat(5, 82vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; }
  .k-col { scroll-snap-align: center; }

  .auth { grid-template-columns: 1fr; background: #fff; }
  .auth-art { display: none; }
  .auth-form { align-items: flex-start; padding: calc(60px + var(--safe-t)) 22px 30px; }
  .auth-box .app-icon { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 20px; display: block; }
  .auth-box h1, .auth-box .sub { text-align: center; }

  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
  .funnel .f-row { grid-template-columns: 76px 1fr 56px; }
  .wa-phone { max-width: 300px; }
}

@media (max-width: 575.98px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-card .ws-stats b { font-size: 15px; }
}

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

/* ---------- Media headers (image / PDF) ---------- */
.wa-media { margin: -4px -6px 6px; border-radius: 10px; overflow: hidden; background: #dfe5e7; }
.wa-media img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.wa-media.empty { height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #8696a0; font-size: 12px; font-weight: 600; }
.wa-media.empty .ic { width: 30px; height: 30px; }
.wa-doc { display: flex; align-items: center; gap: 10px; margin: -2px -4px 8px; padding: 10px; border-radius: 10px; background: #f0f2f5; }
.wa-doc .pdf { flex: none; width: 34px; height: 40px; border-radius: 6px; background: linear-gradient(160deg, #ff6b6b, #e03131); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; letter-spacing: .02em; }
.wa-doc b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-doc small { color: #8696a0; font-size: 11.5px; }
.msg .wa-media { margin: 0 0 6px; max-width: 280px; }
.msg .wa-doc { margin: 0 0 6px; background: rgba(255,255,255,.6); max-width: 280px; }
.seg label .ic { width: 15px; height: 15px; margin-top: -2px; }
.file-pick { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2); border: 1.5px solid var(--line); }
.file-pick .thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: #dfe5e7; }
