/* =============================================================================================
 * Design system. One stylesheet for the whole app.
 *   Tokens       - colours, radius, shadow, type; light and dark themes
 *   Shell        - dark sidebar, top bar, command palette
 *   Components   - buttons, cards, KPIs, tables, toolbars, menus, dialogs, forms, badges
 *   Pages        - dashboard journey, settings, roles, activity, WhatsApp connection, playground
 * Theme: <html data-theme="light|dark">, set before first paint by theme.js.
 * =========================================================================================== */

:root {
  --brand: #5b4bff;
  --brand-2: #8b5cf6;
  --brand-ink: #4336e6;
  --brand-soft: #eeecff;
  --brand-glow: rgba(91, 75, 255, 0.28);

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --line: #e4e7ef;
  --line-strong: #d3d7e3;
  --ink: #0f1222;
  --ink-2: #474d63;
  --ink-3: #868ca0;

  --go: #0f9f6e;
  --go-soft: #dcf5ea;
  --warn: #c2700a;
  --warn-soft: #fdf0d9;
  --risk: #dc2650;
  --risk-soft: #fde6eb;
  --info: #0b84c6;
  --info-soft: #e0f1fb;

  --side-bg: #0d0f20;
  --side-bg-2: #12152b;
  --side-ink: #a7acc8;
  --side-ink-strong: #f2f3fb;
  --side-line: rgba(255, 255, 255, 0.07);
  --side-hover: rgba(255, 255, 255, 0.06);

  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 45, 0.06);
  --shadow: 0 1px 2px rgba(16, 20, 45, 0.05), 0 6px 20px -8px rgba(16, 20, 45, 0.12);
  --shadow-lg: 0 24px 60px -12px rgba(16, 20, 45, 0.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #7c6dff;
  --brand-ink: #a59bff;
  --brand-soft: rgba(124, 109, 255, 0.16);
  --brand-glow: rgba(124, 109, 255, 0.35);
  --bg: #090b16;
  --surface: #11142a;
  --surface-2: #151935;
  --surface-3: #1b2042;
  --line: #232849;
  --line-strong: #2f3560;
  --ink: #eceefb;
  --ink-2: #b4b9d3;
  --ink-3: #7c82a3;
  --go: #34d399;
  --go-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --risk: #fb7185;
  --risk-soft: rgba(251, 113, 133, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --side-bg: #070814;
  --side-bg-2: #0b0d1d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
code { font-family: var(--mono); font-size: 0.85em; }
::selection { background: var(--brand-soft); }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ico { flex: none; }
[hidden] { display: none !important; }

/* ============================================ Shell ============================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 0.9rem;
  padding: 1rem 0.8rem; color: var(--side-ink);
  background: radial-gradient(120% 60% at 0% 0%, rgba(91, 75, 255, 0.22), transparent 60%), linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  border-right: 1px solid var(--side-line); transition: width 0.18s ease;
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.45rem; color: var(--side-ink-strong); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #6d5dff 0%, #8b5cf6 55%, #c084fc 100%); box-shadow: 0 6px 18px -4px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 0.98rem; font-weight: 700; letter-spacing: -0.015em; }
.brand-text small { font-size: 0.72rem; color: var(--side-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-search { display: flex; align-items: center; gap: 0.55rem; width: 100%; padding: 0.55rem 0.65rem; border-radius: 10px; border: 1px solid var(--side-line); background: rgba(255,255,255,0.04); color: var(--side-ink); font: inherit; font-size: 0.82rem; cursor: pointer; text-align: left; }
.side-search:hover { background: rgba(255,255,255,0.08); color: var(--side-ink-strong); }
.side-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-search .kbd { flex: none; }
.kbd, kbd { font-family: var(--font); font-size: 0.68rem; font-weight: 600; padding: 0.08rem 0.38rem; border-radius: 5px; border: 1px solid currentColor; opacity: 0.7; line-height: 1.4; }

.sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.1rem; margin: 0 -0.2rem; padding: 0 0.2rem; scrollbar-width: none; }
.nav-label { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #6b7095; padding: 0.95rem 0.6rem 0.35rem; }
.sidebar nav a { position: relative; display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: 9px; color: var(--side-ink); font-size: 0.86rem; font-weight: 500; }
.sidebar nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); text-decoration: none; }
.sidebar nav a.active { color: #fff; background: linear-gradient(90deg, rgba(124, 109, 255, 0.35), rgba(124, 109, 255, 0.08)); box-shadow: inset 0 0 0 1px rgba(146, 135, 255, 0.25); }
.sidebar nav a.active .ico { color: #c4bdff; }
.nav-soon { margin-left: auto; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #7d82a8; border: 1px solid var(--side-line); border-radius: 5px; padding: 0 0.3rem; }
.nav-step { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 0.62rem; font-weight: 700; color: #7d82a8; border: 1px solid var(--side-line); }
.nav-step.done { color: #0d0f20; background: #34d399; border-color: #34d399; }

.conn { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 0.7rem; border-radius: 11px; background: rgba(255,255,255,0.04); border: 1px solid var(--side-line); color: var(--side-ink); font-size: 0.78rem; }
.conn:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.conn b { display: block; color: var(--side-ink-strong); font-size: 0.8rem; font-weight: 600; }
.conn small { display: block; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn > span:last-child { min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #6b7095; }
.dot.go { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); }
.dot.risk { background: #fb7185; box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.2); }
.dot.warn { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2); }

.me { position: relative; }
.me > summary { list-style: none; display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem; border-radius: 11px; cursor: pointer; }
.me > summary::-webkit-details-marker { display: none; }
.me > summary:hover, .me[open] > summary { background: var(--side-hover); }
.me-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 0.74rem; font-weight: 700; color: #fff; background: linear-gradient(140deg, #6d5dff, #c084fc); }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.me-text b { font-size: 0.82rem; font-weight: 600; color: var(--side-ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: 0.7rem; color: var(--side-ink); }
.me .ds-pop { bottom: calc(100% + 6px); top: auto; left: 0; right: 0; min-width: 0; }

/* Collapsed sidebar (desktop): icons only */
.nav-collapsed .app-shell .sidebar { width: 72px; }
.nav-collapsed .app-shell .brand-text, .nav-collapsed .app-shell .nav-label, .nav-collapsed .app-shell .sidebar nav a span,
.nav-collapsed .app-shell .side-search span, .nav-collapsed .app-shell .side-search .kbd, .nav-collapsed .app-shell .conn > span:last-child,
.nav-collapsed .app-shell .me-text, .nav-collapsed .app-shell .nav-soon, .nav-collapsed .app-shell .nav-step { display: none; }
.nav-collapsed .app-shell .sidebar nav a, .nav-collapsed .app-shell .side-search, .nav-collapsed .app-shell .conn, .nav-collapsed .app-shell .me > summary { justify-content: center; }
.nav-collapsed .app-shell .brand { justify-content: center; padding: 0.25rem 0; }

/* Main column + top bar */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem; height: 58px; padding: 0 1.75rem; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; color: var(--ink-3); min-width: 0; flex: 1; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 0.4rem; }
.tb-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.tb-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.tb-search { display: inline-flex; align-items: center; gap: 0.5rem; height: 34px; padding: 0 0.6rem 0 0.7rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font: inherit; font-size: 0.82rem; cursor: pointer; min-width: 220px; }
.tb-search span { flex: 1; text-align: left; white-space: nowrap; }
.tb-search .kbd { flex: none; }
.tb-search:hover { border-color: var(--line-strong); color: var(--ink-2); }
.theme-dark-only { display: none; }
:root[data-theme="dark"] .theme-dark-only { display: block; }
:root[data-theme="dark"] .theme-light-only { display: none; }

.main { padding: 1.6rem 1.75rem 3rem; width: 100%; max-width: 1320px; }

/* Flash messages appear as a toast-like banner at the top of the content */
.flash { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.95rem; border-radius: 10px; margin-bottom: 1.2rem; font-size: 0.86rem; border: 1px solid; }
.flash.info { background: var(--go-soft); color: var(--go); border-color: color-mix(in srgb, var(--go) 25%, transparent); }
.flash.error { background: var(--risk-soft); color: var(--risk); border-color: color-mix(in srgb, var(--risk) 25%, transparent); }

/* ========================================== Command palette ==================================== */
.cmdk { border: none; padding: 0; width: min(620px, calc(100vw - 2rem)); margin: 12vh auto auto; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); overflow: hidden; }
.cmdk::backdrop { background: rgba(7, 8, 20, 0.55); backdrop-filter: blur(4px); }
.cmdk-input { display: flex; align-items: center; gap: 0.65rem; padding: 0.95rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.cmdk-input input { flex: 1; border: none; outline: none; background: transparent; font: inherit; font-size: 1rem; color: var(--ink); }
.cmdk-list { max-height: 56vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-group { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 0.65rem 0.65rem 0.3rem; }
.cmdk-item { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.6rem 0.65rem; border-radius: 9px; color: var(--ink); font-size: 0.88rem; cursor: pointer; }
.cmdk-item:hover { text-decoration: none; }
.cmdk-item .ci { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.cmdk-item small { display: block; color: var(--ink-3); font-size: 0.76rem; }
.cmdk-item[aria-selected="true"] { background: var(--brand-soft); }
.cmdk-item[aria-selected="true"] .ci { background: var(--brand); color: #fff; }
.cmdk-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-3); }
.cmdk-foot { display: flex; gap: 1rem; padding: 0.55rem 1rem; border-top: 1px solid var(--line); font-size: 0.74rem; color: var(--ink-3); background: var(--surface-2); }

/* ============================================ Page header ======================================= */
.pg-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.pg-head-main { display: flex; gap: 0.9rem; align-items: center; min-width: 0; }
.pg-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--brand-ink); background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); }
.pg-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; margin: 0; line-height: 1.2; }
.pg-sub { color: var(--ink-2); font-size: 0.88rem; margin-top: 0.25rem; max-width: 70ch; }
.pg-actions { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }

/* ============================================== Buttons ========================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; height: 38px; padding: 0 1rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand)); box-shadow: 0 1px 2px rgba(16, 20, 45, 0.2), 0 4px 12px -4px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.18); transition: transform 0.06s, box-shadow 0.15s, background 0.15s; }
.btn:hover { text-decoration: none; box-shadow: 0 1px 2px rgba(16, 20, 45, 0.2), 0 8px 20px -6px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn:active { transform: translateY(1px); }
.btn.secondary { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn.danger { color: var(--risk); }
.btn.danger:not(.secondary) { color: #fff; background: var(--risk); box-shadow: none; }
.btn.sm { height: 32px; padding: 0 0.75rem; font-size: 0.8rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }

/* =============================================== Cards ========================================== */
.ui-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); container-type: inline-size; }
.ui-card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.95rem 1.15rem; border-bottom: 1px solid var(--line); }
.ui-card-head .t { font-weight: 650; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ui-card-head .h { color: var(--ink-3); font-size: 0.79rem; margin-top: 0.1rem; }
.ui-card-body { padding: 1.1rem 1.15rem; }
.ui-card-foot { display: flex; justify-content: flex-end; align-items: center; gap: 0.6rem; padding: 0.8rem 1.15rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.ui-card-foot .muted { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; margin-right: auto; }

.callout { background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); border-radius: var(--radius); padding: 0.9rem 1.1rem; font-size: 0.86rem; color: var(--ink-2); margin-bottom: 1rem; }
.callout-title { font-weight: 700; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--info); margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.4rem; }
.callout p { margin: 0 0 0.4rem; }
.callout ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; }
.callout b { color: var(--ink); }
.risk-callout { background: var(--risk-soft); border-color: color-mix(in srgb, var(--risk) 25%, transparent); }
.risk-callout .callout-title { color: var(--risk); }
.callout code, .hint code, .ds-empty code, .guide-steps code { background: var(--surface-3); color: var(--ink); padding: 0.05rem 0.35rem; border-radius: 5px; }

/* ================================================ KPIs ========================================== */
.ds-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 1.2rem; }
.ds-kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ds-kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); min-width: 0; }
.ds-kpi .k { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 500; color: var(--ink-2); }
.ds-kpi .k .ki { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.ds-kpi .k .ki.go { background: var(--go-soft); color: var(--go); }
.ds-kpi .k .ki.risk { background: var(--risk-soft); color: var(--risk); }
.ds-kpi .k .ki.warn { background: var(--warn-soft); color: var(--warn); }
.ds-kpi .k .ki.info { background: var(--info-soft); color: var(--info); }
.ds-kpi .v { margin-top: 0.55rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ds-kpi .v small { font-size: 0.85rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.ds-kpi .s { margin-top: 0.35rem; font-size: 0.76rem; color: var(--ink-3); }

/* ============================================== Toolbar ========================================= */
.ds-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.toolbar-right { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.ds-tabs { display: inline-flex; gap: 0.15rem; padding: 0.22rem; background: var(--surface-3); border-radius: 10px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ds-tabs button, .ds-tabs a { white-space: nowrap; border: none; background: transparent; padding: 0.38rem 0.75rem; border-radius: 8px; font: inherit; font-size: 0.82rem; font-weight: 550; color: var(--ink-2); cursor: pointer; }
.ds-tabs a:hover { text-decoration: none; }
.ds-tabs button span, .ds-tabs a span { font-size: 0.7rem; margin-left: 0.2rem; padding: 0.02rem 0.4rem; border-radius: 10px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.ds-tabs button:hover, .ds-tabs a:hover { color: var(--ink); }
.ds-tabs .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.ds-search { position: relative; display: flex; align-items: center; margin: 0; max-width: 100%; }
.ds-search .ico { position: absolute; left: 0.7rem; color: var(--ink-3); pointer-events: none; }
.ds-search input { width: 270px; max-width: 100%; height: 36px; padding: 0 2rem 0 2.1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.84rem; }
.ds-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ds-search kbd { position: absolute; right: 0.55rem; color: var(--ink-3); }
.ds-select { height: 36px; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.84rem; }

/* =============================================== Tables ========================================= */
.dt-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dt-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 0.7rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.dt-scroll:first-child table thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.dt-scroll:first-child table thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.cell-main { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.cell-main b { display: block; font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.cell-main small { display: block; color: var(--ink-3); font-size: 0.78rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 0.74rem; color: #fff; background: var(--brand); }
.avatar.sm { width: 24px; height: 24px; font-size: 0.62rem; }
.avatar.sq { border-radius: 10px; }
.you { display: inline-block; margin-left: 0.35rem; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-soft); border-radius: 6px; padding: 0.05rem 0.4rem; vertical-align: 1px; }
.ds-card { overflow: visible; }
.ds-empty { padding: 2.6rem 1.2rem; text-align: center; color: var(--ink-3); display: grid; gap: 0.35rem; justify-items: center; font-size: 0.86rem; }
.ds-empty > .ico { width: 46px; height: 46px; padding: 11px; border-radius: 14px; background: var(--surface-3); color: var(--ink-2); margin-bottom: 0.3rem; }
.ds-empty strong { color: var(--ink); font-size: 0.95rem; }
.ds-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.7rem 1.1rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-2); }
.pager { display: inline-flex; gap: 0.4rem; }
.copy-chip { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 8px; padding: 0.25rem 0.55rem; font: inherit; cursor: pointer; }
.copy-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.copy-chip code { font-size: 0.76rem; }

/* ========================================== Badges + pills ====================================== */
.badge, .pill { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.go, .pill.go { background: var(--go-soft); color: var(--go); }
.badge.warn, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.badge.risk, .pill.risk { background: var(--risk-soft); color: var(--risk); }
.badge.neutral, .pill.neutral { background: var(--surface-3); color: var(--ink-2); }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); }

/* =========================================== Menus + dialogs ==================================== */
.ds-menu { position: relative; }
.ds-menu > summary { list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); }
.ds-menu > summary::-webkit-details-marker { display: none; }
.ds-menu > summary:hover, .ds-menu[open] > summary { background: var(--surface-3); color: var(--ink); }
.ds-pop { position: absolute; right: 0; top: 36px; z-index: 30; min-width: 220px; padding: 0.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.ds-pop a, .ds-pop button { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; padding: 0.5rem 0.6rem; border: none; background: transparent; border-radius: 8px; font: inherit; font-size: 0.84rem; color: var(--ink); cursor: pointer; }
.ds-pop a:hover, .ds-pop button:hover { background: var(--surface-3); text-decoration: none; }
.ds-pop form { margin: 0; }
.ds-pop hr { border: none; border-top: 1px solid var(--line); margin: 0.3rem 0.2rem; }
.ds-pop .ico { color: var(--ink-3); }
.ds-pop .danger, .ds-pop .danger .ico { color: var(--risk); }

.ds-dialog { border: none; padding: 0; width: min(500px, calc(100vw - 2rem)); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); }
.ds-dialog::backdrop { background: rgba(7, 8, 20, 0.5); backdrop-filter: blur(3px); }
.ds-dialog form { padding: 1.35rem 1.4rem 1.25rem; }
.ds-dialog-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ds-dialog-head .t { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.015em; }
.ds-dialog-head .muted { font-size: 0.84rem; margin-top: 0.2rem; }
.ds-dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.3rem; }
.ds-x { border: none; background: transparent; cursor: pointer; color: var(--ink-3); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.ds-x:hover { background: var(--surface-3); color: var(--ink); }
.ds-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); background: #0f1222; color: #fff; padding: 0.6rem 1rem; border-radius: 10px; font-size: 0.84rem; opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 100; box-shadow: var(--shadow-lg); }
.ds-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =============================================== Forms ========================================== */
form.stacked label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink); margin: 1rem 0 0.35rem; }
form.stacked label:first-child, form.stacked .form-grid > div > label:first-child { margin-top: 0; }
form.stacked .form-grid > div > label:first-child { margin-top: 1rem; }
form.stacked input:not([type=checkbox]):not([type=radio]), form.stacked select, form.stacked textarea {
  width: 100%; height: 40px; padding: 0 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.88rem; transition: border-color 0.12s, box-shadow 0.12s; }
form.stacked textarea { height: auto; padding: 0.6rem 0.8rem; resize: vertical; }
form.stacked input:focus, form.stacked select:focus, form.stacked textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
form.stacked input:disabled { background: var(--surface-2); color: var(--ink-3); }
form.stacked input::placeholder, form.stacked textarea::placeholder { color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.hint { color: var(--ink-3); font-size: 0.78rem; margin: 0.4rem 0 0; }
label.check { display: inline-flex !important; align-items: center; gap: 0.45rem; margin: 0 !important; font-weight: 500 !important; font-size: 0.82rem !important; cursor: pointer; }
label.check input { accent-color: var(--brand); }

/* ================================================ Auth ========================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; padding: 2.5rem 3rem; color: #e9e8ff; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(70% 60% at 15% 10%, rgba(139, 92, 246, 0.55), transparent 60%), radial-gradient(60% 50% at 90% 90%, rgba(91, 75, 255, 0.6), transparent 60%), #0b0c1d; }
.auth-art .brand { padding: 0; }
.auth-art h2 { font-size: 2.1rem; line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 0.8rem; color: #fff; max-width: 16ch; }
.auth-art p { color: #b8b6e6; max-width: 42ch; margin: 0; }
.auth-flow { display: grid; gap: 0.55rem; margin-top: 2rem; max-width: 380px; }
.auth-flow div { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); font-size: 0.86rem; color: #dcdbff; }
.auth-flow i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-style: normal; font-size: 0.74rem; font-weight: 700; background: rgba(255,255,255,0.12); color: #fff; }
.auth-art small { color: #8d8bc2; font-size: 0.76rem; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.5rem; background: var(--bg); }
.login-card { width: min(400px, 100%); }
.login-card h1 { font-size: 1.6rem; letter-spacing: -0.03em; margin: 0; }
.login-card .lead { color: var(--ink-2); margin: 0.35rem 0 1.6rem; font-size: 0.9rem; }
.login-card form.stacked input:not([type=checkbox]) { height: 44px; }
.login-card .btn { height: 44px; margin-top: 1.4rem; }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; font-size: 0.82rem; }
.login-foot { margin-top: 1.5rem; font-size: 0.78rem; color: var(--ink-3); text-align: center; }

/* ============================================ Dashboard ========================================= */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 1.6rem 1.7rem; margin-bottom: 1.2rem; color: #fff;
  background: radial-gradient(80% 120% at 100% 0%, rgba(192, 132, 252, 0.55), transparent 55%), radial-gradient(70% 90% at 0% 100%, rgba(91, 75, 255, 0.9), transparent 60%), linear-gradient(120deg, #1c1846, #2b1f6b); box-shadow: var(--shadow); }
.hero-top { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.03em; line-height: 1.2; }
.hero p { margin: 0.35rem 0 0; color: #d6d2ff; max-width: 60ch; }
.hero-progress { min-width: 220px; }
.hero-progress .lbl { display: flex; justify-content: space-between; font-size: 0.78rem; color: #d6d2ff; margin-bottom: 0.4rem; }
.hero-progress .bar { height: 8px; border-radius: 8px; background: rgba(255,255,255,0.15); overflow: hidden; }
.hero-progress .bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #34d399, #a7f3d0); }
.hero .btn { background: #fff; color: #2b1f6b; box-shadow: 0 6px 20px -6px rgba(0,0,0,0.4); }
.hero .btn.secondary { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }

.journey { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; margin-top: 1.4rem; }
.jstep { position: relative; display: flex; flex-direction: column; gap: 0.45rem; padding: 0.85rem 0.8rem; border-radius: 13px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: #fff; min-width: 0; }
.jstep:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.jstep .ji { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,0.12); }
.jstep b { font-size: 0.84rem; }
.jstep small { font-size: 0.72rem; color: #c9c5f5; line-height: 1.35; }
.jstep .js { position: absolute; top: 0.7rem; right: 0.7rem; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 6px; background: rgba(255,255,255,0.12); color: #e0ddff; }
.jstep.done .ji { background: #34d399; color: #062b1e; }
.jstep.done .js { background: rgba(52, 211, 153, 0.25); color: #a7f3d0; }
.jstep.next { background: #fff; color: #1c1846; border-color: #fff; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); }
.jstep.next .ji { background: var(--brand); color: #fff; }
.jstep.next small { color: #5b5785; }
.jstep.next .js { background: var(--brand); color: #fff; }
.jstep.later { opacity: 0.6; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.dash-col { display: grid; gap: 1rem; min-width: 0; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; padding: 1.1rem 1.15rem 1.2rem; }
.flow-node { position: relative; text-align: center; display: grid; justify-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--ink-2); }
.flow-node .fi { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink); }
.flow-node.brandy .fi { background: linear-gradient(140deg, #6d5dff, #a78bfa); color: #fff; box-shadow: 0 8px 20px -8px var(--brand-glow); }
.flow-node b { color: var(--ink); font-size: 0.82rem; }
.flow-node:not(:last-child)::after { content: ''; position: absolute; top: 23px; left: calc(50% + 30px); right: calc(-50% + 30px); border-top: 2px dashed var(--line-strong); }
.flow-note { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.8rem 1.15rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.flow-note .ico { color: var(--brand-ink); margin-top: 2px; }

.health { display: grid; gap: 0; }
.health-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.7rem 1.15rem; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
.health-row:last-child { border-bottom: none; }
.health-row span:first-child { color: var(--ink-2); display: flex; align-items: center; gap: 0.5rem; }
.health-row b { font-weight: 600; text-align: right; }

.feed { list-style: none; margin: 0; padding: 0.3rem 0; }
.feed li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 0.7rem; align-items: start; padding: 0.6rem 1.15rem; font-size: 0.84rem; }
.feed .fi { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.feed small { color: var(--ink-3); font-size: 0.75rem; }
.feed time { color: var(--ink-3); font-size: 0.74rem; white-space: nowrap; }

/* ===================================== Module "coming next" page ================================ */
.pending { overflow: hidden; }
.pending-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 0; }
.pending-main { padding: 1.6rem 1.6rem 1.8rem; }
.pending-main h2 { font-size: 1.2rem; letter-spacing: -0.02em; margin: 0.8rem 0 0.35rem; }
.pending-main p { margin: 0 0 1rem; color: var(--ink-2); }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; font-size: 0.88rem; }
.pending-list li { display: flex; gap: 0.6rem; align-items: center; }
.pending-list .ico { color: var(--go); }
.pending-side { padding: 1.6rem; background: var(--surface-2); border-left: 1px solid var(--line); }
.pending-side h3 { margin: 0 0 0.9rem; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.mini-journey { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.mini-journey li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.55rem; border-radius: 9px; font-size: 0.84rem; color: var(--ink-2); }
.mini-journey li i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 0.68rem; font-weight: 700; background: var(--surface-3); color: var(--ink-2); flex: none; }
.mini-journey li.done i { background: var(--go); color: #fff; }
.mini-journey li.here { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.mini-journey li.here i { background: var(--brand); color: #fff; }

/* ========================================= Settings layout ====================================== */
.ui-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.ui-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 1rem; }
.ui-nav-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.015em; padding: 0 0.6rem; }
.ui-nav-group { display: flex; flex-direction: column; gap: 0.1rem; }
.ui-nav-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 0 0.6rem 0.3rem; }
.ui-nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 9px; color: var(--ink-2); font-size: 0.86rem; font-weight: 500; }
.ui-nav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 0 0 1px var(--line); }
.ui-nav a.active { background: var(--surface); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.ui-nav a.active .ico { color: var(--brand); }
.ui-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ui-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.ui-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.025em; }
.ui-sub { color: var(--ink-2); font-size: 0.86rem; margin-top: 0.2rem; max-width: 70ch; }
.ui-title .pill { font-size: 0.7rem; }
.acct-grid, .wa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }

/* Role picker + permission matrix */
.role-pick { border: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.45rem; }
.role-pick legend { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; padding: 0; }
.role-pick legend small { font-weight: 400; }
form.stacked .role-opt, .role-opt { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; margin: 0; font-weight: 400; }
.role-opt:hover { border-color: var(--line-strong); }
.role-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent); }
.role-opt input { margin: 0.2rem 0 0; accent-color: var(--brand); }
.role-opt b { display: block; font-size: 0.86rem; }
.role-opt small { display: block; color: var(--ink-2); font-size: 0.77rem; line-height: 1.4; }
.role-pick:disabled .role-opt { opacity: 0.55; cursor: not-allowed; }
.role-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.perm-groups { display: grid; gap: 1rem; }
.perm-group { border: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.perm-group legend { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.3rem; padding: 0; }
.perm { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.84rem; padding: 0.3rem 0.35rem; border-radius: 7px; cursor: pointer; }
.perm:hover { background: var(--surface-2); }
.perm input { margin: 0.22rem 0 0; accent-color: var(--brand); }
.perm input:disabled + span { color: var(--ink-3); }

/* Activity log */
.ui-log { font-size: 0.86rem; }
.log-day { padding: 0.55rem 1.15rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.log-day:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.log-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 0.8rem; align-items: start; padding: 0.8rem 1.15rem; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: none; }
.log-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.log-ico.go { background: var(--go-soft); color: var(--go); }
.log-ico.warn { background: var(--warn-soft); color: var(--warn); }
.log-ico.risk { background: var(--risk-soft); color: var(--risk); }
.log-sum { color: var(--ink); }
.log-more { font-size: 0.74rem; color: var(--brand-ink); margin-left: 0.3rem; }
.log-by { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.3rem; font-size: 0.78rem; color: var(--ink-2); }
.log-by .avatar { background: var(--brand-soft); color: var(--brand-ink); }
.log-time { font-size: 0.78rem; color: var(--ink-3); white-space: nowrap; }
.ui-log details > summary { list-style: none; cursor: pointer; }
.ui-log details > summary::-webkit-details-marker { display: none; }
.ui-log .chg { margin: 0.5rem 0 0; padding: 0.6rem 0.8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; font-size: 0.8rem; color: var(--ink-2); display: grid; gap: 0.2rem; }
.ui-log .chg b { color: var(--ink); }

/* ===================================== WhatsApp connection + playground ========================= */
.guide-steps { margin: 0; padding: 1rem 1.2rem 1.2rem 2.4rem; display: grid; gap: 0.8rem; font-size: 0.84rem; line-height: 1.55; color: var(--ink-2); }
.guide-steps b { color: var(--ink); }
.pg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.pg-forms { display: grid; gap: 1rem; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 0.72rem; font-weight: 700; }
.tpl-preview { margin-top: 0.9rem; padding: 1rem; border-radius: 12px; background: #e9e3da url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23000' stroke-opacity='.03'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .tpl-preview { background-color: #0b141a; }
.bubble { position: relative; max-width: 92%; background: #fff; color: #111b21; border-radius: 0 10px 10px 10px; padding: 0.55rem 0.75rem; font-size: 0.86rem; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,0.1); }
:root[data-theme="dark"] .bubble { background: #202c33; color: #e9edef; }
.bubble[data-note]::after { content: attr(data-note); display: block; margin-top: 0.45rem; font-size: 0.74rem; color: var(--warn); }
.pg-log { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.call { border-bottom: 1px solid var(--line); }
.call:last-child { border-bottom: none; }
.call summary { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; padding: 0.75rem 1.15rem; cursor: pointer; list-style: none; }
.call summary::-webkit-details-marker { display: none; }
.call summary:hover { background: var(--surface-2); }
.call.ok .call-ico { color: var(--go); }
.call.fail .call-ico { color: var(--risk); }
.call-main b { display: block; font-size: 0.86rem; }
.call-main small { color: var(--ink-3); font-size: 0.76rem; }
.call-time { font-size: 0.76rem; color: var(--ink-3); white-space: nowrap; }
.call-body { padding: 0 1.15rem 1.1rem; }
.call-err { background: var(--risk-soft); color: var(--risk); border-radius: 9px; padding: 0.65rem 0.8rem; font-size: 0.82rem; display: grid; gap: 0.3rem; }
.call-err div { color: var(--ink); }
.call-okmsg { background: var(--go-soft); color: var(--ink-2); border-radius: 9px; padding: 0.65rem 0.8rem; font-size: 0.82rem; overflow-wrap: anywhere; line-height: 1.55; }
.call-okmsg b { color: var(--ink); }
.call-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0.85rem 0 0.35rem; }
.call pre { margin: 0; background: #0d0f20; color: #d9dcf2; border-radius: 10px; padding: 0.75rem 0.85rem; font-size: 0.75rem; line-height: 1.55; overflow-x: auto; max-height: 320px; }

/* ============================================ Responsive ======================================== */
@media (max-width: 1200px) {
  .journey { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .role-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .dash-grid, .wa-grid, .pg-grid { grid-template-columns: minmax(0, 1fr); }
  .pg-log { position: static; max-height: none; }
  .ds-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .ui-shell { grid-template-columns: minmax(0, 1fr); }
  .ui-nav { position: static; flex-direction: row; overflow-x: auto; gap: 0.25rem; scrollbar-width: none; }
  .ui-nav-title, .ui-nav-label { display: none; }
  .ui-nav-group { flex-direction: row; }
  .ui-nav a { white-space: nowrap; }
  .pending-body { grid-template-columns: minmax(0, 1fr); }
  .pending-side { border-left: none; border-top: 1px solid var(--line); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
}
@media (max-width: 860px) {
  .app-shell, .nav-collapsed .app-shell { flex-direction: column; }
  .sidebar, .nav-collapsed .app-shell .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; }
  .sidebar nav { order: 5; width: 100%; flex: none; flex-direction: row; overflow-x: auto; }
  .nav-label, .side-search, .conn, .nav-soon, .nav-step, .collapse-btn { display: none !important; }
  .sidebar nav a { white-space: nowrap; }
  .nav-collapsed .app-shell .sidebar nav a span, .nav-collapsed .app-shell .brand-text { display: inline; }
  .me { margin-left: auto; }
  .me-text { display: none; }
  .me .ds-pop { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; min-width: 200px; }
  .topbar { padding: 0 1rem; position: static; }
  .tb-search { min-width: 0; }
  .tb-search span, .tb-search .kbd { display: none; }
  .main { padding: 1.1rem 1rem 2rem; }
  .form-grid, .acct-grid, .ds-kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.2rem; }
  .flow-node::after { display: none; }
  .hero { padding: 1.3rem; }
  .hero-progress { min-width: 0; width: 100%; }
}
@media (max-width: 520px) {
  .ds-kpis { grid-template-columns: minmax(0, 1fr); }
  .ds-search input { width: 100%; }
  .ds-search, .toolbar-right { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.btn[aria-busy="true"] { opacity: 0.75; cursor: progress; }

/* =============================================================================================
 * Cinematic layer: deeper contrast, aurora light, glass surfaces, glowing data, motion.
 * Sits on top of the base system; everything respects prefers-reduced-motion.
 * =========================================================================================== */
:root[data-theme="dark"] {
  --bg: #05060d;
  --surface: rgba(17, 20, 40, 0.72);
  --surface-2: rgba(22, 26, 52, 0.7);
  --surface-3: rgba(40, 46, 88, 0.55);
  --line: rgba(130, 140, 255, 0.12);
  --line-strong: rgba(150, 160, 255, 0.24);
  --brand: #8371ff;
  --brand-ink: #b3a8ff;
  --brand-glow: rgba(131, 113, 255, 0.5);
  --side-bg: #04050b;
  --side-bg-2: #080a18;
}

/* Aurora: slow-moving coloured light behind the whole workspace */
body::before {
  content: ''; position: fixed; inset: -20vh -10vw; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vw 40vw at 18% 12%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(35vw 35vw at 85% 8%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(45vw 45vw at 70% 95%, rgba(192, 132, 252, 0.12), transparent 60%);
  animation: aurora 60s ease-in-out infinite alternate;
}
:root[data-theme="dark"] body::before {
  background:
    radial-gradient(40vw 40vw at 18% 12%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(35vw 35vw at 85% 8%, rgba(56, 189, 248, 0.08), transparent 60%),
    radial-gradient(45vw 45vw at 70% 95%, rgba(192, 132, 252, 0.1), transparent 60%);
}
@keyframes aurora { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(3vw, 2vh, 0) scale(1.06); } 100% { transform: translate3d(-2vw, 4vh, 0) scale(1); } }
body { background: var(--bg); }
.main-col { position: relative; }

/* Glass surfaces with a light-catching top edge */
.ui-card, .ds-kpi, .dt-wrap, .cmdk, .ds-dialog, .ds-pop {
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
:root[data-theme="dark"] .ui-card, :root[data-theme="dark"] .ds-kpi, :root[data-theme="dark"] .dt-wrap {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 40px -24px rgba(0, 0, 0, 0.8);
}
:root[data-theme="dark"] .cmdk, :root[data-theme="dark"] .ds-dialog, :root[data-theme="dark"] .ds-pop { background: rgba(14, 16, 34, 0.92); }
.ui-card, .ds-kpi { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.ds-kpi:hover { border-color: var(--line-strong); }

/* Page titles: larger, with a gradient sheen */
.pg-title, .ui-title { font-size: 1.75rem; letter-spacing: -0.035em; }
:root[data-theme="dark"] .pg-title, :root[data-theme="dark"] .ui-title, :root[data-theme="dark"] .hero h1 {
  background: linear-gradient(180deg, #ffffff 30%, #b9b2ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ui-title .pill { -webkit-text-fill-color: initial; }
.pg-ico { box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent), 0 10px 30px -10px var(--brand-glow); }

/* KPI tiles: big glowing numbers and a coloured light in the corner */
.ds-kpi::after { content: ''; position: absolute; width: 140px; height: 140px; right: -50px; top: -60px; border-radius: 50%; background: radial-gradient(circle, var(--brand-glow), transparent 70%); opacity: 0.3; pointer-events: none; }
.ds-kpi:nth-child(2)::after { background: radial-gradient(circle, rgba(251, 113, 133, 0.45), transparent 70%); }
.ds-kpi:nth-child(3)::after { background: radial-gradient(circle, rgba(52, 211, 153, 0.4), transparent 70%); }
.ds-kpi:nth-child(4)::after { background: radial-gradient(circle, rgba(56, 189, 248, 0.4), transparent 70%); }
.ds-kpi .v { font-size: 2.1rem; font-weight: 700; }
:root[data-theme="dark"] .ds-kpi .v { text-shadow: 0 0 22px rgba(160, 150, 255, 0.18); }

/* Hero: living gradient mesh, glowing journey */
.hero { padding: 2rem 2rem 1.8rem; border-radius: 22px; isolation: isolate; border: 1px solid rgba(160, 150, 255, 0.25);
  background: linear-gradient(120deg, #120f33, #24135f 45%, #0f1a4a); box-shadow: 0 30px 60px -40px rgba(91, 75, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.1); }
.hero::before { content: ''; position: absolute; inset: -40%; z-index: -1;
  background: conic-gradient(from 0deg at 50% 50%, rgba(124, 92, 255, 0.0), rgba(124, 92, 255, 0.45), rgba(56, 189, 248, 0.25), rgba(192, 132, 252, 0.45), rgba(124, 92, 255, 0.0));
  filter: blur(70px); opacity: 0.6; animation: spin 90s linear infinite; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, #000, transparent 75%); }
@keyframes spin { to { transform: rotate(360deg); } }
.hero h1 { font-size: 2.1rem; letter-spacing: -0.04em; }
.hero p { font-size: 0.98rem; }
.hero-progress .bar { height: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.hero-progress .bar i { box-shadow: 0 0 10px rgba(52, 211, 153, 0.5); }
.jstep { backdrop-filter: blur(10px); transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease; }
.jstep:hover { transform: translateY(-1px); }
.jstep.done { border-color: rgba(52, 211, 153, 0.35); }
.jstep.done .ji { box-shadow: 0 0 10px rgba(52, 211, 153, 0.35); }
.jstep.next { box-shadow: 0 18px 40px -16px rgba(124, 92, 255, 0.8); }

/* Buttons: richer gradient */
.btn:not(.secondary):not(.ghost) { background: linear-gradient(135deg, #7c6dff, #5b4bff 55%, #8b5cf6); }
.hero .btn { background: #fff !important; color: #24135f; }

/* Sidebar: glowing edge on the active item */
.sidebar nav a.active::before { content: ''; position: absolute; left: -0.8rem; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, #a78bfa, #5b4bff); box-shadow: 0 0 6px rgba(139, 92, 246, 0.6); }

/* "How it works": data visibly travelling along the path */
.flow-node:not(:last-child)::after { border-top: none; height: 2px; top: 22px; background: linear-gradient(90deg, var(--brand) 0 40%, transparent 40%) 0 0 / 14px 2px repeat-x; animation: march 0.9s linear infinite; opacity: 0.7; }
@keyframes march { to { background-position: 14px 0; } }
.flow-node .fi { transition: transform 0.25s; }
.flow-node:hover .fi { transform: translateY(-3px) scale(1.05); }

/* Entrance: content rises in, staggered */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main > * { animation: rise 0.5s cubic-bezier(.2, .8, .2, 1) both; }
.main > *:nth-child(2) { animation-delay: 0.06s; }
.main > *:nth-child(3) { animation-delay: 0.12s; }
.main > *:nth-child(4) { animation-delay: 0.18s; }
.ds-kpis > .ds-kpi { animation: rise 0.5s cubic-bezier(.2, .8, .2, 1) both; }
.ds-kpis > .ds-kpi:nth-child(2) { animation-delay: 0.08s; }
.ds-kpis > .ds-kpi:nth-child(3) { animation-delay: 0.14s; }
.ds-kpis > .ds-kpi:nth-child(4) { animation-delay: 0.2s; }

/* Login: cinematic panel */
.auth-art { background: #05050f; isolation: isolate; }
.auth-art::before { content: ''; position: absolute; inset: -30%; z-index: -1; filter: blur(70px);
  background: radial-gradient(30% 30% at 25% 25%, rgba(139, 92, 246, 0.85), transparent 70%), radial-gradient(30% 30% at 75% 70%, rgba(91, 75, 255, 0.85), transparent 70%), radial-gradient(25% 25% at 60% 20%, rgba(56, 189, 248, 0.5), transparent 70%);
  animation: aurora 18s ease-in-out infinite alternate; }
.auth-art::after { content: ''; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 75%); }
.auth-art h2 { font-size: 2.8rem; max-width: 14ch; background: linear-gradient(180deg, #fff 40%, #c9c1ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-flow div { backdrop-filter: blur(10px); animation: rise 0.6s cubic-bezier(.2, .8, .2, 1) both; }
.auth-flow div:nth-child(2) { animation-delay: 0.1s; } .auth-flow div:nth-child(3) { animation-delay: 0.2s; } .auth-flow div:nth-child(4) { animation-delay: 0.3s; }
.auth-flow i { background: linear-gradient(140deg, #7c6dff, #c084fc); }
.auth-main { background: transparent; }
:root[data-theme="dark"] .login-card h1 { background: linear-gradient(180deg, #fff 30%, #b9b2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .auth { background: var(--bg); }

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

/* ============================================ Templates ========================================= */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.tpl-card { display: flex; flex-direction: column; gap: 0.8rem; padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-sm); backdrop-filter: blur(14px); transition: border-color 0.2s, transform 0.2s; min-width: 0; }
.tpl-card:hover { text-decoration: none; border-color: var(--line-strong); transform: translateY(-2px); }
.tpl-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.tpl-id { min-width: 0; }
.tpl-id b { display: block; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-id small { color: var(--ink-3); font-size: 0.76rem; }
.tpl-mini { flex: 1; max-height: 260px; overflow: hidden; border-radius: 12px; mask-image: linear-gradient(180deg, #000 80%, transparent); }
.tpl-reason { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--risk); }
.tpl-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }

/* WhatsApp chat look */
.wa-chat, .wa-phone .wa-chat { padding: 0.9rem; border-radius: 12px; background: #e9e3da url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23000' stroke-opacity='.03'/%3E%3C/svg%3E"); display: grid; gap: 0.25rem; justify-items: start; }
:root[data-theme="dark"] .wa-chat { background-color: #0b141a; }
.wa-phone { max-width: 420px; margin: 0 auto; padding: 0.6rem; border-radius: 28px; background: linear-gradient(160deg, #2a2d45, #10121f); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.08); }
.wa-phone .wa-chat { min-height: 300px; align-content: start; border-radius: 22px; padding: 1.2rem 1rem; }
.wa-msg { position: relative; max-width: 100%; background: #fff; color: #111b21; border-radius: 0 10px 10px 10px; padding: 0.4rem 0.55rem 1.1rem; font-size: 0.86rem; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,0.12); overflow-wrap: anywhere; }
:root[data-theme="dark"] .wa-msg { background: #202c33; color: #e9edef; }
.wa-head { font-weight: 700; margin: 0.15rem 0.1rem 0.3rem; }
.wa-media { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; height: 120px; margin: 0 0 0.45rem; border-radius: 7px; background: rgba(0,0,0,0.07); color: rgba(0,0,0,0.45); font-size: 0.76rem; }
:root[data-theme="dark"] .wa-media { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.45); }
.wa-body { padding: 0 0.1rem; }
.wa-body code { font-family: var(--mono); font-size: 0.8rem; }
.wa-foot { margin-top: 0.35rem; font-size: 0.76rem; color: #667781; padding: 0 0.1rem; }
:root[data-theme="dark"] .wa-foot { color: #8696a0; }
.wa-time { position: absolute; right: 0.5rem; bottom: 0.2rem; font-size: 0.66rem; color: #667781; }
.wa-buttons { display: grid; gap: 0.25rem; width: 100%; }
.wa-btn { display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.5rem; border-radius: 8px; background: #fff; color: #00a5f4; font-size: 0.84rem; font-weight: 500; box-shadow: 0 1px 1px rgba(0,0,0,0.12); }
:root[data-theme="dark"] .wa-btn { background: #202c33; color: #53bdeb; }
mark.var { background: rgba(124, 109, 255, 0.16); color: #5b4bff; border-radius: 5px; padding: 0 0.25rem; font-weight: 600; font-size: 0.82em; }
mark.var.filled { background: rgba(52, 211, 153, 0.18); color: inherit; font-size: inherit; font-weight: 500; }
:root[data-theme="dark"] mark.var { color: #b3a8ff; }
details.raw > summary { list-style: none; cursor: pointer; border-bottom: none; }
details.raw > summary::-webkit-details-marker { display: none; }
details.raw[open] > summary { border-bottom: 1px solid var(--line); }
details.raw[open] > summary .ico { transform: rotate(90deg); }
details.raw pre { margin: 0; padding: 1rem 1.15rem; background: #0d0f20; color: #d9dcf2; font-size: 0.75rem; line-height: 1.55; overflow-x: auto; max-height: 420px; border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 1100px) { .tpl-detail { grid-template-columns: minmax(0, 1fr); } }

/* ===================================== Organisations, members, teams =========================== */
.org-switch { position: relative; }
.org-switch > summary { list-style: none; cursor: pointer; border-radius: 11px; padding: 0.35rem 0.45rem; }
.org-switch > summary::-webkit-details-marker { display: none; }
.org-switch > summary:hover, .org-switch[open] > summary { background: var(--side-hover); }
.org-caret { margin-left: auto; transform: rotate(90deg); color: var(--side-ink); }
.org-switch[open] .org-caret { transform: rotate(-90deg); }
.org-pop { left: 0; right: auto; top: calc(100% + 6px); width: 270px; }
.org-pop-label { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 0.45rem 0.6rem 0.25rem; }
.org-pop button.on { background: var(--brand-soft); }
.org-pop-name { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.org-pop-name b { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-pop-name small { color: var(--ink-3); font-size: 0.72rem; }
.org-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 0.82rem; color: #fff; background: linear-gradient(140deg, #6d5dff, #c084fc); }
.org-mark.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 0.66rem; }
.nav-collapsed .org-caret { display: none; }
.cmdk-form { margin: 0; }

.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.org-card { display: flex; flex-direction: column; }
.org-card.current { border-color: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent), var(--shadow); }
.org-top { display: flex; gap: 0.8rem; align-items: center; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.org-id b { display: block; font-size: 1rem; }
.org-id small { color: var(--ink-3); font-size: 0.78rem; }
.org-id .here { color: var(--brand-ink); font-weight: 600; }
.org-card .health { flex: 1; }

.role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
.role-grid legend { grid-column: 1 / -1; }
.ds-dialog.wide { width: min(640px, calc(100vw - 2rem)); }
.ds-dialog-actions.spread { justify-content: space-between; }
.ds-dialog-actions.spread > span { display: flex; gap: 0.6rem; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.team-lead { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: 0.82rem; margin-bottom: 0.8rem; }
.team-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; font-size: 0.86rem; }
.team-people li { display: flex; align-items: center; gap: 0.55rem; }
.team-people small { color: var(--ink-3); font-size: 0.74rem; margin-left: auto; }
.team-people.inline { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.team-people.inline small { margin-left: 0.3rem; }
.pick-people { border: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; max-height: 320px; overflow-y: auto; }
.pick-people legend { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; padding: 0; }
form.stacked .person-opt, .person-opt { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 10px; margin: 0; font-weight: 400; cursor: pointer; }
.person-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.person-opt input { accent-color: var(--brand); margin: 0; }
.person-opt b { display: block; font-size: 0.84rem; }
.person-opt small { display: block; color: var(--ink-3); font-size: 0.72rem; line-height: 1.3; }
.role-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .role-grid, .pick-people, .role-cols { grid-template-columns: minmax(0, 1fr); } }

/* Organisations grouped by main account */
.main-account { margin-bottom: 1.6rem; }
.ma-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.ma-title { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.ma-title .muted { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.ma-title b { font-size: 1.05rem; }
.ma-rename { position: relative; }
.ma-rename > summary { list-style: none; }
.ma-rename > summary::-webkit-details-marker { display: none; }
.ma-rename-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; gap: 0.5rem; padding: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); backdrop-filter: blur(14px); }
.ma-rename-form input { width: 240px; height: 32px; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 0.85rem; }
.placement:has(input[value="existing"]:checked) .when-standalone { display: none; }
.placement:has(input[value="standalone"]:checked) .when-existing { display: none; }

/* ============================================== Contacts ========================================= */
a.kpi-link { color: inherit; display: block; }
a.kpi-link:hover { text-decoration: none; border-color: var(--line-strong); }
table.rows-link td:first-child { padding: 0; }
.row-link { display: block; color: var(--ink); padding: 0.8rem 1.1rem; }
.row-link:hover { text-decoration: none; }
table.rows-link tbody tr:hover .row-link b { color: var(--brand-ink); }
.owner-chip { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; white-space: nowrap; }
.empty-hero .ds-empty { padding: 3.5rem 1rem; }

.dropzone { display: flex !important; flex-direction: column; align-items: center; gap: 0.35rem; padding: 1.6rem 1rem !important; margin: 0 !important; border: 1.5px dashed var(--line-strong); border-radius: 14px; text-align: center; cursor: pointer; background: var(--surface-2); color: var(--ink-2); font-weight: 400 !important; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.dropzone b { color: var(--ink); font-size: 0.95rem; }
.dropzone small { color: var(--ink-3); font-size: 0.78rem; }
.dropzone input[type=file] { margin-top: 0.6rem; height: auto !important; border: none !important; background: transparent !important; padding: 0 !important; width: auto !important; color: var(--ink-2); font-size: 0.82rem; }
details.guide { margin-top: 1rem; border: 1px solid var(--line); border-radius: 12px; }
details.guide > summary { cursor: pointer; padding: 0.7rem 0.9rem; font-size: 0.84rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; list-style: none; }
details.guide > summary::-webkit-details-marker { display: none; }
details.guide .guide-steps { padding-top: 0; }

.stepper { list-style: none; display: flex; gap: 0.5rem; margin: 0 0 1.2rem; padding: 0; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.85rem 0.35rem 0.4rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }
.stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 0.7rem; }
.stepper li.done { color: var(--go); }
.stepper li.done span { background: var(--go); color: #fff; }
.stepper li.here { color: var(--ink); border-color: var(--brand); }
.stepper li.here span { background: var(--brand); color: #fff; }

.import-form { display: grid; gap: 1rem; }
.source-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.map-table td:first-child b { display: inline; }
.map-table td:first-child small { display: block; color: var(--ink-3); font-size: 0.76rem; margin-top: 0.15rem; max-width: 46ch; }
.map-table select, .owner-select { width: 100%; min-width: 220px; height: 36px; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.84rem; }
.map-table td.sample { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-select.ok { border-color: color-mix(in srgb, var(--go) 50%, transparent); }
.owner-select.missing { border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.ui-card-foot.left { justify-content: space-between; flex-wrap: wrap; }
.extra-cols { font-size: 0.78rem; }
.preview-table td, .preview-table th { white-space: nowrap; font-size: 0.78rem; }
.sticky-actions { position: sticky; bottom: 1rem; z-index: 10; display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.8rem; border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: var(--shadow-lg); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }

.contact-head { display: grid; gap: 0.8rem; margin-bottom: 1.3rem; }
.contact-head .btn { justify-self: start; }
.contact-id { display: flex; gap: 1rem; align-items: center; }
.avatar.xl { width: 58px; height: 58px; font-size: 1.15rem; border-radius: 18px; background: linear-gradient(140deg, #6d5dff, #c084fc); }
.contact-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.4rem; font-size: 0.84rem; }
.contact-meta .muted { display: inline-flex; align-items: center; gap: 0.3rem; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.owner-box { display: flex; gap: 0.8rem; align-items: center; }
.owner-box b { display: block; }
.owner-box small { color: var(--ink-3); font-size: 0.8rem; }
.crm-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.75rem 1.15rem; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.crm-row:last-child { border-bottom: none; }
.crm-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-main small { color: var(--ink-3); font-size: 0.76rem; }
@media (max-width: 1100px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } .source-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .source-pick { grid-template-columns: minmax(0, 1fr); } }
.sample-link { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.9rem; font-size: 0.84rem; font-weight: 600; }
.sample-link .muted { font-weight: 400; }

/* Number activation */
.activate { padding: 1.35rem 1.4rem 1.25rem; }
.act-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0.8rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.act-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700; }
.act-step.done .act-n { background: var(--go); }
.act-body b { display: block; }
.act-body small { display: block; color: var(--ink-3); font-size: 0.8rem; margin-top: 0.15rem; }
.act-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; align-items: center; }
.act-row form { margin: 0; }
.code-input { width: 150px; height: 36px; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-family: var(--mono); letter-spacing: 0.25em; }
.code-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Connect WhatsApp (Embedded Signup) */
.connect-card { overflow: hidden; background: radial-gradient(90% 140% at 100% 0%, rgba(52, 211, 153, 0.14), transparent 60%), var(--surface); }
.connect-body { display: flex; gap: 1.2rem; padding: 1.5rem 1.6rem; align-items: flex-start; }
.connect-mark { width: 56px; height: 56px; border-radius: 16px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #25d366, #128c7e); box-shadow: 0 10px 26px -10px rgba(37, 211, 102, 0.6); }
.connect-text h2 { margin: 0 0 0.3rem; font-size: 1.2rem; letter-spacing: -0.02em; }
.connect-text p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.connect-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; align-items: center; }
.btn.connect-btn { background: linear-gradient(135deg, #25d366, #128c7e) !important; height: 42px; padding: 0 1.2rem; }
.connect-status { flex-basis: 100%; margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--ink-2); }
.connect-status.error { color: var(--risk); }
details.advanced > summary { list-style: none; cursor: pointer; border-bottom: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced[open] > summary { border-bottom: 1px solid var(--line); }
details.advanced[open] > summary .ico { transform: rotate(90deg); }
.advanced-form .ui-card-head { display: none; }
@media (max-width: 700px) { .connect-body { flex-direction: column; } }
