/* ============================================================
   Motoloop — business console auth (login + dashboard shell)
   Reuses tokens.css + site.css (.btn, .brand, .grad-text, .kicker).
   ============================================================ */

/* Author display rules (flex/grid) otherwise beat the UA [hidden] rule, so
   re-assert it — keeps toggled error/note/grid/section elements actually hidden. */
[hidden] { display: none !important; }

.auth-body {
  min-height: 100vh;
  /* Mobile browsers size 100vh against the largest possible viewport (address
     bar collapsed) — with the bar visible on first load, that leaves a
     phantom gap below the centered content. dvh tracks the *actual* visible
     viewport; browsers that don't support it just keep the vh value above. */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255, 90, 40, 0.16), transparent 70%),
    var(--bg);
}

/* ---- Centered login shell ---- */
.auth-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 20px 56px;
}
.auth-brand { gap: 10px; }
.auth-brand img { width: 34px; height: 34px; border-radius: 9px; }
.auth-brand .word { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: var(--ls-wordmark); }

.auth-card {
  width: 100%;
  max-width: 412px;
  background: var(--surface-1);
  border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 30px 28px 26px;
  box-shadow: var(--shadow-sheet);
}
.auth-card .kicker { margin-bottom: 14px; }
.auth-card h1 {
  font-family: var(--font-display); font-weight: 800; font-size: 26px;
  letter-spacing: -0.5px; line-height: var(--lh-tight); margin: 0 0 8px;
}
.auth-sub { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }

.auth-field { display: block; margin-bottom: 14px; }
.auth-field span {
  display: block; font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--ls-mono);
  text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 7px;
}
/* .loc-wrap: the address-search input sits outside .auth-field (its own
   positioning wrapper for the results dropdown) — styled alongside so it
   and the textarea (auth-field's OTHER non-input control) get the same dark
   treatment as regular text inputs instead of falling back to browser
   defaults (plain white). */
.auth-field input, .loc-wrap input, .auth-field textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg); color: var(--text);
  border: var(--border-thin) solid var(--border); border-radius: var(--radius-lg);
  padding: 13px 14px; font-family: var(--font-sans); font-size: 15px;
  transition: border-color var(--dur-fast);
}
.auth-field input::placeholder, .loc-wrap input::placeholder, .auth-field textarea::placeholder { color: var(--text-quaternary); }
.auth-field input:focus, .loc-wrap input:focus, .auth-field textarea:focus { outline: none; border-color: var(--orange); }

.auth-error {
  display: flex; align-items: center; gap: 9px;
  background: var(--fill-red-soft); border: var(--border-hairline) solid var(--fill-red-stroke);
  color: #FF6B5E; font-size: 13px; line-height: 1.4;
  border-radius: var(--radius-lg); padding: 11px 13px; margin: 4px 0 14px;
}
.auth-error svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-note {
  background: var(--fill-orange-soft); border: var(--border-hairline) solid var(--fill-orange-stroke);
  color: var(--orange); font-size: 13px; line-height: 1.45;
  border-radius: var(--radius-lg); padding: 11px 13px; margin: 4px 0 14px;
}

.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: var(--disabled-opacity); pointer-events: none; }

.auth-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.auth-link {
  background: none; border: 0; cursor: pointer; padding: 4px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
}
.auth-link:hover { color: var(--orange); }

.auth-foot {
  margin-top: 22px; padding-top: 18px; border-top: var(--border-hairline) solid var(--border);
  font-size: 13.5px; color: var(--text-secondary); text-align: center;
}
.auth-foot a { color: var(--orange); font-weight: 600; }
.auth-foot-sub { display: block; margin-top: 12px; font-size: 12.5px; color: var(--text-tertiary); line-height: 1.5; }
.auth-foot-sub a { color: var(--text-secondary); }
.auth-legal {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--text-tertiary); text-align: center; max-width: 412px;
}
.auth-legal a { color: var(--text-secondary); }

/* spinner on the submit button */
.spin { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.25); border-top-color: #1a0d00; border-radius: 50%; animation: aspin 0.7s linear infinite; }
@keyframes aspin { to { transform: rotate(360deg); } }

/* ============================================================
   Dashboard (placeholder console)
   ============================================================ */
.dash-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: var(--border-hairline) solid var(--border);
  background: var(--surface-1);
}
.dash-top .brand .word { font-size: 20px; }
.dash-user { display: flex; align-items: center; gap: 14px; }
.dash-user .who { font-size: 13px; color: var(--text-secondary); }
.dash-user .who b { color: var(--text); font-weight: 600; }

.dash-wrap { max-width: 980px; margin: 0 auto; padding: 40px 24px 80px; width: 100%; box-sizing: border-box; }
.dash-wrap h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.6px; margin: 0 0 6px; }
.dash-wrap .lead { margin-bottom: 30px; }

.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.biz-tile {
  display: block; text-align: left; width: 100%; color: var(--text); font-family: var(--font-sans);
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-xl); padding: 18px; cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.biz-tile:hover { border-color: var(--text-tertiary); transform: translateY(-2px); }
.biz-tile .bt-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.biz-tile .lg { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; }
.biz-tile .lg svg { width: 22px; height: 22px; color: var(--orange); }
.biz-tile .nm { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.3px; }
.biz-tile .ty { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--text-secondary); text-transform: capitalize; margin-top: 2px; }
.biz-tile .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text-secondary); }
.chip.role { background: var(--fill-orange-soft); color: var(--orange); }
.chip.verified { background: rgba(50,215,75,0.12); color: var(--green); }
.chip.tier { background: var(--surface-2); color: var(--text); }

.dash-soon {
  margin-top: 34px; border: var(--border-hairline) dashed var(--border); border-radius: var(--radius-2xl);
  background: var(--surface-1); padding: 30px; text-align: center;
}
.dash-soon .ic { width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 14px; }
.dash-soon .ic svg { width: 24px; height: 24px; color: var(--orange); }
.dash-soon h3 { font-family: var(--font-display); font-weight: 800; font-size: 19px; margin: 0 0 6px; }
.dash-soon p { color: var(--text-secondary); font-size: 14px; max-width: 460px; margin: 0 auto; line-height: 1.5; }

.dash-empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.dash-empty svg { width: 40px; height: 40px; color: var(--text-tertiary); margin-bottom: 14px; }
.dash-loading { text-align: center; padding: 80px 20px; color: var(--text-secondary); }

/* ============================================================
   Full CRM shell (business-dashboard)
   ============================================================ */
.crm-page {
  min-height: 100vh;
  min-height: 100dvh; /* see .auth-body — avoids a phantom gap under mobile browser chrome */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  /* Not "hidden": on narrow/short viewports (see the max-width:860px block
     below) .crm-shell switches to natural document flow and can grow taller
     than 100vh — this needs to be a scrollable fallback or that overflow gets
     silently clipped instead of scrollable. On desktop this never triggers
     because .crm-shell/.crm-content-area absorb all overflow internally. */
  overflow-y: auto;
  overflow-x: hidden;
}
.crm-page .dash-top { flex-shrink: 0; }

.crm-shell {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.crm-sidebar-full {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: var(--border-hairline) solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.crm-back {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  padding: 14px 16px;
  border: 0; border-bottom: var(--border-hairline) solid var(--border);
  background: none; width: 100%; text-align: left; cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.crm-back:hover { color: var(--text); background: var(--surface-2); }
.crm-back svg { width: 15px; height: 15px; flex-shrink: 0; }
.crm-biz-card {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px;
  border-bottom: var(--border-hairline) solid var(--border);
}
.crm-biz-logo {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: var(--grad-brand); display: grid; place-items: center; flex-shrink: 0;
}
.crm-biz-logo svg { width: 19px; height: 19px; color: #1a0d00; }
.crm-biz-name { font-weight: 700; font-size: 14px; line-height: 1.15; }
.crm-biz-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); letter-spacing: 0.03em; margin-top: 2px; }
.crm-nav-full { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; }
.crm-nav-full a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.crm-nav-full a:hover { background: var(--surface-2); color: var(--text); }
.crm-nav-full a.on { background: var(--surface-3); color: var(--text); }
.crm-nav-full a.on svg { color: var(--red); }
.crm-nav-full a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---- Content area ---- */
.crm-content-area {
  flex: 1; min-width: 0;
  overflow-y: auto; overflow-x: hidden;
}
.crm-section { padding: 28px 32px; max-width: 1000px; }
.crm-section-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 22px;
}
.crm-section-h h2 {
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  letter-spacing: -0.4px; margin: 0;
}
.crm-section-h h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  letter-spacing: -0.3px; margin: 0;
}
.range-badge {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  border: var(--border-hairline) solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 13px; white-space: nowrap;
}
.crm-loading { text-align: center; padding: 60px 20px; color: var(--text-secondary); font-size: 14px; }
.crm-error {
  display: flex; align-items: center; gap: 9px;
  padding: 20px; color: #FF6B5E; font-size: 14px;
}
.crm-error svg { width: 18px; height: 18px; flex-shrink: 0; }
.crm-empty {
  text-align: center; padding: 48px 20px; color: var(--text-secondary);
  font-size: 14px; line-height: 1.55;
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-2xl);
}
.crm-empty-sm { padding: 14px 0; color: var(--text-secondary); font-size: 13px; text-align: center; }
.crm-sub-section { margin-top: 30px; }

/* KPI delta colours */
.kpi .delta.pos { color: var(--green); }
.kpi .delta.neg { color: var(--text-secondary); }

/* ---- Status badges ---- */
.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-secondary);
  white-space: nowrap;
}
.badge-new       { background: var(--fill-orange-soft); color: var(--orange); }
.badge-answered  { background: rgba(94,200,255,0.12); color: var(--cool); }
.badge-accepted  { background: rgba(50,215,75,0.12); color: var(--green); }
.badge-declined,
.badge-spam      { background: var(--surface-2); color: var(--text-quaternary); }
.badge-active    { background: rgba(50,215,75,0.12); color: var(--green); }
.badge-draft     { background: var(--surface-2); color: var(--text-secondary); }
.badge-scheduled { background: var(--fill-orange-soft); color: var(--orange); }
.badge-ended     { background: var(--surface-2); color: var(--text-quaternary); }

/* ---- Action icon buttons ---- */
.act-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: var(--border-hairline) solid var(--border);
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
}
.act-btn svg { width: 13px; height: 13px; }
.act-btn.accept  { border-color: rgba(50,215,75,0.3); }
.act-btn.accept:hover { background: rgba(50,215,75,0.12); }
.act-btn.accept svg { color: var(--green); }
.act-btn.decline:hover { background: var(--fill-red-soft); }
.act-btn.decline svg  { color: var(--text-secondary); }
.act-btn.spam svg     { color: var(--text-tertiary); }
.act-btn.spam:hover   { background: var(--surface-3); }
.act-btn[disabled]    { opacity: 0.4; pointer-events: none; }

/* ---- Data table ---- */
.table-wrap { overflow-x: auto; }
.crm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.crm-table thead th {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-tertiary);
  padding: 10px 14px; text-align: left;
  border-bottom: var(--border-hairline) solid var(--border); white-space: nowrap;
}
.crm-table tbody td {
  padding: 12px 14px;
  border-bottom: var(--border-hairline) solid var(--border);
  vertical-align: middle;
}
.crm-table tbody tr:last-child td { border-bottom: 0; }
.crm-table tbody tr:hover td { background: var(--surface-1); }
.crm-table .num { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.inq-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.inq-msg { font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.inq-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); letter-spacing: 0.03em; }
/* Section-level description under a .crm-section-h header — needs to read as a
   sentence, not a metadata tag, so it's sans-serif and notably larger than .inq-meta. */
.crm-section-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ---- Catalogue grid ---- */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 14px; }
.listing-card {
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-xl); padding: 18px;
  transition: border-color var(--dur-fast);
}
.listing-card:hover { border-color: #3a3a3a; }
.listing-card.inactive { opacity: 0.5; }
.listing-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.listing-views { display: flex; align-items: center; gap: 4px; margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); }
.listing-views svg { width: 12px; height: 12px; }
.listing-card h4 { font-family: var(--font-sans); font-weight: 700; font-size: 16px; margin: 0 0 6px; letter-spacing: -0.2px; }
.listing-desc { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; line-height: 1.4; }
.listing-price { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.5px; margin-bottom: 12px; }
.listing-actions { display: flex; gap: 8px; margin-top: 12px; }
.listing-actions .btn { padding: 8px 14px; font-size: 12.5px; flex: 1; justify-content: center; }

/* ---- Team ---- */
.member-cell { display: flex; align-items: center; gap: 10px; }
.member-cell .av { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 12px; flex-shrink: 0; }
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-actions .btn { padding: 9px 16px; font-size: 13px; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface-1); border: var(--border-hairline) solid var(--border); border-radius: var(--radius-md); margin-bottom: 8px; }
.invite-code { font-family: var(--font-mono); font-weight: 700; font-size: 15px; letter-spacing: 0.1em; color: var(--green); }
.invite-role { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); margin-top: 3px; }

/* ---- Seats & billing (team) ---- */
.seat-summary { background: var(--surface-1); border: var(--border-hairline) solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.seat-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; color: var(--text-secondary); }
.seat-line b { color: var(--text); font-weight: 700; }
.seat-line em { color: var(--text-tertiary); font-style: normal; }
.seat-total { margin-top: 4px; padding-top: 11px; border-top: var(--border-hairline) solid var(--border); }
.seat-total span { color: var(--text); font-weight: 700; }
.seat-total b.seat-due { color: var(--orange); font-size: 15px; }
.seat-note { display: flex; gap: 9px; margin: 12px 0 0; padding: 11px 13px; background: var(--fill-orange-bg, rgba(255,149,0,0.07)); border: var(--border-hairline) solid var(--fill-orange-stroke, rgba(255,149,0,0.22)); border-radius: var(--radius-md); font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); }
.seat-note svg { width: 16px; height: 16px; color: var(--orange); flex-shrink: 0; margin-top: 1px; }
.seat-note b { color: var(--text); }

/* ---- Walkthrough (how to redeem) ---- */
.walkthrough { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.walkthrough li { position: relative; padding: 0 0 14px 40px; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); }
.walkthrough li:last-child { padding-bottom: 0; }
.walkthrough li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--grad-brand); color: #1a0d00; font-family: var(--font-mono); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.walkthrough li:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 4px; width: 1px; background: var(--border); }
.walkthrough b { color: var(--text); }

/* ---- Billing ---- */
.billing-card {
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-2xl); padding: 24px; margin-bottom: 18px;
}
.billing-tier .kicker { margin-bottom: 8px; }
.billing-tier h3 { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.5px; margin: 0; }
.billing-detail { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; }
.billing-detail .sub { font-size: 13px; color: var(--text-secondary); }
.billing-detail .warn { color: var(--warning); font-weight: 600; }
.billing-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.billing-upsell {
  background: linear-gradient(160deg, rgba(255,149,0,0.06), var(--surface-1) 70%);
  border: var(--border-hairline) solid var(--fill-orange-stroke);
  border-radius: var(--radius-2xl); padding: 22px;
}
.billing-upsell .pt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange); margin-bottom: 14px; }
.upsell-items { display: flex; flex-direction: column; gap: 11px; margin-bottom: 20px; }
.upsell-items div { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.upsell-items svg { width: 16px; height: 16px; color: var(--green); flex-shrink: 0; }

/* ---- Business list (multi-biz selector) ---- */
.biz-list-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.biz-list-page h1 { font-family: var(--font-display); font-weight: 800; font-size: 32px; letter-spacing: -0.6px; margin: 0 0 8px; }
.biz-list-page .lead { margin-bottom: 30px; }

/* ---- Findings / insights ---- */
.findings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.findings-list li { font-size: 13.5px; color: var(--text-secondary); padding-left: 16px; position: relative; line-height: 1.4; }
.findings-list li::before { content: '→'; position: absolute; left: 0; color: var(--orange); font-family: var(--font-mono); }

/* ---- Dashboard: KPI cards ---- */
.kpis {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.kpi {
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-xl); padding: 18px 20px;
}
.kpi .lab { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 8px; }
.kpi .val { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.8px; line-height: 1; margin-bottom: 8px; }
.kpi .delta { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; }

/* ---- Dashboard: chart + panels ---- */
.crm-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel {
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-xl); padding: 18px 20px;
}
.pt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 14px; }
.chart {
  display: flex; align-items: flex-end; gap: 3px;
  height: 80px; overflow: hidden;
}
.chart .bar {
  flex: 1; min-width: 4px;
  background: var(--grad-brand); border-radius: 3px 3px 0 0;
  transition: opacity var(--dur-fast);
}
.chart .bar.dim { opacity: 0.25; }

/* ---- Dashboard: recent leads ---- */
.lead-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: var(--border-hairline) solid var(--border);
}
.lead-row:last-child { border-bottom: 0; }
.lead-row .lt { flex: 1; min-width: 0; }
.lead-row .lt b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row .lt span { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); letter-spacing: 0.03em; margin-top: 2px; display: block; }

/* qualified-lead badge */
.qp {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 9px; border-radius: var(--radius-pill);
  background: var(--fill-orange-soft); color: var(--orange);
  white-space: nowrap; flex-shrink: 0;
}

/* ---- Qualify-lead action button ---- */
.act-btn.qualify { border-color: rgba(255,149,0,0.30); }
.act-btn.qualify:hover { background: var(--fill-orange-soft); }
.act-btn.qualify svg { color: var(--orange); }

/* ---- Custom select — removes native OS arrow, adds a Feather chevron ---- */
.pf-field select,
.crm-modal-b select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
  cursor: pointer;
}
body.theme-light .pf-field select,
body.theme-light .crm-modal-b select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ---- Theme toggle button ---- */
.theme-toggle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: var(--border-hairline) solid var(--border);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  color: var(--text-secondary); transition: background var(--dur-fast), color var(--dur-fast);
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text); }
.theme-toggle svg { width: 15px; height: 15px; }

/* ---- Leads filter bar ---- */
.filter-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-sep {
  width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex-shrink: 0;
}
.filter-chip {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 6px 13px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: var(--border-hairline) solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  white-space: nowrap;
}
.filter-chip:hover { background: var(--surface-3); color: var(--text); }
.filter-chip.on { background: var(--fill-orange-soft); border-color: var(--fill-orange-stroke); color: var(--orange); }

/* ---- Quota banner ---- */
.quota-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; margin-bottom: 16px;
  background: var(--surface-1); border: var(--border-hairline) solid var(--border);
  border-radius: var(--radius-md); font-size: 13px; flex-wrap: wrap;
}
.quota-banner.warn {
  background: var(--fill-orange-soft); border-color: var(--fill-orange-stroke);
}
.quota-banner .qb-label { color: var(--text-secondary); flex: 1; min-width: 0; }
.quota-banner.warn .qb-label { color: var(--text); }
.quota-banner .qb-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.quota-bar {
  width: 72px; height: 6px; background: var(--surface-3);
  border-radius: var(--radius-pill); overflow: hidden; flex-shrink: 0;
}
.quota-fill {
  height: 100%; background: var(--grad-brand);
  border-radius: var(--radius-pill); transition: width 0.3s;
}
.quota-fill.full { background: var(--orange); }
.quota-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  white-space: nowrap;
}
.quota-banner.warn .quota-count { color: var(--orange); font-weight: 700; }

/* ---- Responsive CRM ---- */
@media (max-width: 860px) {
  .crm-shell { flex-direction: column; height: auto; overflow: visible; }
  .crm-sidebar-full { width: 100%; border-right: 0; border-bottom: var(--border-hairline) solid var(--border); }
  .crm-nav-full { flex-direction: row; overflow-x: auto; padding: 6px 8px; }
  .crm-nav-full a { white-space: nowrap; padding: 8px 12px; }
  .crm-nav-full a svg { display: none; }
  .crm-content-area { overflow: visible; }
  .crm-section { padding: 20px 18px; }
  .listing-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .crm-panels { grid-template-columns: 1fr; }
  .kpi .val { font-size: 24px; }
}

/* ================================================================
   Light mode — toggled via body.theme-light
   Flips all surface/border/text tokens to a warm off-white palette.
   Brand colours (red, orange, green, gradients) stay unchanged.
   ================================================================ */
body.theme-light {
  --bg:              #F7F7F8;
  --surface-1:       #FFFFFF;
  --surface-2:       #F2F2F5;
  --surface-3:       #E8E8EB;
  --border:          #D8D8DC;
  --tabbar:          #E8E8EB;
  --text:            #1A1A1E;
  --text-secondary:  #58585F;
  --text-tertiary:   #8A8A93;
  --text-quaternary: #AEAEB2;
  --fill-orange-soft:   rgba(255,149,0,0.10);
  --fill-orange-stroke: rgba(255,149,0,0.24);
  --fill-red-soft:      rgba(255,59,48,0.07);
  --fill-red-stroke:    rgba(255,59,48,0.22);
  --shadow-sheet:    0 -4px 20px rgba(0,0,0,0.08);
  --shadow-pop:      0 4px 20px rgba(0,0,0,0.10);
  --scrim:           rgba(240,240,240,0.86);
}
/* Modal overlay is lighter in light mode */
body.theme-light .crm-modal-ov { background: rgba(0,0,0,0.30); }
/* Auth background gradient toned down */
body.theme-light .auth-body {
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255,90,40,0.08), transparent 70%),
    var(--bg);
}
/* Badge colours need stronger contrast on light backgrounds */
body.theme-light .badge-answered  { background: rgba(0,150,220,0.10); color: #0077aa; }
body.theme-light .badge-accepted  { background: rgba(0,170,50,0.10);  color: #1a8a30; }
body.theme-light .badge-new       { background: rgba(255,149,0,0.12); color: #c27000; }
body.theme-light .badge-active    { background: rgba(0,170,50,0.10);  color: #1a8a30; }
body.theme-light .badge-scheduled { background: rgba(255,149,0,0.12); color: #c27000; }
/* Spin button contrast inside primary buttons (still dark bg) */
body.theme-light .btn-primary .spin { border-color: rgba(0,0,0,0.25); border-top-color: rgba(0,0,0,0.6); }
/* Filter chip active state needs darker text on a light background — #FF9500 on white is ~2.2:1 */
body.theme-light .filter-chip.on { color: #9B5C00; background: rgba(155,92,0,0.10); border-color: rgba(155,92,0,0.28); }
/* Quota bar track is nearly invisible on white surface — bump contrast */
body.theme-light .quota-bar { background: #CFCFD4; }
