/* Cosmo Pools Leads & Sales Portal - brand: navy #0C2B4E, aqua #13C0D2, warm cream page. Charts use mid blue #0E4E78. */
:root {
  --brand-black: #0c2b4e;      /* navy: sidebar, primary dark */
  --brand-black-2: #0a2240;
  --brand-yellow: #13c0d2;     /* aqua accent */
  --brand-yellow-hover: #3dcfdd;
  --on-accent: #053238;        /* text on aqua */
  --gold: #0e4e78;             /* chart hue */
  --gold-wash: rgba(14, 78, 120, 0.10);
  --peak: #00707e;
  --award: #c9a24b;

  --page: #fbf8f1;
  --surface: #ffffff;
  --surface-2: #f6f2e9;
  --ink: #0d1b2a;
  --ink-2: #4a5568;
  --muted: #5f6b78;
  --line: #efe8d9;
  --grid: #e6e1d6;
  --axis: #c9c2b2;
  --ring: #efe8d9;

  --good: #1f9d55;
  --good-text: #17703a;
  --warning: #e0a526;
  --critical: #b4531f;
  --critical-text: #b4531f;
  --critical-wash: #fbe9e1;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(12, 43, 78, 0.04), 0 6px 18px rgba(12, 43, 78, 0.05);
  --font: "Mulish", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Plus Jakarta Sans", "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--page); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .kpi .value { font-family: var(--font-head); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }

/* ---------------------------------------------------------------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 9px 18px; font-weight: 700; font-size: 15px; transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; text-decoration: none; }
.btn-primary { background: var(--brand-yellow); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--brand-yellow-hover); }
.btn-dark { background: var(--brand-black); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #143d69; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--axis); background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: #f0cdbd; color: var(--critical-text); }
.btn-danger:hover:not(:disabled) { background: var(--critical-wash); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }

.field { display: grid; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 14px; color: var(--muted); }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 70px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-yellow); box-shadow: 0 0 0 3px rgba(19, 192, 210, .18); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14.5px; }
.check input { accent-color: var(--brand-black); width: 18px; height: 18px; flex: none; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }

/* ---------------------------------------------------------------- logo */
.logo-tile { background: #fff; border-radius: 14px; padding: 8px 12px; display: inline-flex; align-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.logo-tile img { display: block; }
.logo-tile .logo-full { width: 128px; height: auto; }
.logo-tile .logo-mark { display: none; width: 30px; height: 30px; }
.logo-tile-lg { align-self: flex-start; }
.logo-tile-lg img { width: 210px; height: auto; }
.award { display: inline-block; margin-top: 22px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--award); border: 1px solid var(--award); border-radius: 999px; padding: 4px 12px; }

/* ---------------------------------------------------------------- login */
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero { background: var(--brand-black); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; position: relative; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 440px; height: 440px; border: 60px solid var(--brand-yellow); border-radius: 50%; opacity: .09; }
.login-hero h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; font-weight: 800; letter-spacing: -.01em; }
.login-hero h1 em { color: var(--brand-yellow); font-style: normal; }
.login-hero p { color: #c7d3e0; max-width: 480px; font-size: 16px; margin: 0; }
.login-points { display: grid; gap: 10px; margin-top: 26px; padding: 0; list-style: none; }
.login-points li { display: flex; gap: 10px; align-items: center; color: #e3ebf3; }
.login-points li::before { content: ""; width: 9px; height: 9px; background: var(--brand-yellow); border-radius: 3px; flex: none; }
.login-hero small { color: #93a6bb; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--page); }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; }
.env-badge { display: inline-block; margin-bottom: 14px; padding: 4px 10px; border-radius: 999px; background: var(--brand-yellow); color: #1b2733; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.env-badge[hidden] { display: none; }
.login-card > p { margin: 0 0 24px; color: var(--ink-2); }
.login-form { display: grid; gap: 16px; }
.login-form .btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.demo-notice { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.form-error { background: var(--critical-wash); color: var(--critical-text); border: 1px solid #f0cdbd; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.demo-accounts { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.demo-accounts h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; font-family: var(--font); }
.demo-account { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.demo-account:hover { border-color: var(--brand-yellow); }
.demo-account strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; margin-bottom: 2px; }
.demo-account > div > span { display: block; font-size: 14px; color: var(--ink-2); }
.demo-account .role { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-black); background: #e3f7f9; padding: 3px 9px; border-radius: 99px; white-space: nowrap; flex: none; }
.demo-note { font-size: 14px; color: var(--muted); margin-top: 12px; }
.demo-note a { color: var(--ink); font-weight: 700; }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand-black); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 22px 14px 16px; }
.sidebar .brand { display: flex; flex-direction: column; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid #1d4069; margin-bottom: 14px; align-items: flex-start; }
.sidebar .brand span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #93a6bb; }
.nav { display: grid; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: #c7d3e0; font-weight: 600; text-align: left; position: relative; }
.nav button svg { width: 18px; height: 18px; flex: none; stroke: currentColor; }
.nav button:hover { background: #143d69; color: #fff; }
.nav button[aria-current="page"] { background: #17436f; color: #fff; }
.nav button[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-yellow); }
.nav .badge { margin-left: auto; background: var(--brand-yellow); color: var(--on-accent); font-size: 12px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #1d4069; padding: 14px 8px 0; display: grid; gap: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-yellow); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.user-chip strong { display: block; font-size: 14px; }
.user-chip span { font-size: 14px; color: #a9b9ca; }
.sidebar-foot .btn { width: 100%; background: #143d69; color: #e3ebf3; border-color: #1d4069; }
.sidebar-foot .btn:hover { background: #1b4a7c; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 32px 18px; background: var(--page); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); background: rgba(251, 248, 241, .94); backdrop-filter: blur(8px); }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; color: var(--brand-black); }
.topbar p { margin: 2px 0 0; color: var(--ink-2); font-size: 14.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.view-as { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.view-as .select { width: auto; padding-top: 6px; padding-bottom: 6px; font-weight: 600; color: var(--ink); }
.demo-pill { font-size: 13px; font-weight: 700; color: var(--on-accent); background: #e3f7f9; border: 1px solid #b6eaf0; border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--brand-black); color: #fff; }
.content { padding: 4px 32px 40px; display: grid; gap: 20px; transition: opacity .2s; }
.content.loading { opacity: .55; pointer-events: none; }
#content:focus { outline: none; } /* a programmatic focus target only, when the opener is gone */

/* ---------------------------------------------------------------- cards */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--ring); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 4px; }
/* The title and its line keep a readable width; a pill or button beside them drops below on a phone. */
.card-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.card-head h2 { margin: 0; font-size: 17px; color: var(--brand-black); }
.card-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.card-body { padding: 12px 20px 20px; }
.card-body.flush { padding: 8px 0 4px; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.view-toggle button { border: 0; background: var(--surface); font-size: 14px; padding: 6px 13px; color: var(--ink-2); }
.view-toggle button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.chart-box { position: relative; width: 100%; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.six .value { font-size: 23px; }
.card.fill { display: flex; flex-direction: column; }
.card.fill .card-body { flex: 1; display: flex; flex-direction: column; }
.card.fill .chart-box { flex: 1; }
.show-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }
.kpi { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi .label { font-size: 14px; color: var(--ink-2); }
.kpi .value { font-size: 27px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; color: var(--brand-black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .delta { display: block; font-size: 14px; margin-top: 4px; color: var(--muted); }
.delta.up { color: var(--good-text); }
.delta.down { color: var(--critical-text); }
.kpi.alert { border-color: #f0cdbd; background: #fffaf7; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; font-size: 13.5px; font-weight: 700; color: var(--ink-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.data td { padding: 10px 14px; border-bottom: 1px solid #f3eee3; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .r { text-align: right; }
table.data td.r, table.data td.num, table.data td.nowrap { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: #fcfaf5; }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
/* Team: seven columns in a half-width card; the labels wrap so it fits without scrolling at 1440. */
table.data.team th.r { white-space: normal; vertical-align: bottom; }
table.data.team th:not(:first-child):not(:last-child), table.data.team td:not(:first-child):not(:last-child) { padding-left: 10px; padding-right: 10px; }
.cell-main { font-weight: 700; }
.cell-sub { font-size: 14px; color: var(--muted); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.st-New { background: #e3f7f9; border-color: #b6eaf0; color: #05616b; }
.st-Contacted, .st-VisitBooked, .st-VisitDone, .st-QuotationSent { background: #e7eff7; border-color: #c8d9ea; color: #0e4e78; }
.st-Signed { background: #e5f4ea; border-color: #bfe3cb; color: var(--good-text); }
.st-DepositPaid, .st-Scheduled { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.st-Won { background: #e5f4ea; border-color: #bfe3cb; color: var(--good-text); }
.st-Lost { background: #eeeeec; border-color: #deded9; color: #6b6b66; }
.q-PendingApproval, .warn { background: var(--critical-wash); border-color: #f0cdbd; color: var(--critical-text); }
.q-Sent { background: #e7eff7; border-color: #c8d9ea; color: #0e4e78; }
.q-Accepted { background: #e5f4ea; border-color: #bfe3cb; color: var(--good-text); }
.q-Superseded, .q-Declined { background: #eeeeec; border-color: #deded9; color: #6b6b66; }
.tag { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.ok-text { color: var(--good-text); font-weight: 700; }
.bad-text { color: var(--critical-text); font-weight: 700; }

/* alert lists */
.alert-list { list-style: none; margin: 0; padding: 0 20px 12px; }
.alert-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3eee3; }
.alert-list li.clickable { cursor: pointer; }
.alert-list li.clickable:hover .cell-main { text-decoration: underline; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .meta { font-size: 14px; color: var(--muted); }
.alert-count { font-size: 13px; font-weight: 800; border-radius: 99px; padding: 2px 9px; background: var(--critical-wash); color: var(--critical-text); }
.alert-count.zero { background: var(--surface-2); color: var(--muted); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .select, .filters .input { width: auto; min-width: 150px; padding-top: 8px; padding-bottom: 8px; }
.filters .input { min-width: 220px; }
.filters .count { margin-left: auto; color: var(--ink-2); font-size: 14px; }

/* leads toolbar: search, step, owner, Filters, the layout and New lead on one row (desktop) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px 10px; }
.toolbar .input, .toolbar .select { width: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.toolbar .tb-search { flex: 1 1 200px; min-width: 180px; max-width: 380px; }
.toolbar .select { flex: 0 1 auto; min-width: 0; max-width: 200px; }
.toolbar .btn-sm { min-height: 42px; }
.toolbar .view-toggle { margin-left: auto; }
.toolbar .view-toggle button { min-height: 40px; padding: 6px 15px; font-weight: 700; }
.tb-filters[aria-expanded="true"] { background: var(--surface-2); border-color: var(--axis); }
.f-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--brand-black); color: #fff; font-size: 12.5px; font-weight: 800; display: inline-grid; place-items: center; }
.tb-count { margin: 0 20px 10px; font-size: 14px; color: var(--ink-2); }
.filter-panel { margin: 0 20px 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: grid; gap: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.filter-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* pipeline board: a strip of the steps over columns that scroll sideways inside the card */
.board-nav { display: flex; align-items: center; gap: 8px; padding: 0 20px 10px; }
.steps-strip { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 4px; }
.steps-strip { align-items: stretch; }
.steps-strip button { width: 100%; height: 100%; min-height: 42px; display: grid; align-content: start; gap: 1px; padding: 6px 10px 7px; border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; font-weight: 700; color: var(--ink-2); text-align: left; }
.steps-strip button:hover { border-color: var(--axis); }
.steps-strip button.in-view { border-top-color: var(--brand-yellow); background: #f2fbfc; color: var(--brand-black); }
.ss-label { min-width: 0; line-height: 1.2; font-size: 13px; }
.ss-count { order: -1; font-size: 16px; line-height: 1.25; font-weight: 800; color: var(--brand-black); }
@media (max-width: 1180px) { .steps-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .toolbar .tb-search { flex-basis: 100%; max-width: none; } .toolbar .select { flex: 1 1 150px; max-width: 220px; } }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(252px, 1fr); gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 20px 14px; scroll-snap-type: x proximity; scroll-padding: 0 20px; scrollbar-width: auto; scrollbar-color: #b9b2a2 var(--surface-2); }
.board:focus-visible { outline-offset: -2px; border-radius: 14px; }
.board-col { scroll-snap-align: start; background: var(--surface-2); border-radius: 14px; padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 2px 4px 0; }
.col-head h3 { margin: 0; font-size: 15px; color: var(--brand-black); }
.col-count { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.col-value { margin: -4px 4px 2px; font-size: 14px; color: var(--muted); }
.col-cards { display: grid; gap: 8px; }
.col-empty { margin: 2px 4px; font-size: 14px; color: var(--muted); }
.col-more { display: block; padding: 9px 6px; text-align: center; font-size: 14px; font-weight: 700; color: var(--brand-black); text-underline-offset: 3px; }
.lead-card { display: grid; gap: 4px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.lead-card:hover { border-color: var(--brand-yellow); box-shadow: 0 2px 10px rgba(12, 43, 78, .07); }
.lead-card.overdue { border-color: #f0cdbd; background: #fffaf7; }
.lc-name { font-weight: 800; font-size: 15px; line-height: 1.3; color: var(--brand-black); overflow-wrap: anywhere; }
.lc-value { font-weight: 800; font-size: 15px; white-space: nowrap; }
.lc-product { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-band { display: flex; }
.lc-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); }
.lc-where { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-age { flex: none; }
.lc-flags { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.flag.flag-bad { color: var(--critical-text); }
.flag.flag-bad::before { background: var(--critical); }
.flag.flag-warn::before { background: var(--warning); }
.flag.flag-good { color: var(--good-text); }
.flag.flag-good::before { background: var(--good); }
/* phone: one step at a time, picked by name */
.stage-picker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; align-items: center; padding: 0 16px 10px; }
.board.board-one { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); overflow: visible; padding: 4px 16px 16px; scroll-snap-type: none; }

/* crew calendar */
.calendar { overflow-x: auto; padding: 4px 20px 18px; }
.calendar table { border-collapse: separate; border-spacing: 6px; min-width: 980px; width: 100%; }
.calendar th { font-size: 14px; color: var(--ink-2); font-weight: 700; text-align: left; white-space: nowrap; }
.calendar th.now { color: var(--peak); }
.calendar td { vertical-align: top; }
.calendar .crew { font-weight: 800; font-size: 14.5px; white-space: nowrap; color: var(--brand-black); }
.calendar .crew span { display: block; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.slot { display: block; border-radius: 10px; padding: 8px 10px; font-size: 14px; min-height: 56px; }
button.slot { width: 100%; text-align: left; font: inherit; font-size: 14px; color: var(--ink); }
.slot.booked { background: #e7eff7; border: 1px solid #c8d9ea; cursor: pointer; }
.slot.booked:hover { border-color: var(--gold); }
.slot .slot-job { display: block; color: var(--ink-2); }
.slot.booked.past { background: #f1f1ee; border-color: #e3e3dd; color: var(--ink-2); }
.slot.free { border: 1px dashed var(--axis); color: var(--muted); }
.slot.busy { background: #f1f1ee; border: 1px solid #e3e3dd; color: var(--ink-2); }
.slot strong { display: block; font-size: 14px; }

/* overlays, forms and shared record parts */
.scrim { position: fixed; inset: 0; background: rgba(5, 22, 40, .42); z-index: 40; animation: fade .15s; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv dd .pill { white-space: normal; }
.section-label { font-size: 15px; line-height: 1.3; color: var(--brand-black); font-weight: 800; margin: 0 0 10px; font-family: var(--font); }
.note-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.note-box .who { font-size: 14px; color: var(--muted); margin-top: 4px; }
.shared { font-size: 12px; font-weight: 800; color: var(--peak); text-transform: uppercase; letter-spacing: .05em; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; position: relative; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); margin-top: 5px; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); }
.timeline li.k-sales::before { background: var(--brand-yellow); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 4.5px; top: 18px; bottom: -12px; width: 1px; background: var(--line); }
.timeline .when { font-size: 14px; color: var(--muted); }
.totals { display: grid; gap: 6px; font-size: 14.5px; margin-top: 10px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { font-weight: 800; font-size: 16px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.quote-block { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.quote-block + .quote-block { margin-top: 10px; }
.quote-block.old { opacity: .7; }
.quote-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.q-Signed { background: #fff4d6; border-color: #f0dca0; color: #7a5300; }
.link-box { margin-top: 10px; border-radius: 12px; padding: 10px 12px; background: var(--surface-2); font-size: 14.5px; display: grid; gap: 6px; }
.link-box.ok { background: #eaf6ee; color: var(--good-text); }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The quotation's contract on the Quotations tab (W8): status, what the client did, the record of it. */
.ct-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ct-box .kv, .ct-record .kv { margin: 2px 0; }
.ct-record { margin-top: 10px; display: grid; gap: 6px; font-size: 14.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.ct-trail summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.ct-trail ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.ct-trail li { overflow-wrap: anywhere; }
.ct-trail li .cell-sub { display: block; }
.send-ways { gap: 8px; }
.send-way { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; min-height: 56px; }
.send-way input { margin: 2px 0 0; width: 20px; height: 20px; flex: none; accent-color: var(--brand-black); }
.send-way > span { display: grid; gap: 2px; min-width: 0; }
.send-way:has(input:checked) { border-color: var(--brand-black); box-shadow: 0 0 0 1px var(--brand-black); }
.l-short { display: none; }
#visit-box { display: grid; gap: 18px; }
#visit-box .kv + .link-actions { margin-top: 12px; }
.record-notice { overflow-wrap: anywhere; }
.banner { border-radius: 12px; padding: 10px 12px; font-size: 14.5px; background: #e3f7f9; color: var(--on-accent); }
.banner.warn { background: var(--critical-wash); color: var(--critical-text); }
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 42; padding: 16px; overflow-y: auto; }
.modal-card { background: var(--surface); border-radius: var(--radius); width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); animation: pop .15s ease-out; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-card header { padding: 20px 22px 4px; }
.modal-card header h2 { margin: 0; font-size: 18px; color: var(--brand-black); }
.modal-card header p { margin: 4px 0 0; color: var(--ink-2); font-size: 14.5px; }
.modal-card .body { padding: 14px 22px; display: grid; gap: 14px; overflow-y: auto; }
.modal-card footer { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-error { background: var(--critical-wash); color: var(--critical-text); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

/* reports */
.report-types { display: grid; gap: 10px; }
.report-type { display: flex; gap: 14px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.report-type:hover { border-color: var(--axis); }
.report-type input { margin-top: 3px; accent-color: var(--brand-black); }
.report-type:has(input:checked) { border-color: var(--brand-black); background: #f7fbfc; }
.report-type.locked { cursor: not-allowed; opacity: .6; }
.report-type strong { display: block; }
.report-type span { font-size: 14px; color: var(--ink-2); }
.report-form { display: grid; gap: 18px; }
.report-form .row { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.recipient { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.recipient svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.success-box { display: flex; gap: 14px; align-items: center; justify-content: space-between; background: #eaf6ee; border: 1px solid #c4e6cf; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; flex-wrap: wrap; }
.success-box.failed { background: var(--critical-wash); border-color: #f0cdbd; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.flow li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; counter-increment: step; font-size: 14.5px; }
.flow li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-black); color: var(--brand-yellow); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.flow strong { display: block; }
.flow span { color: var(--ink-2); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin-top: 16px; font-size: 14.5px; }
.on-badge { font-size: 13px; font-weight: 800; color: var(--good-text); background: #e5f4ea; border-radius: 99px; padding: 3px 10px; }

/* toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 60; pointer-events: none; display: grid; gap: 10px; width: min(400px, calc(100vw - 36px)); }
.toast { background: var(--brand-black); color: #fff; border-radius: 14px; padding: 12px 14px 12px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; gap: 12px; align-items: flex-start; animation: pop .2s ease-out; border-left: 4px solid var(--brand-yellow); font-size: 14.5px; pointer-events: none; }
.toast.error { border-left-color: #e8794a; }
.toast.success { border-left-color: #3ccf7a; }
.toast strong { display: block; margin-bottom: 2px; }
.toast span { color: #c7d3e0; }
.toast button { margin-left: auto; background: none; border: 0; color: #a9b9ca; font-size: 20px; line-height: 1; padding: 2px 6px; pointer-events: auto; }

.twin-table { max-height: 300px; overflow: auto; }

/* ---------------------------------------------------------------- QA round (14 Nov 2026) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.kpi-note { margin: -8px 0 0; font-size: 14px; color: var(--ink-2); }
.kpi .basis { font-size: 14px; color: var(--muted); margin-top: 2px; }
.lead-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brand-black); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.lead-link:hover, .lead-link:focus-visible { text-decoration-color: currentColor; }
.card-foot { display: flex; justify-content: center; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
table.data tr.muted-row td { color: var(--ink-2); }
table.data tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; background: var(--surface-2); padding-top: 11px; padding-bottom: 11px; }
.stale { opacity: .5; pointer-events: none; transition: opacity .15s; }
.more-btn { border: 0; background: none; color: var(--brand-black); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.notice-slot:empty { display: none; }
.record-notice { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border-radius: 12px; padding: 10px 8px 10px 14px; font-size: 14.5px; background: #e3f7f9; color: var(--on-accent); border: 1px solid #b6eaf0; }
.record-notice.success { background: #eaf6ee; border-color: #c4e6cf; color: var(--good-text); }
.record-notice.error { background: var(--critical-wash); border-color: #f0cdbd; color: var(--critical-text); }
.record-notice span { color: var(--ink); }
.record-notice:focus { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }
.notice-x { background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; min-width: 36px; min-height: 36px; border-radius: 8px; flex: none; }
.notice-x:hover { background: rgba(0, 0, 0, .05); }
.field-error { font-size: 14px; font-weight: 700; color: var(--critical-text); }
.input[aria-invalid="true"] { border-color: var(--critical); box-shadow: 0 0 0 3px rgba(180, 83, 31, .14); }
.confirm-card { width: min(420px, 100%); }
.demo-password { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.demo-password code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14.5px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.demo-account .use { font-size: 13px; font-weight: 700; color: var(--brand-black); white-space: nowrap; flex: none; }
.week-list { display: none; }
.week-list .week { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.week-list .week.now { border-color: var(--brand-yellow); }
.week-list h3 { margin: 0 0 10px; font-size: 16px; color: var(--brand-black); }
.week-list .week.now h3 { color: var(--peak); }
.week-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.week-list li { display: grid; grid-template-columns: minmax(84px, 30%) 1fr; gap: 10px; align-items: start; }
.week-list .crew-name { font-weight: 800; font-size: 14.5px; color: var(--brand-black); padding-top: 10px; }
.week-list .slot { min-height: 46px; }

/* ---------------------------------------------------------------- the lead record (over the page, or its own page) */
body.no-scroll { overflow: hidden; }
.record { background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.record-overlay { position: fixed; inset: 16px; z-index: 41; border-radius: var(--radius); box-shadow: 0 24px 80px rgba(5, 22, 40, .3); overflow-y: auto; overscroll-behavior: contain; animation: pop .15s ease-out; }
.record-page { border: 1px solid var(--ring); border-radius: var(--radius); box-shadow: var(--shadow); }
.record-head { display: grid; gap: 16px; padding: 22px 28px 20px; border-bottom: 1px solid var(--line); }
.rh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.rh-title { min-width: 0; }
#record-title { margin: 0; font-size: 27px; line-height: 1.2; letter-spacing: -.01em; color: var(--brand-black); overflow-wrap: anywhere; }
#record-title:focus, #modal-title:focus { outline: none; }
.rh-sub { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14.5px; color: var(--ink-2); }
.rh-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: -6px 0 4px; font-weight: 700; color: var(--brand-black); text-decoration: none; }
.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.progress { display: grid; gap: 8px; }
.progress-now { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--brand-black); }
.progress-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.progress-steps li { display: grid; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.progress-steps li::before { content: ""; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.progress-steps li.done { color: var(--ink-2); }
.progress-steps li.done::before { background: var(--brand-black); border-color: var(--brand-black); }
.progress-steps li.current { color: var(--brand-black); font-weight: 800; }
.progress-steps li.current::before { background: var(--brand-yellow); border-color: var(--brand-yellow); }
.progress.lost li.current::before { background: #9aa5b1; border-color: #9aa5b1; }
.progress.won li::before { background: var(--good); border-color: var(--good); }
.ps-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh-facts { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 0; }
.rh-facts div { min-width: 0; }
.rh-facts dt { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.rh-facts dd { margin: 2px 0 0; font-size: 15.5px; font-weight: 700; color: var(--ink); }
.rh-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rh-actions .btn { min-height: 44px; }
/* A step held up by the lead's state: the reason in words under the buttons, not a broken-looking button (item 3). */
.rh-gate, .rh-wait { flex: 1 1 100%; }
.btn svg { flex: none; }
.more-menu { position: relative; }
.more-menu .menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 6; min-width: 210px; display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(12, 43, 78, .16); }
.menu-item { min-height: 44px; padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 700; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item.danger { color: var(--critical-text); }
.record-body { flex: 1; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.record-nav { padding: 16px 12px; border-right: 1px solid var(--line); background: #fdfbf7; }
.record-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: sticky; top: 12px; }
.record-page .record-nav ul { top: 92px; }
.record-nav button { width: 100%; min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px 8px 9px; border: 0; border-left: 3px solid transparent; border-radius: 10px; background: none; font-weight: 700; color: var(--ink-2); text-align: left; }
.record-nav button:hover { background: var(--surface-2); color: var(--ink); }
.record-nav button[aria-current="true"] { background: #e3f7f9; color: var(--brand-black); border-left-color: var(--brand-yellow); }
.sn-count { flex: none; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 800; color: var(--ink-2); }
.record-main { min-width: 0; display: grid; gap: 18px; align-content: start; padding: 22px 28px 28px; }
.record-section { display: grid; gap: 20px; max-width: 920px; min-width: 0; }
.section-title { margin: 0; font-size: 20px; color: var(--brand-black); }
.section-title:focus { outline: none; }
.record-foot { padding: 12px 28px; border-top: 1px solid var(--line); background: #fdfbf7; font-size: 14px; color: var(--muted); border-radius: 0 0 var(--radius) var(--radius); }
.link-btn { min-height: 32px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--brand-black); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* Details: open fields, one Save; what the system set sits in a grey panel without input borders */
.details-form { display: grid; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.readonly-block { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.readonly-block .section-label { margin-bottom: 8px; }
.readonly-block .kv { font-size: 14.5px; }
.lock-hint { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 14px; color: var(--ink-2); }
.lock-hint svg { flex: none; margin-top: 2px; color: var(--muted); }
.lock-hint:focus { outline: 2px solid var(--brand-yellow); outline-offset: 2px; border-radius: 6px; }
/* Contact log: the composer is open at the top */
.composer { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.composer .textarea { min-height: 96px; }
.composer-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px 14px; align-items: end; }
.composer .form-actions { padding-top: 0; border-top: 0; }
.seg-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.seg-field legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14.5px; font-weight: 700; color: var(--ink-2); }
.seg label:hover span { border-color: var(--axis); }
.seg input:checked + span { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }
.next-step { margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--peak); }
/* Tasks & notes */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 14.5px; }
.task-list li.late { border-color: #f0cdbd; background: #fffaf7; }
.task-list .due { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.task-list li.late .due { color: var(--critical-text); font-weight: 700; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1360px) {
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .card.fill .chart-box { min-height: 290px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px; gap: 22px; }
  .login-hero h1 { font-size: 30px; }
  .logo-tile-lg img { width: 150px; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } /* a short page grows the page, not the top bar */
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 14px; gap: 10px; z-index: 20; }
  .sidebar .brand { border: 0; padding: 0; margin: 0; flex-direction: row; align-items: center; }
  .sidebar .brand span { display: block; font-size: 12px; }
  .logo-tile { padding: 4px; border-radius: 10px; }
  .logo-tile .logo-full { display: none; }
  .logo-tile .logo-mark { display: block; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 0; background: var(--brand-black); border-top: 1px solid #1d4069; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(12, 43, 78, .18); }
  .nav button { flex: 1 1 auto; width: auto; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 3px; border-radius: 10px; text-align: center; white-space: nowrap; }
  .nav button span.label { display: block; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav button svg { width: 20px; height: 20px; }
  .nav button[aria-current="page"]::before { left: 28%; right: 28%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; }
  .nav .l-long { display: none; }
  .nav .l-short { display: inline; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .sidebar-foot .user-chip { display: none; }
  .sidebar-foot .btn { width: auto; min-height: 44px; padding: 8px 16px; }
  .topbar { position: static; padding: 16px 16px 8px; flex-wrap: wrap; }
  .topbar-actions { justify-content: flex-start; }
  /* A phone keeps the header short: Refresh is its icon (the name stays for screen readers), so the demo pill, the
     bell and Refresh share one row. */
  .topbar-actions { gap: 8px; }
  #refresh { font-size: 0; gap: 0; min-width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .content { padding: 4px 14px calc(92px + env(safe-area-inset-bottom)); }
  .toasts { right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .kpis, .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value, .kpis.six .value { font-size: 22px; }
  .filters .input, .filters .select { min-width: 0; flex: 1 1 140px; }
  .today-bar .filters #t-q { flex-basis: 100%; }
  .form-grid, .checks { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .btn, .btn-sm, .segmented button, .view-toggle button, .more-btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .input, .select { min-height: 44px; }
  .alert-list li { padding: 12px 0; }
  .lead-link { min-height: 32px; }
  .calendar { display: none; }
  .week-list { display: grid; gap: 12px; padding: 4px 16px 18px; }
  .record-body { grid-template-columns: 188px minmax(0, 1fr); }
  .record-head, .record-main { padding-left: 22px; padding-right: 22px; }
  .record-foot { padding-left: 22px; padding-right: 22px; }
  .progress-steps .ps-label { display: none; }
  .toolbar .tb-search { flex-basis: 100%; max-width: none; }
  .toolbar .view-toggle { margin-left: 0; }
  .details-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details-form .form-grid .span-2 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .record-overlay { inset: 0; border-radius: 0; }
  .record-head { padding: 16px; gap: 14px; }
  #record-title { font-size: 23px; }
  .rh-tools .btn-sm { padding: 7px 12px; }
  .rh-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
  .rh-actions .btn, .rh-actions .more-menu { flex: 1 1 auto; }
  .rh-actions .more-menu > .btn { width: 100%; }
  .more-menu .menu { left: auto; right: 0; }
  .record-body { grid-template-columns: minmax(0, 1fr); }
  .record-nav { position: sticky; top: 0; z-index: 4; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
  .record-nav ul { position: static; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .record-nav button { width: auto; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px 5px; }
  .record-nav button[aria-current="true"] { border-bottom-color: var(--brand-yellow); }
  .record-main { padding: 16px 16px 20px; }
  .record-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; }
  /* The record's own page runs edge to edge on a phone: one column, nothing beside it. */
  .record-page { margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .composer { padding: 14px; }
  .composer-row { grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn { flex: 1 1 0; }
  .toolbar { padding: 14px 16px 10px; }
  .toolbar .select { flex: 1 1 40%; max-width: none; }
  .toolbar .tb-filters { flex: 1 1 auto; }
  .toolbar #new-lead { flex: 1 1 100%; }
  .details-form .form-grid { grid-template-columns: minmax(0, 1fr); }
  .details-form .form-grid .span-2 { grid-column: auto; }
  .tb-count { margin: 0 16px 10px; }
  .filter-panel { margin: 0 16px 14px; }
}
/* Phones: the bottom bar holds up to seven words, so its labels drop to 11px (10.5px on 360px phones) and every one fits
   uncut; each button stays at least 44px wide and 58px tall. */
@media (max-width: 600px) {
  .nav button { min-width: 44px; }
  .nav button span.label { font-size: 11px; letter-spacing: 0; }
}
@media (max-width: 374px) {
  .nav { padding-left: 2px; padding-right: 2px; }
  .nav button { padding-left: 2px; padding-right: 2px; }
  .nav button span.label { font-size: 10.5px; }
}
@media print {
  .sidebar, .topbar-actions, .toasts { display: none; }
  .app { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- The client's pages (book.html, sign.html): one column, phone first, 44 px+ targets, text 14 px+ ---------- */
.cq-body { background: var(--page); }
.cq-top { background: var(--brand-black); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cq-top .logo-tile { padding: 6px 10px; }
.cq-top .logo-tile .logo-full { display: block; width: 112px; }
.cq { max-width: 640px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 14px; outline: none; }
.cq h1 { font-size: 24px; line-height: 1.25; margin: 0; outline: none; }
.cq h2 { font-size: 18px; margin: 0 0 10px; outline: none; }
.cq .lede { color: var(--ink-2); margin: 6px 0 0; }
.cq-card { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.cq-card p { margin: 0 0 10px; }
.cq-card p:last-child { margin-bottom: 0; }
.cq-msg { text-align: center; padding: 28px 18px; }
.cq-msg .btn { margin-top: 12px; }
.cq-kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.cq-kv dt { color: var(--muted); }
.cq-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cq-lines { width: 100%; border-collapse: collapse; }
.cq-lines td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.cq-lines td.r { text-align: right; white-space: nowrap; padding-left: 12px; font-variant-numeric: tabular-nums; }
.cq-opt { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.cq-extras { display: grid; }
.cq-extra { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.cq-extra input { width: 22px; height: 22px; flex: none; accent-color: var(--brand-black); }
.cq-extra .name { flex: 1; min-width: 0; }
.cq-extra .price { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.cq-sum { display: grid; gap: 6px; }
.cq-sum > div { display: flex; justify-content: space-between; gap: 12px; }
.cq-sum .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cq-sum .grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.cq-sum .deposit { background: var(--gold-wash); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 800; }
.cq form { display: grid; gap: 12px; }
.cq .input { min-height: 48px; font-size: 16px; }
.cq .btn { min-height: 48px; width: 100%; font-size: 16px; white-space: normal; }
.cq-pay { display: grid; gap: 10px; margin-bottom: 10px; }
.cq-note { font-size: 14px; color: var(--ink-2); }
.cq-demo { font-size: 14px; color: var(--muted); border-top: 1px dashed var(--axis); padding-top: 10px; margin-top: 12px !important; }
.cq-error { color: var(--critical-text); font-weight: 700; font-size: 14.5px; }
.cq-receipt { border: 2px solid var(--good); }
.cq-tick { width: 44px; height: 44px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.cq-next { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }

/* ---- revise a quote: what changes from the current version (idea 3) ---- */
.q-diff { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; background: var(--page); }
.q-diff h3 { font-size: 15px; margin: 0 0 6px; }
/* The quotation editor (W8): the engine's options, the client's details, the priced preview. */
.q-opts { grid-template-columns: 1fr; gap: 8px; }
.q-opt { display: grid; gap: 6px; }
.q-opt .check { align-items: flex-start; min-height: 32px; }
.q-opt .check > span:first-of-type { flex: 1 1 auto; min-width: 0; }
.q-opt .check input { margin-top: 2px; }
.q-qty { display: flex; align-items: center; gap: 8px; margin-left: 26px; font-size: 14px; color: var(--ink-2); }
.q-qty .input { width: 96px; min-height: 40px; }
.q-details { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; min-width: 0; display: grid; gap: 10px; }
.q-details > legend { font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 0 4px; }
.q-details #q-id-demo { margin-top: 6px; }
.q-notes { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
#q-preview.is-busy { opacity: .6; transition: opacity .15s; }
.q-diff ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.q-diff li, .q-diff-sum div { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-size: 14px; }
.q-diff li .num, .q-diff-sum .num { text-align: right; margin-left: auto; }
.q-diff-sum { display: grid; gap: 6px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.q-diff-sum div > span:first-child { font-weight: 700; }
.q-diff .up { color: #8A4A12; }
.q-diff .down { color: #1F6B3A; }
.q-diff p { margin: 0; font-size: 14px; }

/* ---- decisions: money and jobs waiting for a decision (idea 12) ---- */
.dec-jump { display: grid; grid-template-columns: repeat(4, max-content); gap: 8px; margin-bottom: 16px; }
@media (max-width: 600px) { .dec-jump { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dec-jump a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.dec-jump a:hover { border-color: var(--brand-yellow); }
.dec-count { font-size: 14px; font-weight: 800; border-radius: 99px; padding: 1px 9px; background: var(--critical-wash); color: var(--critical-text); }
.dec-count.zero { background: var(--surface-2); color: var(--muted); }
.dec-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); align-items: start; }
.dec-section:focus { outline: none; }
.dec-section:focus-visible { outline: 3px solid var(--brand-yellow); outline-offset: 2px; }
.dec-list { list-style: none; margin: 0; padding: 0; }
.dec-list li + li { border-top: 1px solid var(--line); }
.dec-item { display: grid; gap: 4px; width: 100%; min-height: 44px; padding: 12px 20px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dec-item:hover { background: var(--surface-2); }
.dec-item:focus-visible { outline: 3px solid var(--brand-yellow); outline-offset: -3px; }
.dec-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; }
.dec-value { display: grid; justify-items: end; flex: none; }
.dec-value .num { font-weight: 800; }
.dec-sub, .dec-what, .dec-next { font-size: 14px; }
.dec-sub { color: var(--muted); }
.dec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; color: var(--muted); }
.dec-meta .pill { font-size: 14px; }
.dec-foot { font-size: 14px; margin-top: 14px; }
/* Paid today: the money that just came in, across the full width above the lists that wait for a decision. */
.dec-paid { grid-column: 1 / -1; border-color: #bfe3cb; }
.dec-paid .empty { padding: 14px 20px; }
.dec-count.good, .pill.good { background: #e5f4ea; border-color: #bfe3cb; color: var(--good-text); }
.dec-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.dec-id { font-size: 14px; color: var(--muted); font-weight: 600; }
@media (max-width: 600px) { .dec-item { padding: 12px 16px; } }

/* The quote page's budget band on leads and contacts (Admin and Sales). Colours from web/settings.mjs. */
.band { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 2px 9px 2px 7px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.band::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #9aa5b1; flex: none; }
.band-grey::before { background: #8a96a3; }
.band-blue { background: #e8f0fb; border-color: #c9daf3; } .band-blue::before { background: #2f6fd0; }
.band-teal { background: #e3f7f9; border-color: #bfe9ee; } .band-teal::before { background: #0fa3b4; }
.band-green { background: #e5f4ea; border-color: #bfe3cb; } .band-green::before { background: #1f9d55; }
.band-gold { background: #fbf2dc; border-color: #f0dca8; } .band-gold::before { background: #c9a24b; }
.band-none::before { background: transparent; border: 1.5px dashed #9aa5b1; }
.band-flagged { color: var(--ink-2, #4a5563); border-style: dashed; }
/* The follow-up emails on the Contacts page (web/follow-ups.mjs). */
.fu { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.fu-due { background: #fbf2dc; border-color: #f0dca8; color: #6b4d00; }
.fu-next { background: #e8f0fb; border-color: #c9daf3; color: #1d4f9a; }
.fu-stopped { color: var(--ink-2); }
.fu-line { margin-top: 6px; }
.fu-log { margin-top: 6px; }
.fu-form { display: grid; gap: 6px; margin-top: 6px; min-width: 210px; }
.fu-form-btns { display: flex; gap: 6px; }
.lead-card .band { font-size: 12px; }
code.wrap { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; word-break: break-all; }

/* ================================================================ W1a: the sales flow */
/* Bad lead, a closed outcome (the steps' colours are with the pills above) */
.st-BadLead { background: #eeeeec; border-color: #deded9; color: #6b6b66; }

/* nav: Add and More only on the phone bar */
.nav .nav-phone { display: none; }

/* the bell and its panel */
.bell-wrap { position: relative; }
.icon-btn.bell { width: 40px; height: 40px; position: relative; color: var(--brand-black); }
.icon-btn.bell svg { width: 20px; height: 20px; }
.bell-badge { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--critical); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--page); line-height: 1; }
.alerts-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto; background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(12, 43, 78, .18); z-index: 35; text-align: left; }
.alerts-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.alerts-head h2 { margin: 0; font-size: 16px; color: var(--brand-black); }
.alerts-list { list-style: none; margin: 0; padding: 4px 0; }
.alert-item { display: grid; gap: 2px; width: 100%; min-height: 44px; text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 10px 16px 10px 13px; font: inherit; color: var(--ink); }
.alert-item:hover { background: var(--surface-2); }
.alert-item.unread { border-left-color: var(--brand-yellow); background: #f3fbfc; }
.alert-item.unread .alert-title { font-weight: 800; }
.alert-title { font-weight: 600; font-size: 14.5px; }
.alert-text { font-size: 14px; color: var(--ink-2); }
.alert-when { font-size: 13px; color: var(--muted); }
.alert-toasts { position: fixed; top: 16px; right: 16px; z-index: 61; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.alert-toast { pointer-events: auto; border-left: 4px solid var(--brand-yellow); align-items: center; }
.alert-toast span { display: block; }
.toast .toast-open { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--brand-yellow); border: 1px solid #2c5a86; border-radius: 99px; padding: 6px 12px; min-height: 36px; }
.toast .toast-open + .toast-x { margin-left: 0; }

/* scores, bands and flags */
.score { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; flex: none; border: 1px solid transparent; }
.score.hi { background: #e5f4ea; color: var(--good-text); border-color: #bfe3cb; }
.score.mid { background: #fbf2dc; color: #7a5a12; border-color: #f0dca8; }
.score.lo { background: var(--critical-wash); color: var(--critical-text); border-color: #f0cdbd; }
.score.none { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9aa5b1; flex: none; padding: 0; border: 0; vertical-align: middle; }
.dot.band-grey { background: #8a96a3; }
.dot.band-blue { background: #2f6fd0; }
.dot.band-teal { background: #0fa3b4; }
.dot.band-green { background: #1f9d55; }
.dot.band-gold { background: #c9a24b; }
.dot.band-none { background: transparent; border: 1.5px dashed #9aa5b1; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.chip-flag { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip-flag.quiet { background: #eeeeec; border-color: #deded9; color: #5b5b56; }
.chip-flag.dup { background: #f1ecfa; border-color: #dccff2; color: #5b3b99; }
.chip-owner { font-size: 13px; color: var(--muted); font-weight: 600; }

/* the phone lead card */
.work-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.work-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; min-width: 0; }
.work-card.overdue { border-color: #f0cdbd; background: #fffaf7; }
.lc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.work-card .lc-name { font-weight: 700; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.work-card .lc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; color: var(--ink-2); }
.lc-job { min-width: 0; }
.lc-next { font-size: 14px; color: var(--ink-2); }
.lc-next.late { color: var(--critical-text); }
.lc-extra { font-size: 14px; color: var(--muted); }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.card-act { min-height: 44px; background: var(--surface); border-color: var(--line); color: var(--ink); flex: 1 1 auto; text-decoration: none; padding-left: 12px; padding-right: 12px; }
.card-act:hover:not(:disabled) { background: var(--surface-2); border-color: var(--axis); }
.card-act svg { width: 17px; height: 17px; flex: none; stroke: currentColor; }
.card-act.act-call { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.card-act.act-call:hover { background: #143d69; }
.card-act.act-wa { background: #e8f7ee; border-color: #bfe3cb; color: var(--good-text); }
.card-act.act-wa:hover { background: #d9f1e3; }
.filters-toggle { display: none; }
.muted-row td { color: var(--muted); }

/* Today */
.today-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.today-jump a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; font-size: 14.5px; color: var(--ink-2); }
.today-jump a b { color: var(--brand-black); font-size: 16px; }
.today-jump a.late { border-color: #f0cdbd; background: var(--critical-wash); color: var(--critical-text); }
.today-jump a.today-contacts { margin-left: auto; }
@media (max-width: 560px) { .today-jump a.today-contacts { margin-left: 0; } }
.today-jump a.late b { color: var(--critical-text); }
.today-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.today-list:focus { outline: none; }
.today-list .work-list { grid-template-columns: 1fr; }

/* Live */
.live-cards { display: none; }
.live-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.live-card.total { background: #eef3f8; border-color: #c8d9ea; }
.live-card h3 { margin: 0 0 8px; font-size: 15.5px; color: var(--brand-black); }
.live-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.live-card dt { font-size: 13px; color: var(--muted); }
.live-card dd { margin: 0; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.live-card dd span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.live-foot { padding: 0 20px 14px; margin: 8px 0 0; font-size: 14px; }

/* the record: score, history, photos */
/* the record's header: the score chip by the name, the duplicate flag once, Call and WhatsApp big enough for a thumb */
.rh-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rh-name .score { min-width: 32px; height: 32px; font-size: 15px; }
.rh-dup { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.rh-dup .lead-link { font-size: inherit; }
.rh-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 10px; }
.btn-quick { min-height: 48px; font-size: 16px; justify-content: center; }
.btn-quick svg { width: 19px; height: 19px; }
/* WhatsApp: the ready messages for the lead's step (whatsapp.mjs), or why there are none. */
.wa-more { display: grid; gap: 6px; margin-top: 10px; }
.wa-sends { margin: 0; font-size: 14px; color: var(--ink-2); }
.wa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
a.wa-chip { text-decoration: none; }
.wa-chip svg { width: 16px; height: 16px; flex: none; stroke: currentColor; color: var(--good-text); }
.wa-blocked { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.wa-blocked svg { width: 18px; height: 18px; flex: none; stroke: currentColor; margin-top: 1px; }
.lc-nowa { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; font-size: 13.5px; color: var(--muted); flex: 1 1 auto; }
.lc-nowa svg { width: 16px; height: 16px; flex: none; stroke: currentColor; }
.next-now { margin: 0; font-size: 14px; color: var(--ink-2); }
.next-now.late { color: var(--critical-text); }
.lead-card .lc-name .score { min-width: 24px; height: 22px; margin-left: 6px; padding: 0 5px; font-size: 12.5px; border-radius: 6px; vertical-align: 1px; }
.score-box { display: grid; gap: 12px; }
.score-big { display: flex; align-items: center; gap: 12px; }
.score-big .score { min-width: 48px; height: 48px; font-size: 20px; border-radius: 12px; }
.score-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.score-parts li { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.score-parts .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.score-parts .bar span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.score-parts .num { color: var(--ink-2); white-space: nowrap; }
.dup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; }
.dup-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid #f3eee3; }
.dup-list li:last-child { border-bottom: 0; }
.hist-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-thumb { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; min-height: 44px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal.photo-modal { background: rgba(5, 15, 28, .85); }
.photo-modal figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 94vw; }
.photo-modal img { max-width: 94vw; max-height: 80vh; border-radius: 12px; display: block; }

/* forms: one-tap chips, the next step, yes/no, slots */
.chip-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
.chip-group > legend { font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.chip-group .hint { font-size: 14px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input, .slot-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip > span, .chip-btn, .slot-opt > span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 14.5px; cursor: pointer; color: var(--ink); }
.chip:hover > span, .chip-btn:hover, .slot-opt:hover > span { border-color: var(--axis); background: var(--surface-2); }
.chip input:checked + span, .slot-opt input:checked + span { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.chip input:focus-visible + span, .slot-opt input:focus-visible + span { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }
.quick-dates { margin-top: 8px; }
.ns-grid { gap: 12px; }
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yesno .btn { min-height: 56px; font-size: 17px; background: var(--surface); border-color: var(--line); }
.yesno .btn[aria-pressed="true"] { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.slot-picker .slot-day { display: grid; gap: 6px; padding: 8px 0; border-bottom: 1px solid #f3eee3; }
.slot-picker .slot-day:last-of-type { border-bottom: 0; }
.slot-day-label { font-weight: 700; font-size: 14px; color: var(--brand-black); }
.slot-times { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-opt { position: relative; display: inline-flex; }
.slot-opt.taken > span { opacity: .5; cursor: not-allowed; text-decoration: line-through; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--critical); }
.has-error .chip > span, .has-error .slot-opt > span { border-color: #e8b39c; }
.qa-band-hint { margin: 0; }

/* the dashboard's quality card */
.kpis.quality-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.quality-kpis .kpi { box-shadow: none; }

/* Settings */
.set-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 18px; margin: 0; }
.set-dl dt { display: inline; color: var(--muted); }
.set-dl dt::after { content: ":"; }
.set-dl dd { display: inline; margin: 0 0 0 4px; font-weight: 600; }
div.set-group { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
div.set-group > fieldset, div.set-group > .wide-field { grid-column: 1 / -1; }
fieldset.set-group { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
fieldset.set-group > legend { font-size: 14px; font-weight: 800; color: var(--brand-black); padding: 0 4px; }
.set-rows { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
.set-rows > legend { font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.set-rows-list { display: grid; gap: 10px; }
.set-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.set-cell { flex: 1 1 120px; display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 0; }
.set-cell.wide { flex-basis: 100%; }
.set-row-del { width: 44px; height: 44px; font-size: 20px; }
.set-rows [data-row-add] { justify-self: start; }
/* Settings (tidy, 23 Nov 2026, 19df9b2f): the sections' list, the overview and a section page with its save bar. */
.sec-layout { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.sec-nav ul, .sec-rows { list-style: none; margin: 0; padding: 0; }
.sec-nav ul { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sec-link { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.sec-nav li:first-child .sec-link { border-top: 0; }
.sec-link:hover, .sec-link[aria-current="page"] { background: var(--surface-2); }
.sec-link[aria-current="page"] { box-shadow: inset 4px 0 0 var(--brand-yellow); }
.sec-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--brand-black); }
.sec-ic svg { width: 20px; height: 20px; stroke: currentColor; }
.sec-chev svg { transform: rotate(-90deg); color: var(--muted); }
.sec-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 800; color: var(--brand-black); }
.sec-name .pill { font-size: 12px; padding: 1px 8px; }
.sec-sum { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.sec-page { display: grid; gap: 16px; max-width: 760px; min-width: 0; }
.sec-title h2 { margin: 0; font-size: 21px; color: var(--brand-black); }
.sec-title p { margin: 4px 0 0; color: var(--ink-2); }
.sec-title .sec-meta { font-size: 13.5px; color: var(--muted); }
.sec-card { padding: 2px 20px; }
.sec-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.sec-field:first-child { border-top: 0; }
.sec-field.wide { grid-template-columns: minmax(0, 1fr); }
.sec-field > .sec-help, .sec-field > .field-error { grid-column: 1 / -1; margin: 0; }
.sec-lbl { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand-black); }
.sec-help { font-size: 14px; color: var(--muted); }
.sec-i { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); font: italic 700 13px/1 Georgia, serif; color: var(--ink-2); cursor: pointer; }
.sec-val { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.sec-text { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 100%; font-size: 14.5px; overflow-wrap: anywhere; }
.sec-text > .pill { white-space: normal; }
.sec-num { width: 96px; }
.sec-more > summary { cursor: pointer; font-weight: 800; color: var(--brand-black); padding: 6px 0 10px; }
.sec-note { display: grid; gap: 6px; justify-items: start; border-radius: 14px; padding: 12px 16px; border: 1px solid; }
.sec-note, .sec-name .pill.warn, .sec-guesses .pill.warn { background: #fff4d6; border-color: #f0dca0; color: #7a5300; } /* amber, like .q-Signed */
.sec-note.ok { background: #e5f4ea; border-color: #bfe3cb; color: var(--good-text); }
.sec-note p { margin: 0; color: var(--ink); }
.sec-rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 14.5px; }
.sec-rows li:first-child { border-top: 0; }
.sec-bar { position: sticky; bottom: 12px; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--brand-black); color: #fff; border-radius: 14px; padding: 8px 8px 8px 16px; box-shadow: 0 10px 30px rgba(12, 43, 78, .3); }
.sec-bar > span { display: flex; gap: 6px; }
.sec-bar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.sec-back, .sec-intro { display: none; }
@media (min-width: 601px) { .modal.sheet.drawer { padding: 0; place-items: stretch end; } .modal.sheet.drawer .modal-card { width: min(560px, 100%); height: 100vh; max-height: none; border-radius: 0; } }
@media (max-width: 900px) { .sec-layout { grid-template-columns: minmax(0, 1fr); } .sec-layout.in-sec .sec-nav { display: none; } .sec-back { display: inline-flex; } }
@media (max-width: 600px) { .sec-intro { display: block; margin: 0 0 12px; color: var(--ink-2); } .sec-guesses { display: none; } .sec-card { padding: 2px 16px; } .sec-field { grid-template-columns: minmax(0, 1fr); } .sec-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
table.audit-table td { vertical-align: top; }
/* My hours (the visit calendar) */
.sec-tile { border: 1px solid var(--ring); }
.hr-page, .hr-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.hr-page > p, .hr-grid .card-body > p { margin: 0; }
.hr-grid .card-body[data-days] { padding-top: 4px; padding-bottom: 8px; }
.hr-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hr-day { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 60px; border-top: 1px solid var(--line); }
.hr-day:first-child { border-top: 0; }
.hr-times { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hr-times .select { width: 96px; min-width: 0; }
.hr-track { position: relative; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.hr-track i { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; }
.hr-track .v { background: var(--brand-black); }
.hr-track .g { background: repeating-linear-gradient(135deg, var(--line) 0 4px, var(--surface) 4px 8px); }
.ef-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ef-row > div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
[data-entries] .ef-row:first-child { border-top: 0; padding-top: 0; }
.ef-clashes:not(:empty) { background: var(--critical-wash); border-radius: 10px; padding: 10px 14px; }
.form-grid.ef-times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ef-gives { margin: 0; }
.ef-clashes > p { margin: 0 0 6px; color: var(--critical-text); font-weight: 700; }
.hr-axis { display: flex; justify-content: space-between; margin: 2px 0 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .hr-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .hr-day { grid-template-columns: 40px minmax(0, 1fr) auto; } .hr-times .select { width: 88px; padding-left: 10px; padding-right: 22px; } }

@media (max-width: 1200px) {
  .kpis.quality-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* The phone bar, every role: at most five buttons, none cut, no sideways scroll (PHONE_BAR in app.js). The role's
     pages in their bar order, then Add and More; More opens the other pages above the bar, three to a row. */
  .nav.phone-bar { overflow: visible; flex-wrap: wrap; }
  .nav.phone-bar button { flex: 1 1 0; min-width: 56px; order: var(--bar, 20); }
  .nav.phone-bar button span.label { font-size: 13px; }
  .nav.phone-bar .nav-extra { display: none; }
  .nav.phone-bar .nav-phone { display: flex; }
  /* A phone-only button that lives under More (the owner's Add, the public quote page) waits there like a page. */
  .nav.phone-bar .nav-phone.nav-extra { display: none; }
  .nav.phone-bar.more-open .nav-extra { display: flex; order: -1; flex: 0 0 calc(100% / 3 - 1px); }
  /* A line break after the More pages, so a short last row never pulls the bar's buttons up beside it. */
  .nav.phone-bar.more-open::after { content: ""; order: -1; flex: 0 0 100%; height: 0; }
  .nav #nav-add { color: var(--brand-yellow); }
  .nav #nav-more.is-current, .nav #nav-more[aria-expanded="true"] { background: #17436f; color: #fff; }
  .filters-toggle { display: inline-flex; }
  #lead-filters .f-extra { display: none; }
  #lead-filters.show-extra .f-extra { display: block; }
  .alerts-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-height: calc(100vh - 170px); }
  .alert-toasts { top: 12px; left: 12px; right: 12px; width: auto; }
  .icon-btn.bell { width: 44px; height: 44px; }
  .toast .toast-open { min-height: 44px; }
  .kpis.quality-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-grid { grid-template-columns: 1fr; }
  .work-list { grid-template-columns: 1fr; }
  /* With the phone bar, the public quote page is under More (startApp), not in the header. A role without More
     (Installations) keeps it in the header (Codex P2 on #108). */
  body.bar-more #public-quote { display: none; }
}
@media (max-width: 600px) {
  .live-table { display: none; }
  .live-cards { display: grid; gap: 10px; padding: 4px 16px 8px; }
  .modal.sheet { padding: 0; place-items: stretch; }
  .modal.sheet .modal-card { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .modal.sheet .modal-card footer { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal.sheet .modal-card footer .btn { flex: 1; }
  .score-parts li { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) auto; }
  /* After the 900px block (which sets 13px): phone labels are 11px, every one uncut. */
  .nav button span.label, .nav.phone-bar button span.label { font-size: 11px; letter-spacing: 0; }
  .rh-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The phone header in two short rows (21 Nov screen review, item 1): the page name with the bell and Refresh, then
     View as and the demo pill. The subtitle is the desktop's help line; the period buttons, where a page has them,
     take a third row. */
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 12px 16px 6px; }
  .topbar > div:first-child { grid-column: 1; grid-row: 1; min-width: 0; }
  .topbar h1 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #page-subtitle { display: none; }
  .topbar-actions { display: contents; }
  .bell-wrap { grid-column: 2; grid-row: 1; }
  #refresh { grid-column: 3; grid-row: 1; }
  .view-as { grid-column: 1; grid-row: 2; min-width: 0; }
  .view-as .select { flex: 1 1 auto; min-width: 0; }
  .demo-pill { grid-column: 2 / 4; grid-row: 2; justify-self: stretch; text-align: center; padding: 5px 8px; }
  .demo-pill .dp-more { display: none; }
  #period { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  #public-quote { grid-column: 1 / -1; justify-self: start; } /* where it stays (no More): the next free row */
  /* Leads on a phone: the four tiles keep their name and number (the line under each is the desktop's), so the
     first lead shows on the first screen. */
  #lead-kpis .kpi { padding: 10px 12px; }
  #lead-kpis .kpi .label { font-size: 13px; }
  #lead-kpis .kpi .delta { display: none; }
  /* The phone bar's Add (under More for the owner) already adds a lead, and the step picker above a one-step board
     already names the step and its count (the column keeps its value line). */
  .toolbar #new-lead { display: none; }
  .board-one .col-head { display: none; }
  .board-one .col-value { margin-top: 0; }
}
@media (max-width: 374px) {
  .nav button span.label, .nav.phone-bar button span.label { font-size: 10.5px; }
}

/* Demo mode is a per-environment switch (ADR 0007): each page's script adds .demo to <html> when config.js says
   demo: true. Everything marked demo-only exists only then. */
html:not(.demo) .demo-only { display: none !important; }
