/* ============================================================================
   FirstMile Portal — design system
   One light theme, modern and calm. Indigo primary on a soft slate canvas.
   ========================================================================== */
:root {
  --brand:        #4f46e5;   /* indigo 600 */
  --brand-600:    #4338ca;
  --brand-50:     #eef2ff;
  --brand-100:    #e0e7ff;
  --ink:          #0f172a;   /* slate 900 */
  --ink-2:        #334155;   /* slate 700 */
  --muted:        #64748b;   /* slate 500 */
  --faint:        #94a3b8;   /* slate 400 */
  --line:         #e2e8f0;   /* slate 200 */
  --line-2:       #eef2f6;
  --bg:           #f1f5f9;   /* slate 100 */
  --surface:      #ffffff;
  --surface-2:    #f8fafc;   /* slate 50 */
  --ok:           #059669;   --ok-bg:#d1fae5;
  --warn:         #b45309;   --warn-bg:#fef3c7;
  --danger:       #dc2626;   --danger-bg:#fee2e2;
  --info:         #2563eb;   --info-bg:#dbeafe;
  --radius:       12px;
  --radius-sm:    9px;
  --shadow-sm:    0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow:       0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:    0 18px 50px rgba(15,23,42,.20);
  --font:         'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;

  /* Aliases for the older token names still used by some pages' inline styles
     (cases/settings/login). Kept mapped to the current palette so those rules
     resolve — e.g. the active status tab was white text on an unset (→
     transparent) background before these existed. */
  --accent:       var(--brand);
  --accent-mid:   var(--brand-600);
  --accent-soft:  var(--brand-100);
  --border:       var(--line);
  --text:         var(--ink);
  --text-2:       var(--ink-2);
  --text-3:       var(--muted);
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  /* The topbar is sticky (top:0), so any scroll-to-element — anchor links and
     scrollIntoView({block:'start'}) — must leave room for it, or the target
     lands hidden underneath the header. */
  scroll-padding-top: 76px;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; color: var(--ink); }
::placeholder { color: var(--faint); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--radius-sm); padding: 9px 15px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .14s, border-color .14s, box-shadow .14s, transform .05s;
  white-space: nowrap; line-height: 1.2; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f3c8c8; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); border-color: #f0b4b4; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 7px 9px; font-size: 14px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 14px;
}
.topbar-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-family: 'Plus Jakarta Sans', var(--font); font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.topbar-sub { font-size: 12.5px; color: var(--muted); }
.topbar-icon, .topbar-title { display: none; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hdr-clock { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px 6px 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); white-space: nowrap; }
.hdr-clock .hc-ic { width: 17px; height: 17px; color: var(--accent); flex: none; opacity: .9; }
.hdr-clock .hc-stack { display: flex; flex-direction: column; line-height: 1.18; }
.hdr-clock .hc-time { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 700; font-size: 15.5px; color: var(--text); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.hdr-clock .hc-ap { font-size: 10.5px; font-weight: 700; color: var(--text-3); margin-left: 4px; letter-spacing: .3px; }
.hdr-clock .hc-date { font-size: 10.5px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; }
.hdr-clock .hc-tz { background: var(--accent-soft); color: var(--accent); font-weight: 800; padding: 1px 5px; border-radius: 5px; margin-left: 5px; font-size: 9.5px; letter-spacing: .3px; }
/* On phones/tablets the branding is hidden, so the clock stays in the header —
   just made more compact so it sits comfortably beside the hamburger. */
@media (max-width: 900px) {
  .hdr-clock { padding: 5px 10px; gap: 7px; margin-right: auto; }
  .hdr-clock .hc-ic { width: 15px; height: 15px; }
  .hdr-clock .hc-time { font-size: 14px; letter-spacing: .3px; }
  .hdr-clock .hc-date { font-size: 10px; }
}
@media (max-width: 380px) {
  .hdr-clock { padding: 4px 8px; gap: 6px; }
  .hdr-clock .hc-time { font-size: 13px; }
  .hdr-clock .hc-date { font-size: 9px; }
  .hdr-clock .hc-tz { margin-left: 4px; padding: 1px 4px; }
}
#nav-cases, #nav-inbox, #nav-invoice { position: relative; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle; }
.topbar-right .topbar-sub { margin-right: 4px; }
nav a.btn.active, .btn.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); }

/* Mobile nav drawer: on phones the top nav collapses behind a hamburger and
   slides in from the right as an off-canvas sheet. The links in the sheet are
   the very same .topbar-right elements (so permission-hiding and unread badges
   keep working) — only their layout changes. Hidden on desktop. */
.nav-actions { display: none; align-items: center; gap: 2px; margin-left: auto; }
.nav-burger { display: none; position: relative; flex: 0 0 auto; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.nav-burger svg { width: 22px; height: 22px; }
.nav-burger.has-dot::after { content: ''; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; border: 2px solid var(--surface); }
.nav-top-bell { width: 40px; height: 40px; border-radius: 50%; background: none; border: none; box-shadow: none; padding: 0; font-size: 20px; color: var(--text); position: relative; }
.nav-top-bell:hover { background: var(--surface-2); }
.nav-backdrop { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.42); opacity: 0; transition: opacity .2s ease; }
.nav-backdrop.show { display: block; opacity: 1; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap, .set-shell { max-width: 1180px; margin: 0 auto; padding: 22px; }
.set-shell { max-width: 940px; }

/* ── Cards & sections ────────────────────────────────────────────────────── */
.card, .table-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card { padding: 20px 22px; margin-bottom: 16px; }
.table-card { overflow: hidden; }
.table-head {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
}
.table-scroll { overflow-x: auto; }
.set-section-title { font-family: 'Plus Jakarta Sans', var(--font); font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.set-section-sub { font-size: 13px; color: var(--muted); margin: 4px 0 18px; max-width: 70ch; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--surface-2); padding: 10px 14px; text-align: left;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
table.grid, table.cases { font-size: 13.5px; }
/* The actions cell must stay a real table cell — display:flex (from .row-actions)
   pulls it out of the table, so the row borders stop short and the buttons float
   away from their row. Keep it a cell, pinned right, and lay buttons out inline. */
table.grid td.row-actions { display: table-cell; white-space: nowrap; vertical-align: middle; text-align: right; padding-right: 22px; }
table.grid td.row-actions .btn + .btn { margin-left: 8px; }
table.cases tbody tr.clickable { cursor: pointer; transition: background .1s; }
table.cases tbody tr.clickable:hover { background: var(--brand-50); }
table.cases tbody tr.readonly { color: var(--muted); }
.col-n { width: 40px; color: var(--faint); }
.col-actions { width: 1%; white-space: nowrap; }

/* ── Badges & pills ──────────────────────────────────────────────────────── */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .2px;
  white-space: nowrap;
}
.b-Lead     { background: var(--info-bg);  color: #1e40af; }
.b-Pending  { background: var(--warn-bg);  color: var(--warn); }
.b-Assigned { background: #ede9fe;         color: #6d28d9; }
.b-Unpaid   { background: var(--danger-bg);color: var(--danger); }
.b-Partiallypaid { background: #fef3c7; color: #92400e; }
.b-Paid     { background: var(--ok-bg);    color: var(--ok); }
.b-Expired  { background: #f1f5f9;         color: var(--muted); }
.b-Fulfilled { background: #dbeafe;        color: #1d4ed8; }
.b-Closed   { background: #cbd5e1;         color: #1e293b; }
.pill-role  { background: var(--brand-50); color: var(--brand-600); }
/* Distinct colour per role, so it reads at a glance. The .pill compound raises
   specificity so these win over settings.html's inline .pill-role rule. */
.pill.role-admin          { background: #fee2e2; color: #b91c1c; }  /* red   */
.pill.role-manager        { background: #dbeafe; color: #1d4ed8; }  /* blue  */
.pill.role-representative { background: #dcfce7; color: #15803d; }  /* green */
.pill.role-salesperson    { background: #fef3c7; color: #b45309; }  /* amber */
.pill-off   { background: var(--danger-bg); color: var(--danger); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.grid-search { grid-column: 1 / -1; margin: 0 0 6px; }
.grid-search-input { width: 100%; box-sizing: border-box; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; }
.grid-search-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea, .cell-input, .addr-select, input.dlg-input, select.dlg-input, textarea.dlg-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.field textarea, textarea.dlg-input { resize: vertical; min-height: 76px; font: inherit; }
.case-notes { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; line-height: 1.5; }
/* Licence image: small preview in the create dialog, and the viewer in the case drawer. */
.lic-preview { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.lic-preview[hidden] { display: none; }
.lic-preview img { width: 84px; height: 54px; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; }
.lic-view { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.lic-frame { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; line-height: 0; }
.lic-img { max-width: 100%; display: block; }
/* Hover overlay with a centered eye that opens the image full size. */
.lic-view-btn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-decoration: none; color: #fff; background: rgba(15,23,42,0); opacity: 0; transition: opacity .15s, background .15s; }
.lic-frame:hover .lic-view-btn, .lic-view-btn:focus-visible { opacity: 1; background: rgba(15,23,42,.4); }
.lic-view-btn .eye { display: flex; padding: 11px; border-radius: 999px; background: rgba(0,0,0,.55); }
/* Always-visible red remove button, top-right. */
.lic-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; border: none; border-radius: 999px; background: var(--danger); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.lic-remove:hover { background: #b91c1c; }
.field input:focus, .field select:focus, .field textarea:focus, .cell-input:focus, .addr-select:focus, .dlg-input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100);
}
.field .hint, .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.banner { padding: 14px 18px; border-radius: var(--radius); background: var(--info-bg); color: #1e3a8a; font-size: 13.5px; }

/* checkbox that reads as a toggle-ish control */
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* ── Quote page: lead rows ───────────────────────────────────────────────── */
/* A larger, friendlier section header for the Leads/Quotes card. */
.table-card > .table-head {
  font-size: 15px; font-weight: 800; letter-spacing: -.01em; text-transform: none;
  color: var(--ink); padding: 16px 20px; background: var(--surface-2);
}
/* Roomier rows with top-aligned, grouped fields — less "spreadsheet", more form. */
#rows td { padding: 14px 12px; vertical-align: top; }
#rows tr { transition: background .12s; }
#rows tr:hover { background: var(--brand-50); }
#rows tr + tr td { border-top: 1px solid var(--line); }
.cell-input { min-width: 92px; }
textarea.cell-multiline { min-height: 132px; resize: vertical; line-height: 1.45; }
.cell-input.mono { letter-spacing: .3px; }
.cell-input.err, input.dlg-input.err, textarea.dlg-input.err, select.dlg-input.err,
.field input.err, .field select.err { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.modal-fs { margin-top: 6px; }
.modal-fs:empty { display: none; }
.stack-input { margin-top: 8px; }
/* small caption above a stacked field */
.micro-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin: 0 0 3px 2px; }
.lead-channel { min-width: 120px; cursor: pointer; }
/* WhatsApp field with its quick "same as phone" link */
.wa-row { display: flex; flex-direction: column; gap: 3px; }
.wa-input { min-width: 92px; }
.linkbtn { align-self: flex-start; background: none; border: none; padding: 0; margin: 1px 0 0 2px; color: var(--brand); font-size: 11px; font-weight: 700; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
/* Lead channel picker + chips (leads, cases, settings) */
.channel-picker { display: flex; align-items: center; gap: 8px; }
.channel-ic { display: inline-flex; align-items: center; flex-shrink: 0; }
.channel-ic svg { display: block; }

/* Custom channel dropdown (leads rows) — shows icon + full text, no truncation */
.chan-select { position: relative; width: 100%; }
.chan-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.chan-btn:hover { border-color: var(--brand-300, #c7d2fe); }
.chan-btn.open { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.chan-btn.empty { cursor: default; color: var(--faint); }
.chan-btn-text { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-caret { display: inline-flex; color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.chan-btn.open .chan-caret { transform: rotate(180deg); }
.chan-menu {
  position: fixed; z-index: 200; width: max-content; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 12px 34px rgba(15,23,42,.16); padding: 5px; overflow-y: auto;
}
.chan-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; border-radius: 8px; background: none; color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.chan-item:hover { background: var(--brand-50); }
.chan-item.sel { background: var(--brand-100); font-weight: 600; }
.chan-item-text { flex: 1; }
.chan-primary { font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--brand); background: var(--brand-50); border-radius: 999px; padding: 2px 8px; }

/* Leads action buttons — a tidy vertical group */
.act-group { display: flex; flex-direction: column; gap: 7px; min-width: 128px; }
.act-btn { display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: 100%; }
.act-btn .act-ic { display: inline-flex; opacity: .85; }
.act-primary { justify-content: center; }
.act-ghost { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.act-ghost:hover { background: var(--brand-50); border-color: var(--brand-300, #c7d2fe); color: var(--brand); }
.act-remove { background: none; border-color: transparent; color: var(--muted); }
.act-remove:hover { background: var(--danger-bg); color: var(--danger); }
.channel-chip { display: inline-flex; align-items: center; gap: 7px; }
.primary-pill { border: none; cursor: pointer; font: inherit; }
.primary-pill:hover { filter: brightness(.96); }
.field-status { display: block; }
.resolved { display: block; font-size: 11.5px; margin-top: 5px; line-height: 1.4; }
.resolved.ok { color: var(--ok); } .resolved.err { color: var(--danger); }
.resolved.loading { color: var(--muted); } .resolved.empty { color: var(--faint); font-style: italic; }
.addr-select { margin-top: 6px; }
.add-case-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 20px 18px; }
.add-case-bar[hidden] { display: none; }
#btn-add {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: 1px dashed var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--brand); font-weight: 700; font-size: 13px;
  box-shadow: none; transition: border-color .12s, background .12s, color .12s;
}
#btn-add:hover { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600, var(--brand)); }
.footbar {
  position: sticky; bottom: 0; z-index: 20; background: #fff;
  border-top: 1px solid var(--line); padding: 11px 22px; display: flex; align-items: center; gap: 10px;
}
.footbar .count { font-size: 12.5px; color: var(--muted); }
.footbar .note-pii { margin-left: auto; margin-right: 12px; font-size: 11.5px; color: var(--faint); }
.empty-state { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-state p { margin-bottom: 14px; }

/* status/quote cell */
.status { min-width: 140px; font-size: 13px; }
.status.idle { color: var(--faint); }
.status-run { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; }
.status-err { color: var(--danger); font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; }
.status-err .x { font-weight: 800; }
.status-err .msg { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.price { font-family: 'Plus Jakarta Sans', var(--font); font-size: 20px; font-weight: 800; color: var(--ok); line-height: 1.15; }
.price-period { font-size: 12px; font-weight: 600; color: var(--faint); }
.price-annual { font-size: 12px; color: var(--muted); margin-top: 1px; }
.quote-num { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.link-details { background: none; border: none; color: var(--brand); font-size: 12px; font-weight: 700; padding: 4px 0 0; cursor: pointer; }
.detail-row td { background: var(--surface-2); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; padding: 4px 2px; }
.detail-block h5 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 7px; font-weight: 800; }
.tier { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.tier:last-child { border-bottom: none; } .tier b { color: var(--ok); }
.retrieve-values { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.retrieve-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.retrieve-key { color: var(--muted); min-width: 72px; }
.retrieve-copy { padding: 2px 8px; font-size: 11px; }
.retrieve-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* ── Cases dashboard toolbar ─────────────────────────────────────────────── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { flex: 1; min-width: 220px; max-width: 440px; position: relative; }
.search input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.status-tab { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; box-shadow: var(--shadow-sm); }
.status-tab:hover { border-color: var(--faint); }
.status-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.status-tab .n { background: rgba(15,23,42,.08); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.status-tab.active .n { background: rgba(255,255,255,.28); }
/* bulk action bar */
.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 16px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius); margin-bottom: 14px; }
.bulkbar[hidden] { display: none; }
.bulkbar .sel-count { font-weight: 700; color: var(--brand-600); }
.check-cell { width: 34px; text-align: center; }
.check-cell input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* Shared filter controls (cases + leads toolbars) */
.member-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.member-filters .filter-select { width: auto; min-width: 170px; margin: 0; font-size: 12.5px; padding: 8px 12px; }
.date-custom { display: inline-flex; align-items: center; gap: 6px; }
.date-custom[hidden] { display: none; }
.member-filters .filter-date-input { width: auto; min-width: 0; margin: 0; font-size: 12.5px; padding: 7px 10px; }
.date-dash { color: var(--faint); }

/* ── Leads page: collapsible intake panel ────────────────────────────────── */
.intake-card { margin-bottom: 20px; }
.intake-head-row { display: flex; align-items: stretch; gap: 10px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; padding-right: 14px; }
.intake-head {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left;
  padding: 15px 20px; background: none; border: none;
  font: inherit; cursor: pointer; color: var(--ink);
}
.intake-search { display: flex; align-items: center; align-self: center; position: relative; flex: 0 1 420px; min-width: 260px; }
.intake-search .ico { position: absolute; left: 11px; color: var(--faint); font-size: 13px; pointer-events: none; }
.intake-search input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; }
.intake-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
@media (max-width: 640px) { .intake-search { display: none; } }
.intake-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.intake-hint { color: var(--muted); font-size: 12.5px; flex: 1; }
.intake-chevron { color: var(--ink-2); font-size: 26px; font-weight: 700; line-height: 1; display: inline-block; transition: transform .15s; }
.intake-chevron-btn { display: flex; align-items: center; justify-content: center; align-self: center; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; cursor: pointer; }
.intake-chevron-btn:hover { background: var(--brand-50); border-color: var(--brand); }
.intake-chevron-btn:hover .intake-chevron { color: var(--brand); }
.intake-chevron-btn.collapsed .intake-chevron { transform: rotate(-90deg); }
.intake-body[hidden] { display: none; }
@media (max-width: 720px) { .intake-hint { display: none; } }

/* Intake as labelled cards (one lead per card, fields in a responsive grid) */
.lead-cards { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px 4px; }
.lead-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.lead-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 18px; align-items: start; }
.lc-field { display: flex; flex-direction: column; min-width: 0; }
.lc-field.lc-full { grid-column: 1 / -1; }
/* Gender (33%) + Address (66%) share one full-width row. */
.lc-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 2fr; gap: 14px 18px; align-items: start; }
.lc-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin: 0 0 5px 1px; }
.lc-field .cell-input, .lc-field .cc-field, .lc-field .chan-select, .lc-field .wa-row { width: 100%; }
.lead-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.lead-card-foot .status { min-width: 0; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.act-row .act-btn { width: auto; }
/* the address / vehicle textareas need less height inside the card */
.lead-card textarea.cell-multiline { min-height: 62px; }
.lead-card .detail-row, .lead-cards .detail-row { grid-column: 1 / -1; }

/* ── Leads page: saved-leads list ────────────────────────────────────────── */
.leads-list-card { margin-top: 6px; }
table.leads-list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.leads-list th { background: var(--surface-2); padding: 10px 14px; text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.leads-list td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.leads-list tbody tr:last-child td { border-bottom: none; }
table.leads-list tbody tr:hover { background: var(--brand-50); }
.case-title { font-weight: 700; color: var(--text); text-decoration: none; cursor: pointer; }
.case-title:hover { color: var(--brand); text-decoration: underline; }
/* Left-edge status stripe: green once sent, amber while a quote still needs
   sending, amber (thinner) while not yet quoted. */
table.leads-list tbody tr.is-sent td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
table.leads-list tbody tr.is-tosend td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
table.leads-list tbody tr.is-unquoted td:first-child { box-shadow: inset 3px 0 0 var(--warn, #e8951c); }
/* Urgent leads: a red left edge overrides the status colour, and a tinted row. */
table.leads-list tbody tr.is-urgent td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
table.leads-list tbody tr.is-urgent { background: #fef2f2; }
/* …but once it's quoted and only waiting to be sent, the URGENT badge already
   says enough — keep the calmer "To send" amber stripe rather than a red alarm. */
table.leads-list tbody tr.is-urgent.is-tosend td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
/* Closed cases read as "done": a muted row with a slate stripe, so open cases
   stand out against them in a mixed list. */
table.leads-list tbody tr.is-closed { background: #f3f5f8; }
table.leads-list tbody tr.is-closed td:first-child { box-shadow: inset 4px 0 0 #94a3b8; }
table.leads-list tbody tr.is-closed .case-title,
table.leads-list tbody tr.is-expired-case .case-title { color: var(--muted); font-weight: 600; }
/* Section divider marking where the closed cases begin — same "— LABEL —" style
   as the invoices page's Paid divider. */
table.leads-list tbody tr.closed-divider td,
table.leads-list tbody tr.closed-divider:hover td { padding: 0; background: transparent; border-bottom: none; }
.row-divider { display: flex; align-items: center; gap: 12px; margin: 18px 14px 10px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.row-divider::before, .row-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
/* Closed-cases divider: a full-width shaded band so you clearly feel you've
   scrolled past the active cases into the closed ones. */
.closed-divider td { padding: 0; }
.closed-divider .row-divider { margin: 0; padding: 14px 16px; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 11.5px; box-shadow: inset 0 1px 0 var(--surface); }
.closed-divider .row-divider::before, .closed-divider .row-divider::after { background: var(--line); }
/* A pinned copy of that band that rides at the top while you scroll through the
   closed cases (the table's overflow wrappers rule out pure CSS position:sticky,
   so a fixed banner is positioned by JS). */
.closed-sticky { position: fixed; z-index: 30; display: none; pointer-events: none; }
.closed-sticky.show { display: block; }
.closed-sticky .row-divider { margin: 0; padding: 14px 16px; background: var(--bg); border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 11.5px; box-shadow: 0 6px 14px -8px rgba(15,23,42,.35); }
.ll-urgent { display:inline-block; margin-left:7px; padding:1px 8px; border-radius:10px; font-size:10.5px; font-weight:800; letter-spacing:.3px; background:#fee2e2; color:#b91c1c; border:1px solid #fca5a5; vertical-align:middle; white-space:nowrap; }
.ll-urgent.clickable { cursor:pointer; }
.ll-urgent.clickable:hover { background:#fecaca; }
.ll-name { font-weight: 700; color: var(--ink); }
.lead-editor .section-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.lead-editor .field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.lead-editor .field label { display:block; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.lead-editor .field input, .lead-editor .field select, .lead-editor textarea.dlg-input { width: 100%; box-sizing: border-box; }
.lead-editor .rep-editor { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.lead-editor .rep-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.lead-editor .rep-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.lead-editor .le-docs-wrap { margin-bottom: 6px; }
.doc-scan { margin: 4px 0 14px; padding: 12px 14px; border: 1px dashed var(--brand-100, #c7d2fe); border-radius: 10px; background: var(--brand-50, #eef2ff); }
.doc-scan-btn { display: inline-flex; align-items: center; gap: 6px; }
.doc-scan-hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.45; }
.doc-scan-status { font-size: 12px; margin-top: 6px; min-height: 15px; }
.doc-scan-status.ok { color: #15803d; font-weight: 600; }
.doc-scan-status.err { color: #b91c1c; font-weight: 600; }
.doc-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.doc-row.clickable { cursor: pointer; }
.doc-row.clickable:hover { border-color: var(--brand); background: var(--surface); }
.doc-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .3px; padding: 2px 8px; border-radius: 10px; flex-shrink: 0; }
.doc-kind.k-lic { background: #dbeafe; color: #1e40af; }
.doc-kind.k-oth { background: #f3f4f6; color: #4b5563; }
.doc-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-eye { color: var(--text-3); display: inline-flex; padding: 2px; }
.doc-eye:hover { color: var(--brand); }
.doc-x { border: none; background: none; color: #ef4444; font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; }
.doc-upload-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-spin { width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: doc-spin .7s linear infinite; flex-shrink: 0; }
.doc-cancel { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 11.5px; font-weight: 600; line-height: 1; cursor: pointer; padding: 4px 9px; border-radius: 6px; flex-shrink: 0; font-family: inherit; }
.doc-cancel:hover { border-color: #ef4444; color: #ef4444; }
@keyframes doc-spin { to { transform: rotate(360deg); } }
.lead-editor .le-docs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.lead-editor .le-doc-cell { position: relative; }
.lead-editor .le-thumb { display: block; width: 90px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.lead-editor .le-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lead-editor .le-file { display: inline-flex; align-items: center; max-width: 170px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); text-decoration: none; color: var(--text); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-editor .le-rm { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; border: none; background: #ef4444; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.ll-name-link { color: inherit; text-decoration: none; }
.ll-name-link:hover { color: var(--brand); text-decoration: underline; }
.bot-badge { display:inline-block; margin-left:7px; padding:1px 7px; border-radius:10px; font-size:10.5px; font-weight:700; letter-spacing:.2px; background:#ecfeff; color:#0e7490; border:1px solid #a5f3fc; vertical-align:middle; }
.web-badge { display:inline-block; margin-left:7px; padding:1px 7px; border-radius:10px; font-size:10.5px; font-weight:700; letter-spacing:.2px; background:#fdf6e6; color:#946015; border:1px solid #f0dcae; vertical-align:middle; white-space:nowrap; }
.ll-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ll-sub.mono { font-family: var(--mono); font-size: 11.5px; }
.q-badge { display: inline-block; white-space: nowrap; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .2px; }
.ll-wa, .ll-mail, .ll-phone { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; margin-top: 3px; }
.ll-wa .channel-ic, .ll-mail .channel-ic, .ll-phone .channel-ic { flex-shrink: 0; }
.ll-phone:first-child, .ll-wa:first-child, .ll-mail:first-child { margin-top: 0; }
.ll-mail { word-break: break-all; }

/* Driver / Vehicle cell: name + vehicle at normal size, licence + VIN smaller/mono */
.ll-driver { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.ll-driver .ll-person { display: inline-flex; flex-shrink: 0; }
.ll-veh { display: flex; align-items: flex-start; gap: 6px; margin-top: 3px; color: var(--ink); }
.ll-veh .ll-person { flex-shrink: 0; margin-top: 1px; }
.ll-addr { margin-top: 3px; color: var(--ink-2); font-size: 12.5px; }

/* Fixed "+1" country-code prefix on the phone / WhatsApp inputs */
.cc-field { display: flex; align-items: stretch; width: 100%; }
.cc-field .cc-input {
  width: 46px; flex: 0 0 46px; text-align: center; padding: 9px 4px; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-right: none; border-radius: 9px 0 0 9px;
}
.cc-field .cc-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); position: relative; z-index: 1; }
.cc-field .cell-input { border-top-left-radius: 0; border-bottom-left-radius: 0; min-width: 0; }
.q-badge.q-yes { background: #d1fae5; color: #065f46; }
/* One-time fee on the leads-list quote cell — lightly highlighted. */
.ll-fee { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 600;
  color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 1px 7px; }
.q-badge.q-no { background: #fef3c7; color: #92400e; }
.q-status-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.q-badge.q-sent { background: #047857; color: #ffffff; display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 1px 2px rgba(5,80,60,.35); }
.q-badge.q-tosend { background: #f59e0b; color: #432004; display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 1px 2px rgba(180,110,10,.4); }
.q-badge.q-sent svg, .q-badge.q-tosend svg { flex: none; }
/* "Wants to start" — buying signal. Compact line on the leads list … */
.ll-start { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12px; color: #92400e; }
.ll-start-ic { font-size: 12px; }
.ll-start strong { color: #7c2d12; }
/* … and, on the lead detail fields, a soft highlight across the whole row —
   both the question (label) and the answer (value). */
.kv dt.hl-q { background: #f0fdf4; color: #15803d; font-weight: 600;
  padding: 4px 10px; border-radius: 7px 0 0 7px; box-shadow: inset 2px 0 0 #22c55e; }
.kv dd.hl-a { background: #f0fdf4; color: #14532d; font-weight: 700;
  padding: 4px 10px; border-radius: 0 7px 7px 0; }
/* Key identity fields (name, DOB, address, postal) — a neutral yellow highlight,
   so they stand out as "read these first" without implying a status. */
.kv dt.hl-id { background: #fef9c3; color: #854d0e; font-weight: 600;
  padding: 4px 10px; border-radius: 7px 0 0 7px; box-shadow: inset 2px 0 0 #eab308; }
.kv dd.hl-id-v { background: #fef9c3; color: #713f12; font-weight: 700;
  padding: 4px 10px; border-radius: 0 7px 7px 0; }
/* "Fake contacts used" — highlighted box above the notes on the lead detail. */
.fake-contacts { margin: 14px 0 4px; padding: 12px 14px; background: #fffbeb;
  border: 1px solid #fcd34d; border-radius: 10px; }
.fake-contacts .fc-title { font-weight: 700; color: #92400e; margin-bottom: 6px; }
.fake-contacts .fc-row { display: flex; gap: 8px; font-size: 14px; margin: 2px 0; }
.fake-contacts .fc-k { color: #b45309; min-width: 54px; }
.fake-contacts .fc-v { color: #7c2d12; font-weight: 600; }
/* A declared ticket / suspension / cancellation / claim — a risk factor to notice. */
.rep-flag { margin-top: 8px; padding: 10px 12px; background: #fff7ed;
  border: 1px solid #fdba74; border-left: 3px solid #f97316; border-radius: 8px; }
.rep-flag-h { font-weight: 700; color: #9a3412; margin-bottom: 6px; }
/* At-a-glance "basics" band above the Driver card. */
.basics-card { background: #f8fafc; border: 1px solid #e2e8f0; border-left: 3px solid #94a3b8;
  border-radius: 10px; padding: 12px 14px; }
.basics-head { margin-bottom: 10px; }
.basics-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; }
.basics-badge.good { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.basics-badge.bad { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.basics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; }
.ll-clean { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin: 6px 0 2px; }
.ll-clean.good { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.ll-clean.bad { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
/* Lead/case detail — sticky section menu */
/* Desktop: the chips wrap onto as many rows as they need — no horizontal scroll.
   Mobile: a single horizontally-scrolling row instead, because on small screens
   wrapping to two lines made the bar taller than the gap below the topbar and its
   top row slid underneath. */
.sec-nav {
  position: sticky; top: 61px; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0; margin: 2px 0 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.sec-nav-btn { flex: none; font-size: 12.5px; font-weight: 600; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink, #1f2937); cursor: pointer; white-space: nowrap; }
.sec-nav-btn:hover { background: var(--brand-50, #eef2ff); border-color: var(--brand, #4f46e5); color: var(--brand, #4f46e5); }
@media (max-width: 768px) {
  .sec-nav { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .sec-nav::-webkit-scrollbar { display: none; }
}
.sec-flash { animation: sec-flash-anim 1.6s ease-out; }
@keyframes sec-flash-anim { 0% { box-shadow: 0 0 0 3px var(--brand, #4f46e5); } 100% { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0); } }
/* "Start quoting" soft-lock control */
.quoting-ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; }
.act-btn.quoting-start { background: var(--brand, #4f46e5); color: #fff; border-color: var(--brand, #4f46e5); font-weight: 700; }
.act-btn.quoting-start:hover { filter: brightness(1.06); }
.act-btn.quoting-start .act-ic { color: #fff; }
.quoting-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.quoting-pill.mine { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.quoting-pill.other { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.quoting-pill .q-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.22); }
.act-btn.quoting-takeover { font-size: 11px; }
/* Prominent full-width banner on the lead detail page */
.quoting-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; }
.quoting-banner.other { background: #fef3c7; border: 1px solid #f59e0b; }
.quoting-banner.mine { background: #dcfce7; border: 1px solid #86efac; }
.quoting-banner.free { background: var(--surface-2, #f8fafc); border: 1px dashed var(--line, #e5e7eb); }
.quoting-banner .qb-hint { font-size: 13px; color: var(--muted, #6b7280); }
.quoting-banner .quoting-ctl { margin: 0; }
/* Inside the banner the colored strip is the background, so the pill is plain text. */
.quoting-banner .quoting-pill { background: transparent; border: 0; padding: 0; font-size: 14px; }
.basics-item { display: flex; flex-direction: column; gap: 1px; }
.basics-item .bi-k { font-size: 11.5px; color: var(--muted, #64748b); font-weight: 600; }
.basics-item .bi-v { font-size: 14px; color: var(--ink, #0f172a); font-weight: 600; }
@media (max-width: 640px) { .basics-grid { grid-template-columns: 1fr; } }
/* Copy-to-clipboard button next to a value. */
.copy-btn { display: inline-flex; align-items: center; justify-content: center; margin-left: 7px;
  padding: 2px; width: 22px; height: 22px; vertical-align: middle; border: 1px solid var(--line, #e5e7eb);
  border-radius: 6px; background: var(--surface, #fff); color: var(--muted, #64748b); cursor: pointer; }
.copy-btn:hover { color: var(--brand, #4f46e5); border-color: var(--brand, #4f46e5); }
.copy-btn.copied { color: #16a34a; border-color: #86efac; background: #f0fdf4; }
/* Top-nav buttons: icon + label. */
.nav-btn { display: inline-flex; align-items: center; gap: 7px; }
.nav-ic { flex-shrink: 0; }
/* Icon-only nav buttons (notifications bell, sign out). */
.nav-icon-btn { display: inline-flex; align-items: center; justify-content: center; }
#btn-bell { font-size: 20px; line-height: 1; padding-left: 12px; padding-right: 12px; }
/* Inner tabs (e.g. Payments → Interac / Shopify). */
.subtabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line, #e5e7eb); }
.subtab { appearance: none; background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 12px; margin-bottom: -1px; font: inherit; font-weight: 600; font-size: 14px;
  color: var(--muted, #6b7280); cursor: pointer; }
.subtab:hover { color: var(--ink, #111827); }
.subtab.active { color: var(--brand, #4f46e5); border-bottom-color: var(--brand, #4f46e5); }
.q-badge.clickable { cursor: pointer; text-decoration: none; }
.q-badge.clickable:hover { filter: brightness(0.96); text-decoration: underline; text-underline-offset: 2px; }
/* Quote details — highlighted so it reads as the internal record it is. */
.card.quote-card {
  border: 1px solid #34d399;
  background: linear-gradient(0deg, rgba(16,185,129,.05), rgba(16,185,129,.05)), var(--surface, #fff);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.card.quote-card > h2 { color: #065f46; }
.card.quote-card .quote-sub { margin-top: 14px; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--muted, #6b7280); }
.card.quote-card iframe.quote-pdf { width: 100%; height: 560px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: #fff; display: block; }
.card.quote-card img.quote-shot { max-width: 100%; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; cursor: pointer; display: block; }
.card.quote-card a.lead-link { display: inline-block; margin-top: 8px; }
/* Expired: grey, because it is not a result — it is the absence of one. */
.q-badge.q-exp { background: var(--line-2, #e5e7eb); color: var(--muted, #6b7280); }
tr.lead-row.is-expired > td { opacity: .55; }
tr.lead-row.is-expired > td.col-actions { opacity: 1; }
.leads-list .muted { color: var(--faint); }

/* Column widths. Without these the browser gives the Lead title all the room
   it asks for and squeezes Contact, which breaks a phone number across three
   lines. A title is allowed to wrap; a phone number is not — it stops being
   readable as a number. Columns: 1 Lead · 2 Channel · 3 Driver/Vehicle ·
   4 Contact · 5 Quote · 6 Added · 7 Actions. */
/* Columns: 1 ID · 2 Lead · 3 Channel · 4 Driver/Vehicle · 5 Contact · 6 Quote ·
   7 Added · 8 Actions. Everything shrinks to its content except the lead title
   and the driver block, which are the only two that should wrap. */
/* Fixed layout: columns share the width proportionally and long values (emails,
   addresses) wrap inside their cell instead of pushing the whole table wider —
   so the list fits on screen without horizontal scrolling on desktop.
   Columns: 1 check · 2 ID · 3 Lead · 4 Contact · 5 Driver/Vehicle · 6 Status
   · 7 Channel · 8 Added · 9 Actions. */
table.leads-list { table-layout: fixed; }
table.leads-list td { overflow-wrap: anywhere; }
table.leads-list th:nth-child(1), table.leads-list td:nth-child(1) { width: 34px; }
table.leads-list th:nth-child(2), table.leads-list td:nth-child(2) { width: 68px; }
table.leads-list td:nth-child(2) { overflow-wrap: normal; }
.ll-id { white-space: nowrap; }
table.leads-list th:nth-child(3), table.leads-list td:nth-child(3) { width: 16%; }
table.leads-list th:nth-child(4), table.leads-list td:nth-child(4) { width: 17%; }
table.leads-list th:nth-child(5), table.leads-list td:nth-child(5) { width: 21%; }
table.leads-list th:nth-child(6), table.leads-list td:nth-child(6) { width: 11%; }
table.leads-list th:nth-child(7), table.leads-list td:nth-child(7) { width: 9%; }
table.leads-list th:nth-child(8), table.leads-list td:nth-child(8) { width: 9%; }
table.leads-list th:nth-child(9), table.leads-list td:nth-child(9) { width: 172px; white-space: normal; }
/* On phones the fixed columns would crush each cell to a few characters, so let
   the table size to its content and scroll sideways inside .table-scroll
   instead (desktop keeps the fit-to-width fixed layout above). */
@media (max-width: 820px) {
  table.leads-list { table-layout: auto; width: auto; min-width: 100%; }
  table.leads-list th, table.leads-list td { width: auto !important; overflow-wrap: normal; white-space: nowrap; }
  /* Multi-line stacks (driver block, contact lines, comment) may still wrap. */
  table.leads-list td .ll-sub, table.leads-list td .ll-addr, table.leads-list td .lc-box { white-space: normal; }
}
/* The stacked action buttons fill their column rather than forcing it wider. */
.leads-list .act-group { min-width: 0; }
.leads-list .act-group .act-btn { width: 100%; }
/* Flex rows (contact + driver/vehicle lines) must let their text shrink/wrap. */
.ll-wa > span, .ll-mail > span, .ll-phone > span,
.ll-driver > span, .ll-veh > span { min-width: 0; overflow-wrap: anywhere; }

.ll-id { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; color: var(--faint); }

/* Sortable headers: the arrow only appears on the column doing the sorting. */
table.leads-list th.th-sort { cursor: pointer; user-select: none; }
table.leads-list th.th-sort:hover { color: var(--ink-2); }
table.leads-list th.th-sort::after { content: ''; margin-left: 5px; font-size: 9px; opacity: .55; }
table.leads-list th.th-sort.sort-asc::after { content: '\25B2'; }
table.leads-list th.th-sort.sort-desc::after { content: '\25BC'; }

/* The native chevron sits hard against the right edge with no way to move it,
   so these draw their own and give it room. */
.filter-select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 15px;
}

/* ── Drawer (case detail) ────────────────────────────────────────────────── */
/* Stacking order, top last: notification backdrop 8800 → notification panel
   8900 → push notice 9000 → dialogs 9500 → toasts 9800. A dialog has to clear
   the notification panel: "Clear all" is asked from inside that panel, and at
   z-index 100 the question appeared behind the thing that asked it. */
.overlay { position: fixed; inset: 0; z-index: 9500; background: rgba(15,23,42,.45); display: flex; }
.overlay[hidden] { display: none; }
.drawer { width: min(560px, 100%); margin-left: auto; height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideIn .18s ease; }
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-head h2 { font-family: 'Plus Jakarta Sans', var(--font); font-size: 17px; font-weight: 800; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 9px; flex-wrap: wrap; background: var(--surface-2); }
.close-x { margin-left: auto; background: none; border: none; font-size: 22px; line-height: 1; color: var(--faint); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.close-x:hover { background: var(--line-2); color: var(--ink); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 14px; font-size: 13.5px; margin-bottom: 16px; }
.kv dt { color: var(--muted); } .kv dd { color: var(--ink); }
.sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 800; margin: 18px 0 9px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.timeline { list-style: none; }
.timeline li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.paylink { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; word-break: break-all; margin-top: 6px; }
.readonly-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 12.5px; color: var(--muted); flex: 1 1 100%; }

/* ── Modal / Settings panels ─────────────────────────────────────────────── */
.modal { background: var(--surface); border-radius: var(--radius); width: min(920px, 100%); max-height: min(88vh, 940px); margin: auto; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.overlay.center { align-items: center; justify-content: center; padding: 22px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-family: 'Plus Jakarta Sans', var(--font); font-size: 17px; font-weight: 800; }
.modal-head .sub { font-size: 12px; color: var(--muted); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 22px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; align-items: center; background: var(--surface-2); }
.modal-foot .note { margin-right: auto; font-size: 12px; color: var(--muted); }
.fieldgrid, .defaults-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; }
.section-title, .sec-head { grid-column: 1/-1; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 16px 0 4px; }
.section-title:first-child, .sec-head:first-child { margin-top: 0; }

/* ── Repeating detail blocks (tickets / suspensions / claims) ─────────────── */
.section-hint { grid-column: 1/-1; font-size: 12px; color: var(--muted); margin: 2px 0 8px; line-height: 1.5; }
.field-full { grid-column: 1/-1; }
.field-2 { grid-column: span 2; }

/* Live address autocomplete */
.addr-ac { position: relative; width: 100%; }
.addr-ac-menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15,23,42,.16); padding: 4px; max-height: 260px; overflow-y: auto;
}
.addr-ac-menu[hidden] { display: none; }
.addr-ac-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink); padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.addr-ac-item:hover { background: var(--brand-50); }
.addr-ac-keep { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 2px; }
.addr-ac-note { padding: 8px 10px; font-size: 12.5px; color: var(--muted); }
.repeater { grid-column: 1/-1; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 6px 0 14px; background: var(--surface-2); }
.repeater-head { display: flex; align-items: center; justify-content: space-between; }
.repeater-title { font-weight: 700; font-size: 13.5px; color: var(--ink); margin-bottom: 4px; }
.repeater-rows { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 10px; }
.repeater-empty { font-size: 12.5px; color: var(--muted); font-style: italic; padding: 2px 0 4px; }
.repeater-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.repeater-row-num { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--brand-600); margin-bottom: 8px; }
.repeater-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.repeater-grid .field { margin-bottom: 8px; }
.repeater-row .btn-danger { margin-top: 2px; }

/* ── Settings tabs ───────────────────────────────────────────────────────── */
.set-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.set-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.set-tab:hover { color: var(--ink); }
.set-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.set-panel[hidden] { display: none; }

/* ── Toast & dialogs (see ui.js) ─────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 9800; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; animation: toastIn .18s ease; }
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); } .toast.ok { background: var(--ok); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-input { display: block; margin-top: 10px; }
.dlg-msg { font-size: 14px; color: var(--ink-2); line-height: 1.55; white-space: pre-line; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--brand-50), var(--bg)); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: min(400px, 100%); padding: 34px 30px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .icon { width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), #7c3aed); display: flex; align-items: center; justify-content: center; font-size: 21px; box-shadow: var(--shadow-sm); }
.login-brand h1 { font-family: 'Plus Jakarta Sans', var(--font); font-size: 18px; font-weight: 800; }
.login-brand p { font-size: 12.5px; color: var(--muted); }
.login-field { margin-bottom: 15px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.login-field input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.login-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); background: #fff; }
.login-btn { width: 100%; padding: 12px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 4px; box-shadow: var(--shadow-sm); }
.login-btn:hover:not(:disabled) { background: var(--brand-600); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-error { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 15px; }
.login-error[hidden] { display: none; }
.login-note { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  /* z-index 60 lifts the topbar (and the drawer nested inside it) above the
     backdrop (55). Without this the sticky topbar's own stacking context traps
     the drawer below the backdrop, so nothing in the menu is tappable. */
  .topbar { padding: 10px 14px; flex-wrap: nowrap; z-index: 60; }
  .topbar-title { white-space: nowrap; }        /* don't break "FirstMile Portal" */
  .nav-actions { display: flex; }
  .nav-burger { display: inline-flex; }
  /* Off-canvas sheet sliding in from the right. */
  .topbar-right {
    position: fixed; top: 0; right: 0; z-index: 60;
    height: 100dvh; width: min(82vw, 300px);
    margin: 0; gap: 2px; padding: 10px 8px 24px;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    background: var(--surface); border-left: 1px solid var(--line);
    box-shadow: -10px 0 30px rgba(0,0,0,.18);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    transform: translateX(100%); transition: transform .24s ease;
  }
  .topbar-right.open { transform: translateX(0); }
  .topbar-right .topbar-sub { width: auto; order: -1; margin: 4px 10px 10px; padding: 0; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: none; }
  /* Flat list rows, not bordered button-cards (WhatsApp-style drawer). */
  .topbar-right .btn {
    width: 100%; justify-content: flex-start; gap: 14px;
    padding: 13px 14px; font-size: 15px; font-weight: 500;
    background: none; border: none; border-radius: 10px; box-shadow: none;
    color: var(--text);
  }
  .topbar-right .btn:hover { background: var(--surface-2); }
  .topbar-right .btn.active { background: var(--brand-50); color: var(--brand-600); }
  .topbar-right .btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
  .topbar-right .nav-badge { margin-left: auto; }
  /* Give the icon-only actions a text label inside the drawer. */
  .topbar-right #btn-logout::after { content: 'Sign out'; font-weight: 500; }
  .topbar-right #btn-bell::after { content: 'Notifications'; font-weight: 500; }
  .wrap, .set-shell { padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .lc-pair { grid-template-columns: 1fr; }
  .fieldgrid, .defaults-grid { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 100px 1fr; }
  .drawer { width: 100%; }
  .footbar { flex-wrap: wrap; }
  .footbar .note-pii { display: none; }
}
@media (max-width: 520px) {
  .fieldgrid, .defaults-grid { grid-template-columns: 1fr; }
  .btn { padding: 9px 12px; }
  .topbar-title { font-size: 15px; }
  /* Nav is the slide-in drawer (see the 820px block); nothing to reflow here. */
  /* Keep every case column on small screens; the table scrolls sideways in its
     own container (.table-scroll) rather than dropping columns. */
}
[hidden] { display: none !important; }

/* ── Push notice ──────────────────────────────────────────────────────────
   A push that lands while the portal is open. One at a time, bottom centre,
   and it stays until it is dismissed or the next one replaces it. */
.push-banner {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 9000; display: flex; align-items: center; gap: 14px;
  min-width: 360px; max-width: min(620px, calc(100vw - 32px));
  padding: 16px 18px; border-radius: 14px;
  background: var(--surface, #fff); color: var(--ink, #0f172a);
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
  animation: pb-in .22s ease-out;
}
@keyframes pb-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.push-banner .pb-ic { font-size: 24px; line-height: 1; }
.push-banner .pb-txt { flex: 1; min-width: 0; }
.push-banner .pb-title { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.push-banner .pb-body { font-size: 13.5px; color: var(--muted, #64748b); margin-top: 3px; }
.push-banner .pb-open {
  flex: none; padding: 8px 15px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 700; border: 1px solid transparent;
  background: var(--brand, #4f46e5); color: #fff;
}
.push-banner .pb-open:hover { filter: brightness(1.07); }
.push-banner .pb-x {
  flex: none; background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; padding: 2px 8px; border-radius: 8px;
  color: var(--faint, #94a3b8);
}
.push-banner .pb-x:hover { background: var(--line-2, #e5e7eb); color: var(--ink, #0f172a); }
@media (max-width: 560px) {
  .push-banner { left: 16px; right: 16px; transform: none; min-width: 0; max-width: none; }
  @keyframes pb-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
}

/* ── Notification sidebar ─────────────────────────────────────────────────
   Opened by the header bell. The feed is per user and lives on the server, so
   it is the same on every machine they sign in from. */
#btn-bell { position: relative; }
#btn-bell .bell-dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--danger, #dc2626); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}
.notif-back {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .28); z-index: 8800;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.notif-back.is-open { opacity: 1; pointer-events: auto; }
.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
  z-index: 8900; display: flex; flex-direction: column;
  background: var(--surface, #fff); border-left: 1px solid var(--line, #e2e8f0);
  box-shadow: -18px 0 46px rgba(15, 23, 42, .16);
  transform: translateX(102%); transition: transform .22s ease;
}
.notif-panel.is-open { transform: none; }
.notif-head {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 16px 14px 14px 20px; border-bottom: 1px solid var(--line, #e2e8f0);
}
.notif-title { font-family: 'Plus Jakarta Sans', var(--font); font-size: 16px; font-weight: 800; flex: 1; }
.notif-clear {
  background: none; border: 1px solid var(--line, #e2e8f0); border-radius: 8px;
  padding: 5px 11px; font-size: 12px; font-weight: 700; color: var(--muted, #64748b); cursor: pointer;
}
.notif-clear:hover { background: var(--danger-bg, #fef2f2); color: var(--danger, #dc2626); border-color: transparent; }
.notif-x { background: none; border: none; font-size: 23px; line-height: 1; color: var(--faint, #94a3b8); cursor: pointer; padding: 0 4px; }
.notif-x:hover { color: var(--ink, #0f172a); }
.notif-ask:empty { display: none; }
.notif-cta { margin: 14px; padding: 14px; border-radius: 12px; background: var(--brand-50, #eef2ff); border: 1px solid var(--line, #e2e8f0); }
.notif-cta-t { font-size: 13.5px; font-weight: 800; }
.notif-cta-b { font-size: 12.5px; color: var(--muted, #64748b); margin: 4px 0 11px; line-height: 1.5; }
.notif-note { margin: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2, #f8fafc); font-size: 12.5px; color: var(--muted, #64748b); line-height: 1.5; }
.notif-list { flex: 1; overflow-y: auto; padding: 6px 0 20px; }
.notif-empty { padding: 44px 20px; text-align: center; color: var(--faint, #94a3b8); font-size: 13px; }
.notif-item {
  display: flex; gap: 11px; width: 100%; text-align: left; cursor: pointer;
  padding: 13px 18px; background: none; border: none; border-bottom: 1px solid var(--line, #e2e8f0);
}
.notif-item:hover { background: var(--surface-2, #f8fafc); }
.notif-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif-item.is-unread .notif-dot { background: var(--brand, #4f46e5); }
.notif-txt { min-width: 0; flex: 1; }
.notif-it { font-size: 13.5px; font-weight: 700; color: var(--ink, #0f172a); }
.notif-item.is-unread .notif-it { font-weight: 800; }
.notif-ib { font-size: 12.5px; color: var(--muted, #64748b); margin-top: 2px; line-height: 1.45; }
.notif-iw { font-size: 11.5px; color: var(--faint, #94a3b8); margin-top: 5px; }

/* Required-reason dialog (expiring a lead or a case). */
.dlg-label { display: block; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--muted); }
.dlg-err { margin-top: 7px; font-size: 12.5px; color: var(--danger, #dc2626); font-weight: 600; }

/* The leads list carries more columns than any other page; it gets the room. */
.wrap--wide { max-width: 1550px; }

/* Why a lead or case was expired — shown wherever that record is read. */
.expired-note {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 16px; padding: 12px 14px; border-radius: 10px;
  background: var(--danger-bg, #fef2f2); border: 1px solid rgba(220, 38, 38, .25);
}
.expired-note .en-ic { flex: none; line-height: 1.3; }
.expired-note .en-l { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--danger, #dc2626); }
.expired-note .en-b { font-size: 13.5px; color: var(--ink, #0f172a); margin-top: 3px; line-height: 1.5; white-space: pre-line; }

/* Expired has to read as a state, not a footnote — it changes what every other
   number on the page means. */
.q-badge.q-exp { background: var(--line-2, #e5e7eb); color: var(--muted, #6b7280); }
.lead-head .q-badge.q-exp,
.sub .q-badge.q-exp {
  background: var(--danger-bg, #fef2f2); color: var(--danger, #dc2626);
  border: 1.5px solid var(--danger, #dc2626); font-weight: 800; letter-spacing: .4px;
}

/* Multi-select on the leads list. */
.leads-list .col-check { width: 34px; padding-right: 0; }
.leads-list .col-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand, #4f46e5); }
.bulkbar .hint { font-size: 12.5px; color: var(--muted); }
.notif-blocked { margin-top: 11px; font-size: 12px; color: var(--muted, #64748b); line-height: 1.5; }
.notif-read {
  background: none; border: 1px solid var(--line, #e2e8f0); border-radius: 8px;
  padding: 5px 11px; font-size: 12px; font-weight: 700; color: var(--muted, #64748b); cursor: pointer;
}
.notif-read:hover:not(:disabled) { background: var(--brand-50, #eef2ff); color: var(--brand, #4f46e5); border-color: transparent; }
.notif-read:disabled { opacity: .45; cursor: default; }

/* ── Lead comment (scenario-tagged, coloured) ─────────────────────────────── */
.lc-wrap { margin-top: 8px; }
.lc-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px dashed var(--line, #d5dbe2); color: var(--muted, #667781);
  border-radius: 8px; padding: 5px 11px; font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.lc-add:hover { border-color: var(--brand, #4f46e5); color: var(--brand-600, #4f46e5); }
.lc-add-ic { font-size: 14px; line-height: 1; }
.lc-box { border: 1px solid; border-radius: 9px; padding: 8px 10px; max-width: 420px; }
/* Comment attribution line: who added/edited it and when (muted, no highlight). */
.lc-foot { margin-top: 7px; padding-top: 6px; border-top: 1px dashed rgba(0,0,0,.14); font-size: 11.5px; font-weight: 600; color: inherit; opacity: .72; display: flex; align-items: center; gap: 5px; }
.lc-compact .lc-foot { font-size: 11px; margin-top: 5px; }
.lc-head { display: flex; align-items: center; gap: 7px; }
.lc-ic { font-size: 14px; line-height: 1; flex: 0 0 auto; }
.lc-head .lc-label { margin: 0; font-weight: 700; font-size: 12px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.lc-tools { margin-left: auto; display: flex; gap: 2px; flex: 0 0 auto; opacity: 0; transition: opacity .12s; }
/* Reveal Edit/Remove only on row hover (list) or when hovering/focusing the box. */
.leads-list tbody tr:hover .lc-tools,
.lc-box:hover .lc-tools,
.lc-wrap:focus-within .lc-tools { opacity: 1; }
.lc-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: none; border: none; cursor: pointer; color: inherit; opacity: .7; padding: 0; border-radius: 6px; }
.lc-btn:hover { opacity: 1; background: rgba(0,0,0,.07); }
.lc-btn-rm { color: #c0392b; }
.lc-text-body { margin-top: 5px; font-size: 13px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.lc-compact .lc-box { padding: 6px 9px; }
.lc-compact .lc-label { font-size: 11.5px; }
.lc-compact .lc-text-body { font-size: 12.5px; margin-top: 3px; }
.lc-compact .lc-btn { width: 22px; height: 22px; }
.lc-card .lc-wrap { margin-top: 0; }

/* Manually highlighted comment — a left accent bar in the comment's own scenario
   colour, a soft lift, and a star stuck on the top-right corner. */
.lc-box.lc-hl { position: relative; box-shadow: inset 3px 0 0 0 var(--hl, #f59e0b), 0 6px 18px -8px rgba(15,23,42,.3); }
.lc-hl-star { position: absolute; top: -9px; right: -8px; display: inline-flex; line-height: 0; color: var(--hl, #f59e0b); filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); z-index: 3; pointer-events: none; }

/* Highlight toggle at the top of the add/edit dialog — tinted (via inline styles)
   to the selected scenario's colour, with a matching star. */
.lc-hl-toggle { display: flex; align-items: center; gap: 11px; cursor: pointer; margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; user-select: none; transition: background .15s, border-color .15s, color .15s; }
.lc-hl-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.lc-sw { position: relative; flex: 0 0 auto; width: 38px; height: 22px; background: rgba(100,116,139,.45); border-radius: 999px; transition: background .15s; }
.lc-sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.lc-hl-toggle input:checked + .lc-sw { background: var(--hl, #f59e0b); }
.lc-hl-toggle input:checked + .lc-sw::after { transform: translateX(16px); }
.lc-hl-toggle input:focus-visible + .lc-sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.lc-hl-txt { font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.lc-hl-star-ic { display: inline-flex; align-items: center; line-height: 0; margin-right: 3px; }
.lc-hl-sub { font-weight: 500; font-size: 12.5px; opacity: .82; }

/* Add/edit dialog */
.lc-scenarios { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.lc-scn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-family: inherit;
  background: var(--scn-bg, #fff8e1); color: var(--scn-fg, #8a6d1b);
  border: 2px solid transparent; border-radius: 10px; padding: 8px 12px;
}
.lc-scn:hover { filter: brightness(.98); }
.lc-scn.sel { border-color: var(--scn-bd, #f0e2ab); box-shadow: 0 0 0 1px var(--scn-bd, #f0e2ab) inset; }
.lc-scn-ic { font-size: 17px; line-height: 1; }
.lc-scn-lb { font-size: 13px; font-weight: 600; }
.lc-text { width: 100%; box-sizing: border-box; }

/* "Open WhatsApp chat" dialog — who created the lead */
.wa-creator { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.wa-creator.is-bot { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.wa-creator.is-client { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
