/* Raven CRM — violet-tinted neutrals, one purple accent (tokens below), Geist type. */
:root {
  /* surfaces (one gray family, faintly tinted toward the purple) */
  --bg: #f7f6f9;
  --surface: #ffffff;
  --surface-2: #fbfafc;
  --surface-3: #f2f0f5;
  --border: #e7e4ec;
  --border-strong: #d7d2de;
  --text: #1d1a24;
  --muted: #6a6476;
  --faint: #9c96a8;
  /* accent: the one interactive color. Swap this block (and the stage ramp below) to re-theme. */
  --accent: #6a3fb5;           /* buttons, links on hover, selected states (AA on white) */
  --accent-hover: #56309a;
  --accent-weak: #f4effc;      /* tinted backgrounds */
  --accent-border: #dccdf3;
  --accent-bright: #bba6f7;    /* the accent on dark surfaces: active nav, toast actions */
  --ring: rgba(106, 63, 181, .25);
  /* pipeline stages deepen as a lead moves along; every shade keeps white text at 4.5:1+ */
  --stage-1: #7a4cc8; --stage-2: #6a3fb5; --stage-3: #5d36a0; --stage-4: #512f8c;
  --stage-5: #462878; --stage-6: #3b2265; --stage-7: #311c54;
  --stage-won: #157a3f;
  --stage-lost: #6f6880;
  /* status */
  --danger: #be123c;
  --danger-weak: #fff1f3;
  --danger-border: #fbcbd5;
  --warn: #a15c07;
  --warn-weak: #fff8eb;
  --warn-border: #f5dcaa;
  --ok: #157a3f;
  --ok-weak: #effaf3;
  /* sidebar */
  --side: #17141d;
  --side-2: #221d2a;
  --side-3: #2d2637;
  --side-text: #d8d2e1;
  --side-muted: #8b8398;
  /* shape, depth, motion */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 14px;
  --shadow-sm: 0 1px 2px rgba(34, 24, 56, .05);
  --shadow: 0 1px 2px rgba(34, 24, 56, .04), 0 3px 8px rgba(34, 24, 56, .05);
  --shadow-lg: 0 20px 48px -14px rgba(34, 24, 56, .30), 0 4px 14px rgba(34, 24, 56, .08);
  /* a transparent ring + soft drop in place of a solid border, so edges read on any background */
  --shadow-border: 0 0 0 1px rgba(29, 20, 48, .09), 0 1px 2px -1px rgba(29, 20, 48, .08), 0 2px 4px 0 rgba(29, 20, 48, .04);
  --shadow-border-hover: 0 0 0 1px rgba(29, 20, 48, .14), 0 1px 2px -1px rgba(29, 20, 48, .10), 0 2px 4px 0 rgba(29, 20, 48, .06);
  --shadow-pop: 0 0 0 1px rgba(29, 20, 48, .09), var(--shadow-lg);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  /* stacking */
  --z-sticky: 2;
  --z-dropdown: 40;
  --z-drawer: 55;
  --z-modal: 60;
  --z-toast: 80;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { text-wrap: balance; }
p, .hint, .empty, td.note-cell, .note-preview, .reminder-summary, .match-hint, .field-error { text-wrap: pretty; }
a { color: var(--text); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: color .15s var(--ease), text-decoration-color .15s var(--ease); }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
.hint a, .empty a, p a { text-decoration-color: var(--border-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg { width: 16px; height: 16px; flex: none; }
.assoc-card .head svg { color: var(--faint); }
.chip svg, .assoc-toggle svg { width: 12px; height: 12px; color: var(--muted); }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: var(--z-toast); background: var(--text); color: #fff; padding: 8px 12px; border-radius: var(--r); font-weight: 600; transition: top .15s var(--ease); }
.skip-link:focus { top: 10px; color: #fff; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 224px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; }
.brand { display: flex; align-items: center; padding: 2px 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 28px; width: auto; }
#nav { display: flex; flex-direction: column; gap: 1px; }
#nav .nav-label { font-size: 11.5px; font-weight: 550; color: var(--side-muted); padding: 14px 10px 5px; letter-spacing: .01em; }
#nav .nav-label:first-child { padding-top: 0; }
#nav a { position: relative; display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 7px 10px; border-radius: var(--r); font-weight: 450; text-decoration: none; transition: background .15s var(--ease), color .15s var(--ease); }
#nav a:hover { background: var(--side-2); color: #fff; }
#nav a.active { background: var(--side-3); color: #fff; font-weight: 550; }
#nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-bright); }
#nav a.active svg { color: var(--accent-bright); opacity: 1; }
#nav svg { width: 16px; height: 16px; flex: none; opacity: .75; stroke-width: 1.5px; }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.global-search { position: relative; width: min(440px, 55%); }
.global-search input { width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239c96a8' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='M9.5 9.5L13 13'/%3E%3C/svg%3E") 12px center no-repeat; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease); }
.global-search input:hover { border-color: var(--border-strong); }
.global-search input:focus { outline: none; background-color: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.global-results { position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: var(--z-dropdown); max-height: 420px; overflow: auto; padding: 6px; }
.global-results .group { font-size: 12px; font-weight: 550; color: var(--faint); padding: 8px 10px 4px; }
.global-results a { display: block; padding: 7px 10px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.global-results a:hover, .global-results a.active { background: var(--accent-weak); color: var(--text); }
.global-results .sub { color: var(--muted); font-size: 12px; margin-left: 6px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.user-chip .avatar { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
main { flex: 1; overflow: auto; min-height: 0; outline: none; }
main:focus, main:focus-visible { outline: none; } /* focused on each page change for screen readers; no ring needed */
/* Reps switch pages all day, so a switch only fades in briefly; the first page simply appears
   (main gets data-ready from the second page on, see main.js) */
main[data-ready] > * { animation: page-in 120ms ease-out both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- generic */
.page { padding: 28px 32px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; line-height: 1.15; margin: 0; font-weight: 650; letter-spacing: -.025em; }
.page-head .count { color: var(--faint); font-weight: 450; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; background: var(--surface); box-shadow: var(--shadow-border); padding: 0 13px; border-radius: var(--r); cursor: pointer; white-space: nowrap; line-height: 1; font-weight: 550; text-decoration: none; transition: background-color .15s ease-out, color .15s ease-out, box-shadow .15s ease-out, scale .15s ease-out; }
.btn:has(> svg:first-child) { padding-left: 11px; } /* an icon looks heavier than text: 2px less on its side */
.btn:hover { background: var(--surface-3); box-shadow: var(--shadow-border-hover); color: var(--text); }
.btn:active:not(:disabled):not(.static) { scale: .96; } /* add .static to opt a button out */
.btn:focus-visible { outline: none; box-shadow: var(--shadow-border), 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 1px 2px rgba(29, 20, 48, .24); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #9f1239; border-color: #9f1239; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
/* after .primary and .ghost, which set their own shadow: keyboard focus must still show its ring */
.btn.primary:focus-visible { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 0 0 3px var(--ring); }
.btn.ghost:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn.small:has(> svg:first-child) { padding-left: 8px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { position: relative; border: 0; background: transparent; padding: 5px; border-radius: var(--r-sm); cursor: pointer; color: var(--faint); display: inline-flex; transition: background-color .15s ease-out, color .15s ease-out; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
/* small icon buttons keep their look; this invisible square is what you actually click (44px on touch screens) */
.icon-btn::after, .chip button::after { content: ""; position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; transform: translate(-50%, -50%); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; /* 6px buttons + 3px padding + 1px border */ }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.segmented svg { width: 16px; height: 16px; }
input.field, select.field, textarea.field { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input.field:hover, select.field:hover, textarea.field:hover { border-color: #c7c0d0; }
textarea.field { min-height: 84px; resize: vertical; line-height: 1.5; }
input.field:focus, select.field:focus, textarea.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input.field::placeholder, textarea.field::placeholder { color: var(--faint); }
.field.invalid, .field.invalid:focus { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(190, 18, 60, .14); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 6px; }
.label .req { color: var(--accent); margin-left: 2px; }
.hint { color: var(--muted); font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.chip button { position: relative; border: 0; background: none; cursor: pointer; padding: 0; color: var(--faint); display: inline-flex; }
.chip button svg { width: 12px; height: 12px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 550; padding: 1px 7px; border-radius: 5px; background: var(--accent-weak); color: var(--accent); border: 1px solid var(--accent-border); }
.badge.source { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.badge.source.AUTOMATION { background: var(--accent-weak); color: var(--accent); border-color: var(--accent-border); }
.stage-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.avatar { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-weak); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 650; font-size: 14px; letter-spacing: .02em; flex: none; box-shadow: inset 0 0 0 1px var(--accent-border); }
.avatar.square { border-radius: 11px; }
.muted { color: var(--muted); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--faint); }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border); }
kbd { font: 500 11px/1 var(--mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--muted); }

/* skeleton loading */
.skeleton-page { padding: 28px 32px; }
.sk { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, #eeebf2 0%, #f7f5f9 45%, #eeebf2 90%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
.sk-title { width: 220px; height: 26px; margin-bottom: 22px; }
.sk-row { height: 44px; margin-bottom: 8px; border-radius: var(--r); }
.sk-line { height: 12px; margin: 10px 0; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------------------------------------------------------------- index */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { width: 260px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--accent-weak); border: 1px solid var(--accent-border); border-radius: var(--r); margin-bottom: 10px; }
.table-wrap { overflow: auto; }
table.records { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); font-variant-numeric: tabular-nums; }
table.records th, table.records td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
table.records tbody tr:last-child td { border-bottom: 0; }
table.records th { position: sticky; top: 0; background: var(--surface-2); font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; user-select: none; z-index: var(--z-sticky); }
table.records th:hover:not(.nosort) { color: var(--text); }
table.records th.nosort { cursor: default; }
table.records th .arrow { margin-left: 4px; color: var(--accent); }
table.records tbody tr { transition: background .12s var(--ease); }
table.records tbody tr:hover td { background: var(--surface-2); }
table.records tbody tr.selected td { background: var(--accent-weak); }
table.records td.check, table.records th.check { width: 40px; padding: 0; }
.check-hit { display: flex; align-items: center; justify-content: center; width: 40px; height: 44px; cursor: pointer; }
table.records td.name a { font-weight: 600; }
table.records input[type=checkbox] { accent-color: var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.popover { position: absolute; z-index: var(--z-dropdown); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 14px; min-width: 260px; animation: pop-in .14s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-3px) scale(.99); } to { opacity: 1; transform: none; } }
.popover .row { margin-bottom: 10px; }
.col-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.col-list label { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.col-list input { accent-color: var(--accent); }

/* ---------------------------------------------------------------- board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 276px; background: var(--surface-3); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); border: 2px solid transparent; transition: border-color .15s var(--ease), opacity .15s var(--ease), background .15s var(--ease); }
.column-head { padding: 12px 12px 8px; }
.column-head .title { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stage-mark { display: inline-flex; color: var(--stage-lost); }
.stage-mark.won { color: var(--stage-won); }
.stage-mark svg { width: 14px; height: 14px; }
.column-head .meta { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.column-body { padding: 0 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column.drop-ok { border-color: var(--accent-border); background: var(--accent-weak); }
.column.drop-blocked { opacity: .5; }
.column.drop-blocked .column-head .title::after { content: "Locked"; font-size: 11px; font-weight: 600; color: var(--danger); margin-left: auto; }
.column.over { border-color: var(--accent); }
.bcard { background: var(--surface); border-radius: var(--r); padding: 11px 12px; box-shadow: var(--shadow-border); cursor: grab; transition: box-shadow .15s ease-out, transform .15s ease-out; }
.bcard:hover { box-shadow: var(--shadow-border-hover), var(--shadow); transform: translateY(-1px); }
.bcard:active { cursor: grabbing; }
.bcard.dragging { opacity: .4; }
.bcard .t { font-weight: 600; display: block; margin-bottom: 6px; color: var(--text); }
.bcard .l { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- record */
.record { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; gap: 16px; padding: 20px 24px 40px; align-items: start; }
.record .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rec-head { padding: 16px 18px; }
.rec-head .back { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; color: var(--muted); }
.rec-head .who { display: flex; gap: 12px; align-items: center; }
.rec-head h1 { font-size: 20px; margin: 0; line-height: 1.2; word-break: break-word; letter-spacing: -.02em; font-weight: 650; }
.rec-head .sub { color: var(--muted); font-size: 13px; word-break: break-all; margin-top: 2px; }
.rec-head .actions { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.stage-line { margin-top: 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: 13px; }
.stage-line select { padding: 5px 8px; min-height: 32px; }
.section { padding: 2px 0; }
.section-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; cursor: pointer; font-weight: 600; user-select: none; border-radius: var(--r-lg); }
.section-head:hover { color: var(--accent); }
.section-head svg { width: 16px; height: 16px; color: var(--faint); transition: transform .18s var(--ease); }
.section.closed .section-head svg { transform: rotate(-90deg); }
.section.closed .section-body { display: none; }
.section-body { padding: 0 18px 14px; }
.prop { padding: 6px 0; }
.prop .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.prop .k .icon-btn { opacity: 0; padding: 1px; }
.prop:hover .k .icon-btn, .prop .k .icon-btn:focus-visible { opacity: 1; }
.prop .v { min-height: 24px; padding: 2px 6px; margin: 0 -6px; border-radius: var(--r-sm); cursor: text; word-break: break-word; white-space: pre-wrap; transition: background .12s var(--ease), box-shadow .12s var(--ease); }
.prop .v:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.prop .v.ro { cursor: default; color: var(--muted); }
.prop .v.ro:hover { background: none; box-shadow: none; }
.prop .v.blank { color: var(--faint); }
.prop .edit-actions { display: flex; gap: 6px; margin-top: 6px; }
.composer { padding: 14px 16px; }
.composer textarea { min-height: 72px; }
.composer .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer .assoc-toggle { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.composer .assoc-toggle label { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; background: var(--surface-3); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; }
.timeline { padding: 4px 18px 18px; }
.tl-month { font-size: 12.5px; font-weight: 600; color: var(--faint); margin: 16px 0 6px; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.tl-month + .tl-item { border-top: 0; }
.tl-dot { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.tl-dot svg { width: 16px; height: 16px; }
.tl-item .when { font-size: 12px; color: var(--faint); }
.tl-item .what { margin: 2px 0 3px; }
.tl-item .body { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 9px 11px; white-space: pre-wrap; margin-top: 6px; }
.assoc-card .head { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.assoc-card .items { padding: 4px 14px 10px; }
.assoc-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.assoc-item:last-child { border-bottom: 0; }
.assoc-item .main { flex: 1; min-width: 0; }
.assoc-item .main a { font-weight: 600; }
.assoc-item .line { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assoc-item .icon-btn { opacity: 0; }
.assoc-item:hover .icon-btn, .assoc-item .icon-btn:focus-visible { opacity: 1; }
.menu { position: absolute; z-index: var(--z-dropdown); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 5px; min-width: 180px; animation: pop-in .14s var(--ease); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.menu button:hover { background: var(--surface-3); }

/* ---------------------------------------------------------------- overlays */
.overlay { position: fixed; inset: 0; background: rgba(24, 16, 38, .36); backdrop-filter: blur(2px); z-index: var(--z-modal); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; animation: fade-in .15s var(--ease); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(480px, 92vw); max-height: 84vh; display: flex; flex-direction: column; animation: dialog-in .2s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog.wide { width: min(640px, 94vw); }
.dialog-head { display: flex; align-items: center; padding: 18px 20px 8px; font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.dialog-head > span:first-child { text-wrap: balance; }
.dialog-body { padding: 8px 20px 16px; overflow: auto; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.drawer-overlay { position: fixed; inset: 0; background: rgba(24, 16, 38, .24); z-index: var(--z-drawer); animation: fade-in .15s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 96vw); background: var(--surface); z-index: calc(var(--z-drawer) + 1); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide-in .2s var(--ease); }
@keyframes slide-in { from { transform: translateX(28px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.picker-results { display: flex; flex-direction: column; margin-top: 10px; max-height: 320px; overflow: auto; }
.picker-results button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.picker-results button:hover, .picker-results button.active { background: var(--accent-weak); }
.history-list { display: flex; flex-direction: column; }
.history-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-row .val { font-weight: 600; word-break: break-word; }
.history-row .meta { font-size: 12px; color: var(--muted); grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.history-row.current .val::after { content: "current"; margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--ok); }
/* bottom-right on desktops, so a message never sits on the Save/Cancel buttons of a dialog opened right after it */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; width: max-content; max-width: min(580px, calc(100vw - 32px)); }
.toast { background: #1f1a27; color: #f4f1f8; padding: 11px 14px 11px 12px; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; gap: 12px; align-items: center; max-width: 580px; animation: toast-in .2s var(--ease); transition: opacity .15s ease-out, translate .15s ease-out; }
.toast.leaving { opacity: 0; translate: 0 6px; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.toast.success::before { background: #4ade80; }
.toast.error::before { background: #fb7185; }
.toast button { background: none; border: 0; color: var(--accent-bright); font-weight: 650; cursor: pointer; padding: 0 2px; }
.toast button:hover { text-decoration: underline; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- settings */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.opt-row { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 6px; margin-bottom: 6px; }
.pipeline { margin-bottom: 18px; }
.pipeline h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.stage-row { display: grid; grid-template-columns: 24px 1fr 110px 1fr; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); align-items: center; }

.version-banner { background: var(--warn-weak); color: #6b3d00; border-bottom: 1px solid var(--warn-border); padding: 10px 24px; font-size: 13px; }
.version-banner code { background: rgba(0, 0, 0, .06); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); }

/* ---------------------------------------------------------------- leads */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-link { display: inline-flex; align-items: center; gap: 9px; color: var(--text); white-space: nowrap; text-decoration: none; padding: 3px 8px 3px 3px; border-radius: var(--r); transition: background .15s var(--ease); }
.user-link:hover { background: var(--surface-3); color: var(--text); }
.call-form { display: flex; flex-direction: column; gap: 14px; }
.call-by { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: 13px; margin-top: -6px; }
.call-by .rep-select { width: auto; min-height: 30px; padding: 3px 8px; }
.call-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.call-reach { margin-top: -8px; }
.call-field { position: relative; }
.call-followup { padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }
.call-followup .label .hint { font-weight: 450; }
.field-extra:empty { display: none; }
.match-hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 12.5px; color: var(--ok); }
.match-hint svg { width: 12px; height: 12px; margin-top: 3px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border-radius: 10px; /* 6px options + 4px padding */ box-shadow: var(--shadow-pop); padding: 4px; margin-top: 4px; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.suggest button:hover, .suggest button.active { background: var(--accent-weak); }
.call-success { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--ok-weak); color: var(--ok); font-weight: 550; }
.call-success svg { width: 16px; height: 16px; }
.call-restored { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r); background: var(--accent-weak); border: 1px solid var(--accent-border); color: var(--text); font-size: 13px; }
.call-restored svg { width: 16px; height: 16px; color: var(--accent); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent-hover); }
.stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-border); }
.stats .stat { position: relative; flex: 1 1 150px; padding: 16px 20px 15px; background: var(--surface); border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; }
.stat-value { order: 2; font: 600 28px/1.1 var(--font); letter-spacing: -.03em; } /* the sans font: Geist Mono slashes its zeros */
.stat-label { order: 1; color: var(--muted); font-size: 12.5px; font-weight: 500; margin-bottom: 6px; }
.stats .stat-alert { background: var(--danger-weak); }
.stat-alert .stat-value { color: var(--danger); }
.stat-alert .stat-label { color: #9f1239; }
.stat-link { position: absolute; right: 8px; bottom: 9px; padding: 8px 10px; /* same spot, bigger target */ font-size: 12px; font-weight: 600; color: var(--danger); text-decoration-color: currentColor; }
.stat-link:hover { color: #9f1239; }
table.calls td { vertical-align: top; }
table.calls td.note-cell { white-space: normal; min-width: 200px; max-width: 360px; color: var(--muted); }
table.calls td.note-cell .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.calls tr.closed td { color: var(--faint); }
table.calls .lead-name { font-weight: 600; }
table.calls .sub, .cell-sub { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
table.calls .reach, .reach-line { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.calls .reach svg, .reach-line svg { width: 12px; height: 12px; color: var(--faint); }
select.field.stage-select { width: auto; min-width: 176px; min-height: 32px; padding: 4px 30px 4px 10px; border-left: 4px solid var(--border-strong); border-radius: var(--r-sm); background-color: var(--surface); font-size: 13px; font-weight: 500; }
.call-empty { padding: 56px 24px; }
.call-empty .big-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-weak); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; box-shadow: inset 0 0 0 1px var(--accent-border); }
.call-empty .big-icon svg { width: 24px; height: 24px; }
.call-empty p { max-width: 46ch; margin: 6px auto; }
.call-empty .btn { margin-top: 12px; }
.rep-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }

/* ---------------------------------------------------------------- reminders */
.bell-btn { position: relative; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r); width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: background-color .15s ease-out, color .15s ease-out, border-color .15s ease-out, scale .15s ease-out; }
.bell-btn:hover { color: var(--text); background: var(--surface-3); }
.bell-btn:active { scale: .96; }
.bell-btn svg { width: 20px; height: 20px; }
.bell-btn .bell-count { display: none; position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font: 600 11px/18px var(--font); font-variant-numeric: tabular-nums; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.bell-btn.has-due { color: var(--danger); border-color: var(--danger-border); background: var(--danger-weak); }
.bell-btn.has-due .bell-count { display: block; }
.bell-btn.has-due svg { animation: ring 3.2s var(--ease) 1s 2; transform-origin: 50% 15%; }
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(12deg); } 92% { transform: rotate(-10deg); } 95% { transform: rotate(6deg); } 98% { transform: rotate(-3deg); } }
.bell-panel { width: 360px; padding: 0; overflow: hidden; }
.bell-head { padding: 13px 16px 10px; border-bottom: 1px solid var(--border); }
.bell-list { max-height: 360px; overflow: auto; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.bell-item:hover { background: var(--surface-2); }
.bell-item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bell-item .main > a:first-child { font-weight: 600; line-height: 1.35; }
.bell-item .reach { font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.bell-item .reach svg { width: 12px; height: 12px; }
.bell-item .icon-btn { border: 1px solid var(--border); color: var(--muted); }
.bell-item .icon-btn:hover { color: var(--ok); border-color: var(--ok); background: var(--ok-weak); }
.bell-empty { display: flex; gap: 8px; align-items: center; padding: 22px 16px; color: var(--ok); }
.bell-foot { display: block; padding: 11px 16px; font-weight: 600; text-align: right; background: var(--surface-2); color: var(--accent); }
#nav .nav-count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 6px; background: var(--danger); color: #fff; font: 600 11px/16px var(--font); font-variant-numeric: tabular-nums; text-align: center; }
.due-label { font-weight: 600; font-size: 13px; }
.due-label.overdue { color: var(--danger); }
.due-label.today { color: var(--warn); }
.due-label.soon { color: var(--text); }
.due-label.later { color: var(--muted); font-weight: 500; }
.reminder-picker { display: flex; flex-direction: column; gap: 10px; }
.reminder-picker .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out, scale .15s ease-out; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn:active { scale: .96; }
.chip-btn.on { background: var(--text); border-color: var(--text); color: #fff; font-weight: 600; }
.reminder-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reminder-custom input[type=number] { width: 72px; }
.reminder-custom select, .reminder-custom input[type=date] { width: auto; }
.reminder-summary { font-size: 12.5px; color: var(--muted); }
.reminder-popover { width: 380px; }
.popover-actions { display: flex; gap: 8px; margin-top: 12px; }
.followup-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); height: 28px; padding: 0 9px; font: 550 12.5px var(--font); cursor: pointer; color: var(--muted); white-space: nowrap; transition: border-color .15s ease-out, background-color .15s ease-out, scale .15s ease-out; }
.followup-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.followup-btn:active { scale: .96; }
.followup-btn svg { width: 12px; height: 12px; }
.followup-btn.overdue { color: var(--danger); border-color: var(--danger-border); background: var(--danger-weak); }
.followup-btn.today { color: var(--warn); border-color: var(--warn-border); background: var(--warn-weak); }
.followup-btn.soon { color: var(--text); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
table.reminders td { white-space: normal; vertical-align: top; }
table.reminders .reminder-cell { min-width: 240px; }
table.reminders .reminder-cell > a { font-weight: 600; }
table.reminders .note-preview { margin-top: 3px; max-width: 440px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
table.reminders .reach { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); }
table.reminders .reach svg { width: 12px; height: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- sign in */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 40px 16px; background: var(--bg); }
.auth-wrap { width: min(400px, 100%); display: flex; flex-direction: column; align-items: center; gap: 22px; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: no-preference) {
  .auth-wrap > * { animation: auth-in .3s ease-out both; }
  .auth-wrap > :nth-child(2) { animation-delay: .1s; }
  .auth-wrap > :nth-child(3) { animation-delay: .2s; }
}
.auth-logo { display: block; height: 46px; width: auto; }
.auth-card { width: 100%; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-border), var(--shadow); padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.auth-card .intro { margin: -6px 0 0; color: var(--muted); }
.auth-card.in-dialog { box-shadow: none; padding: 0; }
.auth-field .hint { margin-top: 5px; }
.auth-error { padding: 10px 12px; border-radius: var(--r); background: var(--danger-weak); color: #9f1239; font-weight: 500; font-size: 13.5px; }
.auth-help { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.auth-foot { margin: 0; color: var(--faint); font-size: 12.5px; }
.pw-wrap { position: relative; }
.pw-wrap .field { padding-right: 64px; }
.pw-toggle { position: absolute; top: 1px; right: 1px; bottom: 1px; border: 0; background: none; color: var(--accent); font: 600 12.5px var(--font); padding: 0 12px; border-radius: 0 calc(var(--r) - 1px) calc(var(--r) - 1px) 0; cursor: pointer; transition: background-color .15s ease-out; }
.pw-toggle::after { content: ""; position: absolute; inset: -3px -1px; } /* 40px tall on a 36px field; 48px on a touch field */
.pw-toggle:hover { background: var(--accent-weak); }
.btn.block { width: 100%; height: 40px; }
.field.mono { font-family: var(--mono); letter-spacing: .02em; }

/* the account menu in the top bar */
button.user-link { border: 0; background: none; font: inherit; cursor: pointer; }
.user-link .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-link .role { font-size: 11.5px; color: var(--muted); }
.user-link > svg { width: 14px; height: 14px; color: var(--faint); }

/* ---------------------------------------------------------------- team */
.rep-cell { display: inline-flex; align-items: center; gap: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.you { color: var(--muted); font-weight: 450; }
.status-warn { color: var(--warn); font-weight: 550; }
.row-end { width: 52px; text-align: right; }
.team-form { display: flex; flex-direction: column; gap: 14px; }
.signin-details { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--shadow-border); }
.signin-details dt { color: var(--muted); }
.signin-details dd { margin: 0; font-weight: 550; word-break: break-all; }
.signin-details .temp-pw { font-family: var(--mono); font-size: 16px; letter-spacing: .04em; }

/* ---------------------------------------------------------------- two-step sign-in */
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .32em; text-align: center; }
.code-input::placeholder { letter-spacing: normal; }
/* scoped to the sign-in screens: .link-btn on its own is the underlined inline link (Log a lead's "Start over") */
.auth-links .link-btn { font: 600 13px var(--font); padding: 4px 6px; margin: -4px -6px; border-radius: var(--r-sm); text-align: left; }
.auth-links .link-btn:hover { background: var(--accent-weak); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-note { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: var(--shadow-border); font-size: 13.5px; }
/* The setup and recovery-code screens sit on one center line: title, steps, QR code, key, code box and buttons. */
.auth-card.centered > h1, .auth-card.centered > .intro { text-align: center; }
.setup-steps { width: 100%; max-width: 400px; margin: 0 auto; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 22px; }
.setup-steps > li { counter-increment: step; display: flex; flex-direction: column; align-items: center; text-align: center; }
.setup-steps > li::before { content: counter(step); width: 24px; height: 24px; margin-bottom: 8px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); font-weight: 650; font-size: 12.5px; display: grid; place-items: center; }
.setup-steps > li > strong { margin-bottom: 4px; }
.setup-steps p { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; text-wrap: balance; }
.setup-steps .hint { margin: 8px 0 0; }
.setup-steps .auth-card.in-dialog { align-self: stretch; margin-top: 8px; gap: 12px; }
.setup-steps .auth-field { text-align: center; }
.qr-box { margin: 8px 0 12px; }
.qr-img { display: block; width: 172px; height: 172px; image-rendering: pixelated; border-radius: var(--r); box-shadow: var(--shadow-border); background: #fff; }
.key-row { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.secret-key { font-family: var(--mono); font-size: 13.5px; letter-spacing: .03em; text-align: center; text-wrap: balance; word-break: break-word; padding: 6px 10px; background: var(--surface-2); border-radius: var(--r-sm); box-shadow: var(--shadow-border); user-select: all; }
.codes-panel { width: 100%; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.codes-panel .intro { margin: 0; color: var(--muted); text-align: center; text-wrap: balance; }
.recovery-list { margin: 0; padding: 14px 16px; list-style: none; display: grid; grid-template-columns: 1fr 1fr; justify-items: center; gap: 6px 18px; background: var(--surface-2); border-radius: var(--r-lg); box-shadow: var(--shadow-border); font-family: var(--mono); font-size: 15px; letter-spacing: .03em; user-select: all; }
.codes-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.codes-panel .codes-actions { justify-content: center; }
.check-row { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; cursor: pointer; }
.dialog-sub { margin: 4px 0 12px; font-size: 15px; text-align: center; }

/* ---------------------------------------------------------------- dashboard */
.dash-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.dash-filters .lbl-short { display: none; }
.dash-filters { align-items: center; }
.dash-filters .rep-select { width: auto; min-width: 190px; flex: none; margin-left: auto; }
.dash > .back { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; color: var(--muted); }
.dash > .back:hover { color: var(--text); }
.rep-head { gap: 14px; }
.rep-head p { margin: 3px 0 0; }
.rep-link { color: inherit; text-decoration: none; }
.rep-link:hover .rep-link-name, .rep-link:focus-visible .rep-link-name { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dash-table tr.clickable { cursor: pointer; }
.dash-leads .section-title { align-items: center; }
.seg-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.segmented button.on .seg-count { color: var(--muted); }
.dash-more { font-size: 13px; margin: 8px 2px 0; }
.dash-content { transition: opacity .15s ease-out; }
.dash-content.is-refreshing { opacity: .55; } /* the last numbers stay while new ones load: no flash */
.stat-note { order: 3; margin-top: 4px; font-size: 12px; color: var(--faint); }
.dash-figs { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.fig { margin: 0; padding: 16px 18px 18px; display: flex; flex-direction: column; min-width: 0; }
.fig-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.fig-title { font-weight: 650; }
.fig-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.fig-note p { margin: 6px 0 0; }
.fig-body { min-width: 0; }
.fig-table { font-size: 13px; }
/* columns: one series, 24px max, 4px rounded tops, square on the baseline, 2px gaps */
.colchart { display: flex; flex-direction: column; gap: 6px; padding-top: 16px; }
.col-plot { position: relative; height: 180px; margin-left: 30px; }
.col-gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.col-gridline:last-child { border-top-color: var(--border-strong); } /* the baseline */
.col-gridline span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.col-row { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.daycol { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; outline: none; }
.daycol:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.col-bar { position: relative; width: min(100%, 24px); background: var(--accent); border-radius: 4px 4px 0 0; transition: filter .12s ease-out; }
.daycol:hover .col-bar, .daycol:focus-visible .col-bar { filter: brightness(1.2); }
.col-value { position: absolute; bottom: calc(100% + 4px); left: 50%; translate: -50% 0; font-size: 11.5px; font-weight: 600; color: var(--text); }
.col-xrow { display: flex; gap: 2px; margin-left: 30px; }
.col-x { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--faint); white-space: nowrap; }
/* horizontal bars, in pipeline order */
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; gap: 12px; }
.hbar-label { font-size: 13px; color: var(--muted); text-align: right; }
.hbar-track { display: flex; align-items: center; gap: 8px; height: 28px; border-radius: 4px; outline: none; }
.hbar-track:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.hbar { height: 16px; background: var(--accent); border-radius: 0 4px 4px 0; transition: filter .12s ease-out; }
.hbar-track:hover .hbar, .hbar-track:focus-visible .hbar { filter: brightness(1.2); }
.hbar-value { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* a rep's two weeks: gray days, today in the accent */
.spark { display: inline-flex; align-items: flex-end; height: 26px; vertical-align: middle; }
.spark-col { width: 8px; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 2px; outline: none; }
.spark-bar { width: 6px; background: #8f889c; border-radius: 2px 2px 0 0; }
.spark-col.is-today .spark-bar { background: var(--accent); }
.spark-col:hover .spark-bar, .spark-col:focus-visible .spark-bar { filter: brightness(1.2); }
.spark-col:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
/* the one tooltip: value first, label second */
.viz-tip { position: fixed; z-index: var(--z-toast); pointer-events: none; display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; background: #1f1a27; color: #f4f1f8; border-radius: var(--r); box-shadow: var(--shadow-lg); font-size: 12.5px; }
.viz-tip strong { font-size: 13.5px; font-weight: 650; }
.viz-tip span { color: #c9c2d6; }
.viz-tip .tip-hint { color: #a99fbd; font-size: 11.5px; margin-top: 2px; }
/* a bar that opens its leads */
.daycol.clickable, .hbar-track.clickable { cursor: pointer; }
.dialog.dialog-leads { width: min(1260px, 96vw); }
.bar-leads .table-wrap { box-shadow: none; }
.bar-leads > p.muted { margin: 4px 0; }
.bar-leads .sk-row { height: 80px; }
table.calls td.lead-delete { width: 1%; padding-left: 0; vertical-align: top; }
table.calls td.lead-delete .icon-btn { color: var(--faint); }
table.calls td.lead-delete .icon-btn:hover { color: var(--danger); }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 10px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.dash-table th.num, .dash-table td.num { text-align: right; }
.scroll-hint { position: relative; }
.scroll-hint::after { content: ""; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 40px; pointer-events: none;
  border-radius: 0 calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0; background: linear-gradient(to left, var(--surface), transparent);
  opacity: 0; transition: opacity .15s ease-out; }
.scroll-hint.more-right::after { opacity: 1; }
.dash-table td.strong { font-weight: 650; }
.overdue-pill { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 600; }
.overdue-pill svg { width: 12px; height: 12px; }
.dash-empty { margin-bottom: 18px; }
.dash-empty > svg { width: 24px; height: 24px; color: var(--accent); }
.dash-empty p { margin: 6px 0 0; }
@media (max-width: 1000px) {
  .dash-figs { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .hbar-row { grid-template-columns: 104px minmax(0, 1fr); }
  .dash-filters .segmented { flex: 1 1 auto; }
  .dash-filters .segmented button { flex: 1 1 auto; justify-content: center; white-space: nowrap; padding: 0 10px; }
  .dash-filters .lbl-long { display: none; }
  .dash-filters .lbl-short { display: inline; }
  .user-link .who, .user-link > svg { display: none; }
  .dash-filters { overflow-x: auto; flex-wrap: wrap; }
  .dash-filters .rep-select { margin-left: 0; width: 100%; flex: 1 1 100%; }
  .dash-leads .section-title .segmented { width: 100%; }
  .dash-leads .section-title .segmented button { flex: 1 1 auto; justify-content: center; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .record { grid-template-columns: 300px minmax(0, 1fr); }
  .record .col.right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 760px) {
  .toasts { right: auto; left: 50%; transform: translateX(-50%); align-items: center; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; gap: 12px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand { padding: 0 4px 0 0; flex: none; }
  .brand-logo { height: 27px; }
  #nav { flex-direction: row; gap: 2px; }
  #nav .nav-label { display: none; }
  #nav a { white-space: nowrap; padding: 6px 10px; }
  #nav a.active::before { left: 10px; right: 10px; top: auto; bottom: -8px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .topbar { padding: 0 12px; height: 54px; gap: 8px; }
  .global-search { width: auto; flex: 1; }
  #log-call-btn { padding: 0 10px 0 8px; }
  .user-chip .muted, .user-link > span:last-child { display: none; }
  .page { padding: 18px 14px 32px; }
  .page-head h1 { font-size: 23px; }
  .record { grid-template-columns: 1fr; padding: 12px; }
  .call-row, .rep-form { grid-template-columns: 1fr; }
  .stats .stat { flex-basis: 30%; padding: 11px 12px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 12px; margin-bottom: 4px; }
  .stat-link { position: static; order: 3; align-self: flex-start; margin: -4px -10px -8px; }
  /* tables become stacked cards on phones */
  table.calls thead, table.reminders thead { display: none; }
  table.calls, table.calls tbody, table.reminders, table.reminders tbody { display: block; }
  table.calls tr, table.reminders tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px; border-bottom: 1px solid var(--border); }
  table.calls td, table.reminders td { display: block; padding: 0; border: 0; max-width: none; white-space: normal; background: none !important; }
  table.calls td.wide, table.reminders td.wide { grid-column: 1 / -1; }
  table.calls td[data-label]::before, table.reminders td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--faint); margin-bottom: 2px; }
  table.calls td.note-cell { min-width: 0; }
  /* a lead card's Delete sits in its top-right corner; the site name keeps clear of it */
  table.calls tr { position: relative; }
  table.calls td.lead-delete { position: absolute; top: 10px; right: 8px; width: auto; }
  table.calls td.name.wide { padding-right: 36px; }
  table.calls select.field.stage-select { min-width: 0; width: 100%; }
  .bar-leads .sk-row { height: 280px; } /* a lead's card is taller on a phone */
  table.reminders .row-actions { justify-content: flex-start; }
}
/* touch screens: 44px targets, and buttons that only appear on hover are always shown */
@media (pointer: coarse) {
  .btn, .btn.small, .chip-btn, .followup-btn, #nav a, .segmented button,
  input.field, select.field, select.field.stage-select { min-height: 44px; }
  .icon-btn::after, .chip button::after { width: 44px; height: 44px; }
  .prop .k .icon-btn, .assoc-item .icon-btn { opacity: 1; }
  .bell-btn { width: 44px; height: 44px; }
  .global-search input, .user-link, .menu button { min-height: 44px; }
  .user-link { min-width: 44px; justify-content: center; }
  .stat-link { padding: 13px 10px; bottom: 4px; } /* text stays put; the target grows to 44px */
}
@media (pointer: coarse) and (max-width: 760px) {
  .stat-link { margin: -9px -10px -13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- prospects */
#nav .nav-count.soft { background: var(--accent-weak); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-border); }
.prospects .page-intro { margin: -6px 0 16px; max-width: 80ch; }
.prospects .prospects-checked { font-size: 13px; }
.prospect-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.prospects-list { transition: opacity .15s ease-out; }
.prospects-list.is-refreshing { opacity: .55; } /* the last list stays while the new one loads: no flash */
.prospect-filters select.field { width: auto; min-width: 170px; }
.prospect-filters input.field { width: auto; flex: 1 1 220px; max-width: 320px; }
.prospects-table td { vertical-align: top; }
.prospects-table td.wide { white-space: normal; }
.prospect-name { font-weight: 650; text-wrap: pretty; }
.in-raven { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 550; }
.in-raven svg { width: 12px; height: 12px; }
.signal + .signal { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.signal-title { font-size: 13.5px; font-weight: 650; text-wrap: pretty; }
.signal-source { font-size: 12px; color: var(--faint); margin-top: 1px; }
.signal-detail { margin-top: 2px; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46ch; }
.signal-link, .prospect-links a { font-size: 12.5px; }
.prospect-links { display: flex; gap: 12px; margin-top: 4px; }
/* who the public record names: a license's owner or a site plan's applicant */
.prospect-owner { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; }
.prospect-owner svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.owner-role { color: var(--muted); }
.owner-name { font-weight: 550; }
/* the business's phone number, typed in by whoever found it */
.prospect-phone { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.prospect-phone .cell-sub { flex-basis: 100%; margin-top: 0; }
.phone-number { position: relative; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.phone-number svg { width: 14px; height: 14px; color: var(--faint); }
.phone-edit { position: relative; font-size: 12.5px; }
.phone-add { margin-left: -8px; }
.phone-form { flex-basis: 100%; max-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.phone-form input.field { min-height: 32px; padding: 5px 9px; }
.phone-form .field-error { margin: 0; text-wrap: pretty; }
.phone-row { display: flex; gap: 6px; align-items: center; }
@media (pointer: coarse) { /* a finger needs 44px: the box itself, and invisible extensions for the number and Change */
  .phone-form input.field { min-height: 44px; }
  .prospect-phone { margin-top: 12px; } /* room for the extension without covering the link above */
  .phone-number::after, .phone-edit::after { content: ""; position: absolute; top: 50%; height: 44px; translate: 0 -50%; }
  .phone-number::after { left: 0; right: 0; }
  .phone-edit::after { left: -4px; right: -8px; } /* stops short of the number: the two never overlap */
}
.fit { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.fit.high { background: #e7f5ec; color: #17633a; box-shadow: inset 0 0 0 1px #bfe3cc; }
.fit.medium { background: var(--accent-weak); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-border); }
.fit.low { background: var(--surface-3); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.prospect-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 128px; }
.prospect-actions .btn { justify-content: center; }
.prospect-actions.done { align-items: flex-start; font-size: 12.5px; }
.load-more { display: flex; justify-content: center; margin: 14px 0; }
.prospect-sources { margin-top: 18px; padding: 0; overflow: hidden; }
.prospect-sources summary { display: flex; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; list-style: none; }
.prospect-sources summary::-webkit-details-marker { display: none; }
.prospect-sources summary svg { width: 16px; height: 16px; color: var(--faint); flex: none; transition: transform .18s var(--ease); }
.prospect-sources:not([open]) summary svg { transform: rotate(-90deg); }
.prospect-sources summary:hover strong { color: var(--accent); }
.prospect-sources table { border-top: 1px solid var(--border); }
.source-ok, .source-error { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 550; }
.source-ok { color: #17633a; }
.source-error { color: var(--danger); white-space: normal; }
.source-ok svg, .source-error svg { width: 12px; height: 12px; flex: none; }
.call-prospect { background: var(--accent-weak); box-shadow: inset 0 0 0 1px var(--accent-border); }
@media (max-width: 760px) {
  .prospect-filters .segmented { width: 100%; }
  .prospect-filters .segmented button { flex: 1 1 auto; justify-content: center; }
  .prospect-filters select.field, .prospect-filters input.field { flex: 1 1 100%; max-width: none; }
  table.records.prospects-table thead { display: none; }
  table.records.prospects-table, table.records.prospects-table tbody { display: block; }
  table.records.prospects-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px; border-bottom: 1px solid var(--border); }
  table.records.prospects-table td { display: block; padding: 0; border: 0; max-width: none; white-space: normal; background: none !important; }
  table.records.prospects-table td.name { grid-column: 1; grid-row: 1; }
  table.records.prospects-table td[data-label="Fit"] { grid-column: 2; grid-row: 1; }
  table.records.prospects-table td.wide, table.records.prospects-table td.prospect-cell-actions { grid-column: 1 / -1; }
  .prospect-actions { flex-direction: row; }
  .prospect-actions .btn { flex: 1; }
}
/* touch screens: the row's text links get a 44px target without moving anything (negative margins take the extra
   height back). After the prospect rules above, which set these links' own margins and spacing. */
@media (pointer: coarse) {
  .signal-link { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
  .prospect-links { gap: 8px; margin-top: 0; }
  .prospect-links a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; margin: -10px 0; } /* stops at the buttons below */
  .in-raven { min-height: 44px; margin: -7px 0 -14px; }
}
