/* Hallmark · genre: modern-minimal (sales tool) · macrostructure: Workbench · theme: studied-DNA "SSC Glass" (source: https://ssc.hotleadbkk.com/)
 * studied: yes · design-system: design.md · designed-as-app
 * pre-emit critique: P4 H4 E4 S5 R4 V4 */

html, body { overflow-x: clip; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.6;
  color: var(--color-ink); background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased; isolation: isolate;
}
/* The SSC wash: four soft blooms (violet, periwinkle, peach, pink) over a lavender-to-peach gradient, fixed behind
   everything and drifting very slowly. Glass panels (.card, the rail, buttons) frost it. */
body::before {
  content: ""; position: fixed; inset: -15% -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 34% at 14% 10%, var(--color-wash-1), transparent 70%),
    radial-gradient(40% 36% at 88% 16%, var(--color-wash-2), transparent 72%),
    radial-gradient(42% 38% at 78% 82%, var(--color-wash-3), transparent 74%),
    radial-gradient(44% 40% at 22% 88%, var(--color-wash-4), transparent 76%),
    linear-gradient(160deg, var(--color-wash-from), var(--color-wash-mid) 45%, var(--color-wash-to));
  filter: blur(10px);
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: wash-drift 36s ease-in-out infinite alternate; }
}
@keyframes wash-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-3%, 2%, 0) scale(1.07); } }
/* Frosted glass: the card, the rail, the phone header and bars. Where blur isn't available, or the viewer asks for
   less transparency, the glass turns into near-opaque white so text never sits on a busy background. */
.card, .side, .mobile-head, .glass {
  background: var(--color-glass); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass);
  border: 1px solid var(--color-glass-edge); box-shadow: var(--shadow-glass);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .side, .mobile-head, .glass { background: var(--color-glass-2); }
}
@media (prefers-reduced-transparency: reduce) {
  .card, .side, .mobile-head, .glass { background: var(--color-panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; font-style: normal; }
/* Page titles as on SSC's cover: light, ink; Latin and figures in Outfit, Thai in Anuphan.
   Section and card titles are SSC's card titles: Anuphan semibold in navy. */
h1 { font-family: var(--font-display); font-weight: 300; }
h2, h3 { font-family: var(--font-sans); font-weight: 600; color: var(--color-accent); }
h1, h2, .brand, .ring__label, .goal__figure, .tile dd, .pay__amount, .money__side dd, .pick__num, .phone, .focus__name { font-variant-numeric: lining-nums; }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
a { color: var(--color-accent-deep); text-underline-offset: 3px; }
button, input { font: inherit; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
/* Headline figures (money, counts, the ring) are set in the display face, like the ads' "50,000" */
.ring__label, .goal__figure, .tile dd, .pay__amount, .money__side dd, .pick__num, .phone { font-family: var(--font-display); font-weight: 600; }
/* Phone numbers, timestamps and secrets read in mono; table figures stay in the body face, tabular */
.ts, .secret, .account, code { font-family: var(--font-mono); }
.table .n, .chip b, .num { font-variant-numeric: tabular-nums lining-nums; }
/* Small labels above figures and table heads */
.goal__label, .tile dt, .table th, .money__side dt { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.02em; }
.muted { color: var(--color-muted); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ── App shell: a glass side rail floating on the wash on desktop, glass bottom tabs on phones ── */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: var(--space-sm); height: calc(100vh - 2 * var(--space-sm)); margin: var(--space-sm) 0 var(--space-sm) var(--space-sm);
  display: flex; flex-direction: column; gap: var(--space-lg);
  padding: var(--space-md) var(--space-sm); color: var(--color-ink); border-radius: var(--radius-card);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;  /* the owner's long menu scrolls inside the rail */
}
.brand { display: inline-flex; align-items: baseline; gap: 2px; padding: 0 var(--space-2xs);
  font-family: var(--font-display); font-weight: 400; font-size: var(--text-xl); line-height: 1.1; letter-spacing: -0.01em; color: var(--color-accent); text-decoration: none; white-space: nowrap; }
/* Type-only wordmark: pink chevron, "Hot Lead" in Outfit, "OS" as tracked small caps */
.brand__chev { color: var(--color-accent-2); font-weight: 700; margin-right: 2px; }
.side > .brand { font-size: var(--text-lg); }  /* the rail is 248 px: wordmark + tag must fit on one line */
.brand__tag { margin-left: 6px; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.04em; color: var(--color-accent-2); }  /* marks the build as not final */
.brand small { margin-left: 6px; font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.22em; color: var(--color-muted); }
.side__nav { display: grid; gap: 2px; }
.side__link {
  display: flex; align-items: center; gap: var(--space-xs); padding: 10px var(--space-xs); border-radius: var(--radius-sm);
  color: var(--color-ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
  transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.side__link svg { width: 20px; height: 20px; flex: none; }
.side__link:hover { background: var(--color-glass-2); color: var(--color-accent); }
.side__link[aria-current="page"] { background: var(--color-glass-2); color: var(--color-accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-accent-2), 0 4px 14px oklch(45% 0.12 290 / 0.10); }
.side__link[aria-current="page"] svg { color: var(--color-accent-2); }
.side__me { margin-top: auto; display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs);
  border-top: 1px solid var(--color-rule); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--color-violet), var(--color-accent)); color: var(--color-on-accent); font-weight: 600; }
.side__who { min-width: 0; flex: 1; line-height: 1.35; }
.side__who p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__role { font-size: var(--text-xs); color: var(--color-muted); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 0; background: none; color: var(--color-muted); cursor: pointer; }
.icon-btn:hover { background: var(--color-glass-2); color: var(--color-accent); }
.icon-btn svg { width: 18px; height: 18px; }
.mobile-head { display: none; }

.main { min-width: 0; padding: var(--space-xl) clamp(var(--space-sm), 4vw, var(--space-2xl)) var(--space-2xl); }
.page { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
/* Page head as on SSC's cover: the title, then a short pink rule that fades out (no full-width ink line) */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap;
  padding-bottom: calc(var(--space-md) + 3px);
  background: linear-gradient(90deg, var(--color-accent-2), transparent) left bottom / 84px 3px no-repeat; }
.head__hello { color: var(--color-muted); margin-bottom: var(--space-2xs); }
.head h1 { font-size: var(--text-display); line-height: 1.2; letter-spacing: -0.015em; overflow-wrap: anywhere; min-width: 0; }
/* Masthead strip above every page, like the ads' "CEO BRANDING ———" line */
.masthead { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: calc(var(--space-xl) * -0.5);
  font-family: var(--font-display); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--color-accent-2); }
.masthead i { flex: 1; height: 1px; background: var(--color-glass-edge); box-shadow: 0 1px 0 var(--color-rule); }
.masthead span + i + span { color: var(--color-muted); font-weight: 400; }
.masthead span + i + span { font-family: var(--font-sans); letter-spacing: 0.02em; text-transform: none; }  /* Thai dates aren't tracked */
.masthead b { color: var(--color-accent-2); font-weight: 700; letter-spacing: 0; }
.block { display: grid; gap: var(--space-sm); }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }

.card { border-radius: var(--radius-card); }
.block__head h2 { font-size: var(--text-xl); }

/* ── Buttons: pills ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs);
  min-height: 44px; padding: 0 var(--space-md); border-radius: var(--radius-pill); border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
/* SSC buttons: the dark pill is a soft ink gradient with a deep shadow; the call button is navy; outline buttons are
   white glass with a navy label whose edge turns pink on hover. Hover lifts 1 px. */
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-call { background: linear-gradient(135deg, var(--color-accent), var(--color-accent-deep)); color: var(--color-on-accent); box-shadow: 0 10px 24px oklch(34% 0.12 265 / 0.30); }
.btn-call:hover { background: linear-gradient(135deg, var(--color-accent-deep), var(--color-btn-to)); }
.btn-dark { background: linear-gradient(135deg, var(--color-btn-from), var(--color-btn-to)); color: var(--color-on-accent); box-shadow: var(--shadow-btn); }
.btn-dark:hover { background: linear-gradient(135deg, var(--color-btn-to), var(--color-btn-to)); }
.btn-line { background: var(--color-glass-2); color: var(--color-accent); border-color: var(--color-glass-edge);
  box-shadow: 0 4px 14px oklch(45% 0.12 290 / 0.10); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.btn-line:hover { border-color: var(--color-accent-2); }
.btn-good { background: var(--color-money); color: var(--color-on-accent); box-shadow: 0 10px 24px oklch(48% 0.12 145 / 0.25); }
.btn-good:hover { background: var(--color-ink); }
.btn-lg { min-height: 52px; padding: 0 var(--space-lg); font-size: var(--text-md); }

input[type="text"], input[type="password"], input[type="month"], input:not([type]) {
  min-height: 44px; padding: 0 var(--space-sm); width: 100%; color: var(--color-ink);
  background: var(--color-panel); border: 1px solid var(--color-rule); border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px oklch(45% 0.12 290 / 0.07);
}
input:hover { border-color: var(--color-muted); }
input:focus-visible { border-color: var(--color-focus); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--color-muted); opacity: .8; }

.flash { padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); background: var(--color-money-soft); color: var(--color-money); font-weight: 500; border-left: 3px solid currentColor; }
.flash.error { background: var(--color-late-soft); color: var(--color-late); }

/* ── Heat ring: share of the 24 h call window left ── */
.ring {
  --size: 52px; --stroke: 5px; --ring-color: var(--color-accent);
  position: relative; flex: none; width: var(--size); height: var(--size); border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color) calc(var(--left) * 1%), var(--color-track) 0);
}
.ring::before { content: ""; position: absolute; inset: var(--stroke); border-radius: 50%; background: var(--color-panel); }
.ring__label { position: relative; font-weight: 600; font-size: var(--text-sm); line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.ring__label small { display: block; font-size: 10px; font-weight: 500; color: var(--color-muted); margin-top: 2px; }
.ring--fresh { --ring-color: var(--color-accent); }
.ring--cooling { --ring-color: var(--color-warm); }
.ring--cold { --ring-color: var(--color-cold); }
.ring--late { --ring-color: var(--color-late); }
.ring--late .ring__label { color: var(--color-late); }
.ring--kept { --ring-color: var(--color-rule); --left: 100 !important; }  /* an old sheet lead: no call window */
.ring--kept .ring__label { color: var(--color-muted); }
.ring-lg { --size: 132px; --stroke: 10px; }
.ring-lg .ring__label { font-size: var(--text-3xl); letter-spacing: -0.04em; }
.ring-lg .ring__label small { font-size: var(--text-sm); }

/* ── Leads ── */
.focus { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-lg); align-items: center;
  padding: var(--space-lg); box-shadow: var(--shadow-lift), inset 0 3px 0 var(--color-accent-2); }
.focus__tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--color-accent-soft); color: var(--color-accent-deep); font-size: var(--text-sm); font-weight: 600; }
.focus--late .focus__tag { background: var(--color-late-soft); color: var(--color-late); }
.focus__name { font-family: var(--font-display); font-weight: 400; font-size: var(--text-xl); letter-spacing: -0.01em; margin-top: var(--space-2xs); overflow-wrap: anywhere; }
.focus__time { margin-top: var(--space-2xs); color: var(--color-ink-2); }

.meta { display: flex; flex-wrap: wrap; gap: 4px var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-md); align-items: center;
  padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--color-rule); }
.row:first-child { border-top: 0; }
.row__name { font-weight: 600; overflow-wrap: anywhere; }
.row__time { font-size: var(--text-sm); color: var(--color-ink-2); }
.row__time.is-late { color: var(--color-late); font-weight: 600; }
.done-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-money); margin: 0 6px; }

.empty { padding: var(--space-xl) var(--space-md); text-align: center; display: grid; gap: var(--space-2xs); justify-items: center; }
.empty__icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--color-money-soft); color: var(--color-money); }
.empty__icon svg { width: 22px; height: 22px; }

/* ── Dashboard ── */
.month { display: flex; gap: var(--space-2xs); align-items: center; }
.month input { width: auto; }
.overview { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-md); }
.goal { padding: var(--space-lg); display: grid; gap: var(--space-sm); align-content: start; }
.goal__label { color: var(--color-muted); font-weight: 500; }
.goal__figure { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.goal__figure small { font-size: var(--text-md); font-weight: 500; letter-spacing: 0; color: var(--color-muted); margin-left: var(--space-2xs); }
.track { height: 10px; border-radius: var(--radius-pill); background: var(--color-track); overflow: hidden; }
.track span { display: block; height: 100%; width: var(--pct); border-radius: inherit; background: var(--color-accent); }
.track--done span { background: var(--color-money); }
.goal__note { color: var(--color-ink-2); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; margin: 0; }
.tile { padding: var(--space-md); border-top: 1px solid var(--color-rule); display: grid; gap: 2px; align-content: start; }
.tile:nth-child(-n+2) { border-top: 0; }
.tile:nth-child(even) { border-left: 1px solid var(--color-rule); }
.tile dt { font-size: var(--text-sm); color: var(--color-muted); }
.tile dd { margin: 0; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile dd.is-alert { color: var(--color-late); }
.tile dd small { font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); letter-spacing: 0; }

.chips { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: var(--space-2xs); padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--color-panel); border: 1px solid var(--color-rule); font-size: var(--text-sm); }
.chip b { font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.chip.is-alert { background: var(--color-late-soft); border-color: transparent; color: var(--color-late); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: 500; color: var(--color-muted); padding: var(--space-xs) var(--space-md); white-space: nowrap; border-bottom: 1px solid var(--color-rule); }
.table td { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.table td:first-child { white-space: nowrap; font-weight: 500; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--color-paper); }
.table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--color-rule); border-bottom: 0; }
.score-sum { display: grid; gap: 6px; margin: 0 0 var(--space-xs); padding: 0; list-style: none; font-size: var(--text-sm); }
.score-sum li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); }
.bar { display: inline-flex; align-items: center; gap: var(--space-2xs); white-space: nowrap; }
.bar i { display: block; width: 72px; height: 6px; border-radius: var(--radius-pill); background: var(--color-track); overflow: hidden; }
.bar i::before { content: ""; display: block; height: 100%; width: var(--pct); background: var(--color-accent); border-radius: inherit; }
.kind { display: inline-block; padding: 1px 10px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 500; background: var(--color-paper-2); color: var(--color-ink-2); }

.money { color: var(--color-night-ink); box-shadow: var(--shadow-glass), inset 0 3px 0 var(--color-accent); padding: var(--space-lg); display: grid; gap: var(--space-md); }
.money__top { display: flex; justify-content: space-between; gap: var(--space-lg); flex-wrap: wrap; align-items: flex-end; }
.money .goal__label, .money .goal__figure small { color: var(--color-night-mute); }
.money__side { display: flex; gap: var(--space-xl); flex-wrap: wrap; margin: 0; }
.money__side dt { font-size: var(--text-sm); color: var(--color-night-mute); }
.money__side dd { margin: 0; font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.money .table th { color: var(--color-night-mute); border-color: var(--color-night-2); }
.money .table td { border-color: var(--color-night-2); }
.money .table tbody tr:hover td { background: var(--color-night-2); }
.money a { color: var(--color-night-ink); }
.money .table-wrap { margin: 0 calc(var(--space-md) * -1); }

.note { font-size: var(--text-sm); color: var(--color-muted); max-width: 72ch; }
.soon { padding: var(--space-md); border-radius: var(--radius-card); border: 1px dashed var(--color-rule); color: var(--color-muted); font-size: var(--text-sm); }

/* ── Sign-in ── */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth__brand { margin: var(--space-sm); border-radius: var(--radius-cover); color: var(--color-night-ink); padding: var(--space-xl); display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-xl);
  background: radial-gradient(70% 90% at 88% 10%, var(--color-wash-1), transparent 65%), radial-gradient(60% 80% at 10% 95%, var(--color-wash-3), transparent 70%), var(--color-night);
  -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); border: 1px solid var(--color-glass-edge); box-shadow: var(--shadow-lift); }
.auth__line { font-family: var(--font-display); font-size: clamp(var(--text-xl), 3.4vw, 3.25rem); font-weight: 300; letter-spacing: -0.015em; line-height: 1.2; color: var(--color-ink); }
.auth__line span { display: block; }  /* two set lines: the promise, then the 24 h */
.auth__sub { color: var(--color-night-mute); max-width: 40ch; margin-top: var(--space-sm); }
.auth__form { display: grid; place-items: center; padding: var(--space-lg) var(--space-sm); }
.auth__form form { width: 100%; max-width: 360px; display: grid; gap: var(--space-md); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; font-size: var(--text-sm); }
.error { color: var(--color-late); font-size: var(--text-sm); }

/* ── Client confirmation (public page, no app menu) ── */
.plain__bar { padding: var(--space-md) clamp(var(--space-sm), 4vw, var(--space-xl)); }
.plain__bar .brand { color: var(--color-ink); padding: 0; }
.plain__main { max-width: 760px; margin: 0 auto; padding: var(--space-md) var(--space-sm) var(--space-2xl); display: grid; gap: var(--space-lg); }
.account { display: inline-block; padding: 2px 12px; border-radius: var(--radius-pill); background: var(--color-panel); border: 1px solid var(--color-rule); font-weight: 600; font-variant-numeric: tabular-nums; }
.pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md) var(--space-lg); padding: var(--space-md) var(--space-lg); align-items: center; }
.pay__amount { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.035em; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pay__amount small { display: block; font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; color: var(--color-muted); }
.pay__actions { grid-column: 1 / -1; display: flex; gap: var(--space-2xs); justify-content: flex-end; padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); }

/* ── Phones ── */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); padding: var(--space-sm); color: var(--color-ink);
    position: sticky; top: 0; z-index: 9; border-radius: 0; border-width: 0 0 1px; }
  .masthead { margin-bottom: calc(var(--space-lg) * -0.5); letter-spacing: 0.16em; }
  .masthead span + i + span { display: none; }
  .side { position: fixed; z-index: 10; inset: auto 0 0 0; height: auto; margin: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; padding: 6px var(--space-2xs) calc(6px + env(safe-area-inset-bottom)); flex-direction: row; gap: 0; }
  .side > .brand, .side__who, .side__me .avatar { display: none; }
  .side__nav { display: flex; flex: 1; gap: 0; }
  .side__link { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: var(--text-xs); justify-content: center; }
  .side { border-width: 1px 0 0; overflow: visible; }
  .side__link[aria-current="page"] { box-shadow: inset 0 3px 0 var(--color-accent-2); }
  .side__me { margin: 0; padding: 0; border: 0; }
  .side__me .icon-btn { width: 52px; height: 100%; }
  .main { padding: var(--space-md) var(--space-sm) calc(var(--space-2xl) + 32px); }
  .page { gap: var(--space-lg); }
  .head h1 { font-size: var(--text-2xl); }
  .focus { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-md); padding: var(--space-md); }
  .focus form, .focus > .btn { grid-column: 1 / -1; }
  .focus .btn { width: 100%; }
  .ring-lg { --size: 72px; --stroke: 7px; }
  .ring-lg .ring__label { font-size: var(--text-lg); }
  .ring-lg .ring__label small { font-size: 10px; }
  .focus__name { font-size: var(--text-lg); }
  .row { grid-template-columns: auto minmax(0, 1fr); padding: var(--space-sm); gap: var(--space-sm); }
  .row form, .row > .btn, .row > .actions { grid-column: 1 / -1; }
  .row .btn { width: 100%; }
  .overview { grid-template-columns: minmax(0, 1fr); }
  .goal__figure { font-size: var(--text-2xl); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__brand { padding: var(--space-lg) var(--space-md); margin: var(--space-2xs); }
  .pay { grid-template-columns: minmax(0, 1fr); padding: var(--space-md); }
  .pay__amount { text-align: left; }
  .pay__actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .track span, .bar i::before { transition: width var(--dur-mid) var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 600; background: var(--color-glass-2); color: var(--color-ink-2); border: 1px solid var(--color-glass-edge); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--approved { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.status--paid { background: var(--color-money-soft); color: var(--color-money); }
@media print {
  body::before { display: none; }
  .card { background: var(--color-panel); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--color-rule); }
  .side, .mobile-head { display: none; }
  .app { display: block; }
  .main { padding: 0; }
}

/* Lead temperature picker on called leads */
.temp { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2xs); }
.temp__opt { min-height: 32px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-panel); color: var(--color-ink-2); font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.temp__opt:hover { border-color: var(--color-muted); }
.temp__opt[aria-pressed="true"] { border-color: transparent; color: var(--color-on-accent); }
.temp__opt--hot[aria-pressed="true"] { background: var(--color-accent-deep); }
.temp__opt--warm[aria-pressed="true"] { background: var(--color-warm); }
.temp__opt--cold[aria-pressed="true"] { background: var(--color-cold); }
.temp__opt--unknown[aria-pressed="true"] { background: var(--color-ink-2); }

/* Call logging and call analysis */
.log-form h2 { margin-bottom: var(--space-2xs); }
.choices { border: 0; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); }
.choices legend { font-weight: 500; font-size: var(--text-sm); margin-bottom: var(--space-2xs); }
.choice { display: flex; align-items: center; gap: var(--space-xs); padding: 10px var(--space-sm); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--color-accent-deep); background: var(--color-accent-soft); }
.choice input { accent-color: var(--color-accent-deep); }
.log-form textarea { font: inherit; width: 100%; padding: var(--space-xs); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-panel); }
.log-form input[type="file"] { font: inherit; }
.status--late { background: var(--color-late-soft); color: var(--color-late); }
.player { width: 100%; position: sticky; top: var(--space-xs); z-index: 5; } /* stays in view while a moment further down plays */
.ts { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; padding: 3px 10px 3px 8px; margin-right: var(--space-2xs); border-radius: var(--radius-pill); border: 1px solid transparent; background: var(--color-accent-soft); color: var(--color-accent); cursor: pointer; vertical-align: middle; }
.ts svg { width: 10px; height: 10px; flex: none; }
.ts:hover { border-color: var(--color-accent); }
.rubric__score { font-size: var(--text-xl); font-weight: 600; min-width: 3ch; }
.rubric__score small { font-size: var(--text-sm); color: var(--color-muted); }
.rubric__score--na { font-size: var(--text-sm); font-weight: 400; color: var(--color-muted); }
.card--alert { border-color: var(--color-late); background: var(--color-late-soft); }
.card--alert .ts { background: var(--color-panel); color: var(--color-late); }
.card--alert .ts:hover { border-color: var(--color-late); }
.evidence { margin-top: var(--space-3xs); font-size: var(--text-sm); } /* not .quote: that is the quotation card */
.bant { text-transform: none; }
.bant--yes { color: var(--color-money); }
.bant--no { color: var(--color-late); }
.bant--unknown { color: var(--color-muted); }
.transcript { padding: var(--space-md); display: grid; gap: var(--space-2xs); max-height: 70vh; overflow-y: auto; }
.line { padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-sm); }
.line b { margin-right: var(--space-2xs); }
.line--rep { background: var(--color-accent-soft); }
.line--customer { background: var(--color-paper-2); }
.plain-list { margin: 0; padding: var(--space-md) var(--space-md) var(--space-md) calc(var(--space-md) + 1em); }
.phone { font-size: var(--text-2xl); overflow-wrap: anywhere; letter-spacing: -0.02em; }

/* Deals */
input[type="number"], input[type="date"], input[type="datetime-local"], select {
  min-height: 44px; padding: 0 var(--space-sm); width: 100%; color: var(--color-ink);
  background: var(--color-panel); border: 1px solid var(--color-rule); border-radius: var(--radius-sm);
}
.field textarea { font: inherit; width: 100%; padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-panel); }
.field input[type="file"] { font: inherit; font-size: var(--text-sm); }
.field--error input, .field--error textarea { border-color: var(--color-late); }
.stack { display: grid; gap: var(--space-md); padding-top: var(--space-sm); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm) var(--space-md); }
.items { display: grid; gap: var(--space-xs); }
.items__row { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--space-xs); align-items: start; }
.quote { padding: var(--space-md) var(--space-lg); display: grid; gap: var(--space-xs); }
.quote__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.quote .table th, .quote .table td { padding-left: 0; }
.actions { display: flex; gap: var(--space-2xs); flex-wrap: wrap; align-items: center; }
.disclosure { padding: var(--space-sm) var(--space-lg); }
.disclosure summary { cursor: pointer; font-weight: 600; color: var(--color-accent-deep); min-height: 32px; display: flex; align-items: center; }
.disclosure--inline { padding: 0; margin-top: var(--space-2xs); }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--color-glass-2); border: 1px solid var(--color-glass-edge); box-shadow: 0 4px 14px oklch(45% 0.12 290 / 0.08); }
.segmented button { font: inherit; border: 0; background: none; padding: 6px 14px; border-radius: var(--radius-pill); color: var(--color-ink-2); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: linear-gradient(135deg, var(--color-btn-from), var(--color-btn-to)); color: var(--color-on-accent); font-weight: 600; box-shadow: var(--shadow-btn); }
.status--won, .status--accepted, .status--client_confirmed { background: var(--color-money-soft); color: var(--color-money); }
.status--lost, .status--rejected, .status--client_disputed { background: var(--color-late-soft); color: var(--color-late); }
.status--sent, .status--slip_uploaded { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.small { font-size: var(--text-sm); }
@media (max-width: 860px) {
  .grid-2, .items__row { grid-template-columns: minmax(0, 1fr); }
  .items__row { padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
  .quote, .disclosure:not(.disclosure--inline) { padding: var(--space-sm) var(--space-md); }
  .quote .table th, .quote .table td { padding-right: var(--space-2xs); }
  .quote .table { font-size: var(--text-xs); }
}

/* Clients */
.client-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.client-logo { width: 44px; height: 44px; object-fit: contain; border-radius: var(--radius-sm); }  /* as uploaded, no white plate */
.client-dot { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--brand); }
.form-section { padding: var(--space-lg); display: grid; gap: var(--space-md); }
.field--wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: var(--space-2xs); font-weight: 500; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--color-accent-deep); }
input[type="color"] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-panel); }
input[type="email"], input[type="url"] { min-height: 44px; padding: 0 var(--space-sm); width: 100%; color: var(--color-ink); background: var(--color-panel); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); }
@media (max-width: 860px) {
  .client-row { grid-template-columns: auto minmax(0, 1fr); }
  .client-row .actions { grid-column: 1 / -1; }
  .form-section { padding: var(--space-md); }
}

.client-bar { display: flex; align-items: center; gap: var(--space-xs); border-top: 4px solid var(--brand); }
.client-chip { display: inline-flex; align-items: center; gap: 6px; }
.client-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.signature-preview { display: block; max-height: 80px; max-width: 260px; margin-block: var(--space-xs) var(--space-sm); background: var(--color-logo-bg); border-radius: var(--radius-sm); padding: 6px; }
.status--pending { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.status--returned { background: var(--color-late-soft); color: var(--color-late); }
/* rows without a leading badge: text, then the action */
.row--plain { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 860px) { .row--plain { grid-template-columns: minmax(0, 1fr); } .row--plain > .btn, .row--plain form { grid-column: 1 / -1; } }
/* rep's brand picker */
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-md); }
.pick form { margin: 0; }
.pick__card { width: 100%; display: grid; justify-items: start; gap: var(--space-2xs); padding: var(--space-lg); text-align: left; font: inherit; color: inherit; cursor: pointer; border-top: 4px solid var(--brand); }
.pick__card:hover { border-color: var(--brand); box-shadow: 0 6px 24px -12px var(--brand); }
.pick__card:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.pick__logo { max-height: 40px; max-width: 160px; margin-bottom: var(--space-xs); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--color-logo-bg); }
.pick__mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: var(--space-xs); }
.pick__name { font-size: var(--text-lg); font-weight: 600; }
.pick__meta { color: var(--color-muted); font-size: var(--text-sm); }
.side__client { display: grid; gap: 2px; margin: var(--space-sm) 0; padding: var(--space-xs) var(--space-sm); border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); }
.side__client small { color: var(--color-muted); font-size: var(--text-xs); }
.side__client strong { font-family: var(--font-display); font-size: var(--text-md); }
.side__client a { color: var(--color-accent-deep); font-size: var(--text-sm); }
.mobile-head__client { color: var(--color-ink); font-size: var(--text-sm); text-decoration: none; padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--color-rule); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .side__client { display: none; } }
.access { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr) auto; gap: var(--space-md); align-items: center; }
.access__clients { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); border: 0; margin: 0; padding: 0; }
@media (max-width: 860px) { .access { grid-template-columns: minmax(0, 1fr); } }
/* company facts from the lead source (e.g. DBD), shown on the call page */
.status--good { background: var(--color-money-soft); color: var(--color-money); }
.facts { display: grid; margin: 0; padding: 0; }
.facts__row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2.4fr); gap: var(--space-md); padding: var(--space-sm) var(--space-lg); border-top: 1px solid var(--color-rule); }
.facts__row:first-child { border-top: 0; }
.facts dt { color: var(--color-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .facts__row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--space-sm); } }
.secret { overflow-wrap: anywhere; font-size: var(--text-sm); }
@media (max-width: 860px) { .row--plain .actions form { flex: 1 1 100%; } }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.dial .btn { flex: 1 1 160px; }
/* Reps: kind is always shown in its own colour so in-house and freelance never blur */
.kind--inhouse { background: var(--color-accent-soft); color: var(--color-accent); }
.kind--freelance { background: var(--color-violet-soft); color: var(--color-violet-ink); }
.kind--lg { padding: 4px 14px; font-size: var(--text-sm); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2xs); align-items: center; }
.toolbar input[type="search"] { flex: 1 1 220px; width: auto; min-height: 44px; padding: 0 var(--space-sm); color: var(--color-ink); background: var(--color-panel); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); }
.toolbar select { width: auto; }
.segmented a { padding: 6px 14px; border-radius: var(--radius-pill); color: var(--color-ink-2); text-decoration: none; white-space: nowrap; }
.segmented a[aria-current="true"] { background: linear-gradient(135deg, var(--color-btn-from), var(--color-btn-to)); color: var(--color-on-accent); font-weight: 600; box-shadow: var(--shadow-btn); }
.tag { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 10px; border-radius: var(--radius-pill); background: var(--color-paper-2); font-size: var(--text-xs); white-space: nowrap; }
.tag b { color: var(--color-warm); }
.tag--own { background: var(--color-warm-soft); color: var(--color-warm); }
.reps tr.is-off td { opacity: .6; }
.actions--end { justify-content: flex-end; flex-wrap: nowrap; }
.btn-danger { color: var(--color-late); }
.btn-danger:hover { border-color: var(--color-late); }
.btn-danger-fill { background: var(--color-late); color: var(--color-on-accent); }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm) var(--space-md); }
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .toolbar .segmented { width: 100%; overflow-x: auto; }
  .actions--end { flex-wrap: wrap; justify-content: flex-start; }
}
/* Rep list on phones: one stacked card per rep instead of a sideways-scrolling table */
@media (max-width: 860px) {
  .reps thead { display: none; }
  .reps, .reps tbody { display: block; }
  .reps tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--space-sm); padding: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
  .reps td { display: block; padding: 0; border: 0; white-space: normal; }
  .reps td:nth-child(3) { grid-column: 1 / -1; }
  .reps td:nth-child(4)::before { content: "ลีดรอโทร "; color: var(--color-muted); }
  .reps td:nth-child(4) { text-align: left; }
  .reps td:nth-child(5) .btn { width: 100%; }
}
.nav-badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--color-accent); color: var(--color-on-accent); font-size: var(--text-xs); font-weight: 700; line-height: 22px; text-align: center; }
@media (max-width: 860px) { .side__link { position: relative; } .nav-badge { position: absolute; top: 2px; right: 18%; margin: 0; min-width: 18px; line-height: 18px; padding: 0 5px; } }
.row.inst { align-items: start; }

/* Owner lead page */
.segmented--scroll { display: flex; max-width: 100%; overflow-x: auto; }
.warn { color: var(--color-warm); }
.good { color: var(--color-money); }
/* Lead summary: one card per brand or channel, a bar of where its leads stand now */
.sources { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.source { display: grid; gap: var(--space-xs); padding: var(--space-md); align-content: start; }
.source__head { display: flex; justify-content: space-between; align-items: start; gap: var(--space-sm); }
.source__name { font-size: var(--text-md); margin: 0; }
.source__total { margin: 0; white-space: nowrap; color: var(--color-muted); }
.source__total b { font-size: var(--text-lg); color: var(--color-ink); }
.mix { display: flex; gap: 2px; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--color-track); }
.mix i { background: var(--c); min-width: 6px; }
.mix--new { --c: var(--color-warm); }
.mix--assigned { --c: var(--color-ink); }  /* green is taken by called leads */
.mix--contacted { --c: var(--color-money); }
.mix--escalated { --c: var(--color-late); }
.mix--closed { --c: var(--color-muted); }
.mix__legend { display: flex; flex-wrap: wrap; gap: 4px var(--space-sm); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--color-ink-2); }
.mix__legend li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c); }
.mix__legend .is-zero { color: var(--color-muted); }
.mix__legend .is-zero::before { background: var(--color-track); }
.after-call { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); margin: 0; padding: var(--space-xs) 0 0; list-style: none; border-top: 1px solid var(--color-rule); font-size: var(--text-sm); color: var(--color-muted); }
.after-call li { position: relative; display: grid; }
.after-call li + li::before { content: "›"; position: absolute; left: calc(var(--space-sm) / -2 - 3px); top: 2px; color: var(--color-muted); }
.after-call b { font-size: var(--text-md); color: var(--color-ink); }
.after-call .good b { color: var(--color-money); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs); margin-top: var(--space-sm); }
.pager__pages { display: flex; flex-wrap: wrap; gap: 4px; }
.pager__n { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--color-rule); border-radius: var(--radius-pill); background: var(--color-panel); color: var(--color-ink); text-decoration: none; }
.pager__n:hover { border-color: var(--color-muted); }
.pager__n[aria-current="page"] { background: var(--color-accent); border-color: transparent; color: var(--color-on-accent); font-weight: 700; }
.pager__gap { display: inline-grid; place-items: center; min-width: 24px; color: var(--color-muted); }
.tag--good { background: var(--color-money-soft); color: var(--color-money); }
.status--new { background: var(--color-warm-soft); color: var(--color-warm); }
.status--assigned { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.status--contacted { background: var(--color-money-soft); color: var(--color-money); }
.status--escalated { background: var(--color-late-soft); color: var(--color-late); }
.leads .status { margin-right: 6px; }
.leads tr.is-off td { opacity: .6; }
.filters .date { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--color-muted); }
.filters .date input { width: auto; }
.bulk { display: grid; gap: var(--space-2xs); padding: var(--space-sm) var(--space-md); }
.history { margin-top: 4px; font-size: var(--text-xs); color: var(--color-muted); font-weight: 400; white-space: normal; }
.history summary { cursor: pointer; }
.history ol { margin: 4px 0 0; padding-left: 1.2em; }
.nowrap, .leads .status { white-space: nowrap; }
.leads .status + .tag { display: table; margin-top: 4px; }
.leads td:nth-child(2) { white-space: normal; min-width: 16rem; }
.leads td:nth-child(2) .meta span:not(.num) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.leads { min-width: 760px; }
.leads__all { display: inline-flex; align-items: center; gap: var(--space-xs); }
.leads__all span { display: none; }
/* Phones: each lead becomes a stacked card instead of a row that scrolls sideways */
@media (max-width: 760px) {
  .leads, .leads thead, .leads tbody { display: block; min-width: 0; }
  .leads thead tr { display: block; padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-rule); }
  .leads thead th { display: none; padding: 0; border: 0; }
  .leads thead th:first-child { display: block; }
  .leads__all span { display: inline; font-family: var(--font-sans); letter-spacing: 0; font-size: var(--text-sm); }
  .leads tr { display: grid; grid-template-columns: 28px 1fr auto; column-gap: var(--space-xs); row-gap: 6px; padding: var(--space-sm) var(--space-md);
    grid-template-areas: "pick lead date" "pick status status" "pick client client" "pick channel channel" "pick rep rep"; border-bottom: 1px solid var(--color-rule); }
  .leads tbody tr:last-child { border-bottom: 0; }
  .leads td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; }
  .leads td.c-pick { grid-area: pick; padding-top: 2px; }
  .leads td.c-lead { grid-area: lead; min-width: 0; } /* drops the desktop column's 16rem floor */
  .leads td.c-date { grid-area: date; font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
  .leads td.c-status { grid-area: status; }
  .leads td.c-client { grid-area: client; }
  .leads td.c-channel { grid-area: channel; }
  .leads td.c-rep { grid-area: rep; }
  .leads td[data-label]::before { content: attr(data-label) " "; color: var(--color-muted); font-size: var(--text-sm); }
  .leads td[data-label] .small { display: inline; margin-left: 4px; }
  .leads td[colspan] { grid-column: 1 / -1; }
}

/* Handoff to the client's closer */
.rows audio { width: 100%; max-width: 520px; }

/* Brand picker: the to-call count leads, then what else waits for the rep */
.pick { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.pick__card { display: grid; justify-items: stretch; gap: var(--space-sm); cursor: default; }
.pick__card:hover { border-color: var(--color-rule); border-top-color: var(--brand); box-shadow: none; }
.pick__card--late { box-shadow: 0 0 0 1px var(--color-late); }
.pick__head { display: flex; align-items: center; gap: var(--space-xs); }
.pick__head .pick__mark, .pick__head .pick__logo { margin: 0; }
.pick__count { display: flex; align-items: baseline; gap: var(--space-xs); width: 100%; padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-accent-soft); border-radius: var(--radius-card); background: var(--color-accent-soft); color: var(--color-ink); font: inherit; text-align: left; cursor: pointer; }
.pick__count:hover { border-color: var(--color-accent); }
.pick__count.is-zero { background: var(--color-paper-2); border-color: var(--color-rule); color: var(--color-muted); }
.pick__num { font-size: var(--text-3xl); font-weight: 600; line-height: 1; letter-spacing: -0.045em; color: var(--color-accent); }
.pick__count.is-zero .pick__num { color: var(--color-muted); }
.pick__label { font-weight: 500; }
.pick__go { justify-self: stretch; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alerts:empty { display: none; }
.alert button { width: 100%; display: flex; align-items: center; gap: var(--space-2xs); padding: 8px var(--space-sm); border: 0; border-radius: var(--radius-sm); background: var(--color-paper-2); color: var(--color-ink-2); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.alert button::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--color-muted); }
.alert button:hover { color: var(--color-ink); }
.alert b { margin-left: auto; font-weight: 600; color: var(--color-ink); }
.alert--late button { background: var(--color-late-soft); color: var(--color-late); }
.alert--late button::before { background: var(--color-late); }
.alert--late b { color: var(--color-late); }
.alert--good button { background: var(--color-money-soft); color: var(--color-money); }
.alert--good button::before { background: var(--color-money); }
.alert--good b { color: var(--color-money); }
.alert--warm button { background: var(--color-warm-soft); color: var(--color-warm); }
.alert--warm button::before { background: var(--color-warm); }
.alert--warm b { color: var(--color-warm); }
.alert--accent button { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.alert--accent button::before { background: var(--color-accent); }
.alert--accent b { color: var(--color-accent); }
.alerts--row { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: var(--space-md); }
.tag--new { background: var(--color-money-soft); color: var(--color-money); }
.head h1.quote-line { max-width: 28ch; text-wrap: balance; }
a.status--link { text-decoration: none; }
a.status--link:hover { box-shadow: 0 0 0 1px currentColor; }
.reply { margin: 0; padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--color-money); border-radius: var(--radius-sm); background: var(--color-paper-2); font-size: var(--text-md); }
/* Brand logos sit on a white square plate: they are drawn for light backgrounds */
.pick__head .pick__logo, .pick__head .pick__mark { flex: none; width: 56px; height: 56px; max-width: none; max-height: none; padding: 6px; border-radius: 14px; }
.pick__head .pick__logo { object-fit: contain; padding: 0; background: none; }  /* the logo as uploaded, no white plate */
.pick__head .pick__mark { font-size: var(--text-lg); }
.client-logo--lg { width: 96px; height: 96px; }

/* Rep dashboard: the commission estimate leads, the other figures sit under it */
.tiles--hero .tile:nth-child(-n+2) { border-top: 1px solid var(--color-rule); }
.tiles--hero .tile:nth-child(even) { border-left: 0; }
.tiles--hero .tile:nth-child(odd):not(.tile--hero) { border-left: 1px solid var(--color-rule); }
.tile--hero { grid-column: 1 / -1; border-top: 0 !important; padding: var(--space-lg) var(--space-md); background: linear-gradient(135deg, var(--color-money-soft), transparent 70%); }
.tile--hero dt { color: var(--color-money); font-weight: 500; }
.tile--hero dd { font-size: var(--text-3xl); letter-spacing: -0.045em; color: var(--color-money); line-height: 1.1; }
.tile--hero dd small { font-size: var(--text-md); }
.tile__sub { margin: var(--space-2xs) 0 0; font-size: var(--text-sm); color: var(--color-ink-2); }
.text-money { color: var(--color-money); }

/* AI training page (owner) */
.lesson { display: grid; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); }
.lesson__text { white-space: pre-line; line-height: 1.7; max-width: 72ch; }
.lesson .disclosure--inline .rows { margin-top: var(--space-xs); }
.tier-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap;
  padding: var(--space-md) var(--space-lg) var(--space-2xs); }
#library .card + .card { margin-top: var(--space-sm); }
.report-note { padding: var(--space-sm) var(--space-md); margin: 0; }
.table--fit td:first-child { white-space: normal; }
.form-stack { display: grid; gap: var(--space-md); padding: var(--space-md) var(--space-lg); }
.form-stack .btn { justify-self: start; }
.correct { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin-top: var(--space-2xs); }
.correct select, .correct input[type="text"] { font: inherit; font-size: var(--text-sm); padding: 6px var(--space-xs);
  border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-panel); color: inherit; }
.correct input[type="text"] { flex: 1 1 16rem; min-width: 0; }
.correct select { width: auto; flex: 0 0 auto; }
@media (max-width: 760px) {
  .lesson, .form-stack { padding: var(--space-sm); }
  .tier-head { padding: var(--space-sm) var(--space-sm) 0; }
  .table--fit th, .table--fit td { padding: var(--space-xs) 6px; }
}
.tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles--3 .tile { border-top: 0; }
.tiles--3 .tile + .tile { border-left: 1px solid var(--color-rule); }
@media (max-width: 760px) {
  .tiles--3 { grid-template-columns: minmax(0, 1fr); }
  .tiles--3 .tile + .tile { border-left: 0; border-top: 1px solid var(--color-rule); }
}
/* Hot/Warm/Cold rules and the owner's review */
.label-rules dl { display: grid; gap: 6px; margin: var(--space-2xs) 0 0; }
.label-rules dl div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); align-items: center; gap: var(--space-xs); }
.label-rules dt { justify-self: start; display: inline-flex; align-items: center; cursor: default; }
.label-rules dd { margin: 0; font-size: var(--text-sm); }
.review { display: grid; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); }
.review fieldset { border: 0; padding: 0; margin: 0; }
.review legend { margin-bottom: var(--space-2xs); }
.temp__pick { display: inline-flex; cursor: pointer; }
.temp__pick input { position: absolute; opacity: 0; pointer-events: none; }
.temp__pick .temp__opt { display: inline-flex; align-items: center; }
.temp__pick input:checked + .temp__opt { border-color: transparent; color: var(--color-on-accent); }
.temp__pick input:checked + .temp__opt--hot { background: var(--color-accent-deep); }
.temp__pick input:checked + .temp__opt--warm { background: var(--color-warm); }
.temp__pick input:checked + .temp__opt--cold { background: var(--color-cold); }
.temp__pick input:checked + .temp__opt--unknown { background: var(--color-ink-2); }
.temp__pick input:focus-visible + .temp__opt { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (max-width: 760px) {
  .review { padding: var(--space-sm); }
  .label-rules dl div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
.tag--alert { background: var(--color-late-soft); color: var(--color-late); }
/* Deals: five columns that fit beside the menu; cards on phones */
.deals th, .deals td { padding-left: var(--space-sm); padding-right: var(--space-sm); }
.deals td { vertical-align: middle; }
.deals td.d-lead { white-space: normal; }
.deals .status { white-space: nowrap; }
.deals .d-val { display: inline-grid; justify-items: end; gap: 2px; }
.deals .d-money .tag { margin: 0 0 0 4px; }
@media (max-width: 760px) {
  .deals, .deals tbody, .deals tr { display: block; }
  .deals thead { display: none; }
  .deals tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2xs) var(--space-sm); padding: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
  .deals tbody tr:last-child { border-bottom: 0; }
  .deals td { display: block; padding: 0; border: 0; text-align: left; }
  .deals .d-lead { grid-column: 1; white-space: normal; }
  .deals .d-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .deals .d-quote, .deals .d-money { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: var(--space-sm); font-size: var(--text-sm); }
  .deals .d-quote, .deals .d-money { align-items: flex-start; }
  .deals [data-label]::before { content: attr(data-label); color: var(--color-muted); }
  .deals tbody tr:hover td { background: none; }
}
.status--owner { background: var(--color-violet-soft); color: var(--color-violet-ink); }
/* AI call guide on the call page */
.brief { display: grid; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); margin-bottom: var(--space-md); }
.brief summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--space-sm); cursor: pointer; list-style: none; }
.brief summary::-webkit-details-marker { display: none; }
.brief summary h2 { font-size: var(--text-md); }
.brief summary h2::after { content: " ▾"; color: var(--color-muted); font-size: var(--text-sm); }
.brief:not([open]) summary h2::after { content: " ▸"; }
.brief__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md) var(--space-lg); }
.brief__col { display: grid; gap: var(--space-sm); align-content: start; min-width: 0; }
.brief h3 { font-size: var(--text-sm); color: var(--color-muted); font-weight: 500; margin-bottom: 4px; }
.brief p, .brief li { line-height: 1.65; }
.brief ol, .brief ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; }
.brief__focus { background: var(--color-accent-soft); border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-sm); }
.brief__focus h3 { color: var(--color-accent); }
.brief__say { color: var(--color-ink); }
.brief .brief__packs { list-style: none; padding-left: 0; }
.brief__packs li { display: grid; gap: 2px; }
@media (max-width: 760px) {
  .brief { padding: var(--space-sm); }
  .brief__grid { grid-template-columns: minmax(0, 1fr); }
}
/* Commission statements on the owner's dashboard */
.cmonth { display: flex; gap: var(--space-2xs); }
.cmonth .btn { min-width: 40px; padding-left: 0; padding-right: 0; justify-content: center; }
.cstate { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-sm); }
.cstatements td { vertical-align: middle; }
.cstatements form { display: inline; }
/* The rep ends a lead as ปิดไม่ได้ */
.lost { padding: var(--space-sm) var(--space-lg); margin-top: var(--space-md); }
.lost summary { cursor: pointer; font-weight: 600; color: var(--color-late); min-height: 32px; display: flex; align-items: center; }
.lost__form { display: grid; gap: var(--space-sm); margin-top: var(--space-xs); }
.lost__form .btn { justify-self: start; }
@media (max-width: 760px) { .lost { padding: var(--space-sm); } .lost__form .btn { justify-self: stretch; } }
.lost-link { color: var(--color-muted); text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.inline-form { margin-top: var(--space-2xs); }
/* Call library shelves: one shelf at a time, filtered and paged so it stays usable with thousands of calls */
.shelf { display: grid; }
.shelf__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs) var(--space-sm);
  padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.shelf__head p { margin: 0; max-width: 60ch; }
.shelf__filters { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.shelf__filters select { font: inherit; font-size: var(--text-sm); padding: 6px var(--space-xs); border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill); background: var(--color-panel); color: inherit; max-width: 100%; }
.shelf__sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 90ch; }
.shelf__pager { padding: var(--space-xs) var(--space-md); margin-top: 0; border-top: 1px solid var(--color-rule); }
@media (max-width: 760px) { .shelf__head, .shelf__pager { padding: var(--space-xs) var(--space-sm); } }
/* Deal stage on the rep's called list */
.status--stage-good { background: var(--color-money-soft); color: var(--color-money); }
.status--stage-won { background: var(--color-money-soft); color: var(--color-money); }
.status--stage-quoted { background: var(--color-accent-soft); color: var(--color-accent-deep); }
.status--stage-open { background: var(--color-violet-soft); color: var(--color-violet-ink); }
.done-dot--off { background: var(--color-muted); }
#called .segmented { margin-bottom: var(--space-sm); }

/* ── Dashboard charts: daily trend (two series, one axis) and the lead-to-won funnel (one hue) ── */
.chart, .funnel { margin: 0; padding: var(--space-md) var(--space-lg); display: grid; gap: var(--space-sm); }
.chart__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-2xs) var(--space-md); }
.chart__title { margin: 0; font-size: var(--text-md); font-weight: 500; }
.chart__legend { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--color-ink-2); }
.chart__key::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 6px; border-radius: 2px; vertical-align: middle; background: var(--c); }
.chart__key b { color: var(--color-ink); }
.chart__key--leads { --c: var(--color-series-1); }
.chart__key--calls { --c: var(--color-series-2); }
.chart__plot { position: relative; }
.chart__plot svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart__plot svg:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; }
.chart__grid { stroke: var(--color-rule); stroke-width: 1; }
.chart__axis { font-family: var(--font-sans); font-size: 12px; fill: var(--color-muted); }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--leads { stroke: var(--color-series-1); }
.chart__line--calls { stroke: var(--color-series-2); }
.chart__area { fill: var(--color-series-1); opacity: 0.08; }
.chart__hover { opacity: 0; pointer-events: none; }
.chart__hover.is-on { opacity: 1; }
.chart__cross { stroke: var(--color-ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart__dot { stroke: var(--color-panel); stroke-width: 2; }
.chart__dot--leads { fill: var(--color-series-1); }
.chart__dot--calls { fill: var(--color-series-2); }
.chart__tip { position: absolute; top: 2%; margin: 0; transform: translateX(-50%); padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--color-ink); color: var(--color-panel); font-size: var(--text-xs); white-space: nowrap; pointer-events: none; }
.chart__table summary { font-size: var(--text-sm); }
.funnel__steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.funnel__step { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 10rem; align-items: center; gap: var(--space-sm); }
.funnel__name { font-size: var(--text-sm); color: var(--color-ink-2); }
.funnel__track { height: 14px; background: var(--color-track); border-radius: 0 4px 4px 0; overflow: hidden; }
.funnel__bar { display: block; height: 100%; width: max(var(--pct), 3px); background: var(--color-series-1); border-radius: 0 4px 4px 0; }
.funnel__n b { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 400; font-variant-numeric: lining-nums tabular-nums; }
.funnel__n small { margin-left: 4px; font-size: var(--text-xs); color: var(--color-muted); }
@media (max-width: 760px) {
  .chart, .funnel { padding: var(--space-sm); }
  .chart__axis { font-size: 22px; }  /* the 640-wide plot shrinks to about half on phones */
  .funnel__step { grid-template-columns: 4.5rem minmax(0, 1fr); row-gap: 2px; }
  .funnel__n { grid-column: 2; }
}

/* ── Motion: sections rise in once, bars grow, the ring fills, the trend draws, late rings pulse twice.
   transform/opacity only (the ring animates its own fill angle). All of it is off for reduced motion. ── */
@property --left { syntax: "<number>"; inherits: false; initial-value: 0; }
.goal__figure, .tile dd, .money__side dd, .pick__num, .pay__amount { font-variant-numeric: lining-nums tabular-nums; }  /* steady width while counting up */
.ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--color-late); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .page > * { animation: rise var(--dur-mid) var(--ease-out) both; }
  .page > :nth-child(2) { animation-delay: 50ms; }
  .page > :nth-child(3) { animation-delay: 100ms; }
  .page > :nth-child(4) { animation-delay: 150ms; }
  .page > :nth-child(5) { animation-delay: 200ms; }
  .page > :nth-child(6) { animation-delay: 250ms; }
  .page > :nth-child(n+7) { animation-delay: 300ms; }
  .track span, .bar i::before, .mix i, .funnel__bar, .hbar i, .sc-meter i, .sc-goal i, .sc-bullet i, .sc-stars__bar i, .sc-stack, .sc-temp { transform-origin: left center; animation: grow 900ms var(--ease-out) 200ms both; }
  .funnel__bar { animation-delay: calc(250ms + var(--i, 0) * 110ms); }
  .ring { animation: ring-fill 1100ms var(--ease-out) 150ms both; }
  .ring--late::after { animation: ring-pulse 1600ms var(--ease-out) 900ms 2; }
  .chart__line { stroke-dasharray: 1; animation: draw 1400ms var(--ease-out) 250ms both; }
  .chart__line--calls { animation-delay: 500ms; }
  .chart__area { animation: fade 900ms var(--ease-out) 900ms both; }
  .chart__hover { transition: opacity var(--dur-short) var(--ease-out); }
  .pick__card, .source { transition: transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
  .pick__card:hover, .source:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes ring-fill { from { --left: 0; } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes ring-pulse { from { opacity: 0.6; transform: scale(1); } to { opacity: 0; transform: scale(1.4); } }

/* Sales Scorecard, sales report and top 5 calls (ported from the Sales Support Center) */
.tag--hot { background: var(--color-late-soft); color: var(--color-late); }
.tag--warm { background: var(--color-warm-soft); color: var(--color-warm); }
.tag--cold { background: var(--color-cold-soft); color: var(--color-cold); }
a.tag { text-decoration: none; }
.hbar { display: block; height: 8px; border-radius: var(--radius-pill); background: var(--color-track); overflow: hidden; }
.hbar i { display: block; height: 100%; width: var(--pct); background: var(--color-accent); border-radius: inherit; }
.hbars { list-style: none; margin: 0; padding: var(--space-sm) var(--space-lg); display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto auto; gap: var(--space-sm); align-items: center; font-size: var(--text-sm); }
.hbars li > .num { text-align: right; min-width: 9ch; }
.top5 { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-md); padding: var(--space-lg); }
.top5__rank { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 300; line-height: 1; color: var(--color-accent); }
.top5__body { display: grid; gap: var(--space-2xs); justify-items: start; min-width: 0; }
.top5__body h2 { margin: 0; font-size: var(--text-xl); }
.top5__meta { margin: 0; font-size: var(--text-sm); color: var(--color-muted); }
.top5__body .player { width: 100%; }
@media (max-width: 860px) {
  .hbars { padding: var(--space-sm); }
  .hbars li { grid-template-columns: minmax(0, 1fr) auto; }
  .hbars .hbar { grid-column: 1 / -1; grid-row: 2; }
  .top5 { padding: var(--space-md); gap: var(--space-sm); }
}
.tag--afford-high { background: var(--color-money-soft); color: var(--color-money); }
.tag--afford-medium { background: var(--color-warm-soft); color: var(--color-warm); }
.tag--afford-low { background: var(--color-late-soft); color: var(--color-late); }
/* Long brand names in a segmented filter scroll inside it instead of widening the whole page */
.head > * { min-width: 0; max-width: 100%; }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
@media (max-width: 860px) {
  /* More menu items than fit a phone: the bottom bar scrolls sideways instead of cutting the last ones off */
  .side__nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .side__nav::-webkit-scrollbar { display: none; }
  .side__link { flex: 1 0 auto; min-width: 64px; white-space: nowrap; }
}

/* Lead chats: every channel on the lead page (calls and LINE) */
#chats .chips { margin: 0; }
.chat-sum h3 { font-size: var(--text-sm); margin: 0 0 4px; color: var(--color-muted); font-weight: 600; }
.chat-sum ul { margin: 0; padding-left: 1.1em; font-size: var(--text-sm); }
.chat-sum__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-sm); }
.chat-add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-lg); padding: var(--space-sm) 0; }
.chat-add__form { display: grid; gap: var(--space-2xs); align-content: start; }
.chat-add__form ol { margin: 0 0 var(--space-2xs); padding-left: 1.2em; }
.chat-add__form .btn { justify-self: start; margin-top: var(--space-2xs); }
.chat-add__bot { border-left: 1px solid var(--color-rule); padding-left: var(--space-lg); display: grid; gap: var(--space-2xs); align-content: start; justify-items: start; }
.chat-add h3 { margin: 0; font-size: var(--text-md); }
.chat-code { margin: 0; font-family: var(--font-mono); font-size: var(--text-xl); letter-spacing: 0.04em; padding: 4px 14px; border: 1px dashed var(--color-rule); border-radius: var(--radius-sm); }
.chat { padding: var(--space-sm) var(--space-lg) var(--space-lg); }
.chat__more { margin: 0 0 var(--space-sm); text-align: center; font-size: var(--text-sm); }
.chat__day { margin: var(--space-md) 0 var(--space-2xs); text-align: center; font-size: var(--text-xs); color: var(--color-muted); }
.chat__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chat__msg { max-width: min(78%, 38rem); padding: 8px 12px; border-radius: 14px; background: var(--color-panel); border: 1px solid var(--color-rule); }
.chat__msg--rep { justify-self: end; background: var(--color-accent-soft); border-color: transparent; border-bottom-right-radius: 4px; }
.chat__msg--customer, .chat__msg--other { justify-self: start; border-bottom-left-radius: 4px; }
.chat__who { margin: 0 0 2px; font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-2); }
.chat__time { font-weight: 400; color: var(--color-muted); }
.chat__via { font-weight: 400; color: var(--color-muted); }
.chat__text { margin: 0; overflow-wrap: anywhere; }
.chat__call { justify-self: center; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: var(--text-sm);
  padding: 6px 14px; border-radius: var(--radius-pill); background: var(--color-paper-2); max-width: 100%; }
@media (max-width: 860px) {
  .chat-add { grid-template-columns: minmax(0, 1fr); }
  .chat-add__bot { border-left: 0; padding-left: 0; border-top: 1px solid var(--color-rule); padding-top: var(--space-sm); }
  .chat { padding: var(--space-2xs) var(--space-sm) var(--space-md); }
  .chat__msg { max-width: 88%; }
}

/* Lead quality, potential and dead leads (leadquality.py) */
/* The rep's called-lead summary: three glass tiles, each a big figure with one small picture of it under */
.lq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); margin: 0 0 var(--space-sm); }
.lq__tile { padding: var(--space-md); display: grid; gap: var(--space-2xs); align-content: start; min-width: 0; }
.lq__label { font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); }
.lq__fig { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--space-2xs); }
.lq__fig b { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 400; line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: lining-nums proportional-nums; }  /* Outfit's tabular 1 has a foot; a lone big figure needs no column alignment */
@media (max-width: 860px) { .lq__fig b { font-size: var(--text-xl); } }
.lq__fig small { color: var(--color-muted); font-size: var(--text-md); margin-right: var(--space-2xs); }
.lq__fig .tag { margin: 0; align-self: center; font-size: var(--text-xs); font-weight: 600; }
.lq__tag--warm { background: var(--color-warm-soft); color: var(--color-warm); }
.lq__tag--cold { background: var(--color-cold-soft); color: var(--color-cold); }
.lq__bar { height: 10px; margin-top: 2px; }
.lq__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--color-ink-2); }
.lq__legend span { display: inline-flex; align-items: center; gap: 6px; }
.lq__legend i { width: 8px; height: 8px; border-radius: 50%; }
.lq__stars { position: relative; display: inline-block; align-self: start; font-size: 1.375rem; letter-spacing: 2px; line-height: 1; color: var(--color-track); }
.lq__stars-on { position: absolute; inset: 0 auto 0 0; overflow: hidden; white-space: nowrap; color: var(--color-accent-2); }
.lq__track { height: 10px; margin-top: 2px; }
.lq__track span { background: var(--color-money); }
.lq__tile--alert .lq__track span { background: var(--color-late); }
.lq__tile--alert .lq__fig b { color: var(--color-late); }
@media (max-width: 860px) {
  .lq { grid-template-columns: minmax(0, 1fr); }
  .lq__tile { padding: var(--space-sm) var(--space-md); }
}
.tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles--3 .tile:nth-child(-n+3) { border-top: 0; }
.tiles--3 .tile + .tile { border-left: 1px solid var(--color-rule); }
#lead-quality .disclosure--inline { margin-top: var(--space-sm); }
.potential { display: inline-flex; align-items: center; gap: 2px; margin: 4px 0; }
.potential__label { font-size: var(--text-xs); color: var(--color-muted); margin-right: 6px; }
.potential__star { min-width: 32px; min-height: 32px; border: 0; background: none; padding: 0; cursor: pointer; font-size: 20px; line-height: 1; color: var(--color-track); }
.potential__star.is-on { color: var(--color-warm); }
.potential__star:hover, .potential__star:focus-visible { color: var(--color-warm); }
.potential__clear { border: 0; background: none; margin-left: 6px; font-size: var(--text-xs); color: var(--color-muted); cursor: pointer; text-decoration: underline; }
@media (max-width: 860px) {
  .tiles--3 { grid-template-columns: minmax(0, 1fr); }
  .tiles--3 .tile + .tile { border-left: 0; border-top: 1px solid var(--color-rule); }
}
.block > details { min-width: 0; }  /* a table inside scrolls in its own frame instead of widening the section */
.lead-emails { display: grid; gap: var(--space-2xs); padding: var(--space-sm) var(--space-lg); }
.lead-emails label { font-weight: 600; font-size: var(--text-sm); }
.lead-emails__row { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.lead-emails__row input { flex: 1 1 16rem; min-width: 0; }
.lead-emails p { margin: 0; }
@media (max-width: 860px) { .lead-emails { padding: var(--space-sm); } }

/* Sales Scorecard charts: one colour per score axis (tokens --color-ax-*), numbers always beside the marks */
.ax-sales { --ax: var(--color-ax-sales); } .ax-activity { --ax: var(--color-ax-activity); } .ax-quality { --ax: var(--color-ax-quality); }
.ax-speed { --ax: var(--color-ax-speed); } .ax-temperature { --ax: var(--color-ax-temperature); }
.sc-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--text-sm); }
.sc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.sc-legend i, .sc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ax); flex: none; }
.sc-lv { font-size: var(--text-xs); font-weight: 600; color: var(--color-accent-deep); background: var(--color-accent-soft); padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
[data-tip] { position: relative; outline-offset: 2px; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 4px 8px; border-radius: var(--radius-sm); background: var(--color-ink); color: var(--color-on-accent); font-size: var(--text-xs); z-index: 5; pointer-events: none; }

.sc-board { padding: var(--space-2xs) var(--space-lg) var(--space-sm); }
.sc-board ol { list-style: none; margin: 0; padding: 0; }
.sc-board__row { display: grid; grid-template-columns: 2ch minmax(0, 9rem) auto minmax(0, 1fr) 4ch; gap: var(--space-sm); align-items: center;
  padding: 10px 0; border-top: 1px solid var(--color-rule); }
.sc-board__row:first-child { border-top: 0; }
.sc-board__no { color: var(--color-muted); }
.sc-board__name { font-weight: 600; color: var(--color-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-board__total { font-family: var(--font-display); font-size: var(--text-xl); text-align: right; }
.sc-stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; background: var(--color-track); transform-origin: left center; }
.sc-stack i { width: var(--w); background: var(--ax); }
.sc-stack i:first-child { border-radius: 4px 0 0 4px; }
.sc-stack i:last-child { border-radius: 0 4px 4px 0; }
.sc-stack i:only-child { border-radius: 4px; }
.sc-table { margin-top: var(--space-2xs); }

.sc-card { padding: var(--space-lg); display: grid; gap: var(--space-lg); }
.sc-hero { display: grid; grid-template-columns: 132px minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--space-lg); align-items: center;
  padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-rule); }
.sc-ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.sc-ring__track { fill: none; stroke: var(--color-track); stroke-width: 12; }
.sc-ring__arc { fill: none; stroke: var(--ax); stroke-width: 12; }
.sc-ring text { transform: rotate(90deg); transform-origin: 60px 60px; text-anchor: middle; fill: var(--color-ink); }
.sc-ring__num { font-family: var(--font-display); font-size: 30px; }
.sc-ring__of { font-size: 10px; fill: var(--color-muted) !important; }
.sc-hero__who h2 { margin: 0; font-size: var(--text-2xl); }
.sc-rank { margin: 6px 0 2px; font-weight: 600; }
.sc-axes { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.sc-axes li { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) 5ch; gap: var(--space-sm); align-items: center; font-size: var(--text-sm); }
.sc-axes li > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.sc-axes li > .num { text-align: right; font-weight: 600; }
.sc-axes small, .sc-part__big small { font-size: var(--text-sm); color: var(--color-muted); font-family: var(--font-sans); font-weight: 400; }
.sc-meter, .sc-goal, .sc-bullet, .sc-stars__bar { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--color-track); }
.sc-meter i, .sc-goal i, .sc-bullet i, .sc-stars__bar i { display: block; height: 100%; width: var(--pct); border-radius: 4px; background: var(--ax, var(--color-accent)); }

.sc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.sc-part { min-width: 0; padding-top: var(--space-sm); border-top: 3px solid var(--ax); display: grid; gap: 8px; align-content: start; }
.sc-part--plain { border-top-color: var(--color-ink); }
.sc-part h3 { margin: 0; font-size: var(--text-md); }
.sc-part h3 small { display: block; font-weight: 400; font-size: var(--text-xs); margin-top: 2px; }
.sc-part p { margin: 0; }
.sc-part__big { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1.1; }
.sc-goal { height: 10px; }
.sc-bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sc-bullets p:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); }
.sc-bullet { height: 10px; margin: 4px 0 2px; }
.sc-bullet b { position: absolute; top: -4px; bottom: -4px; left: var(--at); width: 2px; background: var(--color-ink); }
/* Activity bars split by channel: segments side by side, a 2px surface gap between them, the target tick on top */
.sc-bullet--split { display: flex; }
.sc-bullet--split i { flex: none; border-radius: 0; }
.sc-bullet--split i:first-child { border-radius: 4px 0 0 4px; }
.sc-bullet--split i:nth-last-child(2) { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.sc-bullet--split i + i { box-shadow: -2px 0 0 var(--color-panel); }
.sc-bullet--split b { z-index: 1; }
.sc-channels { display: flex; flex-wrap: wrap; gap: 2px var(--space-sm); margin: 0; color: var(--color-muted); }
.sc-channels span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sc-channels b { color: var(--color-ink); font-weight: 600; }
.ch-call { --ax: var(--color-ch-call); }
.ch-line { --ax: var(--color-ch-line); }
.ch-email { --ax: var(--color-ch-email); }
.sc-scale { position: relative; height: 10px; border-radius: 4px; background: var(--color-track); margin-top: 4px; }
.sc-scale__good { position: absolute; inset: 0 50% 0 0; border-radius: 4px 0 0 4px; background: color-mix(in oklch, var(--ax) 35%, transparent); }
.sc-scale b { position: absolute; top: -5px; left: calc(var(--at) - 7px); width: 14px; height: 20px; border-radius: 4px; background: var(--ax); border: 2px solid var(--color-panel); }
.sc-scale::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: 50%; width: 2px; background: var(--color-ink); }
.sc-scale__ticks { display: flex; justify-content: space-between; }
.sc-temp { display: flex; gap: 2px; height: 14px; border-radius: 4px; transform-origin: left center; }
.sc-temp i { width: var(--w); }
.sc-temp i:first-child { border-radius: 4px 0 0 4px; } .sc-temp i:last-child { border-radius: 0 4px 4px 0; } .sc-temp i:only-child { border-radius: 4px; }
.sc-temp__hot { background: var(--color-late); } .sc-temp__warm { background: var(--color-warm); }
.sc-temp__cold { background: var(--color-cold); } .sc-temp__unknown { background: var(--color-track); }
.sc-temp__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sc-temp__legend span { display: inline-flex; align-items: center; gap: 6px; }
.sc-temp__legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sc-stars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sc-stars li { display: grid; grid-template-columns: 2.5ch minmax(0, 1fr) 3ch; gap: 8px; align-items: center; font-size: var(--text-sm); }
.sc-stars__k { color: var(--color-warm); }
.sc-stars__bar i { background: var(--color-warm); }
.sc-stars li > .num { text-align: right; }
@media (max-width: 1100px) { .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sc-hero { grid-template-columns: 132px minmax(0, 1fr); } .sc-hero .sc-axes { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .sc-card { padding: var(--space-md); gap: var(--space-md); }
  .sc-grid { grid-template-columns: minmax(0, 1fr); }
  .sc-hero { grid-template-columns: 104px minmax(0, 1fr); gap: var(--space-md); }
  .sc-ring { width: 104px; height: 104px; }
  .sc-board { padding: var(--space-2xs) var(--space-sm) var(--space-sm); }
  .sc-board__row { grid-template-columns: 2ch minmax(0, 1fr) auto 4ch; row-gap: 6px; }
  .sc-stack { grid-column: 1 / -1; }
}

/* Sales documents (pitches.py): Deck, Understanding and the closer summary from one form */
.pitch-docs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.pitch-doc { padding: var(--space-md); display: grid; gap: var(--space-2xs); align-content: start; }
.pitch-doc__kind { font-weight: 600; font-size: var(--text-lg); }
.pitch-doc .actions { margin-top: var(--space-2xs); }
.pitch-form, .pitch-form__body { display: grid; gap: var(--space-md); border: 0; padding: 0; margin: 0; min-width: 0; }
.pitch-items { display: grid; gap: var(--space-xs); }
.pitch-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 9rem 5.5rem; gap: var(--space-2xs) var(--space-sm);
              align-items: end; padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.pitch-item > .small { align-self: center; }
.pitch-item__in { display: grid; gap: 2px; }
.pitch-ai { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.pitch-group__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; }
.pitch-form .chips .chip { font: inherit; font-size: var(--text-sm); cursor: pointer; text-align: left; }
@media (max-width: 860px) {
  .pitch-docs, .pitch-ai { grid-template-columns: minmax(0, 1fr); }
  .pitch-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pitch-item .check, .pitch-item > .small { grid-column: 1 / -1; }
}

/* Sales assistant (assist.py): the rep's hand-over card and the assistant's queue */
.assist { display: grid; gap: var(--space-xs); margin-top: var(--space-md); }
.assist__form { display: grid; gap: var(--space-sm); }
.assist__kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-md); min-width: 0; }
.assist__kinds legend { padding: 0; margin-bottom: 2px; }
.assist__done { display: grid; gap: 4px; padding-bottom: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
.queue-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.queue-row form { display: flex; gap: var(--space-2xs); flex-wrap: wrap; align-items: center; }
.queue-row textarea { font: inherit; min-width: 14rem; padding: var(--space-2xs) var(--space-xs); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-panel); }
@media (max-width: 860px) { .queue-row { grid-template-columns: minmax(0, 1fr); } .queue-row textarea { min-width: 0; width: 100%; } }

/* Sales Content (content.py): guide topics from a brand's calls, and the AI drafts written from them */
.content-guide { margin-bottom: var(--space-md); }
.content-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--space-sm); }
.content-topic { padding: var(--space-md); display: grid; gap: var(--space-xs); align-content: start; }
.content-topic h3, .content-piece h3 { font-size: var(--text-md); font-weight: 600; margin: 0; }
.content-quotes { margin: 0; padding-left: 1.1em; display: grid; gap: 2px; font-size: var(--text-sm); color: var(--color-ink-2); }
.content-piece { padding: var(--space-md); display: grid; gap: var(--space-xs); margin-bottom: var(--space-sm); }
.content-drafts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.content-draft { display: grid; gap: var(--space-2xs); align-content: start; padding: var(--space-sm); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); }
.content-draft__title { font-weight: 600; }
.content-draft__text { font-size: var(--text-sm); overflow-wrap: anywhere; }
.content-draft .btn { justify-self: start; }
@media (max-width: 860px) { .content-drafts { grid-template-columns: minmax(0, 1fr); } }
.assist__kindline { font-size: var(--text-lg); font-weight: 600; }

/* Web research before the call (research.py): findings with their sources, under the AI call guide */
.research { display: grid; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); margin-bottom: var(--space-md); }
.research__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2xs) var(--space-sm); }
.research__head h2 { font-size: var(--text-md); }
summary.research__head { cursor: pointer; list-style: none; }
summary.research__head::-webkit-details-marker { display: none; }
.research__head h2::after { content: " ▾"; color: var(--color-muted); font-size: var(--text-sm); }
.research:not([open]) .research__head h2::after { content: " ▸"; }
.research__lead { flex-basis: 100%; color: var(--color-ink-2); }
.research__lead b { color: var(--color-accent); font-weight: 600; white-space: nowrap; }
.research[open] .research__lead b { display: none; }
.research__match--sure { background: var(--color-money-soft); color: var(--color-money); }
.research__match--likely { background: var(--color-accent-soft); color: var(--color-accent); }
.research__match--unsure { background: var(--color-warm-soft); color: var(--color-warm); }
.research__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md) var(--space-lg); }
.research__col { display: grid; gap: var(--space-sm); align-content: start; min-width: 0; }
.research h3 { font-size: var(--text-sm); color: var(--color-muted); font-weight: 500; margin-bottom: 4px; }
.research ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; line-height: 1.65; }
.research__src { font-size: var(--text-xs); color: var(--color-accent); white-space: nowrap; }
.research__caution { background: var(--color-warm-soft); border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-sm); }
.research__warn { color: var(--color-warm); font-weight: 500; }
.research__keys { overflow-wrap: anywhere; }
.research__form { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.research__form input { flex: 1 1 16rem; width: auto; }
@media (max-width: 860px) {
  .research { padding: var(--space-sm); }
  .research__grid { grid-template-columns: minmax(0, 1fr); }
  .research__form .btn { flex: 1 1 100%; }
}

/* Scorecard: each lead the rep called, its average AI call score, and every call with its own score */
.sc-leads { border-top: 1px solid var(--color-rule); padding-top: var(--space-sm); min-width: 0; }
.sc-leads__list, .sc-lead, .sc-lead__row > * { min-width: 0; }  /* the call table scrolls inside the card, never widens it */
.sc-calls__miss td { color: var(--color-muted); }
.sc-leads > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-sm); list-style: none; }
.sc-leads > summary::-webkit-details-marker, .sc-lead > summary::-webkit-details-marker { display: none; }
.sc-leads__title { font-weight: 600; color: var(--color-accent); }
.sc-leads__title::after { content: " ▸"; color: var(--color-muted); }
.sc-leads[open] .sc-leads__title::after { content: " ▾"; }
.sc-leads__list { list-style: none; margin: var(--space-sm) 0 0; padding: 0; display: grid; gap: 6px; }
.sc-lead { border: 1px solid var(--color-glass-edge); border-radius: var(--radius-sm); background: var(--color-glass-2); }
.sc-lead[open] { box-shadow: var(--shadow-glass); }
.sc-lead__row { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(9rem, 12rem); gap: var(--space-2xs) var(--space-sm); align-items: center; padding: 10px var(--space-sm); }
.sc-lead__name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sc-lead__name small { font-weight: 400; }
.sc-lead__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.sc-lead__meta .tag { margin: 0; }
.sc-lead__pot { color: var(--color-accent-2); font-size: var(--text-sm); font-weight: 600; }
.sc-stage--won { background: var(--color-money-soft); color: var(--color-money); }
.sc-stage--quoted, .sc-stage--deal { background: var(--color-accent-soft); color: var(--color-accent); }
.sc-stage--lost { background: var(--color-late-soft); color: var(--color-late); }
.sc-lead__score { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.sc-lead__score small { color: var(--color-muted); }
.sc-lead__score b { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; line-height: 1; font-variant-numeric: lining-nums proportional-nums; }
.sc-lead__bar { height: 8px; border-radius: var(--radius-pill); background: var(--color-track); overflow: hidden; }
.sc-lead__bar i { display: block; height: 100%; width: var(--pct); border-radius: inherit; background: var(--color-ax-quality); }
.sc-lead__score > small.muted:only-child { grid-column: 1 / -1; text-align: right; }
.sc-calls { margin: 0 var(--space-sm) var(--space-xs); width: calc(100% - 2 * var(--space-sm)); font-size: var(--text-sm); }
.sc-lead > p { padding: 0 var(--space-sm) var(--space-sm); }
@media (max-width: 860px) {
  .sc-lead__row { grid-template-columns: minmax(0, 1fr) auto; }
  .sc-lead__meta { grid-column: 1 / -1; grid-row: 2; }
  .sc-lead__score { grid-template-columns: auto auto; }
  .sc-lead__bar { display: none; }
  .sc-calls { display: block; overflow-x: auto; }
}

/* Lead summary for the closer's LINE group (closer_line.py): the editable post beside where it came from */
.closer { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-md); align-items: start; }
.closer__form { padding: var(--space-md); display: grid; gap: var(--space-sm); }
.closer__target { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--space-sm); }
.closer__text { font: inherit; font-size: var(--text-sm); line-height: 1.75; width: 100%; padding: var(--space-sm); border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm); background: var(--color-panel); resize: vertical; }
.closer__count { margin-top: -6px; }
.closer__side { display: grid; gap: var(--space-sm); min-width: 0; }
.closer__help { padding: var(--space-md); display: grid; gap: var(--space-2xs); }
.closer__help h2 { font-size: var(--text-md); }
.closer__help ul:not(.rows) { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; }
.closer__sent { margin-top: 6px; overflow-wrap: anywhere; }
.closer__card { width: 100%; height: 560px; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: #F5EFE6; }
@media (max-width: 860px) {
  .closer { grid-template-columns: minmax(0, 1fr); }
  .closer__actions .btn { flex: 1 1 100%; }
}

/* Lead names open the lead page (same page as the number button) */
.lead-link { color: inherit; text-decoration: none; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px;
  background-position: 0 100%; background-repeat: no-repeat; transition: background-size var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.lead-link:hover, .lead-link:focus-visible { color: var(--color-accent); background-size: 100% 1px; }

/* AI job progress (parts/ai_progress.html): one bar, three named steps, the time left */
.ai-progress { padding: var(--space-md) var(--space-lg); display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); }
.ai-progress__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); }
.ai-progress__title { margin: 0; font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; color: var(--color-ink); }
.ai-progress__pct { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--color-accent); font-variant-numeric: lining-nums tabular-nums; }
.ai-progress__bar { height: 10px; border-radius: var(--radius-pill); background: var(--color-track); overflow: hidden; }
.ai-progress__bar i { display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent), var(--color-violet), var(--color-accent-2)); transition: width 900ms var(--ease-out); }
.ai-progress__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2xs); font-size: var(--text-sm); color: var(--color-muted); }
.ai-progress__steps li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ai-progress__steps li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--color-rule); }
.ai-progress__steps li.is-now { color: var(--color-accent); font-weight: 600; }
.ai-progress__steps li.is-now::before { border-color: var(--color-accent-2); background: var(--color-accent-2); }
.ai-progress__steps li.is-done { color: var(--color-ink-2); }
.ai-progress__steps li.is-done::before { border-color: var(--color-money); background: var(--color-money); }
.ai-progress__steps li:last-child { justify-content: flex-end; }
@media (prefers-reduced-motion: no-preference) {
  .ai-progress__steps li.is-now::before { animation: ai-pulse 1.4s var(--ease-out) infinite; }
}
@keyframes ai-pulse { 50% { opacity: .35; } }
@media (max-width: 860px) { .ai-progress { padding: var(--space-sm) var(--space-md); } .ai-progress__steps { font-size: var(--text-xs); } }
/* A small bar inside a card (one Sales Content piece) */
.ai-progress--compact { padding: var(--space-sm) var(--space-md); margin: 0; border-radius: var(--radius-sm); background: var(--color-violet-soft); }
.ai-progress--compact .ai-progress__title { font-size: var(--text-sm); }
.ai-progress--compact .ai-progress__pct { font-size: var(--text-md); }
.ai-progress--compact .ai-progress__bar { height: 8px; background: var(--color-panel); }

/* The AI tray (ai.js): every AI job the user waits on, on every page, and which ones just finished */
.ai-tray { position: fixed; z-index: 20; right: var(--space-md); bottom: var(--space-md); width: min(340px, calc(100vw - 32px));
  border-radius: var(--radius-card); padding: var(--space-sm) var(--space-md); display: grid; gap: var(--space-xs); box-shadow: var(--shadow-lift); }
.ai-tray[hidden] { display: none; }
.ai-tray__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); }
.ai-tray__head p { margin: 0; font-family: var(--font-display); font-weight: 600; color: var(--color-ink); }
.ai-tray__toggle { border: 0; background: none; padding: 6px 8px; min-height: 32px; font: inherit; font-size: var(--text-sm); color: var(--color-accent); cursor: pointer; border-radius: var(--radius-pill); white-space: nowrap; }
.ai-tray__toggle:hover { background: var(--color-violet-soft); }
.ai-tray__toggle:focus-visible, .ai-tray__x:focus-visible, .ai-tray__item a:focus-visible { outline: 2px solid var(--color-accent-2); outline-offset: 2px; }
.ai-tray.is-collapsed .ai-tray__list { display: none; }
.ai-tray__head p { flex: none; }
.ai-tray__mini { flex: 1; height: 6px; display: none; }
.ai-tray.is-collapsed .ai-tray__mini { display: block; }
.ai-tray.is-collapsed { padding-block: var(--space-2xs); }
.ai-tray__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); max-height: min(50vh, 360px); overflow-y: auto; }
.ai-tray__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--space-xs); padding-top: var(--space-xs); border-top: 1px solid var(--color-rule); }
.ai-tray__item:first-child { border-top: 0; padding-top: 0; }
.ai-tray__item a { grid-column: 1 / -1; display: grid; min-width: 0; text-decoration: none; color: var(--color-ink); border-radius: 6px; }
.ai-tray__item a b { font-weight: 600; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tray__item a span { font-size: var(--text-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tray__item a:hover b { color: var(--color-accent); }
.ai-tray__item .ai-progress__bar { grid-column: 1 / -1; height: 6px; }
.ai-tray__item small { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--color-muted); }
.ai-tray__item--done a, .ai-tray__item--failed a { grid-column: 1; padding-left: 22px; position: relative; }
.ai-tray__item--done a::before, .ai-tray__item--failed a::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--color-on-accent); background: var(--color-money); }
.ai-tray__item--failed a::before { content: "!"; background: var(--color-late); }
.ai-tray__item--done a span { color: var(--color-money); }
.ai-tray__x { grid-column: 2; grid-row: 1; align-self: start; border: 0; background: none; min-width: 32px; min-height: 32px; font-size: 18px; line-height: 1; color: var(--color-muted); cursor: pointer; border-radius: 50%; }
.ai-tray__x:hover { background: var(--color-violet-soft); color: var(--color-ink); }
@media (max-width: 860px) { .ai-tray { right: 16px; left: 16px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Call kinds (Call.kind_name): first real talk, follow-up, call back arranged, short reminder */
.kind { font-weight: 600; }
.kind--first { background: var(--color-violet-soft); color: var(--color-violet-ink); }
.kind--follow { background: var(--color-teal-soft); color: var(--color-teal-ink); }
.kind--callback, .kind--short { background: var(--color-paper-2); color: var(--color-muted); }
.kind-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kind-checks li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kind-checks li > span:first-child { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--color-on-accent); }
.kind-checks__ok > span:first-child { background: var(--color-money); }
.kind-checks__no > span:first-child { background: var(--color-late); }
/* Scorecard: follow-up skills under the radar */
.sc-note { margin: -4px 0 0; }

/* Feedback board (feedback.html) */
.feedback { margin-top: var(--space-md); }
.feedback h2 { font-size: var(--text-md); margin-bottom: var(--space-sm); }
.feedback > summary { cursor: pointer; font-weight: 500; }
.feedback__list { list-style: none; margin: 0; padding: 0; display: grid; }
.feedback__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-sm); align-items: start; padding: var(--space-sm) 0; border-top: 1px solid var(--color-rule); }
.feedback__item:first-child { border-top: 0; padding-top: 0; }
.feedback__main { display: grid; gap: 4px; min-width: 0; }
.feedback__title { overflow-wrap: anywhere; }
.feedback__src { list-style: none; margin: var(--space-xs) 0 0; padding: 0; display: grid; gap: var(--space-xs); }
.feedback__src li { display: grid; gap: 2px; overflow-wrap: anywhere; }
.feedback__src img { max-width: min(280px, 100%); border-radius: var(--radius-sm); border: 1px solid var(--color-rule); }
.feedback__status select { font: inherit; padding: 6px 10px; border-radius: var(--radius-pill); border: 1px solid var(--color-glass-edge); background: var(--color-glass-2); color: var(--color-ink); }
@media (max-width: 560px) { .feedback__item { grid-template-columns: minmax(0, 1fr); } }
.feedback__audio { width: 100%; max-width: 420px; height: 36px; }
.feedback__item--wide { grid-template-columns: minmax(0, 1fr); }

/* Sales documents: offer mode, sample clips (deck.py, 3b) */
.pitch-mode { border: 0; padding: 0; margin: var(--space-sm) 0 0; display: grid; gap: 6px; }
.pitch-clips { display: grid; gap: 6px; margin-top: var(--space-sm); }
.pitch-clip { align-items: flex-start; }
.pitch-clip a { overflow-wrap: anywhere; }
.pitch-rules { margin-top: var(--space-sm); border-left: 3px solid #A8431F; padding: var(--space-xs) var(--space-sm); }
.pitch-rules b { color: #A8431F; }
/* A must-have rubric item (client rubric "* ") and the note when one is missing: the call is held at 49 at most */
.tag--must { background: var(--color-late-soft); color: var(--color-late); font-weight: 600; }
.must-miss { margin: var(--space-xs) 0 0; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--color-late-soft); color: var(--color-late); font-size: var(--text-sm); }
/* Scorecard call quality: every rubric item as one bar, coloured by band; must-haves carry a star */
.sc-skillset { display: grid; gap: 6px; padding-top: var(--space-xs); }
.sc-skillset + .sc-skillset, .sc-note + .sc-skillset { border-top: 1px solid var(--color-rule); }
.sc-skillset p { margin: 0; }
.sc-skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; counter-reset: skill; }
.sc-skills li { counter-increment: skill; display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 2.2em; align-items: center; gap: 8px; font-size: var(--text-sm); }
.sc-skills__name { line-height: 1.35; }
.sc-skills__name::before { content: counter(skill) ". "; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.sc-skills li > b { text-align: right; }
.sc-skill--low .sc-meter i, .sc-key--low::before { background: var(--color-late); }
.sc-skill--mid .sc-meter i, .sc-key--mid::before { background: var(--color-warm); }
.sc-skill--high .sc-meter i, .sc-key--high::before { background: var(--color-money); }
.sc-skills__must .sc-skills__name { font-weight: 600; }
.sc-skills__must .sc-skills__name b, .sc-miss { color: var(--color-late); }
.sc-key { white-space: nowrap; }
.sc-key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 480px) { .sc-skills li { grid-template-columns: minmax(0, 9em) minmax(0, 1fr) 2.2em; } }
/* Scorecard: how the score works, one idea per line */
.sc-method { list-style: none; margin: var(--space-sm) 0; padding: 0; display: grid; gap: var(--space-md); font-size: var(--text-sm); line-height: 1.7; }
.sc-method > li { padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); }
.sc-method > li:first-child { border-top: 0; padding-top: 0; }
.sc-method h3 { margin: 0 0 4px; font-size: var(--text-base); }
.sc-method p { margin: 6px 0 2px; }
.sc-method ul { margin: 2px 0 0; padding-left: 1.3em; }
.sc-method__sub { font-weight: 600; margin-top: var(--space-xs) !important; }
.sc-method__skills { margin: 2px 0 0; padding-left: 1.6em; columns: 2 16em; column-gap: var(--space-lg); }
.sc-method__skills li { break-inside: avoid; }
.sc-method__must { font-weight: 600; color: var(--color-late); }
/* Scorecard: the skill radar above the bars, every rubric item a spoke labelled by its number */
.sc-web { display: block; width: 100%; max-width: 360px; height: auto; margin: 4px auto 6px; overflow: visible; }
.sc-web__ring { fill: none; stroke: var(--color-rule); stroke-width: 1; }
.sc-web__spoke { stroke: var(--color-rule); stroke-width: 1; }
.sc-web__shape { fill: color-mix(in oklch, var(--ax) 20%, transparent); stroke: var(--ax); stroke-width: 2; stroke-linejoin: round; }
.sc-web__dot { stroke: var(--color-panel); stroke-width: 2; }
.sc-web__dot--low { fill: var(--color-late); }
.sc-web__dot--mid { fill: var(--color-warm); }
.sc-web__dot--high { fill: var(--color-money); }
.sc-web__dot--none { fill: var(--color-panel); stroke: var(--color-muted); stroke-width: 1.5; }
.sc-web__label { font-size: 11px; fill: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.sc-web__label--must { fill: var(--color-late); font-weight: 700; }
.sc-web__val { font-weight: 700; fill: var(--color-ink); }
/* My leads: how many calls the rep logged on a lead, and how many got through */
.call-count { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: var(--radius-pill); background: var(--color-cold-soft); color: var(--color-cold); text-decoration: none; white-space: nowrap; }
.call-count:hover { text-decoration: underline; }
.call-count b { font-weight: 700; }
.call-count__talk { padding-left: 6px; border-left: 1px solid currentColor; }
.call-count--none { background: var(--color-paper-2); color: var(--color-muted); }
/* My leads: filter and sort the called list by logged calls */
.called-filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-sm); margin: var(--space-xs) 0; font-size: var(--text-sm); color: var(--color-muted); }
.called-filter label { display: inline-flex; align-items: center; gap: 6px; }
.called-filter select { width: auto; min-width: 11em; padding: 6px 10px; }
/* Customer-need library (needs.html) */
.need-how { max-width: none; }
.need-how mark, .need mark { background: #FFF0A8; padding: 0 3px; }
.need { display: grid; gap: var(--space-xs); scroll-margin-top: 80px; padding: var(--space-lg); }
.need + .need { margin-top: var(--space-md); }
.need-form { padding: var(--space-lg); }
@media (max-width: 760px) { .need, .need-form { padding: var(--space-md); } }
.need__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-sm); align-items: start; }
.need__head h2 { margin: 0; font-size: var(--text-md); line-height: 1.35; }
.need__head p { margin: 2px 0 0; }
.need__no { width: 30px; height: 30px; border-radius: 50%; background: var(--color-ink); color: var(--color-on-accent); display: grid; place-items: center; font-weight: 700; font-size: var(--text-sm); }
.need h3 { margin: var(--space-2xs) 0 2px; font-size: var(--text-sm); color: var(--color-late); letter-spacing: .02em; }
.need ul { margin: 0; padding-left: 1.3em; }
.need p { margin: 0; }
.need__angle { background: var(--color-cold-soft); border-left: 3px solid var(--color-cold); padding: 8px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.need__two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 var(--space-lg); }
@media (max-width: 760px) { .need__two { grid-template-columns: minmax(0, 1fr); } .need__head { grid-template-columns: auto minmax(0, 1fr); } .need__head .status { grid-column: 2; justify-self: start; } }
.need__dont { background: var(--color-late-soft); border-radius: var(--radius-sm); padding: 4px 12px 10px; margin-top: var(--space-2xs); }
.need__review { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: var(--space-xs); border-top: 1px solid var(--color-rule); }
.need__review input[type=text] { flex: 1 1 240px; width: auto; }
.status--need-approved { background: var(--color-money-soft); color: var(--color-money); }
.status--need-revise { background: var(--color-late-soft); color: var(--color-late); }
.status--need-draft { background: var(--color-warm-soft); color: var(--color-warm); }
.need-gaps p { margin: 0 0 6px; }
/* Live-call assistant (live_call.html) */
.page:has(.live) { max-width: 1280px; }
.live-entry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 var(--space-sm); }
.live-note { max-width: none; }
.live-bar { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; padding: var(--space-md) var(--space-lg); }
.live-clock { font-size: var(--text-md); font-weight: 700; min-width: 4ch; }
.live-level { width: 120px; height: 8px; border-radius: 4px; background: var(--color-track); overflow: hidden; }
.live-level i { display: block; height: 100%; width: 0; background: var(--color-money); transition: width 120ms linear; }
.live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: var(--space-lg); align-items: start; }
@media (max-width: 900px) { .live { grid-template-columns: minmax(0, 1fr); } }
.live__main { display: grid; gap: var(--space-md); min-width: 0; }
.live-tip { padding: var(--space-lg); border-left: 5px solid var(--color-cold); }
.live-tip__label { margin: 0; font-size: var(--text-sm); font-weight: 700; color: var(--color-cold); letter-spacing: .04em; }
.live-tip__text { margin: 4px 0 0; font-size: 1.35rem; line-height: 1.5; font-weight: 600; }
.live-tip__ask { margin: var(--space-xs) 0 0; font-size: var(--text-md); color: var(--color-late); font-weight: 600; }
#live-cards { display: grid; gap: var(--space-md); }
.live-card { padding: var(--space-lg); display: grid; gap: 4px; }
.live-card h2 { margin: 0; font-size: var(--text-md); }
.live-card h3 { margin: var(--space-2xs) 0 0; font-size: var(--text-sm); color: var(--color-late); }
.live-card ul { margin: 0; padding-left: 1.3em; }
.live-card p { margin: 0; }
.live-card__label { font-size: var(--text-xs); font-weight: 700; color: var(--color-muted); letter-spacing: .06em; }
.live-card__angle { background: var(--color-cold-soft); border-left: 3px solid var(--color-cold); padding: 8px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.live-card__dont { background: var(--color-late-soft); border-radius: var(--radius-sm); padding: 2px 12px 8px; margin-top: var(--space-2xs); }
.live-text { padding: var(--space-lg); }
.live-text h2 { margin: 0 0 var(--space-xs); font-size: var(--text-base); }
.live-text__body { max-height: 260px; overflow-y: auto; font-size: var(--text-sm); line-height: 1.7; }
.live-text__body p { margin: 0 0 4px; }
.live-check { padding: var(--space-lg); position: sticky; top: 12px; }
.live-check h2 { margin: 0; font-size: var(--text-base); display: flex; justify-content: space-between; }
.live-check__list { list-style: none; margin: var(--space-xs) 0 0; padding: 0; display: grid; gap: 4px; }
.live-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--color-rule); background: transparent; font: inherit; font-size: var(--text-sm); color: var(--color-ink); cursor: pointer; }
.live-item:hover { border-color: var(--color-ink-2); }
.live-item__box { flex: 0 0 18px; height: 18px; border-radius: 5px; border: 2px solid var(--color-muted); display: grid; place-items: center; }
.live-item--must { font-weight: 600; }
.live-item--must:not(.is-done) { border-color: var(--color-late); color: var(--color-late); }
.live-item.is-done { background: var(--color-money-soft); border-color: transparent; color: var(--color-money); }
.live-item.is-done .live-item__box { background: var(--color-money); border-color: var(--color-money); }
.live-item.is-done .live-item__box::after { content: "✓"; color: var(--color-on-accent); font-size: 12px; font-weight: 700; }
.live-item__quote { margin: 2px 0 4px 38px; }
.live-end { padding: var(--space-lg); margin-top: var(--space-lg); }
.live-end h2 { margin: 0 0 var(--space-xs); }
.live-status { border: 0; padding: 0; margin: 0; display: flex; gap: var(--space-md); flex-wrap: wrap; }
.live-bar [hidden], .live [hidden], .live-end[hidden], .live-end [hidden] { display: none !important; }  /* .btn and .card set display */

/* Scorecard: pick a date range beside the period buttons (feedback #12) */
.sc-range { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.sc-range input[type="date"] { min-width: 0; }
.sc-range .btn.is-on { border-color: var(--color-accent-2); color: var(--color-accent); font-weight: 600; }
