/* ==================================================================
   WAVE 1 — DESIGN-SYSTEM TOKEN LAYER (Attio-grade, light + dark)
   One accent, hairline borders, Inter type. Legacy var names kept as
   aliases so every existing selector keeps working (this is a re-skin,
   not a re-layout). Dark set via :root[data-theme="dark"].
   Accent is runtime-overridable from the white-label brand spine
   (app.js applyAccent() sets --accent from GET /api/brand).
   ================================================================== */
:root {
  /* ---- accent (ONE brand accent; overridable at runtime) ---- */
  --accent: #1a73e8;          /* VizionCRM blue (default) */
  --accent-d: #1560c2;        /* derived hover/darker shade */
  --accent-ring: rgba(26,115,232,.28);

  /* ---- semantic surfaces + content (PRD names) ---- */
  --bg: #ffffff;              /* page canvas */
  --fg: #1c1d1f;              /* foreground text (near-black w/ hue) */
  --card: #ffffff;            /* raised card / panel surface */
  --border: #ebecf0;          /* 1px hairline */
  --muted: #666666;
  --soft: #f5f7fa;            /* app canvas + subtle inset fills */

  /* ---- legacy aliases (map onto tokens — keep old selectors alive) ---- */
  --panel: var(--card);
  --ink: var(--fg);
  --line: var(--border);
  --brand: var(--accent);
  --brand-d: var(--accent-d);

  /* ---- status / feedback ---- */
  --ok: #16a34a; --warn: #d97706; --err: #dc2626;
  --hi: #fee2e2; --med: #fef3c7; --lo: #e0f2fe;

  /* ---- status pills (soft pastel bg + bold text) ---- */
  --pill-lead-bg: #e0f2fe;     --pill-lead-fg: #0369a1;
  --pill-contract-bg: #ede9fe; --pill-contract-fg: #6d28d9;
  --pill-won-bg: #dcfce7;      --pill-won-fg: #15803d;
  --pill-lost-bg: #eef1f5;     --pill-lost-fg: #5b6472;
  --pill-rotting-bg: #fee2e2;  --pill-rotting-fg: #b91c1c;

  /* ---- skeleton shimmer ---- */
  --skeleton-base: #eceef2; --skeleton-shine: #f6f8fb;

  /* ---- motion + type ---- */
  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- DARK: full token set; accent stays constant across modes ---- */
:root[data-theme="dark"] {
  --bg: #0d0e10;
  --fg: #eff3f4;
  --card: #121417;
  --border: #1c2536;
  --muted: #97a0af;
  --soft: #0d0e10;
  --accent-ring: rgba(26,115,232,.42);

  --ok: #4ade80; --warn: #fbbf24; --err: #f87171;
  --hi: #3a1d1d; --med: #3a3016; --lo: #13233a;

  --pill-lead-bg: #0c2b45;     --pill-lead-fg: #7cc3ff;
  --pill-contract-bg: #241a4d; --pill-contract-fg: #c4b5fd;
  --pill-won-bg: #0f2e1c;      --pill-won-fg: #6ee7a0;
  --pill-lost-bg: #1c2230;     --pill-lost-fg: #9aa4b2;
  --pill-rotting-bg: #3a1616;  --pill-rotting-fg: #fca5a5;

  --skeleton-base: #1a1d22; --skeleton-shine: #242830;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.5 var(--font-sans); color: var(--ink); background: var(--soft); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- auth (two-column split → single card on mobile) ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--soft); }

/* left brand / value-prop panel */
.auth-brandside {
  position: relative; overflow: hidden; color: #eaf0fb;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 56px 40px;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(37,99,235,.55), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(29,78,216,.5), transparent 55%),
    linear-gradient(150deg, #0f1622 0%, #101a2e 45%, #16223b 100%);
}
.auth-brandinner { max-width: 460px; margin: auto 0; }
.auth-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.auth-mark { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-d)); color: #fff; font-weight: 800; font-size: 24px;
  box-shadow: 0 8px 22px rgba(37,99,235,.5); letter-spacing: -.5px; }
.auth-wordmark { font-size: 24px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
.auth-tagline { font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -.8px; margin: 0 0 16px; color: #fff; }
.auth-subtag { font-size: 16px; line-height: 1.55; color: #aab8d4; margin: 0 0 30px; max-width: 400px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #dbe4f5; }
.auth-tick { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; position: relative; background: rgba(37,99,235,.25); border: 1px solid rgba(120,160,255,.5); }
.auth-tick::after { content: ""; position: absolute; left: 7px; top: 4px; width: 5px; height: 10px; border: solid #7ea8ff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.auth-brand-foot { font-size: 12.5px; color: #6f7f9e !important; }

/* right form side */
.auth-formside { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { background: var(--panel); width: 100%; max-width: 400px; border-radius: 16px; padding: 40px 36px; box-shadow: 0 24px 60px rgba(15,22,40,.14), 0 2px 8px rgba(15,22,40,.06); border: 1px solid var(--line); }
.auth-card-head { margin-bottom: 22px; }
.auth-mark-mobile { display: none; margin-bottom: 16px; }
.brand { margin: 0 0 6px; font-size: 25px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.auth-card-head .muted { margin: 0; font-size: 14px; }
.auth-card label { display: block; margin: 15px 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.auth-card input { display: block; width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-weight: 400; background: var(--card); color: var(--ink); transition: border-color var(--transition), box-shadow var(--transition); }
.auth-card input::placeholder { color: #aab2be; font-weight: 400; }
.auth-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-ring); }
.auth-card .row { display: flex; gap: 10px; }
.auth-card .row label { flex: 1; }
.auth-switch { margin: 16px 0 0; text-align: center; }
.error { background: var(--hi); color: var(--err); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin: 10px 0; }
.btn-lg { width: 100%; padding: 12px 16px; font-size: 15px; margin-top: 18px; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; background: linear-gradient(155deg, #0f1622, #16223b); }
  .auth-brandside { display: none; }
  .auth-formside { min-height: 100vh; padding: 24px 18px; }
  .auth-card { max-width: 400px; }
  .auth-mark-mobile { display: grid; }
}

/* ---------- buttons ---------- */
.btn { cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 10px 16px; border-radius: 9px; font-size: 15px; font-weight: 600; transition: background var(--transition), border-color var(--transition), color var(--transition); }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.primary, .auth-card .btn { width: auto; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 2px 6px; font-size: 13px; }
.link.danger { color: var(--err); }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 18px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 18px; height: 56px; position: sticky; top: 0; z-index: 5; }
.brand-sm { font-weight: 800; color: var(--brand); font-size: 18px; }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--lo); color: var(--brand-d); }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.identity-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1; }
.identity-badge .id-user { font-weight: 700; color: var(--brand-d, var(--brand)); }
.identity-badge .id-company { color: var(--muted); }
.identity-badge .id-version { background: var(--lo, #eef); color: var(--brand-d, var(--brand)); border-radius: 6px; padding: 2px 6px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Full-bleed content: no width cap here (the shell rule below also enforces
   max-width:none). Removing the stale 1200px cap so authed views fill the
   whole app-body edge-to-edge with no dead space on the right. */
main { padding: 22px; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.view-head h2 { margin: 0; font-size: 21px; }
.spacer { flex: 1; }
.sub { margin: 22px 0 10px; font-size: 15px; color: var(--muted); }
.search { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; min-width: 220px; background: var(--card); color: var(--ink); transition: border-color var(--transition), box-shadow var(--transition); }
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-ring); }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- board ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 250px; width: 250px; flex: 1 1 250px; max-width: 420px; min-height: 62vh; position: relative; }
.col:not(:last-child)::after { content: ''; position: absolute; top: 10%; bottom: 10%; right: -8px; width: 1px; background: var(--border); opacity: .55; pointer-events: none; }
.col.drop { outline: 2px dashed var(--brand); }
.col.no-drop { cursor: not-allowed; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.count { background: var(--soft); color: var(--muted); border-radius: 10px; padding: 1px 9px; font-size: 12px; }
.col-list { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 9px; padding: 11px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: border-color var(--transition), box-shadow var(--transition); }
.card.dragging { opacity: .5; }
.card.prio-high { border-left-color: var(--err); }
.card.prio-medium { border-left-color: var(--warn); }
.card.prio-low { border-left-color: var(--brand); }
.card-title { font-weight: 600; margin-bottom: 6px; }
.card-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.pill { background: var(--soft); border-radius: 20px; padding: 2px 9px; font-size: 12px; color: var(--ink); }
.pill.ok { background: #dcfce7; color: var(--ok); }
.pill.warn { background: var(--med); color: var(--warn); }
/* Rotting deal on the board — subtle at-a-glance cue (reuses --pill-rotting tokens; keeps priority left-border). */
.card.rotting { box-shadow: inset 0 0 0 1px var(--pill-rotting-fg), 0 1px 2px rgba(0,0,0,.04); }

/* ---------- tables / cards ---------- */
/* Wide tables (e.g. the 8-column Contacts list) scroll inside their own
   container so a narrow desktop never widens the page body / drags the shell. */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
.table-scroll .tbl.people { min-width: 900px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl th { background: var(--soft); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tbl th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.sortable:hover { color: var(--brand-d); }
.tbl th.sortable.active { color: var(--brand-d); }
.tbl tr:last-child td { border-bottom: 0; }
.cell-date { font-size: 13px; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; }
/* auto-FIT (not auto-fill): collapses empty trailing tracks so cards stretch to
   fill the full row width instead of leaving blank columns on the right. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.mini-card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- forms / modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,20,25,.55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; padding: 24px; position: relative; box-shadow: 0 30px 60px rgba(0,0,0,.4); }
.modal-x { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.form h3, .detail h3 { margin: 0 0 14px; }
.form .row { display: flex; gap: 10px; }
.fld { display: block; margin: 12px 0; }
.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.fld input, .fld select, .fld textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 16px; font-family: inherit; background: var(--card); color: var(--ink); transition: border-color var(--transition), box-shadow var(--transition); }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-ring); }
.form .check { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; }
.form .check input { width: auto; }
.check-group { display: flex; flex-direction: column; gap: 2px; }
.check-group .check { margin: 6px 0; }
.form .btn { margin-top: 8px; }
.form-inline { display: flex; gap: 8px; margin-top: 12px; }
.form-inline input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; background: var(--card); color: var(--ink); }
.form-inline .composer-type { flex: 0 0 auto; padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; background: var(--card); color: var(--ink); }
.form-inline .composer-due { flex: 0 0 140px; }

/* ---------- password change modal ---------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 66px; box-sizing: border-box; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 8px; }
.pw-toggle:hover { text-decoration: underline; }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.tl-row { display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--line); padding: 4px 0 4px 10px; }
.tl-type { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); font-weight: 700; }
.tl-note { font-size: 14px; }
.tl-due { font-style: italic; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 11px 20px; border-radius: 10px; color: #fff; font-weight: 600; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }

@media (max-width: 640px) {
  main { padding: 14px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .tabs { overflow-x: auto; }
  .fld input, .fld select, .fld textarea { font-size: 16px; }
  /* keep identity+version visible on mobile (poka-yoke); company name folds away to save width */
  .identity-badge { flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; }
  .identity-badge .id-company { display: none; }
}

/* ---------- pipeline settings (stage editor) ---------- */
.stage-editor { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin: 8px 0 16px; }
.stage-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; cursor: grab; }
.stage-row.dragging { opacity: .5; }
.stage-row.drop { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }
.stage-row .drag-handle { color: var(--muted); cursor: grab; user-select: none; }
.stage-row .stage-name { font-weight: 600; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--err); }

/* ---------- brand settings (Feature C) ---------- */
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; max-width: 820px; }
.brand-grid .form { margin: 0; }
.brand-grid input[type="color"] { height: 42px; padding: 4px; }
.brand-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.brand-preview-bar { height: 10px; background: var(--brand); }
.brand-preview-body { padding: 18px; }
.brand-preview-title { font-weight: 800; font-size: 18px; color: var(--brand); margin-bottom: 6px; }
.brand-preview-btn { margin-top: 12px; border: 0; color: #fff; background: var(--brand-d); padding: 9px 16px; border-radius: 9px; font-weight: 600; cursor: default; }
@media (max-width: 640px) { .brand-grid { grid-template-columns: 1fr; } }

/* ---------- campaigns / sequences (Feature C) ---------- */
.cp-result { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.seq-card .seq-head { display: flex; justify-content: space-between; align-items: center; }
.seq-steps { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; }
.seq-step { display: flex; gap: 8px; align-items: center; }
.seq-card .row-actions { flex-wrap: wrap; margin-top: 6px; }
.seq-build-steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.seq-build-row { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 8px; padding: 7px 10px; }

/* ---------- Wave 1: reports / audit / saved views ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
.kpi-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi-card.warn { border-color: var(--warn); }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; }
.kpi-card.warn .kpi-value { color: var(--warn); }
.kpi-label { margin-top: 4px; }
.kpi-sub { margin-top: 2px; }
.bars { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 18px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 120px; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 6px 0 0 6px; }
.bar-val { font-size: 13px; color: var(--muted); text-align: right; }
.saved-views-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.saved-views-bar select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.sv-chips { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; margin-top: 4px; }

/* ==================================================================
   APP SHELL — grouped left sidebar (GHL/Pipedrive-grade nav)
   ================================================================== */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar { width: 236px; flex: 0 0 236px; background: #0f1622; color: #cdd5e0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; padding: 18px 18px 12px; }
.side-brand-stack { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.side-brand-name { font-weight: 800; font-size: 18px; color: #fff; letter-spacing: -.3px; line-height: 1.15; }
.side-brand-attr { display: flex; align-items: center; gap: 6px; }
.side-logo { width: 18px; height: 18px; border-radius: 5px; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 11px; flex: 0 0 18px; }
.side-attr-by { font-size: 11px; color: #8a94a6; font-weight: 600; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.nav-group { text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; color: #64748b; margin: 15px 10px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: none; color: #cdd5e0; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item .nav-ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .92; }
.nav-item.active .nav-ico { opacity: 1; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.side-foot .identity-badge { flex-direction: column; align-items: flex-start; gap: 4px; }
.side-foot .identity-badge .id-company { order: -1; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -.2px; }
.side-foot .identity-badge .id-user { color: #8b97a8; font-weight: 600; font-size: 11.5px; }
.side-foot .identity-badge .id-version { background: rgba(255,255,255,.1); color: #cdd5e0; }
/* plan badge — click opens Billing (upgrade surface) */
.identity-badge .id-plan { background: var(--lo, #eef); color: var(--brand-d, var(--brand)); border: 0; border-radius: 6px; padding: 2px 6px; font-weight: 700; font-size: 11px; line-height: 1.3; cursor: pointer; font-family: inherit; }
.side-foot .identity-badge .id-plan { background: rgba(255,255,255,.1); color: #cdd5e0; }
.side-foot .identity-badge .id-plan:hover { background: rgba(255,255,255,.18); color: #fff; }
.side-foot .btn.ghost { color: #cdd5e0; border-color: rgba(255,255,255,.16); background: transparent; align-self: flex-start; }
.side-foot .btn.ghost:hover { background: rgba(255,255,255,.08); }
.app-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--soft); }

/* topbar (re-styled for the shell layout) */
.topbar { display: flex; align-items: center; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 22px; height: 56px; position: sticky; top: 0; z-index: 5; }
.page-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.nav-toggle { display: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; width: 38px; height: 38px; font-size: 18px; line-height: 1; cursor: pointer; }
.side-backdrop { position: fixed; inset: 0; background: rgba(15,20,25,.45); z-index: 14; }

/* Fill the whole app-body: content spans the full remaining width edge-to-edge
   (app-body carries the light --soft bg, so there is never a dark dead zone on
   the right at any desktop width). Off-canvas sidebar handles narrow widths. */
main { padding: 22px; max-width: none; margin: 0; }

/* ---------- launch-gate banner (campaigns) ---------- */
.gate-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.gate-banner.closed { background: #fffbeb; border-color: #fcd9a3; }
.gate-banner.open { background: #ecfdf3; border-color: #a7e3bf; }
.gate-left { display: flex; align-items: center; gap: 12px; }
.gate-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.gate-banner.closed .gate-dot { background: var(--warn); }
.gate-banner.open .gate-dot { background: var(--ok); }

/* ---------- merge-variable chips ---------- */
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; }
.chip { border: 1px solid var(--line); background: var(--soft); color: var(--ink); border-radius: 20px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: ui-monospace, Menlo, monospace; }
.chip:hover { background: var(--lo); border-color: var(--brand); color: var(--brand-d); }

/* ---------- sequence builder / enrollments ---------- */
.seq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
.add-step-box { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 8px; background: var(--soft); }
.delay-row { display: flex; gap: 10px; }
.delay-cell { display: flex; align-items: center; gap: 6px; }
.delay-cell input { width: 72px; }
.detail.wide { max-width: 640px; overflow-x: auto; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- mobile: off-canvas sidebar (real mobile/tablet only) ----------
   768px so the sidebar stays DOCKED on desktop and half-screen windows; only
   true narrow widths get the hamburger + off-canvas drawer. */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 15; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  .sidebar.open { transform: translateX(0); }
  .app-body { width: 100%; }
  main { max-width: none; padding: 16px; }
}

/* ---------- shell-grade view polish (orgs / forms / reports) ---------- */
.view-intro { margin: -6px 0 16px; max-width: 640px; }
.empty-rich { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 32px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.empty-sub { max-width: 380px; }
.empty-cta { margin-top: 10px; }
.mini-card { transition: border-color .15s, box-shadow .15s, transform .05s; }
.mini-card:hover { border-color: #cfd7e2; box-shadow: 0 2px 10px rgba(15,22,40,.06); }
.form-card { min-height: 118px; }
.form-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mono { font-family: ui-monospace, Menlo, monospace; }

/* ---------- template live preview (GHL-grade) ---------- */
.tpl-preview { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--soft); }
.tpl-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; background: var(--panel); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink); }
.tpl-preview-subject { display: flex; align-items: baseline; gap: 8px; padding: 10px 13px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tpl-preview-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; flex: 0 0 auto; }
.tpl-preview-subjtext { font-weight: 600; color: var(--ink); font-size: 14px; word-break: break-word; }
.tpl-preview-frame { display: block; width: 100%; height: 190px; border: 0; background: #fff; }

/* ---------- sequence step editor + reorder ---------- */
.seq-build-row.editing { display: block; background: var(--panel); border: 1px solid var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.seq-edit .fld { margin: 6px 0; }
.seq-edit .form-inline { margin-top: 10px; }
.seq-step-txt { color: var(--ink); }
.link.seq-move { font-size: 15px; line-height: 1; padding: 2px 6px; font-weight: 700; color: var(--muted); }
.link.seq-move:hover { color: var(--brand); text-decoration: none; }
.link.seq-move[disabled] { opacity: .3; cursor: default; }
.link.seq-move[disabled]:hover { color: var(--muted); }

/* ---------- Wave 2: custom fields / organizations ---------- */
.custom-fields { display: flex; flex-direction: column; }
.custom-values { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 14px; }
.cv-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.cv-label { flex: 0 0 auto; }
.cv-val { font-weight: 600; text-align: right; word-break: break-word; }

/* ==================================================================
   ROUND 3 — core-view polish to GHL/Pipedrive grade (contacts / reports / forms)
   Additive only. Reuses existing tokens; no new colors introduced.
   ================================================================== */

/* row hover across every data table (consistent, non-regressive) */
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: var(--soft); }

/* list meta (result count above a table) */
.list-meta { color: var(--muted); font-size: 13px; margin: 2px 2px 10px; font-weight: 600; }

/* initials avatar chip (deterministic color from name — token palette only) */
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; text-transform: uppercase; user-select: none; }
.avatar.c0 { background: var(--brand); }
.avatar.c1 { background: var(--ok); }
.avatar.c2 { background: var(--warn); }
.avatar.c3 { background: var(--brand-d); }
.avatar.c4 { background: var(--err); }

/* contacts "people list" identity cell */
.contact-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.contact-id { min-width: 0; }
.contact-id .cname { font-weight: 600; color: var(--ink); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-id .ctitle { font-size: 12px; color: var(--muted); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-email { color: var(--brand-d); }
.org-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--lo); color: var(--brand-d); border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 600; max-width: 100%; }
.org-chip::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--brand-d); flex: 0 0 6px; }
.tag-chip { display: inline-flex; align-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--muted); border-radius: 20px; padding: 2px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.customer-badge { display: inline-flex; align-items: center; gap: 5px; background: #ecfdf3; border: 1px solid #a7e3bf; color: #157347; border-radius: 20px; padding: 2px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.customer-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #22a565; flex: 0 0 6px; }

/* import / export as a clearer grouped control set */
.tool-btns { display: flex; align-items: center; gap: 8px; }

/* reports — section spacing tune (kpi rows already styled) */
.report-section { margin-top: 6px; }

/* forms — richer card grade */
.form-card .fc-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 4px; }
.form-card .fc-path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }

/* Deal-card hover actions (edit/delete) — 2026-07-10 */
.card { position: relative; }
.card-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card-act { border: 0; background: rgba(255,255,255,.9); cursor: pointer; font-size: 12px; line-height: 1; padding: 3px 5px; border-radius: 5px; color: #667; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.card-act:hover { background: #eef; color: #223; }
.card-act.danger:hover { background: #fdecec; color: #c0392b; }

/* One-click Won/Lost close buttons on deal cards (match .btn.small sizing). */
.card-footer { display: flex; gap: 6px; margin-top: 8px; }
.btn-won, .btn-lost { border: 0; cursor: pointer; font-size: 12px; line-height: 1; padding: 5px 10px; border-radius: 6px; color: #fff; font-weight: 600; }
.btn-won { background: #1f9d55; }
.btn-won:hover { background: #197b43; }
.btn-lost { background: #c0392b; }
.btn-lost:hover { background: #9c2d22; }

/* ==================================================================
   WAVE 1 — status pills · skeleton · micro-label · motion · theme toggle
   Additive. Tokens above drive all colors so light + dark both work.
   ================================================================== */

/* status pills — soft pastel bg + bold text (semantic meaning) */
.pill.lead     { background: var(--pill-lead-bg);     color: var(--pill-lead-fg);     font-weight: 700; }
.pill.contract { background: var(--pill-contract-bg); color: var(--pill-contract-fg); font-weight: 700; }
.pill.won      { background: var(--pill-won-bg);      color: var(--pill-won-fg);      font-weight: 700; }
.pill.lost     { background: var(--pill-lost-bg);     color: var(--pill-lost-fg);     font-weight: 700; }
.pill.rotting  { background: var(--pill-rotting-bg);  color: var(--pill-rotting-fg);  font-weight: 700; }

/* small/bold/uppercase micro-label utility (semantic section labels) */
.label-caps { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* skeleton shimmer — prefer over spinners for loading states */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton-base); border-radius: 8px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* motion — smooth the interactive states already styled above */
.nav-item, .tab { transition: background var(--transition), color var(--transition); }

/* header theme toggle (sun/moon) */
.theme-toggle { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
  border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 9px; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition); }
.theme-toggle:hover { background: var(--soft); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }

/* dark-mode fixups for the few remaining literal-pastel accents */
:root[data-theme="dark"] .gate-banner.closed { background: #2a2412; border-color: #5a4a1e; }
:root[data-theme="dark"] .gate-banner.open   { background: #12271a; border-color: #2b5f3d; }
:root[data-theme="dark"] .customer-badge     { background: #12271a; border-color: #2b5f3d; color: #6ee7a0; }
:root[data-theme="dark"] .card-act           { background: rgba(30,34,42,.92); color: #aab2c0; }
:root[data-theme="dark"] .card-act:hover     { background: #2a3550; color: #dbe4f5; }
:root[data-theme="dark"] .card-act.danger:hover { background: #3a1616; color: #fca5a5; }
/* email preview iframe renders customer HTML — keep it light in both themes */
:root[data-theme="dark"] .tpl-preview-frame  { background: #fff; }

/* ===== Convert — EOS Conversion Focus (flagship) ===== */
.lens-toggle{display:flex;gap:6px;flex-wrap:wrap}
.lens{font:inherit;font-size:12px;cursor:pointer;padding:5px 11px;border-radius:20px;border:1px solid var(--border);background:transparent;color:var(--muted)}
.lens.on{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.cv-heads{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:6px 0 14px}
@media(max-width:560px){.cv-heads{grid-template-columns:1fr}}
.cv-hc{border:1px solid var(--border);border-radius:12px;padding:14px 16px}
.cv-hc.reach{border-color:rgba(52,168,83,.5)}
.cv-hc.risk{border-color:rgba(229,72,77,.5);background:rgba(229,72,77,.06)}
.cv-big{font-size:27px;font-weight:800;letter-spacing:-.02em;line-height:1}
.cv-hc.reach .cv-big{color:#34a853}
.cv-hc.risk .cv-big{color:#e5484d}
.cv-lab{font-size:12.5px;font-weight:600;margin-top:6px}
.cv-coach{border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:10px;padding:10px 14px;margin-bottom:14px}
.cv-lever{font-size:13px;margin-bottom:2px}
.cv-rescue{border:1px solid rgba(229,72,77,.5);border-radius:12px;overflow:hidden;margin-bottom:14px}
.cv-rescue-h{display:flex;align-items:center;gap:8px;padding:9px 14px;background:rgba(229,72,77,.1);font-size:11px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:#e5484d}
.cv-rescue-h b{margin-left:auto;font-size:12px}
.cv-listhead{font-size:10.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);margin:8px 0 4px}
.cv-row{display:flex;align-items:center;gap:12px;padding:11px 4px;border-top:1px solid var(--border)}
.cv-rescue .cv-row{border-top:1px solid rgba(229,72,77,.22);border-left:3px solid #e5484d;padding-left:11px}
.cv-idle{width:46px;flex:none;text-align:center}
.cv-idle b{display:block;font-size:19px;font-weight:800;color:#e5484d;line-height:1}
.cv-idle span{font-size:9px;text-transform:uppercase;color:var(--muted);letter-spacing:.04em}
.cv-rank{width:20px;height:20px;flex:none;border-radius:6px;background:rgba(26,115,232,.12);color:var(--accent);font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}
.cv-chk{width:18px;height:18px;flex:none;border-radius:5px;border:1.5px solid var(--border);background:transparent;cursor:pointer;color:#fff;font-size:11px;line-height:1;display:flex;align-items:center;justify-content:center}
.cv-chk.on{background:#34a853;border-color:#34a853}
.cv-main{flex:1;min-width:0}
.cv-deal{font-size:13.5px;font-weight:650}
.cv-task{font-size:11.5px;color:var(--accent);margin-top:3px;font-weight:600}
.cv-score{width:58px;flex:none;text-align:right}
.cv-scv{font-size:13px;font-weight:750}
.cv-scb{height:5px;border-radius:3px;background:var(--border);overflow:hidden;margin-top:4px}
.cv-scb>i{display:block;height:100%;background:var(--accent);border-radius:3px}
.cv-val{width:60px;flex:none;text-align:right;font-size:14px;font-weight:750}
.cv-val.rot{color:#e5484d}
.cv-act{font:inherit;font-size:11.5px;font-weight:600;cursor:pointer;white-space:nowrap;padding:6px 11px;border-radius:7px;border:1px solid var(--accent);color:var(--accent);background:transparent}
.cv-act:hover{background:var(--accent);color:#fff}
.cv-act.rot{border-color:#e5484d;color:#e5484d}
.cv-act.rot:hover{background:#e5484d;color:#fff}
.cv-grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:18px}
@media(max-width:640px){.cv-grid2{grid-template-columns:1fr}}

/* Scripts + Schedules expander (per-deal cadence + suggested script) */
.cv-rowwrap{display:block}
.cv-scriptbtn{margin-top:5px;font:inherit;font-size:10.5px;font-weight:700;letter-spacing:.03em;cursor:pointer;background:transparent;border:0;padding:2px 0;color:var(--accent);text-transform:uppercase}
.cv-scriptbtn:hover{text-decoration:underline}
.cv-ex{display:none}
.cv-ex.open{display:block;margin:2px 0 12px;animation:cvexpand .18s ease}
@keyframes cvexpand{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
.cv-ex-in{display:grid;grid-template-columns:1fr 1.3fr;gap:16px;padding:14px 16px;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:10px;background:color-mix(in srgb,var(--accent) 4%,var(--card))}
@media(max-width:720px){.cv-ex-in{grid-template-columns:1fr}}
/* Cold call script — novice call cheat-sheet as a FULL-SCREEN view (Convert → header
   button). Centered reading column, numbered steps, copy buttons, They-say/You-say
   objections, follow-up rhythm. */
.coldpage{max-width:760px;margin:0 auto;padding:4px 4px 48px}
.coldcard .ccs-head{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:6px}
.ccs-copyall,.ccs-copy{font:inherit;font-size:12px;font-weight:700;cursor:pointer;border:1px solid var(--border);background:var(--card);color:inherit;border-radius:7px;padding:6px 11px;white-space:nowrap;transition:border-color .15s,color .15s}
.ccs-copyall:hover,.ccs-copy:hover{border-color:var(--accent);color:var(--accent)}
.ccs-step{display:flex;gap:14px;padding:16px 0;border-top:1px solid var(--border)}
.ccs-step:first-of-type{border-top:0;padding-top:10px}
.ccs-num{flex:0 0 28px;height:28px;width:28px;border-radius:50%;background:var(--accent);color:#fff;font-weight:800;font-size:14px;display:grid;place-items:center}
.ccs-body{flex:1;min-width:0}
.ccs-title{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:9px}
.ccs-say{display:flex;flex-direction:column;gap:9px;align-items:flex-start}
.ccs-opener{margin:0;font-size:16px;line-height:1.55;background:color-mix(in srgb,var(--accent) 7%,var(--card));border-left:3px solid var(--accent);border-radius:8px;padding:12px 14px}
.ccs-points{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:7px;font-size:14.5px;line-height:1.5}
.ccs-objs{display:flex;flex-direction:column;gap:12px}
.ccs-obj{border:1px solid var(--border);border-radius:9px;overflow:hidden}
.ccs-line{display:flex;gap:10px;padding:9px 12px;font-size:14px;line-height:1.5}
.ccs-line.they{background:color-mix(in srgb,var(--muted) 12%,transparent)}
.ccs-line.you{border-top:1px solid var(--border)}
.ccs-tag{flex:0 0 60px;font-size:10px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;padding-top:2px;color:var(--muted)}
.ccs-tag.you{color:var(--accent)}
.ccs-ask{margin:0;font-size:15px;font-weight:600;line-height:1.5;background:color-mix(in srgb,var(--accent) 9%,var(--card));border-radius:8px;padding:11px 13px}
.ccs-followup{margin-top:18px;padding-top:16px;border-top:2px solid var(--border)}
.ccs-fuh{font-size:11px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin-bottom:10px}
.ccs-fusteps{display:flex;flex-direction:column;gap:8px}
.ccs-fustep{display:grid;grid-template-columns:74px 104px 1fr;gap:10px;align-items:baseline;font-size:13.5px;line-height:1.45}
.ccs-fuday{font-weight:700}
.ccs-fuch{color:var(--muted);text-transform:capitalize}
.ccs-note{margin-top:16px;font-style:italic}
@media(max-width:560px){.ccs-head{flex-direction:column}.ccs-fustep{grid-template-columns:70px 1fr}.ccs-fuch{display:none}}
.cv-ex-h{font-size:10.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:9px;display:flex;align-items:center;gap:8px}
.cv-tone{font-size:9.5px;font-weight:700;color:var(--accent);background:rgba(26,115,232,.1);padding:2px 7px;border-radius:20px;letter-spacing:.02em;text-transform:none}
.cv-steps{display:flex;flex-direction:column;gap:0;position:relative;padding-left:4px}
.cv-step{display:grid;grid-template-columns:64px 84px 1fr;gap:9px;align-items:baseline;padding:7px 0;border-top:1px dashed var(--border)}
.cv-step:first-child{border-top:0}
.cv-step-day{font-size:11px;font-weight:800;color:var(--text,#111)}
.cv-step-ch{font-size:10px;font-weight:700;text-transform:capitalize;color:var(--muted);white-space:nowrap}
.cv-step-ch.call{color:#1a73e8}.cv-step-ch.email{color:#8a5cf6}.cv-step-ch.text,.cv-step-ch.sms{color:#0ca678}.cv-step-ch.visit,.cv-step-ch.dropby,.cv-step-ch.in-person{color:#e5900d}
.cv-step-lab{font-size:12px;line-height:1.35}
.cv-sc-block{margin-bottom:11px}
.cv-sc-block>b{display:block;font-size:10px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin-bottom:3px}
.cv-sc-block p{font-size:12.5px;line-height:1.45;margin:0}
.cv-sc-block ul{margin:2px 0 0;padding-left:17px}
.cv-sc-block li{font-size:12px;line-height:1.5}
.cv-sc-block.ask{border-left:3px solid var(--accent);padding-left:10px;background:rgba(26,115,232,.05);border-radius:0 7px 7px 0;padding:7px 10px}
.cv-obj{margin-top:6px;font-size:11.5px;line-height:1.4}
.cv-obj-q{display:block;font-weight:700}
.cv-obj-q::before{content:'“'}.cv-obj-q::after{content:'”'}
.cv-obj-a{display:block;color:var(--muted);margin-top:1px}
.cv-obj-a::before{content:'→ '}
.cv-note{margin-top:4px;font-style:italic}

/* ── White-label (Agency plan) branding UI ───────────────────────────── */
.side-logo img, .auth-mark img { max-height: 100%; max-width: 100%; display: block; object-fit: contain; }
.wl-block { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border, #e5e7eb); }
.wl-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.wl-toggle input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; cursor: pointer; }
.upgrade-modal h3 { margin: 0 0 8px; }
.upgrade-points { margin: 10px 0 18px; padding-left: 18px; color: var(--muted); }
.upgrade-points li { margin: 4px 0; }

/* ── Billing / self-serve plans ──────────────────────────────────────── */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; max-width: 760px; margin-top: 6px; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.plan-card.current { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.plan-name { font-weight: 700; font-size: 15px; }
.plan-price { font-size: 28px; font-weight: 800; line-height: 1; }
.plan-per { font-size: 13px; font-weight: 500; }
.plan-feats { list-style: none; margin: 2px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-feats li { position: relative; padding-left: 20px; font-size: 13px; color: var(--ink); }
.plan-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.plan-card .btn { margin-top: auto; width: 100%; }
.plan-current-badge { margin-top: auto; text-align: center; font-size: 13px; font-weight: 600; color: var(--brand); padding: 8px; border: 1px dashed var(--brand); border-radius: 8px; }
.notice-banner { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 4px 0 8px; font-size: 14px; }
.billing-manage { margin-top: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.side-road-logo { display:block; height:auto; width:auto; max-height:60px; max-width:184px; object-fit:contain; margin-bottom:6px; }
.brand-preview-logo { display:none; max-height:44px; max-width:180px; object-fit:contain; margin-bottom:8px; }

/* ── Slide-over record drawer + inline-edit (Wave 4) ──────────────────── */
.drawer-overlay { position: fixed; inset: 0; z-index: 18; }
.drawer-overlay.hidden { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15,20,25,.42); opacity: 0; transition: opacity var(--transition); }
.drawer-overlay.open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: 448px; max-width: 92vw; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -24px 0 60px rgba(0,0,0,.28); overflow: auto; padding: 26px 24px 40px; transform: translateX(100%); transition: transform 220ms cubic-bezier(.4,0,.2,1); box-sizing: border-box; }
.drawer-overlay.open .drawer-panel { transform: translateX(0); }
.drawer-x { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.drawer-x:hover { color: var(--fg); }
.dw-head { margin: 2px 44px 4px 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.dw-idrow { display: flex; align-items: center; gap: 12px; margin: 2px 44px 6px 0; }
.dw-idrow .avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: 15px; }
.dw-idname { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.dw-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.dw-section { margin: 20px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dw-field { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dw-field > .dw-label { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 5px; }
.dw-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.dw-actions { display: flex; gap: 8px; margin: 14px 0 4px; }
/* Unpaid-balance warning chip (PatchQuick job link). Amber bg + warn border,
   red text for urgency — all existing palette vars (theme-adaptive). */
.badge-outstanding { display: block; margin: 12px 0 2px; padding: 8px 12px; border-radius: 8px;
  background: var(--med); border: 1px solid var(--warn); color: var(--err);
  font-size: 13px; font-weight: 600; line-height: 1.35; }
/* Credit-hold banner (persisted crm_contacts.credit_hold — enforcement gate /
   admin override). Stronger than the amber outstanding chip: red border + text. */
.badge-hold { display: block; margin: 12px 0 2px; padding: 8px 12px; border-radius: 8px;
  background: var(--med); border: 1px solid var(--err); color: var(--err);
  font-size: 13px; font-weight: 700; line-height: 1.35; }
/* Tiny inline hold marker on list rows (next to the contact name). */
.hold-chip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--err); color: var(--err); font-size: 10px; font-weight: 800;
  letter-spacing: .04em; vertical-align: 1px; }

.inline-edit { display: inline-flex; align-items: center; gap: 6px; border-radius: 7px; padding: 3px 6px; margin: -3px -6px; cursor: text; max-width: 100%; transition: background var(--transition); }
.inline-edit:hover { background: var(--lo, rgba(26,115,232,.09)); }
.inline-edit:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.inline-edit .ie-val { font-size: 14px; font-weight: 500; color: var(--fg); overflow-wrap: anywhere; }
.inline-edit.empty .ie-val { color: var(--muted); font-style: italic; }
.inline-edit .ie-pencil { opacity: 0; font-size: 11px; color: var(--muted); transition: opacity var(--transition); }
.inline-edit:hover .ie-pencil, .inline-edit:focus .ie-pencil { opacity: .65; }
.dw-head .inline-edit .ie-val { font-size: 20px; font-weight: 800; }
.ie-input { width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid var(--brand); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--card); color: var(--fg); box-shadow: 0 0 0 3px var(--accent-ring); }
textarea.ie-input { min-height: 78px; resize: vertical; line-height: 1.4; }

tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover { background: var(--lo, rgba(26,115,232,.06)); }

@media (max-width: 560px) { .drawer-panel { width: 100vw; max-width: 100vw; } }
@media (prefers-reduced-motion: reduce) {
  .drawer-panel, .drawer-backdrop, .inline-edit, .inline-edit .ie-pencil, .rec-assoc { transition: none !important; }
}

/* ── World-class record page (Wave 5) — HubSpot 3-column deep view ────── */
.recpage { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.rec-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rec-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rec-card-head { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 13px 16px 0; }
.rec-card-body { padding: 12px 16px 15px; display: flex; flex-direction: column; }
.rec-card-body > .dw-field:last-child { border-bottom: 0; padding-bottom: 0; }
.rec-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--fg); }
.rec-title.sm { font-size: 17px; }
.rec-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.rec-metric { font-size: 24px; font-weight: 800; color: var(--brand); margin-top: 12px; letter-spacing: -.02em; }
.rec-idrow { display: flex; align-items: center; gap: 12px; }
.rec-idrow .avatar { width: 44px; height: 44px; flex: 0 0 44px; font-size: 16px; }
.rec-timeline { max-height: none; margin-top: 12px; }
.rec-composer { margin-bottom: 2px; }
.rec-assoc-list { display: flex; flex-direction: column; gap: 8px; }
.rec-assoc { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; cursor: pointer;
  font-family: inherit; transition: border-color var(--transition), background var(--transition); }
.rec-assoc:hover { border-color: var(--brand); background: var(--lo, rgba(26,115,232,.06)); }
.rec-assoc.static, .rec-assoc.static:hover { cursor: default; border-color: var(--line); background: var(--card); }
.rec-assoc-name { font-weight: 600; font-size: 14px; color: var(--fg); }
.rec-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rec-stat:last-child { border-bottom: 0; padding-bottom: 0; }
.rec-stat-n { font-size: 15px; font-weight: 700; color: var(--fg); }
.rec-skel { min-height: 168px; border-radius: 8px; background: var(--soft); }
@media (max-width: 900px) { .recpage { grid-template-columns: 1fr; } }

/* ── Segment builder (multi-condition audience) + branded template preview ── */
.seg-builder { max-width: 640px; }
.seg-cond-head { margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.seg-rows { display: flex; flex-direction: column; gap: 8px; }
.seg-cond-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.seg-cond-row select, .seg-cond-row input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: var(--card); color: var(--ink); }
.seg-cond-row .seg-field { min-width: 130px; }
.seg-cond-row .seg-val-cell { flex: 1; min-width: 120px; display: flex; }
.seg-cond-row .seg-val-cell input, .seg-cond-row .seg-val-cell select { width: 100%; }
.seg-cell { display: inline-flex; }
.seg-del { margin-left: auto; font-size: 13px; line-height: 1; padding: 4px 6px; }
.seg-count-bar { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.seg-sample { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.seg-chip { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: 12px; color: var(--muted); }
.tpl-preview-frame.branded { height: 320px; border: 1px solid var(--line); border-radius: 10px; }

/* ==================================================================
   GUIDES — SOP library: grouped list (left) + reader pane (right).
   Rows are clean title-only; admin ✎/🗑 reuse the pipeline-card
   hover-reveal pattern so actions never dominate the reading surface.
   ================================================================== */
.guides-layout { display: flex; gap: 20px; align-items: flex-start; margin-top: 12px; }
.guides-list { flex: 0 0 280px; min-width: 240px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 8px 12px; position: sticky; top: 12px;
  max-height: calc(100vh - 140px); overflow-y: auto; }
.guides-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 16px 8px 5px; }
.guides-list .guides-cat:first-child { margin-top: 6px; }
.guide-row { position: relative; border-radius: 8px; transition: background var(--transition); }
.guide-row:hover { background: var(--soft); }
.guide-row.active { background: var(--brand); }
.guide-row-btn { display: block; width: 100%; border: 0; background: none; color: var(--ink);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
  text-align: left; font-family: inherit; }
.guide-row-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-row.active .guide-row-btn { color: #fff; font-weight: 600; }
.guide-row-actions { top: 50%; right: 8px; transform: translateY(-50%); }
.guide-row:hover .guide-row-actions, .guide-row:focus-within .guide-row-actions { opacity: 1; }

/* reader pane — card surface, readable measure, ONE title */
.guides-reader { flex: 1 1 480px; min-width: 300px; max-width: 900px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 28px 34px 36px; }
.guide-title { margin: 0 0 16px; font-size: 23px; font-weight: 700; letter-spacing: -.4px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* guide body typography — app type scale applied to seeded SOP HTML
   (images/tables/pre stay inside the reader width; large PNGs scale down). */
.guide-content { overflow-x: auto; font-size: 15px; line-height: 1.65; }
.guide-content h1 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; margin: 30px 0 10px; }
.guide-content h2:not(.guide-title) { font-size: 18px; font-weight: 700; letter-spacing: -.2px; margin: 28px 0 8px; }
.guide-content h3 { font-size: 15.5px; font-weight: 700; margin: 22px 0 6px; }
.guide-content p { margin: 0 0 12px; }
.guide-content ul, .guide-content ol { margin: 0 0 12px; padding-left: 24px; }
.guide-content li { margin: 4px 0; }
.guide-content img { max-width: 100%; height: auto; display: block; margin: 12px 0; }
.guide-content table { border-collapse: collapse; width: 100%; max-width: 100%; margin: 14px 0; font-size: 14px; }
.guide-content th, .guide-content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.guide-content th { background: var(--soft); font-weight: 600; }
.guide-content code { background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.guide-content pre { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 13px; }
.guide-content pre code { background: none; border: 0; padding: 0; }
.guide-content blockquote { border-left: 3px solid var(--brand); margin: 12px 0; padding: 6px 14px; background: var(--soft); border-radius: 0 8px 8px 0; }
.guide-content hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

@media (max-width: 900px) {
  .guides-layout { flex-wrap: wrap; }
  .guides-list { flex: 1 1 100%; position: static; max-height: none; }
}
