  :root {
    --bg:#0B0D12; --sidebar:#0E1016; --card:#12151C; --card2:#161A22; --border:#1F2430;
    --text:#F3F5F9; --dim:#8A93A6; --faint:#5C6477;
    --accent:#5B8CFF; --green:#22C55E; --red:#EF4444; --amber:#F5A524;
    --green-bg:rgba(34,197,94,.12); --red-bg:rgba(239,68,68,.12); --blue-bg:rgba(91,140,255,.12); --amber-bg:rgba(245,165,36,.12);
  }
  [data-theme="light"] {
    --bg:#F6F7F9; --sidebar:#FFFFFF; --card:#FFFFFF; --card2:#F1F3F6; --border:#E3E6EC;
    --text:#10131A; --dim:#5F6878; --faint:#98A0AE;
  }
  * { box-sizing:border-box; }
  html, body { margin:0; background:var(--bg); color:var(--text); font-family:Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size:14px; }
  a { color:var(--accent); }
  .num { font-variant-numeric:tabular-nums; }
  svg.i { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }

  .app { display:flex; min-height:100vh; }

  /* Sidebar */
  .sidebar { width:224px; flex-shrink:0; background:var(--sidebar); border-right:1px solid var(--border); padding:20px 12px 16px; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
  .brand { display:flex; align-items:center; gap:10px; padding:0 8px 22px; font-size:15px; font-weight:700; }
  .brand .wordmark { height:17px; width:auto; display:block; }
  [data-theme="light"] .brand .wordmark { filter:invert(1); }
  .brand .t { font-weight:500; color:var(--dim); font-size:14.5px; letter-spacing:.01em; }
  .brand .mark { display:none; width:34px; height:34px; border-radius:8px; }
  .nav-item { display:flex; align-items:center; gap:12px; padding:10px 10px; border-radius:8px; font-size:14px; color:var(--dim); cursor:pointer; margin-bottom:2px; text-decoration:none; border:0; background:none; width:100%; text-align:left; font-family:inherit; }
  .nav-item:hover { background:var(--card2); color:var(--text); }
  .nav-item.active { background:var(--card2); color:var(--text); }
  .nav-item:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, tr:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
  .sidebar-footer { margin-top:auto; display:flex; align-items:center; justify-content:space-between; padding:12px 8px 0; color:var(--dim); font-size:13px; }
  .theme-toggle { display:flex; gap:2px; background:var(--card2); border:1px solid var(--border); border-radius:999px; padding:3px; }
  .theme-toggle button { border:0; background:none; color:var(--dim); width:28px; height:26px; border-radius:999px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
  .theme-toggle button svg { width:15px; height:15px; }
  .theme-toggle button.on { background:var(--card); color:var(--text); box-shadow:0 0 0 1px var(--border); }

  main { flex:1; min-width:0; }
  .page { max-width:1320px; margin:0 auto; padding:28px 28px 80px; }
  h1 { font-size:24px; font-weight:700; margin:0; letter-spacing:-.01em; }
  .page-head { display:flex; align-items:center; gap:14px; margin-bottom:22px; flex-wrap:wrap; }
  .page-head .spacer { flex:1; }

  /* Cards, KPIs */
  .card { background:var(--card); border:1px solid var(--border); border-radius:12px; }
  .kpi-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:12px; margin-bottom:18px; }
  .kpi { padding:16px 18px; }
  .kpi .lbl { color:var(--dim); font-size:13px; }
  .kpi .val { font-size:30px; font-weight:700; margin-top:6px; letter-spacing:-.02em; }
  .kpi .sub { color:var(--faint); font-size:12px; margin-top:4px; }
  .delta { display:inline-block; font-size:12px; font-weight:600; padding:2px 7px; border-radius:6px; }
  .delta.up { color:var(--green); background:var(--green-bg); }
  .delta.down { color:var(--red); background:var(--red-bg); }
  .delta.flat { color:var(--dim); background:var(--card2); }

  /* Filters */
  .filters { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:16px; }
  .filters label { display:flex; align-items:center; gap:8px; color:var(--dim); font-size:13px; }
  select, input.search { background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:7px 10px; font-size:13px; font-family:inherit; }
  input.search { min-width:220px; margin-left:auto; }

  /* Table */
  .table-wrap { overflow-x:auto; }
  table { width:100%; border-collapse:collapse; }
  th { text-align:left; font-size:12.5px; font-weight:500; color:var(--dim); padding:11px 14px; border-bottom:1px solid var(--border); white-space:nowrap; user-select:none; }
  th.sortable { cursor:pointer; }
  th.sortable:hover { color:var(--text); }
  th.r, td.r { text-align:right; }
  td { padding:11px 14px; border-bottom:1px solid var(--border); white-space:nowrap; font-size:13.5px; }
  tbody tr:last-child td { border-bottom:0; }
  tr.row { cursor:pointer; }
  tr.row:hover td { background:var(--card2); }
  tr.dead { opacity:.5; }
  .acct { display:flex; align-items:center; gap:11px; }
  .avatar { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; color:#fff; flex-shrink:0; }
  .acct .u { font-weight:600; }
  .acct .s { color:var(--dim); font-size:12px; margin-top:2px; }
  .open-hint { color:var(--faint); margin-left:6px; vertical-align:-3px; }
  .open-hint svg { width:13px; height:13px; }
  .pill { display:inline-block; font-size:12px; font-weight:600; padding:3px 9px; border-radius:999px; }
  .pill.active { color:var(--green); background:var(--green-bg); }
  .pill.warming { color:var(--amber); background:var(--amber-bg); }
  .pill.banned { color:var(--red); background:var(--red-bg); }
  .pill.inaccessible { color:var(--dim); background:var(--card2); }
  .pos { color:var(--green); } .neg { color:var(--red); } .muted { color:var(--faint); }
  .pager { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; color:var(--dim); font-size:13px; border-top:1px solid var(--border); }
  .btn { background:var(--card2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:7px 12px; font-size:13px; cursor:pointer; font-family:inherit; display:inline-flex; align-items:center; gap:7px; }
  .btn:disabled { opacity:.4; cursor:default; }
  .icon-btn { padding:8px; }

  /* Empty */
  .empty { padding:70px 20px; text-align:center; color:var(--dim); }
  .empty h2 { color:var(--text); font-size:17px; margin:0 0 6px; }

  /* Detail */
  .back { color:var(--dim); display:flex; align-items:center; text-decoration:none; padding:4px; border-radius:6px; }
  .back:hover { color:var(--text); }
  .back svg { width:20px; height:20px; }
  .overview { padding:22px 24px; margin-bottom:22px; }
  .ov-title { font-size:17px; font-weight:600; }
  .ov-cap { color:var(--dim); font-size:13px; margin:3px 0 20px; }
  .ov-top { display:flex; gap:28px; flex-wrap:wrap; }
  .ov-left { flex:1; min-width:280px; }
  .ov-id { display:flex; align-items:center; gap:16px; }
  .ov-id .avatar { width:72px; height:72px; font-size:26px; }
  .ov-id .u { font-size:20px; font-weight:700; }
  .ov-id .n { color:var(--dim); margin-top:3px; }
  .bio { margin:16px 0 10px; line-height:1.55; white-space:pre-line; max-width:60ch; }
  .ov-link { display:inline-flex; align-items:center; gap:6px; font-size:13.5px; text-decoration:none; }
  .ov-link svg { width:15px; height:15px; }
  .ov-right { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; min-width:340px; }
  .counts { display:flex; gap:36px; }
  .count { text-align:center; }
  .count .lbl { color:var(--dim); font-size:13px; }
  .count .val { font-size:26px; font-weight:700; margin:6px 0; letter-spacing:-.01em; }
  .count .deltas { display:flex; gap:5px; justify-content:center; }
  .tracked { color:var(--dim); font-size:13px; }
  .meta { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:14px; margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
  .meta .lbl { color:var(--dim); font-size:12px; }
  .meta .val { margin-top:4px; font-weight:500; }

  .tabs { display:flex; border-bottom:1px solid var(--border); margin-bottom:18px; }
  .tab { flex:1; padding:12px; text-align:center; background:none; border:0; border-bottom:2px solid transparent; color:var(--dim); font-size:14px; font-weight:500; cursor:pointer; font-family:inherit; margin-bottom:-1px; }
  .tab.on { color:var(--text); border-bottom-color:var(--text); }
  .grid2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
  .chart-card { padding:18px 20px 14px; margin-bottom:16px; }
  .grid2 .chart-card { margin-bottom:0; }
  .chart-card h3 { font-size:15px; font-weight:600; margin:0; }
  .chart-card .cap { color:var(--dim); font-size:12.5px; margin-top:3px; }
  .chart-head { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:12px; }
  .legend { display:flex; gap:14px; color:var(--dim); font-size:12.5px; }
  .legend span::before { content:""; display:inline-block; width:9px; height:9px; border-radius:3px; margin-right:6px; background:var(--c); }
  .chart-box { position:relative; height:240px; }
  .chart-box.tall { height:280px; }
  .linkish { background:none; border:0; padding:0 2px; color:var(--faint); font:inherit; font-size:12px; text-decoration:underline; cursor:pointer; }
  .match-sel { max-width:220px; }
  .modal.replace { display:block; width:min(540px, 100%); }
  .modal.replace h2 { margin:0 0 6px; font-size:18px; }
  .modal.replace .fields { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:14px 0 8px; }
  .modal.replace label { display:flex; flex-direction:column; gap:5px; font-size:12.5px; color:var(--dim); }
  .modal.replace input, .modal.replace select { width:100%; background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-size:13px; font-family:inherit; }
  .modal.replace .addr { font-family:ui-monospace, Menlo, monospace; font-size:13px; background:var(--card2); border:1px solid var(--border); border-radius:8px; padding:9px 11px; margin:6px 0; word-break:break-all; }
  .modal.replace .actions { display:flex; gap:8px; justify-content:flex-end; margin-top:16px; flex-wrap:wrap; }
  .modal.replace .step { color:var(--dim); font-size:13px; margin-top:8px; }
  @media (max-width: 520px) { .modal.replace .fields { grid-template-columns:1fr; } }
  .chart-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; padding:0 40px; font-size:13.5px; }
  .chart-ctrls { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
  .chart-ctrls .seg button { padding:5px 10px; font-size:12.5px; }
  .sdot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:7px; vertical-align:0; }
  .conv-bar { display:inline-block; height:6px; border-radius:3px; background:var(--accent); vertical-align:middle; margin-right:8px; opacity:.8; }
  .reel-play { width:28px; height:28px; border:1px solid var(--border); border-radius:6px; display:flex; align-items:center; justify-content:center; color:var(--dim); }
  .reel-play svg { width:13px; height:13px; }
  .yes { color:var(--green); font-weight:700; } .no { color:var(--red); font-weight:700; }
  .cap-cell { max-width:280px; overflow:hidden; text-overflow:ellipsis; color:var(--dim); }

  /* Phones */
  .check { display:flex; align-items:center; gap:7px; color:var(--dim); font-size:13px; cursor:pointer; }
  .group { margin-bottom:14px; }
  .group > summary { list-style:none; display:flex; align-items:center; gap:12px; padding:12px 16px; cursor:pointer; border-radius:12px; }
  .group > summary::-webkit-details-marker { display:none; }
  .group > summary:hover { background:var(--card2); }
  .group .avatar { width:30px; height:30px; font-size:12px; }
  .g-name { font-weight:600; font-size:15px; }
  .g-sub { color:var(--dim); font-size:13px; }
  .g-issues { margin-left:auto; }
  .chev { color:var(--dim); transition:transform .15s; }
  .group[open] .chev { transform:rotate(90deg); }
  .phone-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:10px; padding:4px 0 8px; }
  .phone { padding:14px; }
  .phone.problem { border-color:rgba(239,68,68,.35); }
  .ph-head { display:flex; align-items:center; gap:8px; font-weight:600; }
  .ph-head svg { width:16px; height:16px; color:var(--dim); }
  .ph-count { margin-left:auto; color:var(--dim); font-weight:400; font-size:12.5px; }
  .stackbar { display:flex; height:5px; border-radius:3px; overflow:hidden; background:var(--card2); margin:11px 0 12px; }
  .stackbar i { display:block; height:100%; }
  .chips { display:flex; flex-direction:column; gap:2px; }
  .chip { display:flex; align-items:center; gap:8px; padding:5px 6px; margin:0 -6px; border-radius:6px; color:var(--text); text-decoration:none; font-size:13px; }
  .chip:hover { background:var(--card2); }
  .chip .dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
  .chip .f { margin-left:auto; color:var(--faint); font-size:12px; }
  .chip.dead { color:var(--faint); text-decoration:line-through; }
  .phone-empty { color:var(--faint); font-size:13px; }

  /* Viral reels */
  .seg { display:flex; gap:4px; flex-wrap:wrap; background:var(--card); border:1px solid var(--border); border-radius:10px; padding:3px; }
  .seg button { border:0; background:none; color:var(--dim); font-family:inherit; font-size:13px; padding:6px 11px; border-radius:7px; cursor:pointer; }
  .seg button:hover { color:var(--text); }
  .seg button.on { background:var(--card2); color:var(--text); box-shadow:0 0 0 1px var(--border); }
  .seg .c { color:var(--faint); margin-left:5px; font-variant-numeric:tabular-nums; }
  .filter-rows { display:flex; flex-direction:column; gap:10px; margin-bottom:18px; }
  .filter-rows .filters { margin-bottom:0; }
  .reel-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:16px; }
  .reel { cursor:pointer; background:none; border:0; padding:0; text-align:left; color:inherit; font-family:inherit; }
  .thumb { position:relative; aspect-ratio:9/16; border-radius:12px; overflow:hidden; border:1px solid var(--border); }
  .thumb .play { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:rgba(255,255,255,.85); }
  .thumb .play svg { width:34px; height:34px; fill:rgba(255,255,255,.18); }
  .mult { position:absolute; top:9px; left:9px; background:rgba(0,0,0,.6); backdrop-filter:blur(6px); color:#fff; font-size:12px; font-weight:700; padding:4px 8px; border-radius:7px; }
  .mult.hot { background:var(--red); }
  .rank { position:absolute; top:9px; right:9px; color:rgba(255,255,255,.75); font-size:12px; font-weight:600; }
  .overlay { position:absolute; left:0; right:0; bottom:0; padding:34px 11px 10px; background:linear-gradient(transparent, rgba(0,0,0,.8)); color:#fff; }
  .overlay .v { font-size:22px; font-weight:700; letter-spacing:-.01em; }
  .overlay .ss { display:flex; gap:12px; font-size:12px; opacity:.85; margin-top:3px; }
  .overlay .ss span { display:flex; align-items:center; gap:4px; }
  .overlay svg { width:13px; height:13px; }
  .reel:hover .thumb, .reel:focus-visible .thumb { border-color:var(--accent); }
  .reel-meta { padding:9px 2px 0; }
  .reel-meta .u { font-weight:600; font-size:13.5px; }
  .reel-meta .d { color:var(--dim); font-size:12.5px; margin-top:2px; }
  .reel-meta .cp { color:var(--faint); font-size:12.5px; margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .more { display:flex; justify-content:center; margin-top:22px; }
  .modal-bg { position:fixed; inset:0; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; z-index:50; padding:20px; }
  .modal { width:min(720px, 100%); max-height:calc(100vh - 40px); overflow:auto; display:grid; grid-template-columns:240px 1fr; gap:22px; padding:20px; position:relative; }
  .modal .thumb { border-radius:10px; }
  .modal h2 { font-size:18px; margin:0; }
  .modal .sub { color:var(--dim); font-size:13px; margin-top:3px; }
  .modal .stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:18px 0; }
  .modal .stat { background:var(--card2); border-radius:10px; padding:11px 12px; }
  .modal .stat .lbl { color:var(--dim); font-size:12px; }
  .modal .stat .val { font-size:19px; font-weight:700; margin-top:3px; }
  .modal .cpt { color:var(--dim); margin-bottom:18px; line-height:1.5; }
  .modal .actions { display:flex; gap:8px; flex-wrap:wrap; }
  .btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; text-decoration:none; }
  a.btn { text-decoration:none; }
  .close { position:absolute; top:12px; right:12px; }
  @media (max-width: 640px) { .modal { grid-template-columns:1fr; } .modal .thumb { max-width:200px; } }

  /* Team */
  .strip { display:block; }
  .strip rect.z { fill:var(--red); opacity:.55; }
  .strip rect.p { fill:var(--accent); }
  .ratio { display:inline-flex; align-items:center; gap:8px; }
  .ratio .bar { width:54px; height:5px; border-radius:3px; background:var(--card2); overflow:hidden; }
  .ratio .bar i { display:block; height:100%; }
  .emp-head { display:flex; align-items:center; gap:14px; }
  .emp-head .avatar { width:44px; height:44px; font-size:17px; }
  .emp-head .sub { color:var(--dim); font-size:13px; margin-top:2px; }
  .heat-wrap { overflow-x:auto; padding-bottom:4px; }
  .heat { display:grid; grid-auto-flow:column; grid-template-rows:repeat(7, 14px); gap:3px; }
  .heat i { width:14px; height:14px; border-radius:3px; background:var(--card2); }
  .heat i.l0 { background:transparent; box-shadow:inset 0 0 0 1px rgba(239,68,68,.55); }
  .heat i.l1 { background:rgba(91,140,255,.28); } .heat i.l2 { background:rgba(91,140,255,.5); }
  .heat i.l3 { background:rgba(91,140,255,.75); } .heat i.l4 { background:var(--accent); }
  .heat i.fut { background:transparent; }
  .heat-row { display:flex; gap:8px; }
  .heat-days { display:grid; grid-template-rows:repeat(7, 14px); gap:3px; color:var(--faint); font-size:10.5px; line-height:14px; }
  .heat-legend { display:flex; align-items:center; gap:5px; color:var(--dim); font-size:12px; margin-top:12px; flex-wrap:wrap; }
  .heat-legend i { width:12px; height:12px; border-radius:3px; display:inline-block; }
  .insights { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:10px; margin-top:16px; }
  .insight { background:var(--card2); border-radius:10px; padding:11px 13px; }
  .insight .lbl { color:var(--dim); font-size:12px; }
  .insight .val { font-weight:600; margin-top:3px; }
  .section-title { font-size:16px; font-weight:600; margin:26px 0 12px; }

  /* Dashboard */
  .dash-sub { color:var(--dim); font-size:13px; margin-top:3px; }
  .creator-seg .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:7px; }
  .kpi .top { display:flex; justify-content:space-between; align-items:center; gap:8px; }
  .share { display:flex; align-items:center; gap:8px; justify-content:flex-end; }
  .share .bar { width:80px; height:6px; border-radius:3px; background:var(--card2); overflow:hidden; }
  .share .bar i { display:block; height:100%; }
  .list-card { padding:6px 0 0; }
  .list-card h3 { font-size:15px; font-weight:600; margin:12px 18px 2px; }
  .list-card .cap { color:var(--dim); font-size:12.5px; margin:0 18px 8px; }
  .list-card td:first-child, .list-card th:first-child { padding-left:18px; }
  .list-card td:last-child, .list-card th:last-child { padding-right:18px; }
  .mini-mult { font-size:12px; font-weight:700; padding:2px 7px; border-radius:6px; background:var(--blue-bg); color:var(--accent); }
  .mini-mult.hot { background:var(--red-bg); color:var(--red); }

  @media (max-width: 900px) {
    .sidebar { width:64px; padding:16px 8px; }
    .brand span.t, .brand .wordmark, .nav-item span, .sidebar-footer .t { display:none; }
    .brand .mark { display:block; }
    .brand { justify-content:center; padding:0 0 18px; }
    .nav-item { justify-content:center; }
    .sidebar-footer { flex-direction:column; gap:8px; padding:0; }
    .theme-toggle { flex-direction:column; }
    .grid2 { grid-template-columns:1fr; }
    .page { padding:20px 16px 60px; }
    .ov-right { min-width:0; width:100%; }
    .counts { gap:20px; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition:none !important; animation:none !important; } }

  /* ---- Additions for the live app ---- */
  .brand .wordmark { height:17px; width:auto; display:block; }
  [data-theme="light"] .brand .wordmark { filter:invert(1); }
  .brand .t { font-weight:500; color:var(--dim); font-size:14.5px; letter-spacing:.01em; }
  .brand .mark { display:none; width:34px; height:34px; border-radius:8px; }
  .nav-item[hidden] { display:none; }
  .me { border-top:1px solid var(--border); margin-top:12px; padding:12px 8px 0; font-size:13px; }
  .me .n { font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .me .r { color:var(--dim); font-size:12px; margin-top:2px; }
  .me button { margin-top:10px; width:100%; justify-content:center; }
  .sync-note { color:var(--faint); font-size:12px; padding:10px 8px 0; }
  .loading { padding:80px 20px; text-align:center; color:var(--dim); }
  .error-box { border-color:rgba(239,68,68,.4); }
  .pill.inactive, .pill.lost, .pill.unknown { color:var(--dim); background:var(--card2); }
  img.avatar { object-fit:cover; background:var(--card2); }
  .thumb img { width:100%; height:100%; object-fit:cover; display:block; }
  .reel-mini { width:34px; height:60px; border-radius:6px; object-fit:cover; background:var(--card2); display:block; }
  .note { color:var(--dim); font-size:12.5px; margin-top:6px; }
  /* Access page */
  .form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:12px; align-items:end; }
  .field label { display:block; color:var(--dim); font-size:12.5px; margin-bottom:6px; }
  .field input, .field select { width:100%; background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:9px 10px; font-size:14px; font-family:inherit; }
  .link-box { display:flex; gap:8px; margin-top:12px; }
  .link-box input { flex:1; font-family:ui-monospace, Menlo, monospace; font-size:12.5px; background:var(--card2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:9px 10px; }
  .banner { border-radius:10px; padding:12px 14px; margin-bottom:16px; font-size:13.5px; }
  .banner.ok { background:var(--green-bg); color:var(--text); border:1px solid rgba(34,197,94,.3); }
  .banner.err { background:var(--red-bg); color:var(--text); border:1px solid rgba(239,68,68,.35); }
  .actions-cell { display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }
  .btn.small { padding:5px 9px; font-size:12.5px; }
  .btn.danger { color:var(--red); }
  /* Login pages */
  .auth-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
  .auth { width:min(380px, 100%); padding:28px; }
  .auth .logo { display:flex; align-items:center; gap:10px; margin-bottom:22px; }
  .auth h1 { font-size:20px; margin:0 0 4px; }
  .auth .sub { color:var(--dim); font-size:13.5px; margin-bottom:20px; }
  .auth .field { margin-bottom:14px; }
  .auth .btn { width:100%; justify-content:center; padding:10px; }

  /* Reel playback */
  .thumb .hover-video, .thumb.player video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; background:#000; }
  .thumb.player video { object-fit:contain; }
  .thumb.player { position:relative; }
  .modal.embed { grid-template-columns:340px 1fr; }
  .modal.embed .thumb.player { aspect-ratio:auto; height:620px; border:0; background:#fff; }
  .modal.embed iframe { width:100%; height:100%; border:0; display:block; }
  @media (max-width: 640px) { .modal.embed .thumb.player { height:520px; } }

  .mult.viral { background:var(--accent); }

  /* Tools */
  .nav-section { color:var(--faint); font-size:11px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; padding:16px 10px 6px; }
  .tool-page { padding:0; max-width:none; }
  .tool-frame { display:block; width:100%; height:100vh; border:0; background:var(--bg); }
  @media (max-width: 900px) { .nav-section { display:none; } }

  /* SMS Codes */
  .sms-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:14px; }
  .sms-card { padding:16px 18px; display:flex; flex-direction:column; gap:12px; }
  .sms-card.got { border-color:color-mix(in srgb, var(--green) 45%, var(--border)); }
  .sms-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .sms-label { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--faint); margin-bottom:3px; }
  .sms-number { font-size:18px; font-weight:600; }
  .sms-code { font-size:26px; font-weight:700; letter-spacing:.1em; line-height:1.2; }
  .sms-msg { font-size:12px; color:var(--faint); margin-top:4px; line-height:1.4; }
  .sms-wait { color:var(--dim); font-size:14px; display:flex; align-items:center; gap:8px; }
  .sms-wait .dot { width:8px; height:8px; border-radius:50%; background:var(--accent); animation:smsPulse 1.2s ease-in-out infinite; }
  @keyframes smsPulse { 0%,100% { opacity:.3 } 50% { opacity:1 } }
  .sms-meta { font-size:12px; color:var(--faint); }
  .btn.small { padding:5px 10px; font-size:12px; white-space:nowrap; flex-shrink:0; }
  .sms-card.expired { opacity:.55; }
  .sms-h { font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--dim); margin:0 0 10px; }
  .sms-history { margin-top:22px; }
  .sms-history summary { cursor:pointer; font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--dim); margin-bottom:10px; }

  /* New Instagram Account */
  .na-page { max-width:980px; }
  .na-card { padding:20px 22px; }
  .na-h { font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--dim); margin:18px 0 10px; }
  .na-h:first-child { margin-top:0; }
  .na-grid3 { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; }
  .na-grid2 { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
  .na-row { display:flex; gap:6px; align-items:center; }
  .na-row input { flex:1; min-width:0; }
  .na-hint { font-size:12px; color:var(--dim); margin-top:5px; min-height:16px; display:flex; align-items:center; gap:6px; }
  .na-hint.good { color:var(--green); } .na-hint.warn { color:var(--amber); } .na-hint.bad { color:var(--red); }
  .na-hint .dot { width:7px; height:7px; border-radius:50%; background:var(--accent); animation:smsPulse 1.2s ease-in-out infinite; }
  .na-code { font-size:16px; letter-spacing:.06em; color:var(--text); }
  .na-actions { display:flex; align-items:center; margin-top:20px; gap:10px; }
  .na-msg { padding:12px 16px; margin-bottom:14px; }
  .na-msg.good { border-color:color-mix(in srgb, var(--green) 45%, var(--border)); }
  .na-msg.bad { border-color:color-mix(in srgb, var(--red) 45%, var(--border)); color:var(--red); }
  .field select:disabled { opacity:.7; }
  @media (max-width: 800px) { .na-grid3, .na-grid2 { grid-template-columns:1fr; } }
  .na-actions .spacer { flex:1; }

  /* Links */
  .tag { display:inline-block; font-size:11px; padding:1px 7px; border-radius:999px; background:var(--card2); border:1px solid var(--border); color:var(--dim); margin-left:4px; vertical-align:1px; }
  .tag.off { color:var(--red); }
  td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }

  /* Guides */
  .guides-page, .guide-page { max-width:820px; }
  .guide-search { width:100%; margin:0 0 18px; padding:11px 14px; font-size:15px; }
  .guide-sec { font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--dim); margin:22px 0 8px; }
  .guide-list { padding:0; overflow:hidden; }
  .guide-row { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:14px 18px; border-top:1px solid var(--border); color:var(--text); text-decoration:none; }
  .guide-row:first-child { border-top:0; }
  .guide-row:hover { background:var(--card2); }
  .guide-title { font-weight:600; font-size:15px; }
  .guide-sum { color:var(--dim); font-size:13px; margin-top:3px; }
  .guide-meta { color:var(--faint); font-size:12px; white-space:nowrap; }
  .back-link { display:inline-block; color:var(--dim); text-decoration:none; font-size:13px; margin-bottom:10px; }
  .guide-intro { color:var(--dim); font-size:15px; margin:-6px 0 18px; }
  .guide-steps { list-style:none; counter-reset:step; padding:0; margin:0 0 16px; display:flex; flex-direction:column; gap:12px; }
  .guide-steps > li { counter-increment:step; position:relative; padding:16px 18px 16px 58px; }
  .guide-steps > li::before { content:counter(step); position:absolute; left:18px; top:15px; width:26px; height:26px; border-radius:50%; background:var(--accent); color:#fff; font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; }
  .guide-step-text { font-size:15px; line-height:1.55; }
  .guide-step-text a { color:var(--accent); }
  .guide-img { display:block; max-width:100%; max-height:520px; border-radius:10px; border:1px solid var(--border); margin-top:12px; }
  .guide-steps .btn.small { margin-top:10px; }
  .guide-help { font-size:13px; color:var(--accent); text-decoration:none; margin-left:14px; align-self:center; white-space:nowrap; }
  .guide-bar { padding:10px 28px 0; }
  .guide-bar .guide-help { margin-left:0; }
  .ge-card { padding:18px 20px; display:flex; flex-direction:column; gap:12px; }
  .ge-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
  .ge-step { display:flex; flex-direction:column; gap:8px; }
  .ge-step textarea { width:100%; resize:vertical; font:inherit; }
  .ge-tools { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
  .ge-tools .spacer { flex:1; }
  .btn.danger { color:var(--red); }
  @media (max-width: 700px) {
    .ge-row { grid-template-columns:1fr; }
    .guide-row { flex-direction:column; align-items:flex-start; gap:4px; }
    .guide-steps > li { padding-left:52px; }
    .guide-step-text { font-size:16px; }
  }
  .ge-step textarea, .ge-step input[data-f] { background:var(--card2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:9px 11px; font:inherit; font-size:14px; outline:none; }
  .ge-step textarea:focus, .ge-step input[data-f]:focus { border-color:var(--accent); }

  /* Phone: bottom menu, "More" opens the full menu as a sheet; room for the iPhone notch and home bar */
  .bottom-nav { display:none; }
  @media (max-width: 700px) {
    .sidebar { display:none; }
    body.menu-open .sidebar {
      display:flex; position:fixed; z-index:40; left:0; right:0; top:0; bottom:calc(60px + env(safe-area-inset-bottom));
      width:auto; height:auto; padding:calc(16px + env(safe-area-inset-top)) 16px 16px; overflow-y:auto; border-right:0;
    }
    body.menu-open .sidebar .nav-item { justify-content:flex-start; font-size:15px; padding:9px 12px; }
    body.menu-open .sidebar .nav-item span, body.menu-open .sidebar .sidebar-footer .t, body.menu-open .brand .wordmark, body.menu-open .brand span.t { display:inline; }
    body.menu-open .sidebar .nav-section { display:block; }
    body.menu-open .brand { justify-content:flex-start; }
    body.menu-open .brand .mark { display:none; }
    body.menu-open .sidebar-footer { flex-direction:row; }
    body.menu-open .theme-toggle { flex-direction:row; }
    .bottom-nav {
      display:grid; grid-template-columns:repeat(5, 1fr); position:fixed; z-index:50; left:0; right:0; bottom:0;
      background:var(--sidebar); border-top:1px solid var(--border); padding:6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav .nav-item.bn { flex-direction:column; gap:3px; padding:6px 0; margin:0; font-size:10.5px; justify-content:center; align-items:center; text-align:center; }
    .bottom-nav .nav-item.bn span { display:block; }
    .bottom-nav .nav-item.bn svg { width:22px; height:22px; }
    body.menu-open #bnMore { color:var(--text); background:var(--card2); }
    main { padding-top:env(safe-area-inset-top); }
    .page { padding-bottom:calc(90px + env(safe-area-inset-bottom)); }
  }
  .push-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; margin-bottom:14px; font-size:13px; color:var(--dim); }
  .push-bar.on { color:var(--green); }
  @media (max-width: 700px) { .push-bar { flex-direction:column; align-items:flex-start; } }

  /* Link graphs */
  tr.link-row { cursor:pointer; }
  tr.link-row .caret { display:inline-block; width:14px; color:var(--faint); transition:transform .15s; }
  tr.link-row.open .caret { transform:rotate(90deg); color:var(--accent); }
  tr.link-row.open td { background:var(--card2); }
  tr.link-chart td { background:var(--card2); padding:6px 16px 14px; }
  .link-chart-box { position:relative; height:220px; }
  .link-chart-note { font-size:12px; margin-top:6px; }

/* Competitors: swipe file star */
.swipe { color:#F5B83D; }

/* ---- B-ruly Ads additions (same tokens and sizes as above) ---- */
:root { --st-new:#5B8CFF; --st-contacted:#3CC7B0; --st-appointment:#A78BFA; --st-quote:#F5A524; --st-sold:#22C55E; --st-lost:#5C6477; --st-invalid:#EF4444; }
[data-theme="light"] { --st-contacted:#139C88; --st-appointment:#7C5CE0; --st-lost:#98A0AE; }
.pill.st-new { color:var(--accent); background:var(--blue-bg); }
.pill.st-contacted { color:var(--st-contacted); background:color-mix(in srgb, var(--st-contacted) 14%, transparent); }
.pill.st-appointment { color:var(--st-appointment); background:color-mix(in srgb, var(--st-appointment) 15%, transparent); }
.pill.st-quote { color:var(--amber); background:var(--amber-bg); }
.pill.st-sold { color:var(--green); background:var(--green-bg); }
.pill.st-lost { color:var(--dim); background:var(--card2); }
.pill.st-invalid { color:var(--red); background:var(--red-bg); }
.pill.paused { color:var(--amber); background:var(--amber-bg); }
.pill.ended { color:var(--dim); background:var(--card2); }
.banner.info { background:var(--blue-bg); color:var(--text); border:1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.nav-section.client-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.page-head .client-sel { max-width:240px; }
.seg .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:7px; }
.kpi .sub b { color:var(--text); font-weight:600; }

/* Where leads stand / funnel: clickable rows with a bar */
.stage-list { display:flex; flex-direction:column; gap:2px; margin-top:4px; }
.stage-row { display:grid; grid-template-columns:110px 1fr 46px 52px; align-items:center; gap:12px; padding:8px 8px; margin:0 -8px; border-radius:8px; border:0; background:none; color:var(--text); font:inherit; font-size:13.5px; text-align:left; cursor:pointer; width:calc(100% + 16px); }
.stage-row:hover { background:var(--card2); }
.stage-row .bar { height:8px; border-radius:4px; background:var(--card2); overflow:hidden; }
.stage-row .bar i { display:block; height:100%; border-radius:4px; }
.stage-row .n { text-align:right; font-weight:600; font-variant-numeric:tabular-nums; }
.stage-row .p { text-align:right; color:var(--dim); font-size:12.5px; font-variant-numeric:tabular-nums; }
.stage-row.static { cursor:default; }
.stage-row.static:hover { background:none; }
.funnel .stage-row { grid-template-columns:150px 1fr 56px 60px; }

/* Leads by source */
.donut-wrap { display:flex; align-items:center; gap:22px; flex-wrap:wrap; }
.chart-box.donut { width:190px; height:190px; flex-shrink:0; }
.donut-legend { flex:1; min-width:180px; display:flex; flex-direction:column; gap:10px; }
.donut-legend .row { display:flex; align-items:center; gap:10px; font-size:13.5px; }
.donut-legend .row .sdot { margin-right:0; }
.donut-legend .row .v { margin-left:auto; font-weight:600; font-variant-numeric:tabular-nums; }
.donut-legend .row .s { color:var(--dim); font-size:12.5px; width:48px; text-align:right; font-variant-numeric:tabular-nums; }
.donut-legend .total { border-top:1px solid var(--border); padding-top:10px; color:var(--dim); font-size:12.5px; }
.chart-box.small { height:200px; }

/* Explainer */
details.explain { padding:0; margin-top:16px; }
details.explain > summary { list-style:none; cursor:pointer; padding:14px 18px; font-size:14px; font-weight:600; display:flex; align-items:center; gap:8px; }
details.explain > summary::-webkit-details-marker { display:none; }
details.explain > summary .chev { width:16px; height:16px; }
details.explain[open] > summary .chev { transform:rotate(90deg); }
details.explain .body { padding:0 18px 16px; color:var(--dim); font-size:13.5px; line-height:1.55; max-width:80ch; }
details.explain .body p { margin:0 0 10px; }
details.explain .body b { color:var(--text); font-weight:600; }

/* Tables: totals row, wide tables */
tfoot td { border-top:1px solid var(--border); border-bottom:0; font-weight:600; background:var(--card2); }
.list-card tfoot td:first-child { padding-left:18px; } .list-card tfoot td:last-child { padding-right:18px; }
td .s { color:var(--dim); font-size:12px; margin-top:2px; }
.lead-notes { max-width:260px; overflow:hidden; text-overflow:ellipsis; color:var(--dim); }
.camp { display:flex; align-items:center; gap:9px; }
.camp .sdot { margin-right:0; flex-shrink:0; }
.table-note { color:var(--dim); font-size:12.5px; padding:12px 18px 14px; border-top:1px solid var(--border); }
.head-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

/* Lead details (uses .modal.replace from above) */
.modal.replace textarea { width:100%; background:var(--card); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-size:13px; font-family:inherit; resize:vertical; min-height:84px; }
.modal.replace label.full { margin-top:2px; }
.lead-contact { display:flex; flex-wrap:wrap; gap:8px 18px; margin:14px 0 4px; font-size:13.5px; }
.lead-contact a, .lead-contact span { display:inline-flex; align-items:center; gap:6px; color:var(--text); text-decoration:none; }
.lead-contact a:hover { color:var(--accent); }
.lead-contact svg { width:15px; height:15px; color:var(--dim); }

/* Connections */
.conn-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.conn-grid .chart-card { margin-bottom:0; }
.kv { display:grid; grid-template-columns:160px 1fr; gap:9px 14px; font-size:13.5px; margin-top:6px; }
.kv .k { color:var(--dim); }
.kv .v { min-width:0; overflow-wrap:anywhere; }
.kv code { font-family:ui-monospace, Menlo, monospace; font-size:12.5px; background:var(--card2); border:1px solid var(--border); border-radius:6px; padding:1px 6px; }
.conn-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; }
.ok-mark { color:var(--green); font-weight:600; } .no-mark { color:var(--red); font-weight:600; }

/* Access: pick clients */
.client-checks { display:flex; flex-direction:column; gap:6px; max-height:180px; overflow:auto; padding:8px 10px; background:var(--card); border:1px solid var(--border); border-radius:8px; }
.client-checks .check { color:var(--text); }
.field.span2 { grid-column:1 / -1; }

@media (max-width: 900px) { .conn-grid { grid-template-columns:1fr; } }
@media (max-width: 700px) {
  .page-head .client-sel { max-width:none; flex:1; }
  .stage-row { grid-template-columns:96px 1fr 40px 46px; gap:8px; }
  .funnel .stage-row { grid-template-columns:110px 1fr 44px 48px; }
  .kv { grid-template-columns:1fr; gap:2px 0; } .kv .v { margin-bottom:8px; }
  .chart-box.donut { width:150px; height:150px; }
}
.card.clip { overflow:hidden; }
.client-checks .check input[type="checkbox"] { width:auto; margin:0; padding:0; accent-color:var(--accent); flex-shrink:0; }
.client-checks .check { justify-content:flex-start; font-size:13.5px; }
@media (max-width: 700px) {
  .chart-head { flex-wrap:wrap; gap:10px; }
  .chart-head .chart-ctrls { justify-content:flex-start; }
}
@media (max-width: 420px) {
  .kpi { padding:14px 14px; }
  .kpi .val { font-size:25px; }
}
.grid2 > *, .conn-grid > * { min-width:0; }

/* Language switch (EN / DE / NL): same pill as the theme switch, with short labels */
.lang-toggle button { width:auto; min-width:28px; padding:0 7px; font-size:11px; font-weight:650; letter-spacing:.02em; font-family:inherit; }
.sidebar-footer + .sidebar-footer { margin-top:8px; padding-top:0; }
.auth-lang { position:absolute; top:16px; right:16px; }

/* Prospect history in the detail window */
.history { margin-top:14px; border-top:1px solid var(--border); padding-top:12px; }
.history h3 { font-size:13px; margin:0 0 8px; color:var(--dim); font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.timeline { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; max-height:180px; overflow:auto; font-size:13px; }
.timeline li { display:flex; gap:10px; }
.timeline .when { color:var(--dim); white-space:nowrap; min-width:92px; font-variant-numeric:tabular-nums; }

.sidebar [hidden], .bottom-nav [hidden] { display:none !important; }
