/* FieldCRM — lightweight, modern, minimal. Light + dark via CSS variables. */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e3e8ef;
  --brand: #3457c5;
  --brand-ink: #ffffff;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Dark palette, shared by system-preference and explicit choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b111c;
    --surface: #131a27;
    --surface-2: #1b2432;
    --text: #e6ebf3;
    --muted: #94a3b8;
    --border: #232e3f;
    --brand: #6f8dff;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0b111c;
  --surface: #131a27;
  --surface-2: #1b2432;
  --text: #e6ebf3;
  --muted: #94a3b8;
  --border: #232e3f;
  --brand: #6f8dff;
  --shadow: none;
}
:root[data-theme="light"] {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e3e8ef;
  --brand: #3457c5;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  overflow-x: hidden; /* guard: long unbroken content can never push the page sideways */
}
/* Long words / URLs / place names must wrap, not overflow (mobile fix). */
.row-title, .row-sub, .feed-title, .feed-notes, .notes, .kpi-val, .bar-label,
.info-v, .tl-title, .tl-note, .detail-title, .picker-item-label { overflow-wrap: anywhere; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.boot { margin: auto; color: var(--muted); }

/* ---- Login ---------------------------------------------------------------*/
.login {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; padding: 24px;
}
.login .brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.login .brand img { width: 64px; height: 64px; }
/* An admin-uploaded logo is usually wider than tall — let it size naturally. */
.login .brand img.brand-logo { width: auto; height: 56px; max-width: 220px; object-fit: contain; }
.login .brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.login .brand p { margin: 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  width: 100%; max-width: 360px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  outline: none;
}
.input:focus { border-color: var(--brand); }

.pin-display {
  display: flex; gap: 10px; justify-content: center; margin: 8px 0 16px;
}
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
}
.pin-dot.filled { background: var(--brand); border-color: var(--brand); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  padding: 16px 0; font-size: 20px; font-weight: 500;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; user-select: none;
}
.key:active { transform: scale(.97); }
.key.ghost { background: transparent; border-color: transparent; }

.btn {
  width: 100%; padding: 13px 16px; font-size: 16px; font-weight: 600;
  background: var(--brand); color: var(--brand-ink);
  border: none; border-radius: 10px; cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}

.error-msg { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }

/* ---- App shell -----------------------------------------------------------*/
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .title { font-weight: 700; letter-spacing: -0.01em; }
.topbar .who { font-size: 13px; color: var(--muted); }
.content { padding: 16px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); max-width: 720px; width: 100%; margin: 0 auto; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.panel h3 { margin: 0 0 6px; font-size: 15px; }
.panel p { margin: 0; color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block; font-size: 12px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px;
}
.link { color: var(--brand); cursor: pointer; background: none; border: none; font-size: 14px; padding: 0; }

/* ---- Nav tabs ------------------------------------------------------------*/
.tabs {
  display: flex; gap: 2px; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 57px; z-index: 9; overflow-x: auto;
}
.tab {
  padding: 12px 12px; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  background: transparent; color: var(--muted);
  border: none; border-bottom: 2px solid transparent; cursor: pointer;
  margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.tab.locked .tab-label { opacity: .7; }
.lock-dia { margin-left: auto; font-size: 10px; color: #c79a3a; line-height: 1; }
.assistant-fab.locked { position: relative; }
.assistant-fab.locked .fab-lock-dia { position: absolute; top: -2px; right: -2px; font-size: 11px; color: #c79a3a; background: var(--surface); border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ---- Layout helpers ------------------------------------------------------*/
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.stack.sm { gap: 8px; }
.dup-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dup-row .row-sub { margin-top: 2px; }
.row { display: flex; align-items: center; min-width: 0; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap > * { flex: 1; min-width: 0; }
/* chip / action rows: don't stretch children, let them wrap naturally */
.chips-row > *, .feed-tags > *, .card-actions > * { flex: 0 0 auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Buttons -------------------------------------------------------------*/
.btn.small { width: auto; padding: 9px 14px; font-size: 14px; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* ---- Stat cards ----------------------------------------------------------*/
.tap { cursor: pointer; }
.tap:active { transform: scale(.99); }
.stat { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---- Lists ---------------------------------------------------------------*/
.list { display: grid; gap: 8px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.row-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow);
}
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
/* Sub Hub user cards: let the details column take the space and wrap long emails,
   and let the status chips wrap to their own line instead of overlapping the text. */
.hub-user .row-main { flex: 1 1 auto; }
.hub-user .row-side { flex-wrap: wrap; justify-content: flex-end; max-width: 42%; }
.row-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ---- Chips ---------------------------------------------------------------*/
.chip {
  display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.chip.brand { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); border-color: transparent; }
.chip.warn  { background: color-mix(in srgb, #f79009 18%, transparent); color: #b54708; border-color: transparent; }
/* Pipeline-stage colour (driven by --sc set inline per stage). */
.chip.stage-chip { background: color-mix(in srgb, var(--sc) 14%, transparent); color: var(--sc); border-color: color-mix(in srgb, var(--sc) 40%, transparent); }
.stage-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sc, var(--muted)); margin-right: 6px; vertical-align: middle; }
.color-input { width: 52px; min-width: 52px; height: 40px; padding: 3px; cursor: pointer; }

/* Custom-field "show on activity logs" collapsible (Settings → Custom fields) */
.ll-block { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 4px; }
.ll-toggle { display: flex; align-items: center; gap: 8px; background: none; border: none; padding: 6px 0; cursor: pointer; color: var(--text); font-weight: 600; font-size: 13px; }
.ll-caret { color: var(--muted); width: 12px; display: inline-block; }
.ll-badge { font-size: 11px; color: var(--muted); font-weight: 500; }
.ll-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 14px; }
.ll-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ll-row select { width: auto; min-width: 104px; padding: 6px 8px; }
@media (prefers-color-scheme: dark) { .chip.warn { color: #fdb022; } }
.chip.muted { background: transparent; }
.link-chip { text-decoration: none; color: var(--brand); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Detail --------------------------------------------------------------*/
.detail-title { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; }
.back { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 4px 0; }
.info { display: grid; gap: 8px; margin: 14px 0; }
.info-row { display: flex; gap: 10px; font-size: 14px; }
.info-k { color: var(--muted); width: 110px; flex-shrink: 0; }
.info-v { color: var(--text); word-break: break-word; }
.notes { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; white-space: pre-wrap; }
.save-status { font-size: 12px; color: var(--muted); }

/* ---- Forms ---------------------------------------------------------------*/
.form .field { margin-bottom: 12px; }
textarea.input { resize: vertical; font-family: inherit; }
select.input { appearance: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.form-actions .btn { flex: 1; }
/* Quote detail actions: buttons keep their own width, wrap to new rows, never
   shrink into each other (fixes label overlap on narrow mobile). */
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.q-actions .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }
.q-actions .btn.link, .q-actions .link { align-self: center; }

/* ---- Feedback ------------------------------------------------------------*/
.spinner, .empty { color: var(--muted); text-align: center; padding: 28px 12px; font-size: 14px; }
.error-box { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #101828; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.warn { background: #b5730f; }

/* ---- Pipeline board ------------------------------------------------------*/
.stage-group { display: grid; gap: 8px; }
.stage-head { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 2px; }
.stage-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.stage-meta { color: var(--muted); font-size: 12px; }

/* ---- Deal funnel ---------------------------------------------------------*/
.funnel { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.funnel-step {
  flex: 1; min-width: 56px; text-align: center; font-size: 11px; font-weight: 600;
  padding: 8px 4px; border-radius: 8px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
}
.funnel-step.done { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.funnel-step.current { outline: 2px solid var(--brand); outline-offset: 1px; }
.closed-tag { margin-top: 10px; font-weight: 700; font-size: 14px; }
.closed-tag.brand { color: var(--brand); }
.closed-tag.warn { color: #b54708; }
@media (prefers-color-scheme: dark) { .closed-tag.warn { color: #fdb022; } }

/* ---- Timeline ------------------------------------------------------------*/
.timeline { display: grid; gap: 2px; }
.tl-item { display: flex; gap: 10px; padding: 6px 0; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 5px; flex-shrink: 0; }
.tl-title { font-size: 14px; font-weight: 600; }
.tl-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tl-detail { font-size: 13px; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.tl-note { font-size: 13px; margin-top: 3px; padding: 6px 8px; background: var(--surface-2); border-radius: 8px; }
/* Full-history timeline: the dot cell carries an emoji glyph instead of a bullet. */
.timeline .tl-item .tl-dot { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-top: 2px; }

/* ---- Activity: type segmented control ------------------------------------*/
.seg-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg-btn {
  flex: 1; min-width: 84px; padding: 10px 8px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg-btn.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---- Disposition pills ---------------------------------------------------*/
.pill {
  padding: 7px 12px; font-size: 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.pill.active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); border-color: var(--brand); }

/* ---- Geo status ----------------------------------------------------------*/
.geo-status {
  margin-top: 6px; padding: 10px 12px; border-radius: 10px; font-size: 13px; cursor: pointer;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.geo-status.ok { color: var(--brand); }
.geo-status.warn { color: #b54708; }
@media (prefers-color-scheme: dark) { .geo-status.warn { color: #fdb022; } }

/* ---- Activity feed -------------------------------------------------------*/
.feed { display: grid; gap: 0; }
.feed-item { display: flex; gap: 10px; padding: 12px 8px; margin: 0 -8px; border-radius: 10px; }
.feed-icon { color: var(--muted); flex-shrink: 0; display: flex; align-items: center; margin-top: 1px; }
.feed-body { min-width: 0; flex: 1; }
.feed-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.feed-title { font-size: 14px; font-weight: 600; min-width: 0; }
.feed-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.feed-notes { font-size: 13px; color: var(--text); margin: 2px 0 4px; white-space: pre-wrap; }
.feed-notes-wrap { margin: 2px 0 4px; }
.feed-notes-wrap .feed-notes { margin: 0; }
.feed-notes.clamp { display: -webkit-box; -webkit-line-clamp: 8; line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.feed-more { display: inline-block; margin-top: 3px; font-size: 12.5px; }
.ac-wrap { position: relative; }
.ac-menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); background: var(--panel, #fff); border: 1px solid var(--line, #e2e2e2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); overflow: hidden; max-height: 260px; overflow-y: auto; }
.ac-item { display: block; width: 100%; text-align: left; padding: 9px 12px; background: none; border: 0; cursor: pointer; font-size: 13.5px; color: var(--text); }
.ac-item:hover { background: var(--hover, rgba(0,0,0,.05)); }
/* "What's new" on the home page — deliberately light and unobtrusive. */
.whats-new { opacity: .96; }
.whats-new .wn-list { margin-top: 6px; display: grid; gap: 8px; }
.whats-new .wn-row { padding-top: 8px; border-top: 1px solid var(--border); }
.whats-new .wn-row:first-child { padding-top: 4px; border-top: 0; }
.whats-new .wn-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.whats-new .wn-title { font-size: 13.5px; font-weight: 600; }
.whats-new .wn-items { margin: 4px 0 0; padding-left: 16px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.whats-new .wn-items li { margin: 1px 0; }
.feed-tags { margin-top: 2px; }

/* ---- Floating "Log" button -----------------------------------------------*/
.fab {
  position: fixed; right: 18px; bottom: 22px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); border: none;
  font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 24, 40, .28);
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.95); }
/* How-to / help floating button — stacked on the right, above the log + assistant FABs. */
.help-fab {
  position: fixed; right: 18px; bottom: 150px; z-index: 60;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface); color: var(--brand); border: 1px solid var(--border);
  font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
  display: flex; align-items: center; justify-content: center;
}
.help-fab:active { transform: scale(.95); }
.fab-plus { margin-top: -2px; }
.fab-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 10px; background: #f79009; color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ---- Tasks ---------------------------------------------------------------*/
.check {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface-2);
  color: var(--brand-ink); font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.check.done { background: var(--brand); border-color: var(--brand); }
.row-title.strike { text-decoration: line-through; color: var(--muted); }
.stage-name.danger { color: var(--danger); }
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}
.notice .btn.small { flex-shrink: 0; width: auto; }

/* ---- Searchable picker ---------------------------------------------------*/
.picker { position: relative; }
.picker-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.picker-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item:active { background: var(--surface-2); }
.picker-item-label { font-size: 14px; font-weight: 600; }
.picker-item-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.picker-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.picker-head { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fu-block { margin-bottom: 12px; }
.fu-block .btn.small { width: auto; }

/* ---- Topbar actions / theme toggle ---------------------------------------*/
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text);
  width: 34px; height: 34px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn.danger { color: var(--danger); }

/* ---- Contacts inline form ------------------------------------------------*/
.panel.inset { background: var(--surface-2); margin-bottom: 10px; box-shadow: none; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.check-row input { width: 18px; height: 18px; }
.link.danger { color: var(--danger); }

/* ---- Collapsible sections ------------------------------------------------*/
.sect { padding: 0; overflow: hidden; }
.sect-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  cursor: pointer; user-select: none;
}
.sect-head:active { background: var(--surface-2); }
.sect-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.sect-count {
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px;
}
.sect-grow { flex: 1; }
.sect-chev { color: var(--muted); font-size: 13px; transition: transform .18s ease; }
.sect.open .sect-chev { transform: rotate(180deg); }
.sect.open .sect-head { border-bottom: 1px solid var(--border); }
.sect-body { padding: 14px 16px 16px; }

/* ---- Company header card -------------------------------------------------*/
.company-card .chips-row { margin-bottom: 12px; }
.card-actions { margin-top: 14px; }
.card-actions .btn.small { width: auto; }
.add-row { width: auto !important; margin-bottom: 12px; }
.muted-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.view-all { display: inline-block; margin-top: 8px; font-weight: 600; }

/* ---- Home: activity type filter -----------------------------------------*/
.seg.subtle { gap: 6px; margin-bottom: 12px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
.seg-btn.sm { flex: 0 0 auto; min-width: auto; padding: 6px 12px; font-size: 12px; }

/* ---- Professional polish -------------------------------------------------*/
.topbar { box-shadow: 0 1px 0 var(--border); }
.topbar .title { font-size: 16px; letter-spacing: -0.02em; }
.panel { padding: 16px; }
.panel h3 { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.detail-title { font-weight: 700; }
.row-card { transition: background .12s ease; }
.row-card.tap:hover { background: var(--surface-2); }
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-item.tap { cursor: pointer; transition: background .12s ease; }
.feed-item.tap:hover { background: var(--surface-2); }

/* ---- Comments / internal communications ---------------------------------*/
.thread-h { font-size: 14px; font-weight: 700; margin: 4px 2px 0; }
.comments { display: grid; gap: 0; }
.comment { padding: 12px 0; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.comment-body { font-size: 14px; line-height: 1.5; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-mentions { margin-top: 6px; }
.composer textarea { margin-bottom: 10px; }
.tag-picker-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.tag-chip {
  padding: 6px 12px; font-size: 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.tag-chip:hover { border-color: var(--brand); }
.tag-chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---- Inline @mention autocomplete ---------------------------------------*/
.mention-wrap { position: relative; }
.mention-menu {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  margin-top: 4px; max-height: 220px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}
.mention-item { padding: 9px 12px; font-size: 14px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: var(--surface-2); color: var(--brand); }

/* Minimal upload progress bar */
.up-bar { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 2px 0 10px; }
.up-fill { height: 100%; width: 2%; background: var(--brand); border-radius: 999px; transition: width .18s ease; }

/* ---- Attachments (logs / comments) --------------------------------------*/
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach { display: inline-flex; align-items: center; gap: 4px; }
.attach-thumb {
  width: 76px; height: 76px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer; background: var(--surface-2);
}
.attach-file {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px;
}
.attach-file:hover { border-color: var(--brand); }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-meta { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.attach-del { width: 26px; height: 26px; font-size: 13px; }

/* ---- Google Sign-In button host -----------------------------------------*/
.gsi-host { display: flex; justify-content: center; min-height: 44px; }

/* Overdue next-task date in the companies grid */
.cell-overdue { color: var(--danger); font-weight: 600; }

/* Quotes list: active company/deal filter banner */
.filter-banner { padding: 4px 2px 8px; }

/* ---- Sub Hub (platform admin console) -----------------------------------*/
.hub { min-height: 100vh; background: var(--bg); }
.hub-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.hub-brand { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; cursor: pointer; }
.hub-main { max-width: 1120px; margin: 0 auto; padding: 20px 20px 60px; }
/* Two-column account detail on desktop; single column on narrow screens. */
.hub-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
/* minmax(0,1fr) (not 1fr = minmax(auto,1fr)) so a wide/unbreakable child — a long
   email or the button row — can't blow its column out and starve the other one. */
@media (min-width: 900px) { .hub-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.hub-grid > .hub-col { display: grid; gap: 12px; align-content: start; min-width: 0; }

/* Companies bulk bar: assign + set-attribute rows */
.bulk-line { margin-top: 8px; align-items: center; }

/* Companies pagination bar */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 4px 2px 20px; }

/* Add-company: "attach this scan to an existing company" strip */
.attach-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; font-size: 13px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}

/* ---- Route map -----------------------------------------------------------*/
.route-map {
  height: 56vh; min-height: 320px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); z-index: 0;
}
.leaflet-container { background: var(--surface-2); font: inherit; }
.route-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.route-stat .stat.sm { font-size: 22px; }
.route-idx {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.route-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.route-legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.route-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px var(--surface); }
.route-members { gap: 6px; }

/* ---- Reports -------------------------------------------------------------*/
/* Fixed column counts + minmax(0,1fr) so big numbers wrap instead of
   expanding tracks past the viewport (mobile overflow fix). */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: 14px; text-align: left; min-width: 0; }
.kpi-val { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn .kpi-val { color: #b54708; }
@media (prefers-color-scheme: dark) { .kpi.warn .kpi-val { color: #fdb022; } }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bar-label { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; min-width: 2px; }
.bar-fill.good { background: #12b76a; }
.bar-fill.bad { background: var(--danger); }
.bar-val { font-size: 12px; font-weight: 600; white-space: nowrap; }

.lb { display: grid; gap: 4px; overflow-x: auto; }
.lb-head, .lb-row { display: grid; grid-template-columns: 1.4fr .6fr .6fr .6fr .7fr 1fr; gap: 8px; align-items: center; min-width: 460px; }
.lb-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.lb-row { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lb-row span, .lb-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name { font-weight: 600; }
.lb-link { color: var(--brand); font-weight: 600; cursor: pointer; }
.lb-link:hover { text-decoration: underline; }
.bar-row.tap { cursor: pointer; border-radius: 8px; transition: background .12s ease; }
.bar-row.tap:hover { background: var(--surface-2); }
.bar-row.tap:hover .bar-label { color: var(--text); }

.row-side.col { flex-direction: column; align-items: flex-end; gap: 2px; }
.deal-val { font-weight: 600; font-size: 13px; }
.deal-aging { font-size: 12px; color: var(--muted); }
.deal-aging.warn { color: #b54708; }
@media (prefers-color-scheme: dark) { .deal-aging.warn { color: #fdb022; } }

/* ---- Ask AI chat ---------------------------------------------------------*/
.chat-panel { padding: 0; }
.chat-msgs { max-height: 54vh; min-height: 200px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-hint { color: var(--muted); font-size: 14px; line-height: 1.5; }
.chat-bubble { max-width: 88%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.chat-bubble.assistant { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input .input { flex: 1; }
.chat-input .btn { width: auto; flex-shrink: 0; }

/* ---- Reporting Assistant (global bubble + drawer) ------------------------*/
.assistant-fab {
  position: fixed; right: 18px; bottom: 86px; z-index: 60;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface); color: var(--brand); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.assistant-fab:active { transform: scale(.95); }
.assistant-overlay { position: fixed; inset: 0; z-index: 200; display: none; }
.assistant-overlay.open { display: block; }
.assistant-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .45); }
.assistant-sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(2, 6, 23, .25);
}
.assistant-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.assistant-title { font-weight: 700; font-size: 15px; flex: 1; }
.assistant-close { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.assistant-sheet .chat-msgs { flex: 1; max-height: none; }
.assistant-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.assistant-input .input { flex: 1; }
.assistant-input .btn { width: auto; flex-shrink: 0; }

/* ---- Activity icons ------------------------------------------------------*/
.act-ic { display: inline-flex; align-items: center; }
.act-ic svg { display: block; }

/* ---- Natural-language quick log ------------------------------------------*/
.nl-panel textarea.input { margin: 8px 0; min-height: 64px; }
.nl-panel .btn { width: 100%; margin-top: 2px; }
.nl-panel .hint { margin-top: 8px; }

/* ---- AI company capture --------------------------------------------------*/
.draft-card { border-left: 3px solid var(--brand); }
input[type="file"].input { padding: 9px 12px; }
.draft-contacts { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 4px; }

/* ---- Duplicate warning ---------------------------------------------------*/
.dup-warn {
  background: color-mix(in srgb, #f79009 12%, transparent);
  border: 1px solid color-mix(in srgb, #f79009 40%, transparent);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.dup-warn.sm { margin-bottom: 10px; }
.dup-title { font-weight: 700; color: #b54708; }
@media (prefers-color-scheme: dark) { .dup-title { color: #fdb022; } }
.picker-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px;
}
.picker-chip.locked { color: var(--muted); }
.picker-chip-label { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-clear {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  background: transparent; border: none; color: var(--muted); font-size: 18px; line-height: 1;
}
.picker-clear:hover { background: var(--border); color: var(--text); }

/* ---- Money vertical (quotes + expenses) ---- */
.warn-panel { border-left: 3px solid #f79009; }
.locked-company { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); font-weight: 600; }

.q-items { display: flex; flex-direction: column; }
.q-item-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.q-item-row:last-child { border-bottom: none; }
.q-item-main { min-width: 0; }
.q-item-amt { font-weight: 600; white-space: nowrap; }

.q-totals { display: flex; flex-direction: column; gap: 6px; margin-left: auto; max-width: 320px; }
.q-total { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 14px; }
.q-total.grand { color: var(--text); font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }

.q-edit-row { padding: 12px; }
.q-mini-field { display: flex; flex-direction: column; gap: 2px; }
.q-mini-field label { font-size: 11px; }

.receipt-host, .receipt-img, .receipt-thumb { max-width: 100%; }
.receipt-img { border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.receipt-thumb { max-height: 160px; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 8px; }

.logo-preview { min-height: 44px; display: flex; align-items: center; margin-bottom: 8px; }
.logo-img { max-height: 56px; max-width: 180px; object-fit: contain; }

/* ---- Deals kanban (drag & drop) ---- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
.kanban-col { flex: 0 0 min(78vw, 260px); background: var(--surface-2); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; min-height: 90px; border-top: 3px solid var(--sc, transparent); }
.kanban-col.drop { outline: 2px dashed var(--brand); outline-offset: -2px; }
.kanban-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; gap: 8px; }
.kanban-head .stage-name { font-weight: 600; font-size: 13px; }
.kanban-head .stage-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.kanban-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; flex: 1; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--sc, var(--border)); border-radius: 8px; padding: 10px; cursor: grab; touch-action: none; box-shadow: var(--shadow); }
.kanban-card:active { cursor: grabbing; }
.kc-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.kc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kc-side { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kc-ghost { opacity: .35; }
.kc-drag { position: fixed; z-index: 1000; pointer-events: none; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); transform: rotate(1.5deg); opacity: .96; }
body.kc-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.deals-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.deals-toolbar .btn { flex: 0 0 auto; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; max-width: 100%; }
/* Long labels (e.g. the settings toggles) must wrap instead of overflowing the
   multi-column settings layout; keep the box aligned to the first line. */
.check-inline > span { white-space: normal; overflow-wrap: anywhere; }
.check-inline:has(> span) { align-items: flex-start; }
.check-inline > input[type="checkbox"] { flex: 0 0 auto; margin-top: 1px; }
.bulk-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-check { display: flex; align-items: center; padding-right: 4px; }
.row-card.selectable { cursor: pointer; }

/* ---- Companies grid (configurable + inline-edit) ---- */
.cgrid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); }
table.cgrid { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--surface); }
.cgrid th, .cgrid td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
.cgrid tbody tr:last-child td { border-bottom: none; }
.cgrid thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; }
.cgrid th.sortable { cursor: pointer; user-select: none; }
.cgrid th.sortable:hover { color: var(--text); }
.cgrid th.active { color: var(--brand); }
.cgrid-name { font-weight: 600; }
.cgrid-name a { text-decoration: none; }
.cgrid-check { width: 34px; text-align: center; }
.cgrid-cell.right { text-align: right; }
.cgrid-cell.editable { cursor: pointer; }
.cgrid-cell.editable:hover { background: var(--surface-2); }
.cgrid-cell .cell-val { display: inline-block; min-width: 24px; }
.cgrid-cell .cell-input { width: 100%; min-width: 110px; padding: 4px 6px; font-size: 13px; }
.cgrid tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.cgrid tbody tr.tap { cursor: pointer; }
.col-picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.col-picker-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; white-space: nowrap; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.col-picker-item:hover { background: var(--surface-2); }
.col-picker-item input { flex: 0 0 auto; }

/* ============================================================
   Glass / fluid design layer  (appended last so it wins)
   ============================================================ */
:root {
  --radius: 14px;
  --glass: color-mix(in srgb, var(--surface) 74%, transparent);
  --glass-2: color-mix(in srgb, var(--surface) 58%, transparent);
  --glass-border: color-mix(in srgb, var(--text) 12%, transparent);
  --glass-shadow: 0 6px 28px rgba(15, 23, 42, .10), 0 1px 3px rgba(15, 23, 42, .05);
  --blur: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-border: color-mix(in srgb, #ffffff 12%, transparent);
    --glass-shadow: 0 10px 34px rgba(0, 0, 0, .42);
  }
}
:root[data-theme="dark"] {
  --glass-border: color-mix(in srgb, #ffffff 12%, transparent);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, .42);
}

/* soft, slowly-drifting background so the blur has depth */
body::before {
  content: ''; position: fixed; inset: -25%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(36rem 36rem at 10% -6%, color-mix(in srgb, var(--brand) 24%, transparent), transparent 60%),
    radial-gradient(32rem 32rem at 106% 6%, color-mix(in srgb, #22c55e 14%, transparent), transparent 60%),
    radial-gradient(40rem 40rem at 62% 114%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%);
  filter: blur(34px) saturate(1.08);
  animation: fluidbg 26s ease-in-out infinite alternate;
}
@keyframes fluidbg {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -2%, 0) scale(1.04); }
  100% { transform: translate3d(0, 1%, 0) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

/* glass surfaces */
.panel, .kpi, .company-card, .cgrid-wrap, .bulk-bar, .warn-panel,
.dropdown-menu, .picker-results, .kanban-col, .kanban-card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.kanban-col { box-shadow: none; }

/* translucent, blurred top chrome */
.topbar, .tabs {
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--glass-border);
}

/* grid over glass */
.cgrid { background: transparent; }
.cgrid thead th {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

/* inputs */
.input {
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--glass-border);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

/* buttons — glass with a subtle lift */
.btn {
  border-radius: 12px;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, filter .15s ease;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .12);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 8px 20px rgba(15, 23, 42, .18); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(15, 23, 42, .12); }
.btn.ghost {
  background: var(--glass-2); color: var(--text);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}
.btn.ghost:hover { background: color-mix(in srgb, var(--surface) 82%, transparent); }

/* cards lift on hover for a fluid feel */
.row-card.tap, .kpi.tap { transition: transform .12s ease, box-shadow .15s ease; }
.row-card.tap:hover, .kpi.tap:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15, 23, 42, .16); }

/* chips + fab */
.chip { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid var(--glass-border); }
.fab { transition: transform .15s ease, box-shadow .15s ease; box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 42%, transparent); }
.fab:hover { transform: translateY(-2px) scale(1.04); }
.assistant-fab { transition: transform .15s ease; }
.assistant-fab:hover { transform: translateY(-2px) scale(1.04); }

/* segmented controls */
.seg-btn { transition: background .15s ease, color .15s ease, transform .12s ease; }
.seg-btn:hover { transform: translateY(-1px); }

/* Filter panel must sit above the grid so its dropdowns aren't clipped behind
   the (later-in-DOM) company grid, which has its own backdrop-filter context. */
.filters-panel { position: relative; z-index: 15; }

/* Filters lay out as a responsive grid — one tidy cell per filter (label above
   control) so they never overlap or squash on small screens. */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 14px; align-items: end; }
@media (max-width: 560px) { .filter-grid { grid-template-columns: 1fr; } }
.filter-grid .field { margin: 0; min-width: 0; }
.filter-grid .field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-grid .dropdown { display: block; }
.filter-grid .dropdown > .btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; text-align: left; }
.filter-grid .dropdown-menu { left: 0; right: auto; min-width: max(100%, 200px); max-width: 88vw; }
.filter-grid .input, .filter-grid select.input { width: 100%; }
.filter-grid .filter-check { align-self: end; min-height: 42px; }

/* Columns dropdown menu */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 230px; max-width: 320px; padding: 8px; border-radius: 16px;
}
.dropdown-head { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 6px 10px 8px; }
.dropdown-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--muted); transition: background .12s ease, color .12s ease; }
.dropdown-item:hover { background: color-mix(in srgb, var(--surface-2) 75%, transparent); color: var(--text); }
.dropdown-item.on { color: var(--text); font-weight: 600; }
.dropdown-item.muted span { color: var(--muted); font-style: italic; }
.dropdown-item input { flex: 0 0 auto; }

/* Native date/time picker glyph — keep it visible in both themes */
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"] { color-scheme: light; }
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="datetime-local"],
:root[data-theme="dark"] input[type="time"],
:root[data-theme="dark"] input[type="month"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="date"],
  :root:not([data-theme="light"]) input[type="datetime-local"],
  :root:not([data-theme="light"]) input[type="time"],
  :root:not([data-theme="light"]) input[type="month"] { color-scheme: dark; }
}
input::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ============================================================
   Desktop shell — left sidebar + wider content (≥1024px).
   Mobile keeps the top bar + horizontal tabs untouched.
   ============================================================ */
.nav-top, .nav-foot { display: none; }
.tab-ic {
  display: none; width: 22px; height: 22px; flex: 0 0 auto;
  align-items: center; justify-content: center; color: inherit;
}
.tab-ic svg { display: block; }
.grid-count { font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.cron-cmd { display: block; margin-top: 6px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text); max-width: 100%; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

/* ---- Tasks — minimal list ---- */
.task-group { padding: 10px 14px 4px; }
.task-group-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 2px 4px; }
.task-group-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.task-group-name.danger { color: #b54708; }
.task-group-count { font-size: 12px; color: var(--muted); }
.task-list { display: flex; flex-direction: column; }
.task-list.panel { padding: 4px 14px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-check {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  border: 1.6px solid color-mix(in srgb, var(--text) 26%, transparent); background: transparent;
  cursor: pointer; display: grid; place-items: center; color: transparent; font-size: 12px; line-height: 1;
  transition: border-color .12s ease, background .12s ease, transform .1s ease;
}
.task-check:hover { border-color: var(--brand); transform: scale(1.08); }
.task-check.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text); }
.task-title.strike { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-right { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.task-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.task-badge.overdue { color: #b54708; background: color-mix(in srgb, #f79009 16%, transparent); }
.task-badge.high { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .task-group-name.danger,
  :root:not([data-theme="light"]) .task-badge.overdue { color: #fdb022; }
}

/* ---- Minimal list treatment across the app (symmetric with tasks) ---- */
.list {
  display: flex; flex-direction: column; gap: 0;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--glass-shadow); padding: 4px 10px;
}
/* Nested lists (inside a panel/section) stay flat — no card-in-a-card */
.panel .list, .sect .list, .sect-body .list, .company-card .list, .stage-group .list {
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  border: none; box-shadow: none; border-radius: 0; padding: 0;
}
.row-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: transparent; border: none; border-radius: 8px; box-shadow: none;
  padding: 11px 8px; border-bottom: 1px solid var(--border);
}
.row-card:last-child { border-bottom: none; }
.row-card.tap { cursor: pointer; transition: background .12s ease; }
.row-card.tap:hover { background: color-mix(in srgb, var(--surface-2) 62%, transparent); transform: none; box-shadow: none; }
.row-card.selectable { border-radius: 8px; }
.row-title { font-size: 14.5px; }
.row-sub { font-size: 12.5px; }

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    align-items: start;
    min-height: 100vh;
    transition: grid-template-columns .18s ease;
  }
  .topbar { display: none; }

  .tabs {
    grid-column: 1; grid-row: 1;
    position: sticky; top: 0; height: 100vh;
    flex-direction: column; align-items: stretch;
    gap: 3px; padding: 14px 12px;
    overflow-x: visible; overflow-y: auto;
    border-right: 1px solid var(--glass-border); border-bottom: none;
  }
  .nav-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 12px; }
  .nav-brand {
    font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: var(--text);
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .nav-collapse {
    flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
    border: 1px solid var(--glass-border); background: var(--glass-2); color: var(--muted);
    cursor: pointer; font-size: 14px; line-height: 1;
  }
  .nav-collapse:hover { color: var(--text); }
  .tab {
    text-align: left; border-bottom: none !important; border-radius: 10px;
    padding: 10px 12px; font-size: 14px; margin-bottom: 0;
    display: flex; align-items: center; gap: 10px;
    transition: background .12s ease, color .12s ease;
  }
  .tab:hover { background: color-mix(in srgb, var(--surface-2) 78%, transparent); color: var(--text); }
  .tab.active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); font-weight: 600; }
  .tab-ic { display: inline-flex; }
  .nav-foot {
    display: flex; flex-direction: column; gap: 8px; margin-top: auto;
    padding: 12px; border-top: 1px solid var(--glass-border);
  }
  .nav-user { font-size: 12.5px; color: var(--muted); }
  .nav-foot-actions { display: flex; align-items: center; gap: 14px; }

  .content { grid-column: 2; grid-row: 1; max-width: 1180px; padding: 24px 28px; }
  .panel.form, form.form { max-width: 780px; }
  .detail-title { font-size: 22px; }

  /* Collapsed sidebar → icon rail */
  .app.nav-collapsed { grid-template-columns: 70px minmax(0, 1fr); }
  .app.nav-collapsed .nav-brand { display: none; }
  .app.nav-collapsed .nav-top { justify-content: center; padding-bottom: 10px; }
  .app.nav-collapsed .tab { justify-content: center; padding: 11px 0; gap: 0; }
  .app.nav-collapsed .tab-label { display: none; }
  .app.nav-collapsed .nav-user { display: none; }
  .app.nav-collapsed .nav-foot { align-items: center; }
  .app.nav-collapsed .nav-foot-actions { flex-direction: column; gap: 10px; }

  /* Settings: desktop-first, admin-only — a spacious, centred workspace. */
  .settings { max-width: 1080px; margin: 0 auto; }
  .settings > .detail-title { font-size: 24px; margin: 4px 0 18px; }
  .settings .seg { margin-bottom: 20px; }
  .settings .seg-btn { flex: 0 0 auto; min-width: auto; padding: 10px 18px; }
  .settings .panel.form, .settings form.form { max-width: none; }
  .settings .panel { padding: 20px 22px; }
  /* Two-column masonry for the form-heavy tabs so panels read as a tidy grid,
     not one tall strip. Non-form tabs keep their own single-column layout. */
  .settings-cols { display: block; column-count: 2; column-gap: 22px; }
  .settings-cols > * { break-inside: avoid; width: 100%; margin: 0 0 22px; }
  .settings-cols > .form-actions { column-span: all; margin: 2px 0 0; }
}

/* Settings tab bar: left-aligned pills that scroll instead of stretching */
.settings .seg { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.settings .seg-btn { flex: 0 0 auto; min-width: auto; padding: 9px 14px; }

@media (min-width: 1440px) {
  .content { max-width: 1320px; }
}
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.attn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.attn-row .kpi { flex: 1; min-width: 120px; }

/* Live-session presence (Sub Hub) */
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #16a34a; flex: 0 0 auto;
  display: inline-block; box-shadow: 0 0 0 0 rgba(22, 163, 74, .5);
  animation: livePulse 1.9s ease-out infinite;
}
@media (prefers-color-scheme: dark) { .live-dot { background: #34d399; } }
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  70%  { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.presence { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.presence-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; }
.presence-item:hover { background: rgba(127, 127, 127, .09); }
.presence-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-count { font-size: 12px; font-weight: 700; color: #15803d; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .presence-count { color: #34d399; } }

/* How-to library */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.help-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; cursor: pointer; width: 100%;
  background: var(--panel, #fff); border: 1px solid var(--line, #e2e2e2); border-radius: 12px; padding: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06); transition: transform .12s ease, box-shadow .15s ease; color: inherit; font: inherit;
}
.help-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15,23,42,.14); }
.help-thumb { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; color: #fff; background: #64748b; }
.help-youtube { background: #ef4444; }
.help-tango { background: #6366f1; }
.help-meta { display: flex; flex-direction: column; min-width: 0; }
.help-title { font-weight: 600; }
.help-desc { font-size: 12.5px; color: var(--muted, #667); margin-top: 2px; }

/* Sub Hub resource rows — desktop-first: the text column truncates, the action
   buttons keep their size and never get overlapped by long titles/URLs. */
.hub-res { display: flex; align-items: center; gap: 18px; }
.hub-res-main { flex: 1 1 auto; min-width: 0; }
.hub-res-main > * { min-width: 0; }
.hub-res-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-res-url { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-res-actions { flex: 0 0 auto; display: flex; gap: 6px; flex-wrap: nowrap; }
@media (max-width: 720px) { .hub-res { flex-wrap: wrap; } .hub-res-actions { flex-wrap: wrap; } }

/* Media modal (YouTube video / Tango walkthrough) */
.media-modal { position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.74); display: flex; align-items: center; justify-content: center; padding: 16px; }
.media-card { background: var(--panel, #fff); border-radius: 14px; width: min(940px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.media-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line, #e2e2e2); }
.media-title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-body { position: relative; background: #000; }
.media-card.is-video .media-body { aspect-ratio: 16 / 9; }
.media-card:not(.is-video) .media-body { height: min(78vh, 680px); }
.media-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-fallback { color: #cbd5e1; padding: 40px 20px; text-align: center; }

/* Lead quarantine: enquiry snippet + lightweight modal (assign/convert/view) */
.lead-snippet { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.lead-modal-ov { position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.6); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.lead-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: min(640px, 100%); margin: auto; padding: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.lead-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
@media (max-width: 560px) { .media-card:not(.is-video) .media-body { height: 72vh; } }

/* ==========================================================================
   Fluidity & perceived-speed polish (v0.42)
   ========================================================================== */

/* Kill the 300ms tap delay and grey tap flash; snappier pointer feel. */
* { -webkit-tap-highlight-color: transparent; }
button, a, .tap, .row-card, .tab, .seg-btn, .chip, .icon-btn, .link,
.cgrid tbody tr.tap, summary, label.dropdown-item, input[type="checkbox"], input[type="radio"] {
  touch-action: manipulation;
}

/* Smooth, momentum scrolling in the content area. */
.content { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
@media (prefers-reduced-motion: reduce) { .content { scroll-behavior: auto; } }

/* Consistent, quick mount transition for every screen. */
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-in { animation: viewIn .18s cubic-bezier(.22,.61,.36,1) both; }

/* Tactile press feedback on tappable surfaces. */
.row-card.tap, .kpi.tap, .panel.tap, .cgrid tbody tr.tap, .quick-actions .btn {
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.row-card.tap:active, .kpi.tap:active, .panel.tap:active { transform: scale(.985); }
.cgrid tbody tr.tap:active { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.chip, .icon-btn { transition: transform .1s ease, background .15s ease, color .15s ease; }
.icon-btn:active { transform: scale(.9); }

/* Long (non-table) lists paint faster: skip off-screen row layout/paint.
   Deliberately NOT applied to table rows — it can desync column widths. */
.feed > * , .list > .row-card { content-visibility: auto; contain-intrinsic-size: 64px; }

/* ---- Skeleton shimmer ---------------------------------------------------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface); }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.15s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 11px; border-radius: 6px; background: color-mix(in srgb, var(--text) 10%, transparent); margin: 5px 0; }
.sk-list { display: flex; flex-direction: column; gap: 10px; }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.sk-avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; background: color-mix(in srgb, var(--text) 10%, transparent); }
.sk-row-lines { flex: 1; }
.sk-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.sk-card { flex: 1; min-width: 120px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.sk-grid { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sk-grid-head { height: 34px; background: var(--surface-2); }
.sk-grid-row { height: 38px; border-top: 1px solid var(--border); }
.sk-grid-row:nth-child(odd) { background: color-mix(in srgb, var(--text) 3%, transparent); }

/* Honour reduced-motion everywhere. */
@media (prefers-reduced-motion: reduce) {
  .view-in { animation: none; }
  .skeleton::after { animation: none; }
  .row-card.tap:active, .kpi.tap:active, .panel.tap:active,
  .icon-btn:active, .btn:active { transform: none; }
}

/* Filter/column dropdown menus must be fully opaque and clearly above the grid —
   the translucent "glass" let dense table rows bleed through and hurt legibility. */
.dropdown-menu {
  background: var(--surface);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
  z-index: 200;
}

/* AI-drafted activity: type must be confirmed before logging. */
.type-confirm-hint {
  margin-top: 8px; font-size: 13px; color: #b45309;
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--border));
  border-radius: 8px; padding: 8px 10px;
}
.seg-btn.suggest { border: 1px dashed #f59e0b; box-shadow: 0 0 0 2px color-mix(in srgb, #f59e0b 25%, transparent); }

/* Quote revision compare */
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th, .cmp-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cmp-table thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.cmp-table tr.cmp-changed { background: color-mix(in srgb, #f59e0b 12%, transparent); }
.timeline .tl-item.tl-cur .tl-dot { background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }

/* Lead capture cards */
.lead-card { padding: 12px 14px; }
.lead-card .row-title { font-size: 15px; }
.lead-card .link { margin-right: 4px; }
/* A checkbox inside a `.row.gap` must NOT inherit `.gap > * { flex:1 }` — otherwise it
   claims an equal share of the row and crushes the content beside it. Keep it intrinsic. */
.lead-card input[type="checkbox"] { flex: 0 0 auto; margin-top: 2px; align-self: flex-start; }

/* Self-serve landing (modern, minimal) */
.landing { min-height: 100dvh; background: var(--bg); padding: 24px 16px; overflow-y: auto; }
.lp-wrap { max-width: 1040px; margin: 0 auto; }
.lp-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 20px; }
.lp-logo { width: 34px; height: 34px; }
.lp-brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.lp-grid { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; padding-top: 12px; }
.lp-hero { max-width: 560px; }
.lp-badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); padding: 5px 11px; border-radius: 999px; margin-bottom: 14px; }
.lp-title { font-size: clamp(26px, 5vw, 40px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 12px; }
.lp-sub { font-size: 15px; color: var(--muted); line-height: 1.55; margin: 0 0 18px; }
.lp-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lp-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.lp-ic { flex: 0 0 auto; }
.lp-auth { justify-self: stretch; display: flex; justify-content: center; }
.lp-auth .card { max-width: 400px; }
.lp-card-title { font-size: 18px; margin: 0 0 4px; }
@media (min-width: 860px) {
  .lp-grid { grid-template-columns: 1.1fr 0.9fr; gap: 44px; min-height: 60vh; }
  .lp-auth { justify-self: end; }
}

/* First-run quick-start modal */
.qs-card { width: min(520px, 100%); }
.qs-list { display: grid; gap: 8px; margin-top: 14px; }
.qs-step { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .12s, transform .08s; }
.qs-step:hover { border-color: var(--brand); transform: translateY(-1px); }
.qs-ic { flex: 0 0 auto; font-size: 18px; }
.qs-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qs-title { font-weight: 600; font-size: 14px; }
.qs-desc { font-size: 12.5px; color: var(--muted); }
.qs-arrow { flex: 0 0 auto; color: var(--muted); font-size: 20px; }

/* Home quick-start panel — a new-user nudge, so it reads as a clear highlight */
.quick-start { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 28%, var(--border)); }
.quick-start .qs-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; font-size: 13px; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--border)); border-radius: 999px; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); }
.qs-chip:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }

/* Convert-enquiry company resolution (dedup choice) */
.conv-resolve { margin: 2px 0 12px; }
.conv-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.conv-opt:hover { border-color: var(--brand); }
.conv-opt input[type="radio"] { flex: 0 0 auto; margin-top: 3px; width: 16px; height: 16px; }
.conv-opt-title { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.conv-opt-sub { display: block; font-size: 12px; color: var(--muted); }

/* Consent / Terms-of-Use gate */
.consent-notice { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border)); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.consent-long { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; color: var(--text); max-height: 260px; overflow-y: auto; background: var(--surface-2); }
.consent-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 13px; cursor: pointer; }
.consent-check input[type="checkbox"] { flex: 0 0 auto; margin-top: 2px; width: 18px; height: 18px; }

/* Leads hub (overview landing) */
.hub-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.hub-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.hub-stat.clickable { cursor: pointer; transition: border-color .12s, transform .12s; }
.hub-stat.clickable:hover { border-color: var(--brand); transform: translateY(-1px); }
.hub-stat-num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.hub-stat-label { font-size: 13px; font-weight: 600; margin-top: 2px; }
.hub-stat-hint { font-size: 11px; color: var(--muted); margin-top: 1px; }
.hub-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hub-row:last-child { border-bottom: 0; }
.hub-banner { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }

/* Dashboards */
.dash-bars { display: flex; flex-direction: column; gap: 8px; }
.dash-bar { display: flex; align-items: center; gap: 10px; }
.dash-bar-label { flex: 0 0 34%; max-width: 34%; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-val { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Split date+time picker (mobile calendar) */
.dt-split { flex-wrap: wrap; align-items: stretch; }
.dt-split > div { min-width: 0; }

/* Header notification bell + badge */
.bell-btn { position: relative; }
.bell-ic { font-size: 16px; line-height: 1; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }

/* Notifications list */
.notif-list { padding: 0; }
.notif-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-row:last-child { border-bottom: 0; }
.notif-row.tap { cursor: pointer; }
.notif-row.tap:hover { background: var(--surface-2); }
.notif-row.unread { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.notif-ic { font-size: 18px; flex: 0 0 auto; line-height: 1.2; }
.notif-main { min-width: 0; flex: 1; }
.notif-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.notif-body { font-size: 13px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.notif-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.notif-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; }
