:root {
  --bg: #f5f6fc;
  --panel: #ffffff;
  --ink: #14162b;
  --muted: #6a6f8e;
  --line: #e7e9f4;
  --primary: #6366f1;
  --primary-d: #4f46e5;
  --accent: #a855f7;
  --ai-cyan: #22d3ee;
  --ai-grad: linear-gradient(115deg, #6366f1 0%, #a855f7 50%, #22d3ee 100%);
  --ai-grad-soft: linear-gradient(115deg, rgba(99,102,241,.14), rgba(168,85,247,.12), rgba(34,211,238,.12));
  --glow: 0 0 0 1px rgba(99,102,241,.12), 0 8px 30px rgba(99,102,241,.22);
  --wa: #25d366;
  --sms: #0a84ff;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20,24,60,.05), 0 2px 8px rgba(20,24,60,.06);
  --side-bg: #0a0b18;
  --side-ink: #b6bcd8;
  --side-w: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin: 0 0 6px; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }

/* layout — app shell with left sidebar */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: none; display: flex; flex-direction: column;
  background:
    radial-gradient(460px 320px at 18% -4%, rgba(99,102,241,.30), transparent 70%),
    radial-gradient(380px 280px at 92% 10%, rgba(168,85,247,.20), transparent 70%),
    linear-gradient(180deg, #0a0b18 0%, #0c0e20 55%, #101331 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow: hidden;
  padding: 18px 12px 0; z-index: 30;
}
/* The brand row has 192px of usable width at --side-w:232px. Laid out at
   16px/800 with a 34px logo it needed 203px, so `overflow:hidden` on the
   sidebar clipped the AI badge and the title ran under it. Sized to fit with
   headroom, and the title now ellipsizes rather than shoving the badge out. */
.brand { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; color: #fff; padding: 2px 6px 14px; letter-spacing: .01em; min-width: 0; }
.brand .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand em { font-style: normal; background: linear-gradient(90deg, #8b8bff, #c58bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand img.logo { width: 30px; height: 30px; object-fit: contain; flex: none; filter: drop-shadow(0 0 8px rgba(140,100,255,.6)); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.side-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #9aa1c6; padding: 14px 10px 5px; }
.nav-btn {
  border: 0; background: transparent; color: var(--side-ink); font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
}
.nav-btn .ni { width: 20px; text-align: center; font-size: 14px; opacity: .85; flex: none; }
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn:focus-visible { outline: 2px solid #8b8bff; outline-offset: -2px; }
.nav-btn.active { background: linear-gradient(90deg, rgba(99,102,241,.42), rgba(168,85,247,.18) 70%, transparent); color: #fff; box-shadow: inset 3px 0 0 #8b8bff; }
.nav-btn .badge { margin-left: auto; background: rgba(255,255,255,.1); color: #c5c9e8; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.nav-btn.active .badge { background: var(--primary); color: #fff; }
.sidebar > .side-foot { position: static; flex: none; z-index: 3; padding: 12px 8px 8px;
  border-top: 1px solid rgba(255,255,255,.1); background: #16123c; }
.syncbadge { font-size: 12px; color: #7c83ad; white-space: nowrap; }

main { flex: 1; min-width: 0; max-width: 1180px; margin: 0 auto; padding: 0 26px 90px;
  display: flex; flex-direction: column; min-height: 100vh; }
#app { display: flex; flex-direction: column; flex: 1; min-width: 0; }
#app > .app-foot { margin-top: auto; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-title { margin: 22px 0 10px; }

/* buttons */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: #fafafe; border-color: #d6d8e0; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--danger); border-color: #f3c7c7; }
.btn.danger:hover { background: #fef2f2; }
.btn.danger.ghost { border-color: transparent; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #053a1b; }
.btn.wa:hover { filter: brightness(.96); }
.btn.sms { background: var(--sms); border-color: var(--sms); color: #fff; }
.btn.sms:hover { filter: brightness(.96); }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 15px; padding: 6px; border-radius: 8px; color: var(--muted); line-height: 1; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* inputs */
.input { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 11px; font: inherit; color: var(--ink); width: 100%; }
.input:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }
.input.small { width: auto; padding: 7px 9px; }
select.input { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* cards / stats */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.danger-card { border-color: #f3c7c7; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-num { font-size: 28px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); width: 100%; text-align: left; font: inherit; color: inherit; cursor: default; }
button.list-row { cursor: pointer; }
button.list-row:hover { border-color: #c7cbd6; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.progress { width: 120px; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.progress.wide { width: 160px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; }
.pct { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 46px; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip { --c: var(--primary); font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--c) 42%, var(--ink)); background: color-mix(in srgb, var(--c) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 34%, var(--panel)); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* table */
.table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tr { display: grid; grid-template-columns: 36px 1fr auto auto; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line); gap: 16px; }
.table.nocalls .cell.quicklog { justify-content: flex-start; }
.tr.th { background: var(--bg); border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
.tr:hover:not(.th) { background: var(--bg); }
.tr.bl { opacity: .62; }
.tr.bl .name strong { text-decoration: line-through; }
.cell { min-width: 0; }
.cell.name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.phone { font-variant-numeric: tabular-nums; color: #374151; }
.cell.cb { display: flex; align-items: center; }
.cell.actions { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: nowrap; align-items: center; }
.cell.quicklog { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.name-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ph-inline { font-variant-numeric: tabular-nums; color: #2563eb; text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.ph-inline:hover { text-decoration: underline; }
.cell.name .name-link { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; font-weight: 600; font-size: 15px; color: var(--ink); text-align: left; }
.cell.name .name-link:hover { text-decoration: underline; }
.tr.bl .name .name-link { text-decoration: line-through; }
.cell.name .lc-line { margin-top: 2px; }
.tr.logged { box-shadow: inset 4px 0 0 var(--lc, #c7d2fe); }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.qchip { font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.qchip:hover { border-color: var(--primary); }
.qchip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.qchip.tagq.on { background: #6366f1; border-color: #6366f1; }
.tchip.manage { margin-left: auto; color: var(--muted); }
.recap { display: flex; flex-wrap: wrap; gap: 20px; }
.recap-item { text-align: center; min-width: 60px; }
.recap-num { font-size: 18px; font-weight: 800; }
.recap-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.taglist { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; }
.tagrow { display: flex; align-items: center; gap: 8px; }
.flash-next { animation: flashnext 1.3s ease; }
@keyframes flashnext { 0%, 55% { background: #fff7ed; } 100% { background: transparent; } }
.icon-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; align-items: center; padding: 4px 4px 10px; font-size: 12px; color: var(--muted); }
.icon-legend .leg-lbl { font-weight: 700; color: var(--ink); }
.icon-legend .leg b { font-weight: 700; color: var(--ink); }
.icon-btn.del-x { color: #b91c1c; }
.icon-btn.del-x:hover { background: #fee2e2; }
.live-timer { margin-top: 3px; font-size: 12px; font-weight: 700; color: #15803d; }
.tr.calling { background: #f0fdf4 !important; box-shadow: inset 4px 0 0 #16a34a !important; }
.qbtn.call.live, .btn.wa.live { background: #16a34a; border-color: #16a34a; color: #fff; animation: callpulse 1.2s ease-in-out infinite; }
@keyframes callpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0); } }
.filter-clear { display: block; width: 100%; text-align: left; background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.filter-clear:hover { background: #fef3c7; }
.past-results { max-height: 250px; overflow-y: auto; }
.past-add:not(:empty) { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 6px; }
.past-result.add-new { color: var(--primary); font-weight: 700; }
.past-result.quick-log { color: #92400e; font-weight: 700; }
.tag.quicktag { background: #fef3c7; color: #92400e; }
.past-recap { background: #ecfdf5; border: 1px solid #a7f3d0; color: #15803d; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.qbtn { font-size: 12px; font-weight: 700; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: #374151; cursor: pointer; line-height: 1; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.qbtn:hover { background: #eef2ff; border-color: var(--primary); }
.qbtn:active { transform: translateY(1px); }
.qbtn.call { background: #ecfdf5; border-color: #a7f3d0; font-size: 14px; }
.qbtn.ans { color: #15803d; border-color: #bbf7d0; }
.tag-chip { --c: #6366f1; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.tchip { font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.tchip:hover { border-color: var(--primary); }
.tchip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; }
.cb-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.dispo-manage { display: flex; flex-wrap: wrap; gap: 8px; }
.dispo-chip-s { --c: #64748b; display: inline-flex; align-items: center; gap: 2px; }
.chip-x { background: none; border: none; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 0 0 3px; line-height: 1; }
.srclist { display: flex; flex-direction: column; gap: 8px; }
.srcrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; }
.srcname { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srcbar { background: var(--bg); border-radius: 8px; height: 10px; overflow: hidden; }
.srcbarfill { display: block; height: 100%; background: var(--primary); border-radius: 8px; }
.srcnum { font-size: 12px; color: var(--muted); white-space: nowrap; }
.recent-list { display: flex; flex-direction: column; gap: 1px; }
.recent-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: 9px 10px; cursor: pointer; font: inherit; }
.recent-row:hover { background: var(--bg); }
.rc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-dispo { font-size: 13px; white-space: nowrap; }
.rc-when { white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle; }
.tag.bl { background: #fee2e2; color: #b91c1c; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* send table */
.send-table .tr.send { grid-template-columns: 38px 1.2fr auto 130px; }
.tr.send.done { background: #f3fbf5; }
.cell.sendbtns { display: flex; gap: 6px; justify-content: flex-end; }
.cell.sentat { text-align: right; }
.campaign-summary { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; box-shadow: var(--shadow); margin-bottom: 12px; }
.msg-preview { background: #fffdf5; border: 1px solid #f0e6c8; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.msg-preview pre { margin: 6px 0 0; white-space: pre-wrap; font: inherit; }
.back { margin-bottom: 4px; padding-left: 4px; }

/* segmented */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg-btn { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg-btn.on { background: var(--primary); color: #fff; }

/* bulk bar */
.bulkbar { position: sticky; top: 62px; z-index: 35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }

/* empty states */
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); }
.empty.cta { border-style: solid; }
.empty h3 { color: var(--ink); }

/* import */
.import-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dropzone { border: 2px dashed #cdd2e0; border-radius: 12px; padding: 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; justify-content: center; }
.dropzone.over { border-color: var(--primary); background: #eef2ff; }
.dz-icon { font-size: 28px; }
.paste-box { display: flex; flex-direction: column; gap: 8px; }

/* modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 150; overflow: auto; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 520px; padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 14px; }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.phone-row { display: flex; gap: 6px; margin-bottom: 6px; }
/* Module pickers: a real grid, so checkboxes line up in columns instead of
   wrapping ragged at whatever width each label happens to be. */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 10px; }
.checks .check { align-items: center; padding: 4px 2px; min-width: 0; }
.checks .check input { flex: none; }
/* Long labels truncate rather than pushing the grid out of alignment. */
.checks .check > span, .checks .check { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .checks { grid-template-columns: 1fr 1fr; } }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; position: relative; border: 2px solid transparent; }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { border-color: #111; box-shadow: 0 0 0 2px #fff inset; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 8px; font-size: 12px; }

/* GHL-style: the sidebar NEVER moves to the top — on narrow screens it
   collapses to an icon rail on the left. */
@media (max-width: 860px) {
  .sidebar { width: 62px; padding: 14px 8px; }
  .brand { padding: 2px 4px 14px; justify-content: center; }
  .brand span.t { display: none; }
  .brand img.logo { width: 30px; height: 30px; }
  .side-lbl { padding: 10px 0 4px; text-align: center; font-size: 11px; letter-spacing: .04em; }
  .nav-btn { justify-content: center; padding: 10px 6px; font-size: 0; gap: 0; }
  .nav-btn .ni { font-size: 16px; width: auto; opacity: 1; }
  .nav-btn .badge { display: none; }
  .side-foot { display: none; }
  main { padding: 16px 12px 80px; }
}
@media (max-width: 720px) {
  .import-grid { grid-template-columns: 1fr; }
  .tr { grid-template-columns: 30px 1fr auto; gap: 10px; }
  .cell.actions { display: none; }
  .send-table .tr.send { grid-template-columns: 32px 1fr auto; }
  .cell.sentat { display: none; }
  main { padding: 16px 12px 80px; }
}

/* call tracker */
.callstats { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.callstats .cs { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; box-shadow: var(--shadow); min-width: 120px; flex: 1; }
.callstats .cs-num { font-size: 22px; font-weight: 800; }
.callstats .cs-lbl { color: var(--muted); font-size: 12px; }
.call-table .tr.callrow { grid-template-columns: 38px 1.3fr 130px 1.5fr auto; align-items: center; }
.tr.callrow.cb { background: #fffaf0; box-shadow: inset 3px 0 0 #f59e0b; }
.cell.lastcall { min-width: 0; }
.lc-out { font-weight: 600; }
.cell.lastcall .note { font-style: italic; }
.outcomes { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.outcome:hover { border-color: var(--primary); background: #eef2ff; }
.feed { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.feed-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.feed-row:first-child { border-top: 0; }
.feed-when { color: var(--muted); font-size: 12px; min-width: 96px; flex: none; }
.feed-out { white-space: nowrap; }
.feed-row .del-call { margin-left: auto; flex: none; }
.hist { display: flex; flex-direction: column; gap: 4px; }
.hist-row { font-size: 13px; }

@media (max-width: 720px) {
  .call-table .tr.callrow { grid-template-columns: 34px 1fr auto; }
  .call-table .cell.phone, .call-table .cell.lastcall { display: none; }
  .feed-when { min-width: 64px; }
  .callstats .cs { padding: 10px 12px; }
}

/* mini-CRM: contact hub, dispositions, tasks/reminders */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-d); font-weight: 700; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.task-pill { font-size: 11px; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.dispo { font-size: 12px; font-weight: 700; background: #eef2ff; color: var(--primary-d); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.dispo.none { background: var(--line); color: var(--muted); }
.reminder-banner { display: block; width: 100%; text-align: left; border: 1px solid #f3d99b; background: #fffaf0; color: #92400e; font-weight: 700; border-radius: 12px; padding: 11px 14px; margin-bottom: 12px; cursor: pointer; font-size: 14px; }
.reminder-banner:hover { background: #fef6e6; }
.hub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hub-head h2 { margin: 0; }
.hub-links { display: flex; gap: 8px; margin: 14px 0 4px; }
.hub-sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.hub-lbl { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.log-meta { display: flex; gap: 6px; margin-top: 8px; }
.log-meta input[type=date] { max-width: 160px; }
.task-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.task-add input[type=date] { max-width: 165px; }
.task-list { display: flex; flex-direction: column; gap: 2px; }
.task-list.card-list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; margin-bottom: 6px; }
.task-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.task-line:hover { background: var(--bg); }
.task-line.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { flex: 1; min-width: 0; }
.task-due { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.task-due.b-overdue { color: #b91c1c; }
.task-due.b-today { color: #b45309; }
.del-task { margin-left: 2px; }
.section-title.danger { color: #b91c1c; }
@media (max-width: 720px) {
  .log-meta { flex-direction: column; }
  .log-meta input[type=date], .task-add input[type=date] { max-width: none; }
}

/* disposition chips + calls-per-day chart */
.dispo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dchip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); white-space: nowrap; }
.dchip:hover { border-color: #c7cbd6; }
.dchip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.daychart { padding: 14px 16px; margin-bottom: 14px; }
.dc-head { font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.dc-bars { display: flex; align-items: stretch; gap: 8px; height: 96px; }
.dc-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.dc-n { font-size: 11px; font-weight: 700; color: var(--muted); height: 15px; }
.dc-barwrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.dc-bar { width: 62%; max-width: 34px; min-height: 3px; background: linear-gradient(180deg, #6366f1, #4f46e5); border-radius: 8px 5px 0 0; }
.dc-lbl { font-size: 11px; color: var(--muted); margin-top: 5px; }
.dc-lbl.today { color: var(--primary-d); font-weight: 700; }
.dc-bars { position: relative; }
.dc-goal { position: absolute; left: 0; right: 0; border-top: 2px dashed #f59e0b; height: 0; z-index: 1; pointer-events: none; }
.dc-bar.hit { background: linear-gradient(180deg, #34d399, #10b981); }
.streak { float: right; font-size: 12px; color: #b45309; font-weight: 700; }
.funnel { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fn { text-align: center; padding: 4px 8px; }
.fn b { display: block; font-size: 22px; font-weight: 800; }
.fn span { font-size: 12px; color: var(--muted); }
.fn.won b { color: #047857; }
.fnarrow { color: #c5c9d6; font-weight: 700; }
.hourbars { display: flex; align-items: flex-end; gap: 3px; height: 72px; margin-top: 8px; }
.hb { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.hbarwrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.hbar { width: 72%; min-height: 2px; background: #c7d2fe; border-radius: 8px 3px 0 0; }
.hbar.pk { background: var(--primary); }
.hl { font-size: 11px; color: var(--muted); margin-top: 3px; height: 11px; }
.kbd { display: inline-block; min-width: 15px; text-align: center; font-size: 11px; background: rgba(0,0,0,.12); border-radius: 8px; padding: 0 4px; font-weight: 700; }

/* passcode lock */
#lockscreen { position: fixed; inset: 0; background: var(--bg); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lockbox { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 26px; text-align: center; max-width: 320px; width: 100%; box-shadow: var(--shadow); }
.lockico { font-size: 40px; margin-bottom: 6px; }
.locklogo { width: 148px; max-width: 60%; display: block; margin: 0 auto 12px; }
.auth-or { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 8px; position: relative; }
.auth-or:before, .auth-or:after { content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--line); }
.auth-or:before { left: 0; } .auth-or:after { right: 0; }
.btn.fbbtn { background: #1877F2; border-color: #1877F2; color: #fff; width: 100%; justify-content: center; }
.btn.fbbtn:hover { background: #0f6ae0; }
.btn.fbbtn span { font-weight: 900; font-family: Georgia, serif; margin-right: 4px; }
.lockbox h2 { margin-bottom: 14px; }
.lockbox input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 18px; text-align: center; letter-spacing: 6px; margin-bottom: 12px; }
.lockbox .btn { width: 100%; }
#lockErr { color: #dc2626; min-height: 18px; margin-bottom: 8px; font-size: 13px; }
#authscreen { position: fixed; inset: 0; background: var(--bg); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
#authscreen .lockbox { max-width: 340px; }
#authscreen .lockbox h2 { margin-bottom: 6px; }
#authscreen .lockbox input { font-size: 15px; text-align: left; letter-spacing: normal; }
.lockerr { color: #dc2626; min-height: 18px; margin-bottom: 8px; font-size: 13px; }

/* power-dial mode */
.dial-wrap { max-width: 460px; margin: 0 auto; }
.dial-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dial-prog { font-size: 13px; font-weight: 700; color: var(--muted); }
.dial-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; text-align: center; }
.dial-name { font-size: 28px; font-weight: 800; line-height: 1.2; }
.dial-num { font-size: 15px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.chips.center { justify-content: center; margin-top: 8px; }
.dial-call { display: flex; justify-content: center; background: var(--wa); border-color: var(--wa); color: #053a1b; font-size: 18px; padding: 16px; border-radius: 12px; margin: 18px 0 14px; font-weight: 800; }
.dial-call:hover { filter: brightness(.96); }
.dial-note { margin-bottom: 14px; }
.dial-dispos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dial-dispos .outcome { justify-content: center; padding: 13px 8px; }
.dial-skip { margin-top: 14px; width: 100%; justify-content: center; }
.dial-hint { text-align: center; margin-top: 14px; }
.dial-done { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 44px 24px; box-shadow: var(--shadow); }
.dial-done-emoji { font-size: 48px; margin-bottom: 8px; }

/* log-past-call modal */
.past-results { max-height: 280px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; }
.past-result { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 12px; font: inherit; cursor: pointer; }
.past-result:last-child { border-bottom: 0; }
.past-result:hover { background: var(--bg); }
.past-selected { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.date-presets { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-presets input[type=date] { max-width: 175px; }

/* per-call timer + backup reminder */
.timer-bar { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 12px; padding: 9px 12px; margin: 0 0 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timer-bar #callTimerDisplay { font-variant-numeric: tabular-nums; font-size: 16px; }
.backup-nag { display: block; width: 100%; text-align: left; border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; font-weight: 700; border-radius: 12px; padding: 11px 14px; margin-bottom: 12px; cursor: pointer; font-size: 14px; }
.backup-nag:hover { background: #fef3c7; }

/* undo bar */
#undobar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #1b1f2a; color: #fff; border-radius: 12px; padding: 8px 10px 8px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 200; font-size: 14px; max-width: 92vw; }
#undobar .btn { background: #fff; color: #1b1f2a; border-color: #fff; }
#undobar .btn:hover { background: #e9e9f5; }
#undobar .undo-x { color: #cbd5e1; }
#undobar .undo-x:hover { color: #fff; }

/* hot star */
.star { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 3px; color: #cbd5e1; vertical-align: middle; }
.star:hover { color: #f59e0b; }
.star.on { color: #f59e0b; }

/* revenue (won) */
.won-amt { color: #047857; font-weight: 700; }
.revcard .rev-total { font-size: 28px; font-weight: 800; margin: 2px 0 8px; }
.rev-groups { display: flex; flex-direction: column; gap: 6px; }
.rev-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rev-row strong { margin-left: auto; }

/* text templates */
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-row { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.tpl-pick { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tpl-pick .past-result { white-space: normal; }

/* sales pipeline (kanban) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(215px, 1fr); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 14px; }
.kcol { background: #eef0f7; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kcol-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; padding: 2px 4px 10px; }
.kcol-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--kc, var(--primary)); flex: none; box-shadow: 0 0 6px var(--kc, var(--primary)); }
.kcol-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; background: var(--panel); border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); }
.kcards { display: flex; flex-direction: column; gap: 8px; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); border-top: 3px solid var(--kc, var(--primary)); cursor: grab; }
.kcard.dragging { opacity: .45; }
.kcol.kover { outline: 2px dashed var(--primary); outline-offset: -2px; background: #eef2ff; }
.kcard .kname { font-weight: 700; font-size: 14px; display: block; }
.kcard .kphone { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kcard select { margin-top: 8px; font-size: 12px; padding: 4px 24px 4px 8px; }
.kcard .chips { margin-top: 6px; }
.kempty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 4px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch .knob { width: 42px; height: 24px; border-radius: 999px; background: #d3d7e5; position: relative; transition: background .15s; flex: none; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked + .knob { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.switch input:checked + .knob::after { left: 21px; }

/* integration store */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.store-card { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); position: relative; }
.store-card.on { border-color: #a7f3d0; }
.store-ico { font-size: 28px; flex: none; }
.store-body { display: flex; flex-direction: column; min-width: 0; }
.store-body strong { font-size: 14px; }
.store-env { font-size: 11px; color: var(--muted); background: var(--bg); padding: 1px 4px; border-radius: 8px; margin-top: 3px; align-self: flex-start; }
.store-badge { position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 700; color: var(--muted); }
.store-badge.live { color: #059669; }

/* page builder mini preview */
.pg-mini { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pm { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.pm b { font-size: 13px; } .pm span { font-size: 12px; color: var(--muted); } .pm em { font-size: 11px; color: var(--primary); font-style: normal; font-weight: 700; }
.pm.hero { background: linear-gradient(135deg, #0e1130, #1a1450); } .pm.hero b, .pm.hero span { color: #fff; } .pm.hero em { color: #b7b7ff; }
.pm.cta { background: #0e1130; } .pm.cta b { color: #fff; }

/* contact detail grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.detail-grid > div { display: flex; flex-direction: column; }
.detail-grid .dk { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
@media (max-width: 620px) { .detail-grid { grid-template-columns: 1fr; } }

/* form builder */
.fb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .fb-grid { grid-template-columns: 1fr; } }
.fb-field { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; background: var(--bg); }
.fb-grip { color: #c5c9d6; cursor: grab; font-size: 12px; }
.fb-preview { background: var(--bg); }
.fp { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.check.small { font-size: 12px; gap: 4px; }

/* spreadsheet */
.ss-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.ss { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
.ss th { background: #f7f8fc; text-align: left; padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ss td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ss tr:hover td { background: var(--bg); }
.ss .mono { font-variant-numeric: tabular-nums; }
.ss select.input.small, .ss input.input.small { margin: 0; min-width: 120px; }

/* calendar */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head > div { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 92px; padding: 6px; }
.cal-cell.empty { background: transparent; border: 0; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.cal-d { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.cal-cell.today .cal-d { color: var(--primary-d); }
.cal-ev { font-size: 11px; padding: 2px 6px; border-radius: 8px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.ev-appt { background: #eef2ff; color: #4338ca; }
.cal-ev.ev-task { background: #fff7ed; color: #b45309; }
@media (max-width: 720px) { .cal-cell { min-height: 62px; } .cal-ev { font-size: 11px; } }

/* threaded conversations inbox */
.conv-grid { display: grid; grid-template-columns: 290px 1fr; gap: 14px; align-items: start; min-height: 480px; }
@media (max-width: 860px) { .conv-grid { grid-template-columns: 1fr; } }
.conv-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; max-height: 70vh; overflow-y: auto; }
.conv-item { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 9px 10px; cursor: pointer; font: inherit; }
.conv-item:hover { background: var(--bg); }
.conv-item.on { background: #eef2ff; }
.conv-ava { font-size: 18px; flex: none; }
.conv-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conv-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-when { flex: none; font-size: 11px; }
.conv-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 70vh; }
.conv-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bubbles { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; min-height: 240px; }
.brow { display: flex; }
.brow.me { justify-content: flex-end; }
.bub { max-width: 72%; padding: 9px 13px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.brow.me .bub { background: linear-gradient(135deg, var(--primary), #6d5cf6); color: #fff; border: 0; }
.bnote { font-size: 11px; opacity: .75; font-weight: 700; }
.conv-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.conv-compose textarea { flex: 1; }
.conv-compose .btn { padding: 10px 16px; }
.conv-compose-wrap { padding: 10px; border-top: 1px solid var(--line); }
.conv-compose-wrap .conv-compose { padding: 0; border-top: 0; }
.chan-filter { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.chan-chip { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 14px; line-height: 1; }
.chan-chip.on { background: #eef2ff; border-color: var(--primary); }
.conv-item.unread strong { font-weight: 800; }
.conv-item.unread { background: #fbfbff; }
.brow.note { justify-content: center; }
.bub.note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; max-width: 92%; }
.brow.note .bub.note b { color: #78350f; }

/* support-desk setup steps */
.setup-steps { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.setup-step { display: flex; gap: 12px; align-items: flex-start; }
.setup-step .sn { flex: none; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.setup-step > div { min-width: 0; }
.setup-step ol { margin: 6px 0; padding-left: 18px; line-height: 1.7; }
.route { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; background: var(--bg); }
.codeblock { background: #0e1130; color: #dfe2ff; border-radius: 8px; padding: 12px 14px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; margin: 8px 0 0; white-space: pre; }

/* app launcher (Odoo-style tile grid) */
.apps-btn { position: fixed; top: 14px; right: 16px; z-index: 60; width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); border: 0; cursor: pointer; box-shadow: 0 6px 22px rgba(91,91,246,.45); display: flex; align-items: center; justify-content: center; }
.apps-btn:hover { filter: brightness(1.06); }
.apps-btn:active { transform: scale(.94); }
.apps-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.apps-dots, .apps-dots::before, .apps-dots::after { display: block; }
.apps-dots { width: 4px; height: 4px; border-radius: 50%; background: #fff; position: relative; box-shadow: 7px 0 #fff, -7px 0 #fff, 0 7px #fff, 7px 7px #fff, -7px 7px #fff, 0 -7px #fff, 7px -7px #fff, -7px -7px #fff; transition: opacity .12s; }
.apps-btn.open { z-index: 62; }
.apps-btn.open .apps-dots { opacity: 0; }
.apps-btn.open::after { content: "✕"; position: absolute; color: #fff; font-size: 22px; font-weight: 400; line-height: 1; }
.lt-hint { color: #8a90ba; font-size: 12px; }
@media (max-width: 560px) { .lt-hint { display: none; } }
.launcher { position: fixed; inset: 0; z-index: 55; background: rgba(12,15,40,.6); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: flex; flex-direction: column; align-items: center; padding: 0 22px 40px; overflow-y: auto; animation: launcherIn .18s ease; }
.launcher[hidden] { display: none; }
.launcher-topbar { position: sticky; top: 0; align-self: stretch; display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.12); background: linear-gradient(rgba(12,15,40,.4), transparent); }
.lt-brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.lt-brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(140,100,255,.6)); }
.lt-close { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: 16px; cursor: pointer; }
.lt-close:hover { background: rgba(255,255,255,.18); }
.lt-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@keyframes launcherIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .launcher { animation: none; } }
.launcher-inner { max-width: 940px; width: 100%; }
.launcher-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.launcher-head h2 { color: #fff; margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.launcher-head .lwmark { color: #c5c9e8; font-size: 13px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 26px 12px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; font: inherit; padding: 4px; animation: tilePop .42s cubic-bezier(.34, 1.56, .5, 1) backwards; }
@keyframes tilePop { 0% { opacity: 0; transform: scale(.4) translateY(10px); } 70% { opacity: 1; transform: scale(1.05) translateY(0); } 100% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .app-tile { animation: none; } }
.app-ico { width: 62px; height: 62px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 30px; box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.25); transition: transform .13s ease; }
.app-tile:hover .app-ico { transform: translateY(-3px) scale(1.05); }
.app-tile:active .app-ico { transform: scale(.92); }
.app-tile:focus-visible { outline: 0; }
.app-tile:focus-visible .app-ico { outline: 2px solid #fff; outline-offset: 3px; }
.app-label { font-size: 12px; font-weight: 600; color: #eef0fb; text-align: center; max-width: 84px; line-height: 1.25; }
.app-tile.current .app-ico { box-shadow: 0 0 0 3px #fff, 0 8px 20px rgba(0,0,0,.3); }
.app-tile.locked .app-ico { filter: grayscale(.7) brightness(.7); position: relative; }
.app-tile.locked .app-label { color: #c5c9e4; }
.app-lock { position: absolute; right: -4px; top: -4px; font-size: 15px; background: #14162b; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.pro-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #fff; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 8px; padding: 1px 4px; vertical-align: middle; }
.launcher-upsell { color: #c5c9e8; text-align: center; font-size: 13px; margin: 26px auto 0; max-width: 460px; }
.plan-block { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.plan-block.pro { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); background: color-mix(in srgb, var(--primary) 4%, transparent); }
.plan-lbl { font-size: 12px; font-weight: 700; color: var(--ink-soft, var(--muted)); margin-bottom: 8px; }

/* embedded tutoring platform */
.tutoring-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--panel); height: calc(100vh - 220px); min-height: 420px; }
.tutoring-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* module toggles in settings */
.modrow { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.modrow:first-of-type { border-top: 0; }
@media (max-width: 720px) { .modrow { grid-template-columns: 1fr; gap: 3px; } }

/* candidates pipeline */
.cand-table .tr.candrow { grid-template-columns: 1.5fr 130px 150px auto; align-items: center; }
.cand-table .cell.stage select { width: 100%; }
@media (max-width: 720px) { .cand-table .tr.candrow { grid-template-columns: 1fr 130px auto; } .cand-table .cell.phone { display: none; } }

/* ============================================================================
   AI-CENTRIC THEME LAYER
   ========================================================================== */

/* Sidebar: aurora glow at the top + subtle grid texture.
   NO `position: relative` here — the base rule's position:sticky already makes
   the sidebar a positioned element (so ::before anchors fine), and overriding
   it was the bug that made the sidebar scroll away instead of staying pinned. */
.sidebar::before {
  content: ""; position: absolute; top: -60px; left: -40px; right: -40px; height: 260px;
  background: radial-gradient(60% 80% at 30% 0%, rgba(99,102,241,.5), transparent 70%),
              radial-gradient(50% 70% at 90% 10%, rgba(168,85,247,.4), transparent 70%),
              radial-gradient(40% 60% at 60% 30%, rgba(34,211,238,.25), transparent 70%);
  /* Toned down and pushed off the brand row: at .55 this bloomed straight
     through the top of the sidebar and washed out white text sitting on it. */
  filter: blur(34px); opacity: .3; pointer-events: none; z-index: 0;
  animation: aurora 14s ease-in-out infinite alternate;
}
.sidebar > * { position: relative; z-index: 1; }
@keyframes aurora { 0% { transform: translateY(0) scale(1); opacity: .26; } 100% { transform: translateY(22px) scale(1.08); opacity: .38; } }
@media (prefers-reduced-motion: reduce) { .sidebar::before { animation: none; } }

/* Brand: gradient wordmark + glowing AI badge */
.brand .t em { background: linear-gradient(90deg, #a5a5ff, #d8a8ff, #7fe9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand::after {
  content: "AI"; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #fff;
  background: var(--ai-grad); border-radius: 8px; padding: 2px 5px; margin-left: 2px;
  box-shadow: 0 0 12px rgba(99,102,241,.6); align-self: center;
}
@media (max-width: 860px) { .brand::after { display: none; } }

/* Active nav item: AI gradient rail + glow */
.nav-btn.active { background: linear-gradient(90deg, rgba(99,102,241,.4), rgba(168,85,247,.22), transparent); box-shadow: inset 2px 0 0 #8b8bff, 0 0 18px rgba(99,102,241,.15); }
.nav-btn .ni { transition: filter .15s; }
.nav-btn.active .ni { filter: drop-shadow(0 0 6px rgba(139,139,255,.9)); }

/* Primary buttons: AI gradient with glow */
.btn.primary { background: var(--ai-grad); border: 0; background-size: 160% 160%; box-shadow: 0 4px 16px rgba(99,102,241,.32); transition: background-position .4s, box-shadow .2s, transform .1s; }
.btn.primary:hover { background: var(--ai-grad); background-size: 160% 160%; background-position: 100% 0; box-shadow: 0 6px 22px rgba(99,102,241,.45); }
.btn.primary:active { transform: translateY(1px); }

/* Inputs: focus in AI violet with a soft glow */
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.16); }

/* Section/stat cards get a whisper of the AI gradient on hover */
.stat-card { transition: transform .14s, box-shadow .14s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }

/* Login screen: animated AI mesh backdrop */
#authscreen { background:
  radial-gradient(40% 50% at 15% 20%, rgba(99,102,241,.16), transparent 60%),
  radial-gradient(45% 55% at 85% 15%, rgba(168,85,247,.15), transparent 60%),
  radial-gradient(50% 60% at 70% 90%, rgba(34,211,238,.12), transparent 60%),
  var(--bg); }
#authscreen .lockbox { box-shadow: 0 20px 60px rgba(60,50,140,.16), 0 0 0 1px rgba(99,102,241,.08); }

/* Floating AI assistant button (bottom-right) */
.ai-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 58; height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 16px; cursor: pointer; color: #fff; font: inherit; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 9px; background: var(--ai-grad); background-size: 180% 180%;
  box-shadow: 0 8px 30px rgba(99,102,241,.45); animation: aiPulse 3.4s ease-in-out infinite, aiShift 6s ease infinite;
}
.ai-fab:hover { filter: brightness(1.06); }
.ai-fab:active { transform: scale(.96); }
.ai-fab .spark { font-size: 18px; filter: drop-shadow(0 0 6px rgba(255,255,255,.7)); }
@keyframes aiPulse { 0%, 100% { box-shadow: 0 8px 30px rgba(99,102,241,.4); } 50% { box-shadow: 0 8px 38px rgba(168,85,247,.6); } }
@keyframes aiShift { 0% { background-position: 0 0; } 50% { background-position: 100% 50%; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .ai-fab { animation: none; } }
@media (max-width: 560px) { .ai-fab span.ai-fab-label { display: none; } .ai-fab { padding: 0 15px; } }

/* AI assistant modal */
.ai-modal .ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.ai-modal .ai-badge { width: 34px; height: 34px; border-radius: 12px; background: var(--ai-grad); display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: 0 0 16px rgba(99,102,241,.5); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.ai-chip { font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--ai-grad-soft); color: var(--primary-d); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.ai-chip:hover { border-color: var(--primary); }
.ai-out { background: var(--ai-grad-soft); border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line)); border-radius: 12px; padding: 14px; margin-top: 10px; white-space: pre-wrap; font-size: 14px; line-height: 1.55; min-height: 40px; }
.ai-out.think { color: var(--muted); font-style: italic; }

/* ============================================================================
   AI THEME — STUNNING LAYER
   ========================================================================== */
/* Ambient gradient aura behind the whole workspace (subtle, light-mode) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 42% at 82% 8%, rgba(168,85,247,.10), transparent 60%),
    radial-gradient(34% 40% at 96% 60%, rgba(34,211,238,.09), transparent 60%),
    radial-gradient(40% 44% at 60% 100%, rgba(99,102,241,.08), transparent 60%);
  animation: auraDrift 22s ease-in-out infinite alternate;
}
@keyframes auraDrift { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(-2%,2%,0) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
/* Lift content above the body::before aura. NOTE: do not include .sidebar here —
   this rule's `position: relative` was overriding the sidebar's own positioning
   (it silently clobbered the sidebar's position:sticky at equal specificity, so
   the sidebar was position:relative and scrolled off with the page instead of
   staying pinned). The sidebar sets its own position:sticky + z-index:30. */
main { position: relative; z-index: 1; }

/* Cards: crisper glass with a gradient hairline that lights up on hover */
.card, .stat-card { position: relative; background: rgba(255,255,255,.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .15s, box-shadow .18s, border-color .18s; }
.card:hover { border-color: color-mix(in srgb, var(--primary) 26%, var(--line)); box-shadow: 0 2px 8px rgba(20,24,60,.05), 0 10px 34px rgba(99,102,241,.10); }

/* Dashboard stat cards: gradient top-accent + big gradient numbers */
.stat-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; border-radius: var(--radius) var(--radius) 0 0; background: var(--ai-grad); opacity: 0; transition: opacity .18s; }
.stat-card:hover::before { opacity: 1; }
.stat-num { background: linear-gradient(120deg, var(--ink), #4f46e5 120%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* View headings get a gradient underline flourish */
.view-head > h1, .view-head > div > h1 { position: relative; }
.view-head h1::after { content: ""; position: absolute; left: 0; bottom: -6px; width: 42px; height: 3px; border-radius: 8px; background: var(--ai-grad); }

/* App launcher: deeper space backdrop + glow ring behind the grid */
.launcher { background: rgba(9,11,32,.66); }
.launcher-inner { position: relative; }
.launcher-inner::before { content: ""; position: absolute; top: -40px; left: 50%; width: 620px; height: 320px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(50% 60% at 50% 0%, rgba(99,102,241,.32), transparent 70%), radial-gradient(45% 55% at 75% 20%, rgba(168,85,247,.24), transparent 70%);
  filter: blur(30px); }
.launcher-head h2 { background: linear-gradient(90deg, #fff, #d8c8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-ico { box-shadow: 0 8px 22px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -8px 16px rgba(0,0,0,.12); }

/* Login lockbox: glass with a gradient ring */
#authscreen .lockbox { background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border: 1px solid rgba(99,102,241,.14); }
.lockbox .btn.primary { width: 100%; justify-content: center; }

/* ---- Mapbox address autocomplete ---- */
.mbx-wrap { position: relative; }
.mbx-suggest {
  display: none; position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel); border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .16);
}
.mbx-item {
  display: block; width: 100%; text-align: left; padding: 10px 13px; border: 0;
  background: transparent; font: inherit; color: #1e293b; cursor: pointer; line-height: 1.35;
  border-bottom: 1px solid #f1f5f9;
}
.mbx-item:last-child { border-bottom: 0; }
.mbx-item:hover, .mbx-item.on { background: linear-gradient(90deg, rgba(99,102,241,.10), rgba(168,85,247,.06)); color: #4338ca; }

/* ===================== Design Studio — workflow builder ===================== */
.studio-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.studio-eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 700;
  background: var(--ai-grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 2px; }
.wf-settings { margin-bottom: 16px; }
.studio-grid { display: grid; grid-template-columns: 1fr 250px; gap: 22px; align-items: start; }
@media (max-width: 860px) { .studio-grid { grid-template-columns: 1fr; } }

.studio-flow { min-width: 0; }
.wf-trigger, .wf-step {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(15,23,42,.05);
}
.wf-trigger { border-color: var(--ink); background: var(--panel); }
.wf-step { border-left: 4px solid var(--c, #6366f1); cursor: grab; transition: box-shadow .15s, transform .05s; }
.wf-step:hover { box-shadow: 0 10px 26px rgba(15,23,42,.12); }
.wf-step.dragging { opacity: .45; }
.wf-grip { color: #cbd5e1; cursor: grab; font-size: 13px; letter-spacing: -2px; }
.wf-step-ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 12px; color: #fff; font-size: 15px; flex-shrink: 0; box-shadow: 0 4px 10px rgba(15,23,42,.18); }
.wf-step-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.wf-step-body strong { font-size: 14px; color: var(--ink); }
.wf-step-sum { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-mini { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 8px; flex-shrink: 0; }
.wf-mini:hover { background: var(--bg); color: var(--primary-d); }

.wf-zone { position: relative; margin: 8px 0; border: 2px dashed #d6dbe7; border-radius: 12px; padding: 7px;
  text-align: center; transition: all .15s; }
.wf-zone.over { border-color: #6366f1; background: linear-gradient(90deg, rgba(99,102,241,.09), rgba(168,85,247,.06)); padding: 18px 7px; }
.wf-zone-hint { font-size: 11px; color: var(--muted); }
/* connector line between the trigger/steps and the drop-zones */
.wf-zone::before { content: ""; position: absolute; left: 50%; top: -9px; width: 2px; height: 9px; background: #d6dbe7; }
.wf-trigger + .wf-zone::before, .wf-step + .wf-zone::before { background: #cbd5e1; }

.studio-lib { position: sticky; top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 6px 18px rgba(15,23,42,.05); }
.studio-lib-title { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.wf-lib-block { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line);
  margin-bottom: 8px; cursor: grab; background: var(--panel); transition: border-color .12s, box-shadow .12s, transform .05s; }
.wf-lib-block:hover { border-color: var(--c, #6366f1); box-shadow: 0 6px 16px rgba(15,23,42,.09); }
.wf-lib-block:active { cursor: grabbing; transform: scale(.98); }
.wf-lib-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; font-size: 14px; flex-shrink: 0; }
.wf-lib-txt { min-width: 0; display: flex; flex-direction: column; }
.wf-lib-txt strong { font-size: 13px; color: var(--ink); }
.wf-lib-desc { font-size: 11px; color: var(--muted); }

/* ---- Mapbox address verification badge ---- */
.abadge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.abadge.ok { background: #dcfce7; color: #15803d; }
.abadge.warn { background: #fef3c7; color: #b45309; }
.abadge.bad { background: #fee2e2; color: #b91c1c; }
.abadge.unk { background: #eef2f7; color: #64748b; }

/* ===================== App footer (Unmasked-style, CRM edition) ===================== */
.app-foot { margin-top: 34px; padding: 22px 4px 10px; border-top: 1px solid #e7e9f2; font-size: 13px; color: #64748b; }
.foot-brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.foot-brand strong { font-size: 15px; color: var(--ink); }
.foot-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 20px; margin-bottom: 16px; }
.fcol-t { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #94a3b8; font-weight: 700; margin: 0 0 7px; }
.fcol ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.flink { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: #4f46e5; cursor: pointer; text-align: left; text-decoration: none; }
.flink:hover { text-decoration: underline; color: #4338ca; }
.foot-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid #eef0f6; font-size: 12px; color: #94a3b8; }

/* ===================== THEMES: light (default) · dark · purple ===================== */
html[data-theme="dark"] {
  --bg: #0f1120; --panel: #181b31; --ink: #e8eaf6; --muted: #9aa0c0; --line: #272b47;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 10px rgba(0,0,0,.35);
  --glow: 0 0 0 1px rgba(129,140,248,.25), 0 8px 30px rgba(99,102,241,.35);
  --side-bg: #090b1a; color-scheme: dark;
}
html[data-theme="purple"] {
  --bg: #f3efff; --panel: #ffffff; --ink: #241a47; --muted: #6f639c; --line: #e4dcf7;
  --primary: #7c3aed; --primary-d: #6d28d9; --accent: #c026d3;
  --ai-grad: linear-gradient(115deg, #7c3aed 0%, #c026d3 55%, #f472b6 100%);
  --ai-grad-soft: linear-gradient(115deg, rgba(124,58,237,.15), rgba(192,38,211,.12), rgba(244,114,182,.12));
  --glow: 0 0 0 1px rgba(124,58,237,.15), 0 8px 30px rgba(124,58,237,.25);
  --side-bg: #1e1339;
}
/* dark: neutralize hardcoded light backgrounds from later layers */
html[data-theme="dark"] .card, html[data-theme="dark"] .stat-card { background: rgba(24,27,49,.92); border-color: var(--line); }
html[data-theme="dark"] body::before { opacity: .25; }
html[data-theme="dark"] .input, html[data-theme="dark"] select.input, html[data-theme="dark"] textarea.input,
html[data-theme="dark"] input.input { background: #12142a; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .ss th { background: #1c2038; }
html[data-theme="dark"] .ss td, html[data-theme="dark"] .ss th { border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .feed-row, html[data-theme="dark"] .list-row { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .modal { background: var(--panel); color: var(--ink); }
html[data-theme="dark"] .kcol { background: #14172c; }
html[data-theme="dark"] .kcard { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .mbx-suggest { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .mbx-item { color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .stat-num { background: linear-gradient(120deg, #c7d2fe, #a5b4fc 120%); -webkit-background-clip: text; background-clip: text; }
html[data-theme="dark"] .app-foot { border-color: var(--line); color: var(--muted); }
html[data-theme="dark"] .foot-bar { border-color: var(--line); }
html[data-theme="dark"] .flink { color: #a5b4fc; }
html[data-theme="dark"] .tchip, html[data-theme="dark"] .chip { filter: brightness(1.15); }
html[data-theme="dark"] .empty { background: #14172c; border-color: var(--line); }
html[data-theme="dark"] .launcher-inner { background: rgba(18,20,42,.96); }
html[data-theme="purple"] .side-nav .nav-btn.on { background: linear-gradient(90deg, rgba(124,58,237,.5), rgba(192,38,211,.3)); }

/* ===================== Toasts ===================== */
#toasts { position: fixed; right: 18px; bottom: 84px; z-index: 240; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 11px 16px; font-size: 13px; box-shadow: 0 12px 32px rgba(15,23,42,.18);
  animation: toastIn .22s ease; max-width: 340px; pointer-events: auto; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===================== Command palette (⌘K) ===================== */
.palette { position: fixed; inset: 0; z-index: 230; background: rgba(10,12,30,.45); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.pal-box { width: 100%; max-width: 560px; background: var(--panel); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(10,12,40,.4); overflow: hidden; }
.pal-box input { width: 100%; border: 0; outline: 0; padding: 17px 20px; font: inherit; font-size: 16px; background: transparent; color: var(--ink); }
.pal-list { max-height: 46vh; overflow: auto; border-top: 1px solid var(--line); padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: 0;
  padding: 10px 12px; border-radius: 12px; font: inherit; color: var(--ink); cursor: pointer; }
.pal-item .pi { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; background: var(--ai-grad-soft); flex: none; }
.pal-item .pl { min-width: 0; flex: 1; } .pal-item .pl b { display: block; font-size: 14px; }
.pal-item .pl span { font-size: 12px; color: var(--muted); }
.pal-item.on, .pal-item:hover { background: var(--ai-grad-soft); }
.pal-hint { padding: 8px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; gap: 14px; }
.pal-hint kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 1px 6px; font-family: inherit; }
.sidebar .search-trigger { display: flex; align-items: center; gap: 8px; margin: 2px 10px 10px; padding: 8px 11px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #aab0d0; font: inherit; font-size: 12px; cursor: pointer; width: calc(100% - 20px); }
.sidebar .search-trigger:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar .search-trigger kbd { margin-left: auto; font-size: 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 1px 5px; }

/* ===================== Contact avatars ===================== */
.avat { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 700; flex: none; letter-spacing: .02em; box-shadow: 0 2px 6px rgba(15,23,42,.18); }
.avat.lg { width: 52px; height: 52px; font-size: 18px; }

/* ===================== Onboarding checklist ===================== */
.onboard { border-left: 4px solid var(--primary); }
.onboard .ob-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.onboard .ob-row.done { color: var(--muted); text-decoration: line-through; }
.onboard .ob-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.onboard .ob-row.done .ob-dot { background: #10b981; border-color: #10b981; color: #fff; }
.onboard .ob-bar { height: 7px; border-radius: 999px; background: var(--bg); overflow: hidden; margin: 8px 0 4px; }
.onboard .ob-bar i { display: block; height: 100%; background: var(--ai-grad); border-radius: 999px; transition: width .4s; }

/* ===================== Mobile bottom tabs ===================== */
#mobileTabs { display: none; }
@media (max-width: 760px) {
  #mobileTabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; background: var(--panel);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(15,23,42,.08); }
  #mobileTabs button { flex: 1; background: none; border: 0; font: inherit; font-size: 11px; color: var(--muted); display: flex;
    flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; cursor: pointer; border-radius: 12px; }
  #mobileTabs button .mt-i { font-size: 18px; line-height: 1; }
  #mobileTabs button.on { color: var(--primary); }
  main { padding-bottom: 86px !important; }
  /* A modal must never be covered by (or compete with) the bottom tab bar. */
  body.modal-open #mobileTabs { display: none; }
  .ai-fab { bottom: 76px; }
  #toasts { bottom: 140px; }
}

/* ===================== Empty states, upgraded ===================== */
.empty { border: 2px dashed var(--line); border-radius: 16px; background: var(--panel); text-align: center; padding: 44px 24px; }
.empty::before { content: attr(data-e); display: block; font-size: 44px; margin-bottom: 10px; filter: saturate(1.1); }
.empty:not([data-e])::before { content: "✨"; opacity: .85; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 8px; }

/* ===================== Shortcuts overlay ===================== */
.kbd-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; align-items: center; font-size: 14px; }
.kbd-grid kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; font-family: inherit; font-size: 12px; box-shadow: 0 1px 0 var(--line); white-space: nowrap; }

/* ===================== Dashboard drag widgets ===================== */
.dwidget { position: relative; }
.dwidget .dw-grip { position: absolute; top: 10px; right: 10px; z-index: 5; cursor: grab; color: var(--muted); opacity: 0;
  transition: opacity .15s; font-size: 14px; letter-spacing: -2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px; }
.dwidget:hover .dw-grip { opacity: .9; }
.dwidget.dragging { opacity: .5; }
.dwidget.dover { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: var(--radius); }

/* ---- sidebar theme switch ---- */
.theme-switch { display: flex; gap: 4px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 3px; margin-bottom: 8px; }
.theme-switch button { flex: 1; background: transparent; border: 0; color: #aab0d0; font-size: 13px; padding: 5px 0; border-radius: 8px; cursor: pointer; transition: background .12s, color .12s; }
.theme-switch button:hover { color: #fff; }
.theme-switch button.on { background: var(--ai-grad); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.4); }

/* ---- contact list "load more" ---- */
.load-more { text-align: center; padding: 14px 0; }

/* ---- notification bell ---- */
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-panel { position: fixed; top: 66px; right: 16px; z-index: 200; width: 340px; max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.24); }
.notif-head { padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.notif-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 11px 14px; font: inherit; color: var(--ink); cursor: pointer; }
.notif-row:hover { background: var(--ai-grad-soft); }
.notif-row .ni2 { font-size: 15px; flex: none; }
@media (max-width: 760px) { .notif-panel { width: calc(100vw - 24px); right: 12px; } }

/* ---- product tour ---- */
.tour-backdrop { position: fixed; inset: 0; z-index: 260; background: rgba(10,12,30,.5); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; padding: 0 16px 40px; }
.tour-card { background: var(--panel); color: var(--ink); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(10,12,40,.4); padding: 24px 26px; max-width: 440px; width: 100%; }
.tour-card h3 { font-size: 18px; margin: 6px 0 6px; }
.tour-card p { color: var(--muted); margin: 0; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 22px; height: 5px; border-radius: 999px; background: var(--line); }
.tour-dots span.on { background: var(--ai-grad); }

/* ============================ AI ACCENTS LAYER ============================ */
/* Animated gradient wordmark */
.brand .t em { background: linear-gradient(90deg, #8b8bff, #c58bff, #22d3ee, #8b8bff);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: aiShimmer 6s linear infinite; }
@keyframes aiShimmer { to { background-position: 220% 0; } }
/* "AI" badge next to the brand */
.ai-badge { margin-left: auto; flex: none; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff;
  padding: 2px 7px; border-radius: 999px; background: var(--ai-grad); background-size: 200% 100%;
  box-shadow: 0 2px 10px rgba(124,92,255,.5); animation: aiShift 5s ease infinite; }
@media (prefers-reduced-motion: reduce) { .brand .t em, .ai-badge { animation: none; } }

/* Neural glow behind the active nav item */
.nav-btn.active { position: relative; }
.nav-btn.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 8px; background: var(--ai-grad); box-shadow: 0 0 10px rgba(139,139,255,.8); }

/* Animated gradient underline on every view title (extends existing ::after) */
.view-head h1 { position: relative; }
.view-head h1::after { content: ""; position: absolute; left: 0; bottom: -6px; height: 3px; width: 42px;
  border-radius: 8px; background: var(--ai-grad); background-size: 200% 100%; animation: aiShift 5s ease infinite; }

/* Search trigger gets a soft AI aura on hover */
.sidebar .search-trigger { position: relative; overflow: hidden; }
.sidebar .search-trigger::after { content: ""; position: absolute; inset: 0; background: var(--ai-grad-soft);
  opacity: 0; transition: opacity .2s; }
.sidebar .search-trigger:hover::after { opacity: 1; }

/* Cards get a whisper-thin gradient top edge on hover (AI "active" feel) */
.card { position: relative; }
.card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 12px 14px 0 0;
  background: var(--ai-grad); opacity: 0; transition: opacity .2s; }
.card:hover::after { opacity: .9; }

/* Buttons: primary buttons carry the animated AI gradient */
.btn.primary { background: var(--ai-grad); background-size: 200% 100%; border: 0; animation: aiShift 7s ease infinite; }
.btn.primary:hover { filter: brightness(1.06); box-shadow: var(--glow); }

/* Sidebar: subtle scanning light near the top (neural sweep) */
.sidebar::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 140px; pointer-events: none;
  background: radial-gradient(120% 80% at 20% 0%, rgba(139,139,255,.18), transparent 70%); z-index: 0; }

/* ---- Social: Facebook / Instagram connection status ---- */
.conn-status { display: flex; flex-direction: column; gap: 8px; }
.conn-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); }
.conn-row.on { border-color: rgba(16,185,129,.4); background: linear-gradient(90deg, rgba(16,185,129,.10), rgba(16,185,129,.02)); }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; flex: none; }
.conn-row.on .conn-dot { background: #10b981; box-shadow: 0 0 0 0 rgba(16,185,129,.5); animation: connPulse 2s infinite; }
@keyframes connPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); } 50% { box-shadow: 0 0 0 5px rgba(16,185,129,0); } }
.conn-ico { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; flex: none; }
.conn-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conn-txt strong { font-size: 14px; color: var(--ink); }
.conn-badge { flex: none; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  background: #eef1f7; color: #64748b; }
.conn-badge.on { background: #dcfce7; color: #15803d; }
@media (prefers-reduced-motion: reduce) { .conn-row.on .conn-dot { animation: none; } }

/* ===================== top-right control cluster ===================== */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 14px 0 10px; background: var(--bg); flex: none; }
.topbar .tb-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 16px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; position: relative; }
.topbar .tb-btn:hover { box-shadow: var(--glow); }
/* neutralize the old standalone fixed positioning now that these live in the cluster */
.topbar .apps-btn { position: static; top: auto; right: auto; }
.topbar .notif-badge { position: absolute; top: -4px; right: -4px; }
.acct-btn { gap: 5px; padding: 0 8px; width: auto !important; }
.acct-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ai-grad); color: #fff;
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.acct-caret { font-size: 11px; color: var(--muted); }

/* account dropdown */
.acct-menu { position: fixed; top: 64px; right: 16px; z-index: 200; width: 268px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.24); overflow: hidden; }
.acct-head { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.acct-head .acct-avatar { width: 40px; height: 40px; font-size: 15px; }
.acct-head b { display: block; font-size: 14px; } .acct-head span { font-size: 12px; color: var(--muted); }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  padding: 11px 16px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.acct-item:hover { background: var(--ai-grad-soft); }
.acct-item.danger { color: var(--danger); }
.acct-sub { padding: 8px 16px 3px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border-top: 1px solid var(--line); }
.acct-ws { max-height: 210px; overflow: auto; }
.acct-ws .acct-item { padding: 9px 16px; }
.acct-ws .acct-item .aw-ava { width: 24px; height: 24px; border-radius: 8px; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }

/* impersonation banner */
.imp-banner { position: sticky; top: 0; z-index: 40; background: linear-gradient(90deg, #f59e0b, #f97316); color: #fff;
  font-size: 13px; font-weight: 600; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.imp-banner button { background: rgba(255,255,255,.25); border: 0; color: #fff; font: inherit; font-weight: 700;
  padding: 4px 12px; border-radius: 8px; cursor: pointer; }
.imp-banner button:hover { background: rgba(255,255,255,.4); }

/* keep view-head controls clear of the fixed cluster */
.view-head {  }
@media (max-width: 760px) { .topbar { padding: 10px 0 8px; } }

/* ---- Settings: modules grid ---- */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 4px; }
.mod-card { display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; cursor: pointer; background: var(--bg); transition: border-color .12s, box-shadow .12s; }
.mod-card:hover { box-shadow: var(--shadow); }
.mod-card.on { border-color: rgba(99,102,241,.4); background: var(--ai-grad-soft); }
.mod-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mod-label { font-weight: 700; font-size: 13px; color: var(--ink); }
.mod-desc { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ---- kanban: add-deal + card meta ---- */
.kcol-head { display: flex; align-items: center; gap: 6px; }
.kcol-add { margin-left: auto; width: 22px; height: 22px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; flex: none; }
.kcol-add:hover { background: var(--ai-grad); color: #fff; border-color: transparent; }
.kadd-empty { width: 100%; border: 1.5px dashed var(--line); background: transparent; color: var(--muted);
  border-radius: 12px; padding: 12px; font: inherit; font-size: 13px; cursor: pointer; }
.kadd-empty:hover { border-color: var(--primary); color: var(--primary); background: var(--ai-grad-soft); }
.kdispo { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kassign { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-top: 5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px 2px 3px; }

/* ===================== Skeleton loading states ===================== */
.skel { display: block; border-radius: 8px;
  background: linear-gradient(90deg, var(--line) 25%, #eef0f8 37%, var(--line) 63%);
  background-size: 400% 100%; animation: skelsh 1.3s ease infinite; }
@keyframes skelsh { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
html[data-theme="dark"] .skel, html[data-theme="purple"] .skel {
  background: linear-gradient(90deg, #21243f 25%, #2c3054 37%, #21243f 63%); background-size: 400% 100%; }
.skel-title { width: 210px; height: 30px; }
.skel-btn { width: 120px; height: 38px; border-radius: 12px; }
.skel-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.skel-av { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-l1 { width: 42%; height: 12px; } .skel-l2 { width: 68%; height: 10px; }
.skel-pill { width: 74px; height: 22px; border-radius: 999px; flex: none; }
.skel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.skel-card { height: 92px; border-radius: 12px; }
.skel-kanban { display: flex; gap: 14px; overflow: hidden; }
.skel-kcol { flex: 1; min-width: 0; } .skel-kh { display: block; height: 20px; width: 62%; margin-bottom: 12px; }

/* ===================== Collapsible sidebar groups ===================== */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group.collapsed { display: none; }
.nav-lbl-btn { display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 0; background: transparent; cursor: pointer; font: inherit; }
.nav-lbl-btn .nl-t { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #565d8a; }
.nav-lbl-btn .chev { font-size: 11px; color: #565d8a; transition: transform .18s ease; }
.nav-lbl-btn[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.nav-lbl-btn:hover .nl-t, .nav-lbl-btn:hover .chev { color: #9aa0cf; }

/* ===================== Global "＋ New" quick-add ===================== */
.topbar .qa-btn { width: auto !important; padding: 0 13px; gap: 5px;
  background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; font-weight: 700; }
.topbar .qa-btn:hover { background: var(--primary-d) !important; box-shadow: 0 6px 18px rgba(99,102,241,.4); }
.qa-btn .qa-plus { font-size: 16px; line-height: 1; }
.qa-btn .qa-word { font-size: 13px; }
@media (max-width: 760px) { .qa-btn .qa-word { display: none; } }
.qa-menu { position: fixed; z-index: 210; width: 210px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 18px 50px rgba(20,22,43,.22); padding: 6px; animation: qapop .14s ease; }
@keyframes qapop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.qa-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent;
  font: inherit; font-weight: 600; color: var(--ink); padding: 10px 12px; border-radius: 8px; cursor: pointer; text-align: left; }
.qa-item:hover, .qa-item:focus { background: var(--bg); }
.qa-item .qa-i { width: 24px; height: 24px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; font-size: 13px; flex: none; }

/* Reserve space at the top-right of every view header for the fixed top-bar
   cluster (＋ New · bell · account · launcher) so action buttons never slide
   underneath it. Mobile moves the cluster to the bottom, so it resets to 0. */


/* ===================== crisp icon set ===================== */
/* Named SVG slots ([data-i]) replace the old Unicode glyphs, which rendered
   at different weights/sizes on every OS and never optically matched. */
.ni, .mt-i, .ni-i { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ni svg   { width: 18px; height: 18px; }
.mt-i svg { width: 20px; height: 20px; }
.ni-i svg { width: 19px; height: 19px; }
.nav-btn .ni { width: 18px; height: 18px; opacity: .82; }
.nav-btn.active .ni, .nav-btn:hover .ni { opacity: 1; }
@media (max-width: 860px) { .nav-btn .ni { opacity: 1; } }

/* Mobile: the bottom tab bar is the navigation — the 62px icon rail was pure
   dead weight next to it, and clipped its own labels. Hide the sidebar. */
@media (max-width: 760px) {
  .sidebar { display: none; }
  main { padding-left: 16px; padding-right: 16px; }
}

/* Contacts rows on narrow screens.
   The old rule gave a 4-child row only 3 columns, so .cell.name resolved to 0px
   (its min-content is 0 thanks to the ellipsis) and the fixed disposition strip
   ate the row — names rendered as a bare "S…". Stack instead: checkbox + name on
   the first line, the disposition strip below it and free to scroll sideways. */
@media (max-width: 860px) {
  .tr { grid-template-columns: 30px minmax(0, 1fr); gap: 8px 10px; align-items: center; }
  .tr > .cell.name { min-width: 0; }
  .tr > .cell.quicklog,
  .tr > .cell.actions { grid-column: 1 / -1; overflow-x: auto; overscroll-behavior-x: contain; }
  .tr > .cell.quicklog { padding-bottom: 2px; }
}

/* Inline icons inside buttons/chips: align with the label and inherit its colour. */
.btn-i { display: inline-flex; align-items: center; }
.btn-i svg { width: 16px; height: 16px; }
.btn svg.ic, .qbtn svg.ic, .tchip svg.ic, .icon-btn svg.ic, .qa-i svg { width: 16px; height: 16px; vertical-align: -3px; }
.icon-btn svg.ic { width: 17px; height: 17px; vertical-align: middle; }
.qbtn svg.ic { width: 15px; height: 15px; vertical-align: -2px; }
.qa-i { display: inline-flex; align-items: center; justify-content: center; width: 18px; }
.btn > svg.ic:only-child, .icon-btn > svg.ic:only-child { vertical-align: middle; }

/* Ask-AI FAB: get out of the way while the user scrolls a list, return at rest. */
.ai-fab { transition: transform .22s ease, opacity .22s ease; }
.ai-fab.fab-away { transform: translateY(120%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .ai-fab { transition: none; } }

/* Row overflow (⋯) for the outcomes that no longer ride in every row. */
.qbtn-more { color: var(--muted); }
.qbtn-more:hover { color: var(--ink); }
#dispoMenu .qa-i svg.ic { width: 15px; height: 15px; }

/* Power dialer bar — pinned under the header while a session runs. */
.pd-bar { position: sticky; top: 62px; z-index: 30; border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--glow); }
.pd-bar .qbtn { min-width: 38px; }

/* Icon safety net. An inline <svg> with no width/height falls back to the
   browser's replaced-element default — a phone icon rendered 649px wide inside
   a card <h3> because no rule happened to match it. :where() has ZERO
   specificity, so this is a floor for any unstyled context while every rule
   above (.ni svg, .qbtn svg.ic, .icon-btn svg.ic …) still wins. */
:where(svg.ic) { width: 16px; height: 16px; flex: none; }
.card h3 svg.ic { width: 17px; height: 17px; vertical-align: -3px; }

/* ===== Accessibility: visible keyboard focus everywhere =====
   Previously only 3 controls had a focus ring; every button, nav item and menu
   item was invisible to keyboard users (WCAG 2.4.7 fail). Zero-specificity
   :where() floor so component styles still win, but nothing is unfocusable. */
:where(button, [role="button"], a[href], .nav-btn, .tb-btn, .icon-btn, .qbtn, .qa-item, .stat-card, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}
:where(.sidebar .nav-btn, .side-lbl):focus-visible { outline-color: #b7b7ff; outline-offset: -2px; }
/* stat tiles are clickable now — make that obvious */
button.stat-card { cursor: pointer; text-align: left; font: inherit; width: 100%; transition: transform .12s, box-shadow .15s; }
button.stat-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }

/* ===== "new version available" banner =====
   Pinned bottom-centre. Fixed width + negative margin (not translateX) so the
   mobile override can reposition it without fighting a transform. */
.update-bar {
  position: fixed; z-index: 130; bottom: 20px; left: 50%; margin-left: -195px; width: 390px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--line));
  border-radius: 999px; padding: 9px 10px 9px 18px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .20);
  font-size: 14px; animation: ubIn .22s ease;
}
.update-bar .ub-txt { flex: 1; min-width: 0; }
.update-bar .icon-btn { color: var(--muted); }
@keyframes ubIn { from { opacity: 0 } to { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .update-bar { animation: none; } }
/* clear the bottom tab bar on phones */
@media (max-width: 760px) {
  .update-bar { left: 12px; right: 12px; width: auto; margin-left: 0; bottom: 88px; }
}

/* Respect the OS "reduce motion" setting globally (transitions included). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* Mobile ergonomics — placed last so these win over the base rules above. */
@media (max-width: 760px) {
  /* 44px minimum touch targets — keep the glyph small, grow the hit box. */
  .icon-btn, .qbtn, .chip-x, .star, .kcol-add, .wf-mini {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .topbar .tb-btn { width: 44px; height: 44px; }
  .bulkbar { top: 56px; }
  .dial-dispos { grid-template-columns: 1fr; }
  .acct-menu { left: 12px; right: 12px; width: auto; }
}

/* Settings tab bar — one group of cards at a time (see setupSettingsTabs). */
.settings-tabs { position: sticky; top: 62px; z-index: 30; background: var(--bg); padding: 8px 0; margin-bottom: 4px; }
.settings-tabs .tchip { font-size: 13px; }
@media (max-width: 760px) { .settings-tabs { top: 56px; overflow-x: auto; flex-wrap: nowrap; } }

/* Empty-state CTA target highlight (see the focus-field action). */
.flash-focus { animation: flashFocus 1.2s ease-out; }
@keyframes flashFocus { 0% { box-shadow: 0 0 0 0 rgba(91,91,246,.55); } 100% { box-shadow: 0 0 0 10px rgba(91,91,246,0); } }
@media (prefers-reduced-motion: reduce) { .flash-focus { animation: none; outline: 2px solid var(--primary); } }

/* mod-card / wf-lib-block became real <button>s so keyboard users can reach
   them; neutralise the UA button defaults so they look unchanged. */
.mod-card, .wf-lib-block { font: inherit; text-align: left; color: inherit; width: 100%; }

/* Touch targets. Keep the glyph small, grow the hit box to the 44px minimum. */
@media (max-width: 760px) {
  .icon-btn, .qbtn, .chip-x, .star, .kcol-add, .wf-mini {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .tb-btn { width: 44px; height: 44px; }
  .tr input[type=checkbox] { position: relative; }
  .tr input[type=checkbox]::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%,-50%);
  }
  .dial-dispos { grid-template-columns: 1fr; }
  .acct-menu { left: 12px; right: 12px; width: auto; }
  .modal-wrap { padding: 20px 12px; }
}
body.modal-open #mobileTabs { display: none; }   /* tab bar must not overlay a dialog */

/* One reduced-motion rule instead of nine ad-hoc blocks. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---- Type & alignment system -------------------------------------------
   Numbers in proportional fonts have varying glyph widths, so stacked
   figures never line up. tabular-nums fixes columns of money, counts,
   dates and phone numbers without changing the typeface. */
.ss, .table, .tr, .cell, .badge, .kpi, .dsh, .feed-when,
.ph-inline, .money, .num, .dc-n, .progress, .wallet-bal, .chip,
/* button.stat-card sets `font: inherit`, and the font shorthand resets
   font-variant-numeric — so it needs matching specificity, not just order. */
.stat-card, button.stat-card {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
/* Headline figures also want tighter tracking so they read as one number. */
.stat-card strong, .stat-card .n, .kpi b, .big-num { letter-spacing: -.02em; }

/* Shared truncation — replaces 14 copies of the same inline style string. */
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Semantic status tokens, so chips stop carrying hardcoded hex inline. */
:root { --ok: #10b981; --warn: #f59e0b; --danger: #ef4444; --info: #0ea5e9; --neutral: #94a3b8; }
.chip.ok { --c: var(--ok); } .chip.warn { --c: var(--warn); }
.chip.danger { --c: var(--danger); } .chip.info { --c: var(--info); }
.chip.muted { --c: var(--neutral); }

/* View headers: title and its action row share a baseline and wrap cleanly
   instead of drifting apart at narrow widths. */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-head h1 { line-height: 1.25; }
.view-head .btn, .view-head .row { align-self: center; }

/* Consistent card rhythm — padding was drifting between 12/14/18/26/28/32px. */
.card { padding: 18px; }
.card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* ---- Workspace switcher (GHL-style) ------------------------------------- */
.ws-switch { display: inline-flex; align-items: center; gap: 9px; max-width: 280px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 12px; font: inherit; font-weight: 700; font-size: 13px; color: var(--ink);
  cursor: pointer; box-shadow: var(--shadow); }
.ws-switch:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.ws-switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ws-ava { width: 22px; height: 22px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--primary); }
.ws-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-caret { color: var(--muted); font-size: 11px; flex: none; }
.ws-menu { position: fixed; z-index: 160; width: 320px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15,23,42,.22); overflow: hidden; }
.ws-menu .ws-search { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px;
  font: inherit; font-size: 14px; background: transparent; color: var(--ink); }
.ws-menu .ws-search:focus { outline: none; }
.ws-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.ws-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink);
  padding: 9px 10px; border-radius: 12px; cursor: pointer; }
.ws-item:hover, .ws-item:focus-visible { background: var(--bg); outline: none; }
.ws-item.on { background: color-mix(in srgb, var(--primary) 12%, var(--panel)); font-weight: 700; }
.ws-item .ws-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.ws-item .grow { flex: 1; min-width: 0; }
.ws-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 10px 12px 4px; }
.ws-empty { padding: 14px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .ws-switch { max-width: 46vw; } }

/* ---- Template gallery ---------------------------------------------------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl-card { display: flex; flex-direction: column; gap: 5px; text-align: left; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; cursor: pointer;
  transition: border-color .12s, transform .1s, box-shadow .12s; }
.tpl-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tpl-card[disabled] { opacity: .6; cursor: default; transform: none; }
.tpl-card strong { font-size: 14px; line-height: 1.3; }
.tpl-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; color: #fff; margin-bottom: 2px; }
.tpl-meta { font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---- Design studio (funnels & websites) ---------------------------------- */
.studio-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 10px 0 12px; background: var(--bg); flex-wrap: wrap; }
.studio-title { font-weight: 700; font-size: 15px; max-width: 260px; }
.studio-slug { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; }
.studio-slug input { border: 0; background: none; font: inherit; font-size: 12px; color: var(--ink);
  padding: 0; width: 150px; }
.studio-slug input:focus { outline: none; }
.dev-switch { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dev-switch button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700;
  color: var(--muted); padding: 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.dev-switch button.on { background: var(--ink); color: #fff; }
.dev-switch button span { display: none; }
@media (min-width: 1100px) { .dev-switch button span { display: inline; } }

.studio { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .studio { grid-template-columns: 1fr; } }
.studio-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; max-height: calc(100vh - 90px); overflow-y: auto; }
.studio-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.studio-panel-h { padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 12px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; justify-content: space-between; }
.studio-add { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.studio-add select { flex: 1; min-width: 0; }

.studio-canvas { background:
  repeating-conic-gradient(from 45deg, color-mix(in srgb, var(--line) 55%, transparent) 0% 25%, transparent 0% 50%) 0 0/18px 18px;
  border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; justify-content: center;
  min-height: 520px; }
/* ---- Dial pad ------------------------------------------------------------ */
.dial-display { font-size: 22px; font-weight: 700; letter-spacing: .02em; text-align: center;
  font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.key { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 54px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 16px; cursor: pointer; font: inherit; transition: transform .06s, background .12s; }
.key:hover { background: var(--bg); }
.key:active { transform: scale(.95); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); }
.key:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.key .kd { font-size: 21px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.key .kl { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); }
.key-back { grid-column: 3; }

/* Corner phone button (replaces the Ask AI FAB for now). */
.phone-fab { background: linear-gradient(135deg, #0e9f6e, #059669); }
.phone-fab .spark { font-size: 20px; }

.studio-frame { position: relative; width: 100%; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(15,23,42,.16); transition: max-width .2s ease; }
.studio-frame.desktop { max-width: 100%; }
.studio-frame.tablet  { max-width: 820px; }
.studio-frame.mobile  { max-width: 390px; }
.studio-frame iframe { display: block; width: 100%; height: min(78vh, 900px); border: 0; background: #fff; }
.studio-mask { position: absolute; top: 10px; right: 10px; background: rgba(17,24,39,.82); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; display: flex; align-items: center; gap: 6px; }
.skel-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: skelPulse 1s infinite; }
@keyframes skelPulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }

/* Grouped business-mode tiles in Settings */
.preset-group{margin-top:14px}
.preset-group[hidden]{display:none}
.preset-group .side-lbl{margin-bottom:6px}
.tpl-card[hidden]{display:none}

/* Env-var snippets in settings cards */
.code-block{background:var(--panel-2,#f4f5fb);border:1px solid var(--line,#e5e7f0);border-radius:8px;
  padding:10px 12px;margin:8px 0;font:12.5px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace;
  white-space:pre-wrap;word-break:break-word;overflow-x:auto;color:var(--ink,#171a2b)}

/* Keeps the brand row and search box legible no matter where the aurora
   animation is: a flat dark scrim above the glow, below the content. */
.sidebar::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 150px;
  background: linear-gradient(180deg, rgba(8,9,20,.72) 0%, rgba(8,9,20,.45) 60%, transparent 100%);
  pointer-events: none; z-index: 0;
}

/* ---- Today's work queue --------------------------------------------------- */
.wq-card{padding:14px 16px}
.wq-money{margin:10px 0 4px;padding:9px 12px;border-radius:10px;font-size:13.5px;
  background:rgba(239,68,68,.09);border:1px solid rgba(239,68,68,.28);color:#b42318}
.wq-legend{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 4px}
.wq-chip{font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:999px;
  color:var(--c);background:color-mix(in srgb,var(--c) 12%,transparent);
  border:1px solid color-mix(in srgb,var(--c) 30%,transparent)}
.wq-feed{margin-top:10px}
.wq-row{align-items:center;gap:10px;border-left:3px solid var(--c);padding-left:10px}
.wq-ico{font-size:16px;flex:none;width:22px;text-align:center}
.wq-main{flex:1;min-width:0}
.wq-main .link-btn{font-weight:650}
.wq-also{font-size:11px;font-weight:700;color:var(--muted-ink,#667085)}
.wq-acts{flex:none}
@media(max-width:640px){
  .wq-row{flex-wrap:wrap}
  .wq-acts{width:100%;justify-content:flex-end}
}
