/*
 * MechanicBazaar client desk.
 * Refinement informed by Unslop by Damir Sokolovsky, CC BY 4.0.
 * https://github.com/heydamir/unslop
 *
 * The client ledger is the visual centre: graphite navigation, white working
 * surfaces, aligned figures and one orange edge on the current client/context.
 * Passes: 4px rhythm; neutral colour; existing line icons; concise UI copy in
 * page modules; calm type; ledger layout; useful detail; real records; feedback.
 * This final layer preserves the original page and responsive behaviour.
 */

:root {
  --navy: #17191d;
  --navy-2: #212429;
  --navy-3: #30343b;
  --blue: #30343b;
  --blue-2: #30343b;
  --orange: #c9461a;
  --orange-2: #c9461a;
  --orange-3: #a83a14;
  --orange-soft: #fcf2ed;
  --bg: #fafafa;
  --surface: #ffffff;
  --line: #e6e7e9;
  --line-2: #cdd0d5;
  --text: #25282d;
  --muted: #5b6069;
  --faint: #6b7079;
  --focus: #565e6c;
  --focus-on-dark: #f2b49a;
  --gray-soft: #f2f3f4;
  --green: #247348;
  --green-soft: #edf6ef;
  --warm: #8d5a0a;
  --warm-soft: #fcf5e7;
  --cold: #41649b;
  --cold-soft: #eef2f8;
  --hot: #b42318;
  --hot-soft: #fff0ee;
  --message-alert: #b42318;
  --message-alert-dark: #912018;
  --message-alert-soft: #fff1ee;
  --radius: 8px;
  --shadow: none;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --desk-ease: cubic-bezier(.22, 1, .36, 1);
}

body { line-height: 1.5; }
h1, h2, h3, h4 { font-weight: 500; }
strong, b { font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.eyebrow.on-dark { color: #d7a58e; }
.small { line-height: 1.5; }

/* One consistent set of line icons; their context supplies the colour. */
.nav-icon { flex: 0 0 20px; width: 20px; height: 20px; }
.nav-icon svg, .button > svg, .icon-button svg { width: 18px; height: 18px; stroke-width: 1.5; }

/* The shell stays dense so the records have room. */
@media (min-width: 1025px) {
  .app { grid-template-columns: 240px minmax(0, 1fr); }
}
.sidebar { gap: 4px; padding: 24px 12px 16px; color: #b4b7be; background: #16191d; }
.sidebar-logo { padding: 0 12px; }
.sidebar-logo img { width: 168px; }
.sidebar-product { margin: 4px 12px 24px; color: #999fa8; font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.nav { gap: 4px; }
.nav-link { min-height: 36px; gap: 8px; padding: 8px 12px; border-radius: 4px; color: #b9bdc4; font-size: 13px; font-weight: 400; line-height: 20px; }
.nav-link:hover { background: #22262c; }
.nav-link.active { color: #fff; background: #2b2f35; box-shadow: inset 2px 0 0 var(--orange); font-weight: 500; }
.nav-badge { min-width: 20px; padding: 0 6px; border-radius: 4px; color: #e0e2e5; background: #3a3e45; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.nav-badge.warn { color: #f6d98e; background: #514222; }
.sidebar-user { padding-top: 24px; }
.user-chip { gap: 8px; padding: 12px 8px; border-top: 1px solid #30343a; border-radius: 0; background: none; }
.user-chip strong { font-weight: 500; }
.user-chip small { color: #a0a6af; }
.user-chip .avatar { color: #e0e3e7; background: #393e46; font-weight: 500; }
.sidebar-user:not(:empty) + .sidebar-status { margin-top: 4px; }
.sidebar-status { gap: 8px; padding: 12px 8px; border-top: 1px solid #30343a; border-radius: 0; color: #aeb3bc; background: none; font-size: 11px; }
.status-row { gap: 8px; }
.status-row strong { color: #cbd0d7; font-weight: 400; }
.dot { width: 6px; height: 6px; }
.dot.ok { box-shadow: none; background: #72b78d; }
.sidebar-signout { min-height: 36px; gap: 8px; margin-top: 4px; padding: 8px 12px; border-radius: 4px; color: #b9bdc4; font-size: 13px; }

.topbar { min-height: 64px; gap: 16px; padding: 12px 32px; background: var(--surface); backdrop-filter: none; }
.topbar-title h1 { font-size: 20px; font-weight: 500; letter-spacing: 0; line-height: 24px; }
.topbar-title p { margin-top: 0; font-size: 12px; line-height: 16px; }
.topbar-tools { gap: 12px; }
.topbar-tools .select-inline select { min-height: 32px; min-width: 144px; padding: 4px 28px 4px 12px; border-color: var(--line); font-size: 12px; }
.topbar-tools .icon-button { width: 32px; height: 32px; border-color: var(--line); }
.switch { gap: 8px; font-size: 12px; font-weight: 400; }
.switch-track { width: 28px; height: 16px; background: #8b9098; }
.switch-track::after { width: 12px; height: 12px; box-shadow: none; }
.switch input:checked + .switch-track { background: #41464f; }
.switch input:checked + .switch-track::after { transform: translateX(12px); }
.updated { font-size: 11px; }
.content { padding: 28px 32px 48px; }
.page { gap: 24px; max-width: 1520px; }
.setup-banner { gap: 8px; margin: 16px 32px 0; padding: 12px 16px; border-radius: 6px; }

/* Controls use quiet graphite; the brand accent marks context. */
input:not([type="checkbox"]), select, textarea { min-height: 36px; padding: 8px 12px; border-radius: 6px; background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.button { min-height: 36px; gap: 8px; padding: 8px 12px; border-color: #d6d8dc; border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 18px; transition: background-color 140ms var(--desk-ease), border-color 140ms var(--desk-ease), color 140ms var(--desk-ease); }
.button:hover:not(:disabled) { color: var(--navy); border-color: #aeb3bb; background: var(--surface-soft); }
.button.primary { color: #fff; border-color: #17191d; background: #17191d; }
.button.primary:hover:not(:disabled) { color: #fff; border-color: #383d45; background: #383d45; }
.button.primary-outline { color: var(--muted); border-color: #b9bdc5; background: var(--surface); }
.button.primary-outline:hover:not(:disabled) { color: var(--navy); border-color: #777e88; background: var(--surface-soft); }
.small-button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.icon-button { border-radius: 6px; }
.icon-button:hover { color: var(--navy); border-color: #adb2ba; background: var(--surface-soft); }
.link-button, .back-link { font-weight: 500; }
.back-link { gap: 4px; }
.button-row { gap: 8px; }

/* Quiet containers, open table rows and tabular figures form the ledger. */
.card { border-color: var(--line); border-radius: 8px; box-shadow: none; }
.card-header { gap: 16px; padding: 20px 24px 0; }
.card-header h2 { font-size: 15px; font-weight: 500; }
.card-header p { max-width: 78ch; margin-top: 4px; font-size: 12px; line-height: 18px; }
.card-body { padding: 20px 24px 24px; }
.card-actions { gap: 8px; }
.grid-2, .grid-3, .stack, .detail-layout, .detail-main, .detail-side, .agent-grid, .brain-layout, .brain-main, .brain-side, .assistant-layout { gap: 24px; }
.leads-card .card-body { gap: 20px; }
.table { font-size: 13px; }
.table th { padding: 12px 16px; color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 400; line-height: 18px; }
.table td { padding: 16px; border-bottom-color: #eceef0; }
.table.compact th, .table.compact td { padding: 8px 12px; }
.table tr.clickable:hover td, .table tr.clickable:focus-within td { background: var(--surface-soft); }
.leads-card .table-scroll, .members-card .table-scroll { margin-right: -24px; margin-left: -24px; }
.leads-card .table th:first-child, .leads-card .table td:first-child,
.members-card .table th:first-child, .members-card .table td:first-child { padding-left: 24px; }
.leads-card .table th:last-child, .leads-card .table td:last-child,
.members-card .table th:last-child, .members-card .table td:last-child { padding-right: 24px; }
.lead-link, .person strong { font-weight: 500; }
.person { gap: 12px; }
.person small { margin-top: 2px; font-size: 12px; }
.avatar { color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 500; }
.avatar.agent { color: var(--muted); background: var(--surface-soft); }
.avatar.hot { color: #9c3128; background: #fae8e4; }
.avatar.warm { color: #8d5a0a; background: #f8efd9; }
.avatar.cold { color: #41649b; background: var(--surface-soft); }
.avatar.ineligible { color: var(--muted); background: var(--surface-soft); }
.num, .kpi-value, .stat-strip strong, .enrollment-totals dd, .agent-stat strong,
.received-cell, .member-summary strong, .member-financial-summary dd { font-variant-numeric: tabular-nums; }
.pager { gap: 12px; padding-top: 4px; font-size: 12px; }
.pager-buttons { gap: 12px; }
.pager-buttons .button { width: 32px; min-height: 32px; }

.pill, .chip, .source-tag, .stage-badge, .quality, .author-chip, .gates li, .rank-badge { border-radius: 4px; font-weight: 500; letter-spacing: 0; }
.pill { padding: 2px 8px; font-size: 11px; line-height: 18px; }
.pill.info { color: #445d80; background: var(--surface-soft); }
.pill.success { color: var(--green); background: var(--green-soft); }
.pill.warning { color: var(--warm); background: var(--warm-soft); }
.pill.danger { color: #a82a21; background: var(--hot-soft); }
.stage-badge { gap: 4px; padding: 2px 6px; border-color: transparent; font-size: 11px; text-transform: none; }
.quality { gap: 4px; padding: 2px 4px 2px 8px; font-size: 11px; }
.quality b { font-size: 11px; font-weight: 500; background: rgba(255, 255, 255, .5); }
.source-tag { padding: 1px 6px; border-color: var(--line); font-size: 11px; }
.chip { padding: 2px 8px; font-size: 11px; }
.tab-count { min-width: 20px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.tab { gap: 8px; padding: 12px; font-size: 13px; font-weight: 500; }
.tabs { gap: 4px; }
.tab.active { border-bottom-color: var(--orange); }
.toolbar, .members-toolbar { gap: 8px; }
.filter-note, .notice, .copy-field { border-radius: 6px; }
.filter-note, .notice.info-notice { color: var(--muted); background: var(--surface-soft); }
.form-label, .field, .field > span, .enrollment-field > span { font-weight: 500; }

/* Numeric summaries read as one report, without a repeated card treatment. */
.kpi-grid { gap: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.kpi { gap: 8px; min-width: 0; padding: 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.kpi:last-child { border-right: 0; }
.kpi-label { font-size: 12px; font-weight: 400; }
.kpi-icon { display: none; }
.kpi-value { font-size: 28px; font-weight: 500; letter-spacing: 0; }
.kpi-sub { line-height: 18px; }
.kpi-more { gap: 4px; margin-top: 0; font-weight: 400; }
.kpi-link:hover { background: var(--surface-soft); transform: none; }
.delta { margin-top: 0; font-weight: 400; }
.stat-strip { gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.stat-strip > div { gap: 4px; padding: 0 16px 20px; border-left: 1px solid var(--line); border-radius: 0; background: none; }
.stat-strip > div:first-child { padding-left: 0; border-left: 0; }
.stat-strip strong { font-size: 24px; font-weight: 500; }
.stage-tiles { gap: 16px; }
.stage-tile { gap: 8px; padding: 16px; border-left-width: 2px; border-radius: 6px; }
.stage-tile strong { font-size: 28px; font-weight: 500; }
.stage-tile-top, .stage-tile-top b { font-weight: 400; }
.attention-list { gap: 0; }
.attention-item { gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.attention-item:last-child { padding-bottom: 0; border-bottom: 0; }
.attention-item:first-child { padding-top: 0; }
.attention-count { min-width: 40px; padding: 4px; border-radius: 4px; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.attention-copy { gap: 4px; }
.attention-copy b { font-weight: 500; }
.attention-item.clear { border-style: solid; }
.attention-item.clear .attention-copy b { font-weight: 400; }
.chart .grid { stroke: #eceef0; }
.chart .tick { fill: #6b7079; }
.donut-value, .score-value, .podium-points { font-weight: 500; }
.funnel-bar { background: #69717c; }
.dimension-track span { background: #69717c; }
.progress span { background: var(--orange); }
.leader-bar > span { background: #69717c; }
.leader-row { padding: 12px; border-radius: 6px; }

.lead-header-main { gap: 16px; }
.lead-title-row h2 { font-size: 24px; font-weight: 500; }
.lead-header .card-body { gap: 16px; }
.lead-header { border-left: 3px solid var(--orange); }
.detail-grid { gap: 16px 24px; }
.detail-grid dd { margin-top: 4px; font-weight: 500; }
.context-chips { gap: 8px; margin-bottom: 16px; }
.strong-chip { color: var(--muted); background: var(--surface-soft); }
.agent-card { gap: 16px; padding: 24px; border-radius: 8px; box-shadow: none; }
.agent-identity strong { font-weight: 500; }
.agent-tags { gap: 8px; }
.agent-stat { gap: 4px; padding: 12px 4px; border-radius: 0; background: var(--surface-soft); }
.agent-stat strong { font-size: 20px; font-weight: 500; }
.agent-actions { padding-top: 16px; }
.template, .mode-tile, .wa-panel { padding: 16px; border-radius: 6px; background: var(--surface); }
.mode-tile:has(input:checked) { border-color: #9d7d70; background: var(--surface-soft); box-shadow: none; }
.option-row:has(input:checked) { border-color: #9d7d70; background: var(--surface-soft); }
.option-row.risky:has(input:checked) { border-color: #be9452; background: var(--warm-soft); }
.wa-details { padding: 12px; border-radius: 6px; background: var(--surface-soft); }
.wa-panels { gap: 24px; padding-top: 24px; }

/* A conversation is a working surface: number, messages, reply. */
.transcript-card { overflow: hidden; }
.transcript-card .chat-header { align-items: center; padding: 16px 20px; border-bottom: 1px solid #edf0f1; }
.chat-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.transcript-card .chat-heading h2 { font-size: 14px; font-weight: 600; }
.transcript-card .chat-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.chat-sync { flex: 0 0 30px; width: 30px; height: 30px; border: 0; color: var(--muted); background: transparent; }
.transcript-card > .card-body { display: grid; gap: 0; padding: 0; }
.chat-conversation-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 20px; border-bottom: 1px solid #e9edef; background: var(--surface); }
.chat-conversation-bar:empty { display: none; }
.chat-number-tabs { display: flex; align-self: stretch; gap: 20px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.chat-number-tab { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 10px 0; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font: inherit; font-size: 12px; cursor: pointer; }
.chat-number-tab:hover { color: var(--text); }
.chat-number-tab.active { border-bottom-color: #277a59; color: var(--text); }
.chat-number-tab.active .chat-number-label { font-weight: 600; }
.chat-number-tab small { padding: 1px 5px; border-radius: 3px; color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 400; }
.chat-reema-switch { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 36px; margin: 0 0 0 auto; padding: 4px 0 4px 8px; border: 0; color: var(--muted); background: transparent; font: inherit; font-size: 11px; cursor: pointer; }
.chat-reema-switch[aria-checked="true"] { color: #297154; }
.chat-reema-switch:disabled { opacity: .55; cursor: wait; }
.chat-switch-track, .wa-toggle-track { position: relative; display: inline-block; flex: 0 0 28px; width: 28px; height: 16px; border-radius: 20px; background: #b7bfc4; transition: background-color 140ms ease; }
.chat-switch-track::after, .wa-toggle-track::after { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); content: ''; transition: transform 140ms ease; }
.chat-reema-switch[aria-checked="true"] .chat-switch-track, .wa-default-switch input:checked + .wa-toggle-track { background: #297a59; }
.chat-reema-switch[aria-checked="true"] .chat-switch-track::after, .wa-default-switch input:checked + .wa-toggle-track::after { transform: translateX(12px); }
.chat-role-note { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.transcript-card .chat { display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 580px; padding: 20px; border-radius: 0; background: var(--surface-soft); }
.transcript-card .chat-empty { align-items: center; justify-content: center; }
.transcript-card .chat-empty .empty-state { padding: 24px; }
.transcript-card .bubble { max-width: min(82%, 560px); padding: 9px 12px 6px; border: 1px solid #e7ecee; border-radius: 10px 10px 10px 3px; background: var(--surface); box-shadow: 0 1px 2px rgb(29 46 54 / 3%); }
.transcript-card .bubble-row.out .bubble, .transcript-card .bubble-row.out.human .bubble { border: 1px solid #dcebe2; border-radius: 10px 10px 3px 10px; background: var(--surface-soft); }
.transcript-card .bubble p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.transcript-card .bubble-author { margin-bottom: 3px; color: #537161; font-size: 10px; font-weight: 500; }
.transcript-card .bubble small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.transcript-card .bubble-tag { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 400; text-transform: none; }
.transcript-card .bubble.ai-answer, .transcript-card .bubble.template { border-style: solid; }
.transcript-card .reply-form { gap: 6px; margin: 0; padding: 12px 16px; border-top: 1px solid #e8edef; background: var(--surface); }
.reply-compose { display: flex; align-items: flex-end; gap: 10px; }
.transcript-card .reply-compose textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 140px; padding: 10px 12px; border-color: #e4e9ec; border-radius: 7px; background: var(--surface-soft); font-size: 13px; line-height: 20px; resize: vertical; }
.transcript-card .reply-compose .button { flex: 0 0 auto; min-height: 40px; padding-inline: 14px; border-color: #27694e; background: #27694e; }
.transcript-card .reply-compose .button:hover:not(:disabled) { border-color: #215a43; background: #215a43; }
.reply-note { padding-left: 2px; font-size: 10px; }
.transcript-card > .card-body > .notice { margin: 0; padding: 14px 20px; border-radius: 0; font-size: 12px; }
.chat-number-tab:focus-visible, .chat-reema-switch:focus-visible { outline: 2px solid #447b66; outline-offset: -3px; border-radius: 3px; }

/* Number setup stays separate from the daily conversation. */
.wa-page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.wa-page-heading h2 { margin: 0; font-size: 20px; }
.wa-page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.wa-page-heading > a { font-size: 12px; }
.wa-number-group { display: grid; gap: 12px; }
.wa-number-group > h3 { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.wa-number-group > .grid-2 { align-items: start; gap: 16px; }
.whatsapp-card .card-header, .wa-official-card .card-header { padding: 18px 20px 0; }
.whatsapp-card .card-body, .wa-official-card .card-body { padding: 12px 20px 20px; }
.whatsapp-card .card-body.stack { gap: 10px; }
.whatsapp-card .wa-panel-head { gap: 12px; }
.whatsapp-card .wa-panel-head strong { font-size: 14px; font-weight: 500; }
.wa-number-caption { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.whatsapp-card .wa-details { padding: 0; border-radius: 0; background: transparent; }
.whatsapp-card .wa-details > summary { padding: 10px 0; border-top: 1px solid #edf0f1; color: var(--muted); font-size: 12px; cursor: pointer; }
.whatsapp-card .wa-details[open] > summary { margin-bottom: 6px; }
.whatsapp-card .wa-details .button-row { gap: 6px; margin-block: 12px; }
.whatsapp-card .wa-details .button { min-height: 32px; padding: 6px 9px; font-size: 11px; }
.wa-official-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.wa-official-form > .button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.wa-default-switch { position: relative; display: inline-flex; align-items: center; gap: 9px; width: fit-content; min-height: 32px; color: var(--muted); font-size: 12px; cursor: pointer; }
.wa-default-switch[hidden], .wa-add-number [hidden], .wa-edit-details [hidden] { display: none; }
.wa-default-switch input { position: absolute; width: 28px; height: 20px; margin: 0; opacity: 0; }
.wa-default-switch input:focus-visible + .wa-toggle-track { outline: 2px solid #447b66; outline-offset: 3px; }
.wa-add-number { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.wa-add-number > summary { display: flex; align-items: center; gap: 8px; padding: 16px 20px; color: var(--muted); font-size: 13px; cursor: pointer; }
.wa-add-number > .stack-form { max-width: 760px; padding: 4px 20px 20px; }
@media (max-width: 760px) {
  .transcript-card .chat-header { padding: 12px 16px; }
  .chat-conversation-bar { flex-wrap: wrap; gap: 0 12px; padding-inline: 16px; }
  .chat-number-tabs { flex: 1 1 auto; gap: 16px; }
  .chat-number-tab { gap: 4px; font-size: 11px; }
  .chat-number-tab small { font-size: 9px; }
  .transcript-card .chat { min-height: 240px; padding: 16px; }
  .transcript-card .bubble { max-width: 90%; }
  .transcript-card .reply-form { padding: 10px 12px; }
  .reply-compose { gap: 8px; }
  .transcript-card .reply-compose .button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-switch-track, .chat-switch-track::after, .wa-toggle-track, .wa-toggle-track::after { transition: none; }
}
.brain-status { gap: 16px; }
.assistant-window { border-radius: 6px; background: var(--surface-soft); }
.assistant-msg { box-shadow: none; }
.assistant-msg.user { background: #30343b; }
.suggestion-chip { border-radius: 6px; font-weight: 400; }
.dialog { border: 1px solid #e1e3e6; border-radius: 12px; box-shadow: 0 24px 80px rgba(18, 22, 28, .2); }
.dialog::backdrop { background: rgba(18, 22, 28, .5); backdrop-filter: none; }
.dialog-form { gap: 16px; padding: 24px; }
.dialog-header h2 { font-weight: 500; }
.toast { border-radius: 6px; background: #24282f; box-shadow: 0 8px 24px rgba(18, 22, 28, .16); }
.empty { gap: 8px; padding: 40px 24px; }
.empty strong { font-weight: 500; }
.empty-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--surface-soft); }

/* Purchase, payment and the five-item setup stay together as working records. */
.enrollment-card { scroll-margin-top: 88px; }
.enrollment-totals { padding: 16px 0; }
.enrollment-totals dd { margin-top: 4px; font-weight: 500; }
.enrollment-stages { gap: 8px; }
.enrollment-stages li { padding: 4px 8px; border-radius: 4px; }
.enrollment-stages li.current { font-weight: 500; }
.simple-enrollment > .card-body { gap: 16px; }
.simple-enrollment .enrollment-totals { padding: 16px 0; }
.simple-setup-row { gap: 16px; padding: 12px 0; border-bottom: 1px solid #eceef0; }
.simple-setup-row:last-child { border-bottom: 0; }
.simple-checklist-row { gap: 8px 16px; }
.enrollment-payment-list { gap: 8px; }
.enrollment-payment-list > li { gap: 8px; padding: 12px 16px; background: var(--surface-soft); }

/* Members: a directory first, with website administration in its disclosure. */
.members-directory { gap: 24px; }
.members-card > .card-header { padding-top: 24px; }
.members-card > .card-body { display: grid; gap: 20px; }
.members-card .card-body > .table-scroll { margin-top: 0; }
.member-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0 0 24px; border-bottom: 1px solid var(--line); }
.member-summary > div { display: grid; align-content: start; gap: 8px; padding: 0 24px; border-left: 1px solid var(--line); }
.member-summary > div:first-child { padding-left: 0; border-left: 0; }
.member-summary strong { color: var(--navy); font-size: 28px; font-weight: 500; line-height: 32px; }
.member-summary span, .member-summary dt { color: var(--muted); font-size: 12px; }
.member-summary small { color: var(--muted); font-size: 12px; }
.members-toolbar { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(120px, 1fr)); }
.members-toolbar > * { min-width: 0; }
.members-toolbar select { font-size: 12px; }
.members-table td:first-child { min-width: 216px; }
.members-directory-row .lead-link { display: inline-block; max-width: 280px; font-size: 14px; }
.member-source { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 11px; line-height: 16px; }
.members-directory .plan-mix { gap: 8px; margin: 0 0 20px; }
.members-directory .integration-steps { gap: 12px; }
.members-tools { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.members-tools > summary { padding: 16px 24px; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.members-tools[open] > summary { border-bottom: 1px solid var(--line); }
.members-import-tools { display: flex; flex-wrap: wrap; align-items: start; gap: 12px; padding: 24px 24px 0; }
.members-import-tools .import-result { flex-basis: 100%; margin-top: 0; }
.members-website-totals { display: grid; gap: 12px; padding: 16px 24px 0; }
.members-website-totals .plan-mix { margin: 0; }
.members-tools > .grid-2 { padding: 24px; }
.members-tools > .grid-2 .card { border: 0; }
.members-tools > .grid-2 .card-header { padding: 0; }
.members-tools > .grid-2 .card-body { padding: 16px 0 0; }

/* A managed-client file: identity, plan/payment ledger, business and accounts. */
.member-detail { display: grid; gap: 24px; min-width: 0; }
.member-back-link { display: inline-flex; width: max-content; color: var(--muted); font-size: 13px; font-weight: 500; }
.member-profile-header { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; padding: 28px 32px; border: 1px solid var(--line); border-left: 3px solid var(--orange); border-radius: 8px; background: var(--surface); }
.member-profile-heading { display: flex; align-items: center; flex: 1 1 400px; gap: 16px; min-width: 0; }
.member-profile-heading > .avatar { width: 56px; height: 56px; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 18px; }
.member-profile-heading > div { display: grid; gap: 6px; min-width: 0; }
.member-profile-heading h1, .member-profile-heading h2 { font-size: 28px; font-weight: 500; line-height: 36px; overflow-wrap: anywhere; }
.member-profile-heading p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.member-profile-heading .button-row { gap: 8px; }
.member-profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.member-context-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.member-context-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--muted); font-size: 13px; }
.member-context-nav a:hover { color: var(--navy); text-decoration: none; box-shadow: inset 0 -2px var(--orange); }
.member-profile-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); align-items: start; gap: 24px; }
.member-profile-section { display: grid; gap: 20px; min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); scroll-margin-top: 88px; }
.member-profile-section > h2 { margin-bottom: 0; font-size: 18px; }
.member-profile-section > h3 { margin-bottom: 0; font-size: 15px; }
.member-profile-section > p { max-width: 78ch; font-size: 13px; }
.member-profile-section > h2 + p { margin-top: -12px; }
.member-profile-grid > div { display: grid; gap: 20px; min-width: 0; }
.member-profile-grid > div > h3 { font-size: 14px; }
.member-profile-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.member-profile-section .card-header { padding: 20px 24px 0; }
.member-profile-section .card-body { display: grid; gap: 20px; }
.member-profile-section .card-body > p { max-width: 78ch; }
.member-info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin: 0; }
.member-info-list > div { min-width: 0; }
.member-info-list dt { color: var(--muted); font-size: 12px; line-height: 20px; }
.member-info-list dd { margin: 4px 0 0; color: var(--text); font-size: 14px; font-weight: 400; line-height: 22px; overflow-wrap: anywhere; white-space: pre-wrap; }
.member-info-list dd a { text-decoration: underline; text-decoration-color: #b7bbc1; text-underline-offset: 3px; }
.member-info-list .wide, .member-info-list .member-info-wide { grid-column: 1 / -1; }
.member-financial-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; padding: 20px 0; border-block: 1px solid var(--line); }
.member-financial-summary > div { min-width: 0; padding: 0 12px; border-left: 1px solid var(--line); }
.member-financial-summary > div:first-child { padding-left: 0; border-left: 0; }
.member-financial-summary dt, .member-financial-summary span { color: var(--muted); font-size: 12px; }
.member-financial-summary dd, .member-financial-summary strong { display: block; margin: 8px 0 0; color: var(--navy); font-size: 20px; font-weight: 500; line-height: 28px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.member-financial-summary .outstanding dd, .member-financial-summary > div:last-child strong { color: var(--orange-3); }
.member-edit-details { padding-top: 16px; border-top: 1px solid var(--line); min-width: 0; }
.member-edit-details > summary { width: max-content; max-width: 100%; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.member-edit-details[open] > summary { margin-bottom: 16px; }
.member-edit-form { display: grid; gap: 16px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.member-edit-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.member-edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.member-edit-wide { grid-column: 1 / -1; }
.member-edit-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.member-form-status { color: var(--muted); }
.member-form-status:empty { display: none; }
.member-edit-form label { display: grid; align-content: start; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.member-edit-form label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; }
.member-edit-checkbox input { order: -1; }
.member-edit-form input, .member-edit-form select, .member-edit-form textarea { min-width: 0; color: var(--text); font-size: 13px; font-weight: 400; }
.member-edit-form > .button { justify-self: start; }
.member-edit-form .button-row { align-items: center; }
.member-account-list { display: grid; gap: 0; }
.member-account-card { display: grid; gap: 16px; min-width: 0; padding: 24px 0; border-bottom: 1px solid var(--line); }
.member-account-card:first-child { padding-top: 0; }
.member-account-card:last-child { padding-bottom: 0; border-bottom: 0; }
.member-account-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.member-account-header > div { display: grid; gap: 4px; min-width: 0; }
.member-account-header h3, .member-account-header strong { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.member-account-header p { color: var(--muted); font-size: 12px; }
.member-account-meta { display: grid; gap: 16px; margin: 0; }
.member-account-meta > .member-info-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.member-account-meta > a { justify-self: start; font-size: 13px; text-decoration: underline; text-decoration-color: #b7bbc1; text-underline-offset: 3px; }
.member-account-meta dt { color: var(--muted); font-size: 12px; }
.member-account-meta dd { margin: 4px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.member-account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.member-account-card .member-edit-details { margin-top: 0; }
.member-account-empty { padding: 16px 0; color: var(--muted); }
.member-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; padding: 12px 16px; border: 1px solid #ccd5df; border-radius: 6px; color: var(--navy); background: var(--surface-soft); }
.member-secret code { padding: 0; color: var(--text); background: none; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
.member-secret small { color: var(--muted); font-size: 12px; }
.member-vault-notice { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 12px 16px; border: 1px solid #e6d4b3; border-radius: 6px; color: #7b561e; background: var(--surface-soft); font-size: 12px; line-height: 20px; }
.member-vault-notice svg { flex: 0 0 auto; margin-top: 2px; }

/* Incoming-message notifications deliberately remain loud and unmistakably red. */
.nav-badge.whatsapp-badge, .pill.message-count { color: #fff; background: #b42318; font-weight: 700; }
.nav-badge.whatsapp-badge { box-shadow: 0 0 0 2px #fff; }
.message-alerts { border-color: #e7aaa1; border-left: 5px solid #b42318; border-radius: 8px; background: var(--surface-soft); }
.message-alert-count { color: #b42318; }
.leads-table tr.has-unread { background: var(--surface-soft); }
.leads-table tr.has-unread > td:first-child { box-shadow: inset 4px 0 0 #b42318; }
.leads-table tr.has-unread.clickable:hover td, .leads-table tr.has-unread.clickable:focus-within td { background: #ffe4de; }

/* Login is a working doorway, with the existing MechanicBazaar identity. */
.login-brand { padding: 48px 56px; background: #16191d; }
.login-pitch h1 { margin: 16px 0 32px; font-size: 32px; font-weight: 500; line-height: 1.3; letter-spacing: 0; }
.login-steps { gap: 16px; font-size: 14px; }
.login-steps li { gap: 12px; }
.login-steps span { color: #d7a58e; background: #352a25; font-size: 12px; font-weight: 500; }
.login-foot { color: #a0a6af; }
.login-card { gap: 12px; padding: 32px; border-radius: 8px; box-shadow: none; }
.login-card h2 { font-size: 24px; font-weight: 500; }
.login-card label { font-weight: 500; }
.login-mark { border-radius: 8px; }

@media (max-width: 1360px) {
  .kpi:nth-child(3) { border-right: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .kpi-grid.compact .kpi:nth-child(3) { border-right: 1px solid var(--line); }
  .kpi-grid.compact .kpi:nth-child(n+4) { border-top: 0; }
  .members-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .members-toolbar .search-field { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .member-profile-grid { grid-template-columns: minmax(0, 1fr); }
  .member-financial-summary dd, .member-financial-summary strong { font-size: 24px; }
}
@media (max-width: 1024px) {
  .sidebar { width: 256px; }
  .topbar { padding-inline: 24px; }
  .content { padding-inline: 24px; }
  .setup-banner { margin-inline: 24px; }
  .kpi-grid.compact .kpi:nth-child(2n) { border-right: 0; }
  .kpi-grid.compact .kpi:nth-child(3) { border-right: 1px solid var(--line); }
  .kpi-grid.compact .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .member-profile-header { padding: 24px; }
}
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 12px 16px; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-tools { gap: 12px; }
  .topbar-tools .select-inline select { min-width: 0; }
  .content { padding: 20px 16px 32px; }
  .page, .stack, .grid-2, .grid-3, .detail-layout, .detail-main, .detail-side, .agent-grid { gap: 16px; }
  .setup-banner { margin-inline: 16px; }
  .card-header { padding: 16px 16px 0; }
  .card-body { padding: 16px; }
  .card-header p { line-height: 18px; }
  .leads-card .table-scroll, .members-card .table-scroll { margin-inline: -16px; }
  .leads-card .table th:first-child, .leads-card .table td:first-child,
  .members-card .table th:first-child, .members-card .table td:first-child { padding-left: 16px; }
  .leads-card .table th:last-child, .leads-card .table td:last-child,
  .members-card .table th:last-child, .members-card .table td:last-child { padding-right: 16px; }
  .leads-table tr { gap: 8px 12px; padding: 16px; }
  .leads-table td, .leads-card .leads-table td:first-child, .leads-card .leads-table td:last-child { padding: 0; }
  .kpi-grid, .kpi-grid.compact { gap: 0; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 26px; }
  .kpi:nth-child(3) { border-right: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat-strip { gap: 16px 0; }
  .stat-strip > div { padding: 0 12px 16px; }
  .stat-strip > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .agent-card { padding: 20px; }
  .member-summary { gap: 16px; padding-bottom: 20px; }
  .member-summary > div { gap: 4px; padding: 0 0 0 16px; }
  .member-summary strong { font-size: 24px; line-height: 28px; }
  .members-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .members-toolbar .search-field { grid-column: 1 / -1; }
  .members-toolbar .button { grid-column: 1 / -1; justify-self: start; }
  .members-tools > summary { padding: 16px; }
  .members-tools > .grid-2 { padding: 20px 16px; }
  .members-import-tools { padding: 20px 16px 0; }
  .members-website-totals { padding-inline: 16px; }
  .member-profile-header { gap: 20px; padding: 20px; }
  .member-profile-heading { flex-basis: 100%; gap: 12px; }
  .member-profile-heading > .avatar { width: 44px; height: 44px; font-size: 15px; }
  .member-profile-heading h1, .member-profile-heading h2 { font-size: 24px; line-height: 30px; }
  .member-context-nav { gap: 4px 20px; }
  .member-profile-section .card-header { padding: 16px 16px 0; }
  .member-profile-section { gap: 16px; padding: 20px; }
  .member-profile-section .card-body { gap: 16px; }
  .member-financial-summary { padding: 16px 0; }
  .member-financial-summary > div { padding-inline: 12px; }
  .member-financial-summary dd, .member-financial-summary strong { font-size: 20px; line-height: 28px; }
  .member-edit-form { padding: 16px; }
  .member-account-card { padding-block: 20px; }
  .login-brand { gap: 32px; padding: 32px 24px; }
  .login-pitch h1 { font-size: 26px; }
}
@media (max-width: 480px) {
  .topbar-tools .switch-label { max-width: 72px; line-height: 16px; }
  .topbar-tools .switch { gap: 6px; }
  .member-info-list, .member-account-meta, .member-account-meta > .member-info-list, .member-edit-fields { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .member-profile-actions { width: 100%; }
  .member-financial-summary { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .member-financial-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0; border: 0; }
  .member-financial-summary dd, .member-financial-summary strong { margin: 0; }
  .member-summary { gap: 12px; }
  .member-summary > div { padding-left: 12px; }
  .member-summary strong { font-size: 22px; }
  .member-summary span { font-size: 11px; }
  .member-context-nav { gap: 4px 16px; }
  .member-context-nav a { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .button, .nav-link, .icon-button { transition-duration: .01ms; }
}
