/* Palette nods to print: paper, ink, and process cyan/magenta/yellow accents. */
:root {
  --paper: #f7f5f0;
  --paper-alt: #efece4;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5d6270;
  --line: #dcd8cd;
  --cyan: #0a8fc4;
  --magenta: #d6246e;
  --yellow: #f2b705;
  --accent: var(--magenta);
  --accent-ink: #ffffff;
  --panel: #ffffff;
  --panel-border: color-mix(in srgb, var(--ink) 22%, transparent);
  --ok: #1f8a4c;
  --warn: #b86e00;
  --bad: #c2372b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --font: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111317;
    --paper-alt: #171a1f;
    --surface: #1d2027;
    --ink: #eef0f3;
    --muted: #9aa0ad;
    --line: #2c3039;
    --cyan: #3cb4e6;
    --magenta: #ff4f93;
    --ok: #46c27b;
    --warn: #f0a63a;
    --bad: #ff6b5e;
    --panel: #262a33;
    --panel-border: rgba(255, 255, 255, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Keep headings clear of the sticky nav after an anchor jump. */
section[id] { scroll-margin-top: 80px; }

/* Buttons and panels set their own display, so make the hidden attribute win. */
[hidden] { display: none !important; }

a { color: inherit; }
.muted { color: var(--muted); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}
.wrap.narrow { max-width: 760px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}
/* Registration-mark logo */
.logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  position: relative;
}
.logo-mark::before,
.logo-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.logo-mark::before { left: 50%; top: -5px; bottom: -5px; width: 2px; transform: translateX(-50%); }
.logo-mark::after { top: 50%; left: -5px; right: -5px; height: 2px; transform: translateY(-50%); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a:not(.btn) {
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
}
.nav-links a:not(.btn):hover { color: var(--ink); }
.nav-email {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 12px 24px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
  .btn-ghost:hover { box-shadow: none; border-color: var(--ink); }
}
.btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-small { padding: 8px 16px; font-size: 15px; }
.btn-block { display: block; width: 100%; }

/* ---------- Typography ---------- */
h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
}
h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 20ch;
}
h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; }
.section-lede {
  margin-top: 18px;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 52ch;
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.lede {
  margin-top: 22px;
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 38ch;
}


/* ---------- Sections ---------- */
.section { padding: 96px 0; }


/* ---------- Form fields ---------- */
.field {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
}
.field:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.form-status { margin-top: 14px; min-height: 1.6em; font-size: 15px; }
.form-status.error { color: var(--magenta); }
.form-status.success { color: var(--ok); font-weight: 600; font-size: 1.1rem; }

/* ---------- App page (signed in) ---------- */
.app-main { padding: 56px 0 96px; }
.app-main h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
.app-section { margin-top: 40px; }
.app-section h2 { font-size: 1.15rem; letter-spacing: 0; }
.deal-list { list-style: none; margin-top: 6px; }
.deal-list + .muted { margin-top: 14px; }
.deal-list > li {
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
/* Scoped to the row's own summary, so the scorecard inside the row keeps its own styles. */
.deal-list > li > details > summary { cursor: pointer; }
.deal-list > li > details > summary > span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.deal-list > li > details[open] > summary { margin-bottom: 4px; }
.deal-list .deal-band { font-weight: 600; }

/* minmax(0, 1fr): a wide row (the customer picker) can't stretch the form past the page. */
.deal-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.deal-form label { font-size: 15px; font-weight: 500; }
.deal-form label:not(:first-child) { margin-top: 8px; }
textarea.field { border-radius: var(--radius); resize: vertical; min-height: 220px; line-height: 1.5; }
.char-count { font-size: 14px; text-align: right; }
.deal-form .btn { justify-self: start; }
@media (max-width: 640px) {
  .deal-form .btn { justify-self: stretch; }
}
textarea.field.textarea-short { min-height: 110px; }
.field-hint { font-size: 14px; }

/* PDF picker: a ghost button (a label around the hidden file input), then the picked files' names. */
.file-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.deal-form label.file-btn { margin-top: 0; font-weight: 600; }
.file-btn:focus-within { outline: 3px solid var(--cyan); outline-offset: 2px; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.file-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 15px; }
.file-list .file-name { min-width: 0; overflow-wrap: anywhere; }
.file-list .link-btn { font-size: 14px; }

/* While PDFs are dragged over the paste box or the file list (app.js dropZone). */
.drop-zone, .file-list { position: relative; }
.drop-zone > textarea { display: block; width: 100%; }
.drop-over::after {
  content: "Drop PDFs here";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px dashed var(--cyan);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--ink);
  font-weight: 600;
  pointer-events: none;
}

/* Optional fields behind a "Additional details" toggle, inside the customer panel. */
.more-fields > summary { cursor: pointer; font-size: 15px; font-weight: 500; padding: 4px 0; }
.more-fields-body { display: grid; gap: 8px; margin-top: 8px; }
.app-lede { margin-top: 10px; max-width: 62ch; }

/* Signed-in nav: the current page reads as ink, the other as muted. */
.nav-links a.app-link[aria-current="page"] { color: var(--ink); font-weight: 500; }

/* Customer picker: one compact row of label, select, and small Edit / + New links. */
.picker-row { display: flex; gap: 12px; align-items: center; }
.picker-row select.field { flex: 1; padding-top: 8px; padding-bottom: 8px; cursor: pointer; }
.link-btn {
  flex: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); }
.link-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 640px) {
  /* The select already says "Choose a customer…", so the label is for screen readers only here. */
  .picker-row label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .picker-row { gap: 10px; }
}

/* New/Edit customer: an outlined box inside the deal form, so it reads as part of picking the customer. */
.customer-panel {
  display: grid;
  gap: 8px;
  margin: 6px 0 4px;
  padding: 18px 20px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
  min-width: 0;
}
.customer-panel legend { padding: 0 6px; font-weight: 600; }
.customer-panel .field { background: var(--surface); }
.panel-actions { display: flex; gap: 10px; margin-top: 8px; }
.deal-form .panel-actions .btn { justify-self: auto; }
.customer-panel .form-status { margin-top: 0; }

/* Admin: lessons form and learning lists, each item with a Delete link on the right. */
.lesson-form { display: flex; gap: 10px; align-items: center; margin: 14px 0 6px; }
.lesson-form .btn { flex: none; }
.learning-list { list-style: none; margin-top: 4px; }
.learning-list > li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.learning-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.learning-subhead { font-size: 1rem; margin-top: 22px; }
.learning-subhead span, .supplier-block h4 { color: var(--muted); font-weight: 500; }

/* Admin System section: 7-day table and the weekly report as plain text. */
.system-days { border-collapse: collapse; width: 100%; max-width: 420px; margin-top: 8px; font-size: 14px; }
.system-days th, .system-days td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.system-days th:first-child, .system-days td:first-child { text-align: left; }
.system-days th { color: var(--muted); font-weight: 500; }
.system-days .is-bad { color: var(--bad); font-weight: 600; }
/* Admin Usage section: the same table, full width, scrolling sideways inside its box on a phone. */
.table-scroll { overflow-x: auto; }
.usage-table { max-width: none; white-space: nowrap; }
.usage-table th, .usage-table td { padding: 6px; }
.system-report { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 8px; }
.supplier-block { margin-top: 26px; }
.supplier-block h3 { font-size: 1.05rem; }
.supplier-block h4, #reports h4 { font-size: 15px; margin-top: 16px; }

/* Past scorecards: one group per customer, newest activity first. */
.customer-group { margin-top: 22px; }
.customer-group h3 { font-size: 1rem; }
.customer-group h3 span { color: var(--muted); font-size: 14px; font-weight: 400; }

/* One scorecard: a raised deliverable card, unlike the flat form fields above it.
   Shown under the form after scoring, and inside each past deal. Also the landing page's example. */
#result { margin-top: 12px; }
.scorecard {
  --scorecard-pad: 36px;
  position: relative;
  margin-top: 12px;
  padding: calc(var(--scorecard-pad) + 4px) var(--scorecard-pad) var(--scorecard-pad);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.14);
  font-size: 17px;
  overflow-wrap: anywhere;
}
.scorecard::before {
  /* CMYK stripe along the top edge */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--yellow));
}
.scorecard-header { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.scorecard-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.scorecard-title { margin-top: 4px; font-size: clamp(1.9rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -0.01em; }
/* Sections share one rhythm: the same gap and a hairline divider between them. */
.scorecard-section { margin-top: 28px; }
.scorecard-section + .scorecard-section:not(.scorecard-verdict) { padding-top: 28px; border-top: 1px solid var(--line); }
.scorecard h4 { font-size: clamp(1.3rem, 3vw, 1.55rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.scorecard-section > :not(h4) { margin-top: 12px; }
.scorecard ul, .scorecard ol { padding-left: 1.3em; }
.scorecard li { padding-left: 0.2em; }
.scorecard li + li { margin-top: 8px; }
.scorecard-label { font-weight: 700; }

/* Buyer Verdict is the hero: a tinted panel in the label's color, with the badge inside it.
   --tone is cyan for older scorecards that have no label. */
.scorecard-verdict {
  --tone: var(--cyan);
  padding: 24px 28px;
  border-left: 4px solid var(--tone);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--tone) 9%, transparent);
}
.scorecard-verdict.is-strong { --tone: var(--ok); }
.scorecard-verdict.is-at-risk { --tone: var(--warn); }
.scorecard-verdict p:not(.scorecard-badge) { font-size: 1.22em; font-weight: 500; line-height: 1.5; }
.scorecard-verdict > .scorecard-badge { margin-top: 0; }
.scorecard-verdict .scorecard-badge + h4 { margin-top: 14px; }

/* Failed checks: above the answer, in the warning tone, so the rep reads them before acting. */
.scorecard-checks {
  margin-top: 24px;
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
  font-size: 15px;
}
.scorecard-checks-title { font-weight: 700; color: color-mix(in srgb, var(--warn) 72%, var(--ink)); }
.scorecard-checks ul { margin-top: 8px; }
.scorecard-checks li + li { margin-top: 6px; }

/* Verdict label: pill with a dot, text in the label's color (mixed toward ink so it stays readable). */
.scorecard-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 12px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
  border-radius: 999px;
  background: var(--panel);
  color: color-mix(in srgb, var(--tone) 72%, var(--ink));
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.scorecard-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }

.scorecard-summary { font-weight: 500; }

/* "See details": a full-width row control, the same in both sections. */
.scorecard-more { margin-top: 14px; }
.scorecard details.scorecard-more > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-alt);
  cursor: pointer;
  list-style: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  transition: background-color 0.15s, border-color 0.15s;
}
.scorecard details.scorecard-more > summary::-webkit-details-marker { display: none; }
.scorecard details.scorecard-more > summary:hover { background: color-mix(in srgb, var(--cyan) 10%, var(--paper-alt)); border-color: color-mix(in srgb, var(--cyan) 40%, var(--line)); }
.scorecard details.scorecard-more > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.scorecard details.scorecard-more[open] > summary { margin-bottom: 0; border-radius: 10px 10px 0 0; }
/* Scoped to beat the past-deals list's own span and summary styles. */
.scorecard .scorecard-toggle span { color: inherit; font-size: inherit; white-space: normal; }
.scorecard .scorecard-toggle .when-open,
.scorecard .scorecard-more[open] .when-closed { display: none; }
.scorecard .scorecard-more[open] .when-open { display: inline; }
.scorecard .scorecard-toggle .scorecard-chevron {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 3px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s;
}
.scorecard .scorecard-more[open] .scorecard-chevron { transform: translateY(2px) rotate(225deg); }
.scorecard-more-body { padding: 16px 16px 4px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; }
.scorecard-more-body > * + * { margin-top: 12px; }

/* What to Do Next: the main value. Accent numbers, airy items. */
.scorecard ol li { line-height: 1.6; }
.scorecard ol li + li { margin-top: 14px; }
.scorecard ol li::marker { font-weight: 700; color: var(--accent); }

/* Footer: quiet and secondary. */
.scorecard-footer { margin-top: 32px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; line-height: 1.5; color: var(--muted); }
.scorecard-footer-title { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.scorecard-footer > * + * { margin-top: 6px; }
.scorecard-footer li + li { margin-top: 2px; }

/* Six-score scorecard: band and composite in the hero, then a grid of scores. Tone: 4-5 ok, 3 warn, 1-2 bad. */
.scorecard-band.is-mid { --tone: var(--warn); }
.scorecard-band.is-at-risk { --tone: var(--bad); }
.scorecard-verdict p.band-composite { margin-top: 10px; font-size: clamp(2.2rem, 6vw, 2.9rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.band-out-of { font-size: 0.42em; font-weight: 500; letter-spacing: 0; color: var(--muted); }
/* No-quote notice (scorecard.js): one grey line under the score, and first in Commercial Offer's detail. */
.scorecard-verdict p.verdict-notice { margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.score-notice { margin-bottom: 8px; color: var(--muted); }
.scorecard-section > p.score-hint { margin-top: 4px; font-size: 14px; }
.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.score-cell {
  --tone: var(--ok);
  border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 7%, transparent);
}
.score-cell.is-mid { --tone: var(--warn); }
.score-cell.is-low { --tone: var(--bad); }
.score-cell > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
}
.score-cell > summary::-webkit-details-marker { display: none; }
.score-cell > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 12px; }
/* overflow-wrap: normal undoes the deal row's "anywhere", which split "Responsiveness" mid-word on phones. */
.score-name { min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: normal; }
.score-short { display: none; }
.score-weight { display: block; margin-top: 2px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.score-value { font-size: 1.8rem; font-weight: 700; line-height: 1; color: color-mix(in srgb, var(--tone) 80%, var(--ink)); }
.score-detail { padding: 0 14px 12px; font-size: 14px; line-height: 1.45; }
.score-detail-title { margin-bottom: 4px; font-size: 13px; font-weight: 700; }
.score-detail ul { margin: 0; padding-left: 18px; }
.score-detail li + li { margin-top: 4px; }
.scorecard-verdict > h4 + .scorecard-badge { margin-top: 12px; }
/* What to Do Next: one group per category, lowest score first, the score in its tone beside the heading. */
.scorecard-section > .next-group { margin-top: 18px; }
.next-group-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.next-group-score {
  --tone: var(--ok);
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: color-mix(in srgb, var(--tone) 80%, var(--ink));
  font-size: 14px;
  text-align: center;
}
.next-group-score.is-mid { --tone: var(--warn); }
.next-group-score.is-low { --tone: var(--bad); }
.next-group ul { margin-top: 8px; }
.next-group li { line-height: 1.55; }
.scorecard-section > .next-pattern { margin-top: 20px; font-style: italic; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .scorecard details.scorecard-more > summary, .scorecard .scorecard-toggle .scorecard-chevron { transition: none; }
}
@media (max-width: 640px) {
  .scorecard { --scorecard-pad: 20px; font-size: 16px; border-radius: var(--radius); }
  .scorecard::before { border-radius: var(--radius) var(--radius) 0 0; }
  .scorecard-verdict { padding: 18px 16px 18px 18px; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-cell > summary { padding: 10px 10px 10px 12px; }
  .score-name { font-size: 13px; }
  /* Phones show "Response"; the full name stays for screen readers. */
  .score-short { display: inline; }
  .score-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .score-value { font-size: 1.5rem; }
}

/* ---------- Sign-in dialog ---------- */
.auth-dialog {
  margin: auto;
  width: min(400px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.auth-dialog h2 { font-size: 1.5rem; margin-bottom: 20px; }
.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.auth-or { margin: 16px 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth-form { display: grid; gap: 10px; }
.auth-form .field { background: var(--paper); }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 18px; font-size: 14px; line-height: 1.45; }
.terms-check input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.terms-check a, .footer-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.auth-dialog .link-btn { display: block; margin: 12px auto 0; }
.auth-dialog.is-reset .not-reset { display: none; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.dialog-actions .btn { flex: 1 1 auto; }

/* ---------- Terms and Privacy pages ---------- */
.legal { padding: 56px 0 72px; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.1; }
.legal-date { color: var(--muted); margin: 8px 0 28px; font-size: 14px; }
.legal h2 { font-size: 1.25rem; margin: 36px 0 10px; }
.legal p, .legal li { line-height: 1.65; }
.legal p + p, .legal ul + p { margin-top: 12px; }
.legal ul { padding-left: 20px; display: grid; gap: 8px; margin-top: 8px; }
.legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Landing page ---------- */
.btn-cta { margin-top: 28px; }
.hero-steps { padding-left: 1.4em; }
.hero-steps li + li { margin-top: 6px; }
.hero-credit { margin-top: 14px; font-size: 15px; color: var(--muted); max-width: 52ch; }
/* The example is the real scorecard (same classes as scorecard.js); the scores are one quiet line under it. */
/* The example sits in its own framed band, with more space around it than between the hero's lines. */
.example { padding: 48px 0; }
.example-frame { padding: 32px 28px; background: var(--paper-alt); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
/* Header over the example: bold spaced capitals in ink, with a magenta and cyan offset shadow like a print
   misregistration, echoing the CMYK stripe on the card. */
.example-title { max-width: none; text-align: center; font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink);
  text-shadow: 2px 2px 0 color-mix(in srgb, var(--magenta) 55%, transparent), 4px 4px 0 color-mix(in srgb, var(--cyan) 35%, transparent); }
.example .scorecard { margin-top: 20px; }
.example-tag { position: absolute; top: 14px; right: 16px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 640px) {
  .example { padding: 40px 0; }
  .example-frame { padding: 24px 14px; }
}
.example-scores { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding-left: 0 !important; font-size: 15px; color: var(--muted); }
.scorecard .example-scores li { padding-left: 0; margin-top: 0; white-space: nowrap; }
.example-scores b { color: color-mix(in srgb, var(--ok) 80%, var(--ink)); }
.example-scores b.is-mid { color: color-mix(in srgb, var(--warn) 80%, var(--ink)); }
.example-scores b.is-low { color: color-mix(in srgb, var(--bad) 80%, var(--ink)); }
.start { padding-top: 24px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 16px; }


/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 40px 0 32px; }
  .section { padding: 64px 0; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav { background: var(--paper); backdrop-filter: none; }
  .nav-links a:not(.btn):not(.app-link) { display: none; }
  .nav-links .btn-small { padding: 11px 18px; }
  .nav-links { gap: 10px; }
  /* Signed-in pages: the logo already goes to My deals, so phones keep only Profile and Sign out. */
  .nav-email, .nav-links a.app-link[href="app.html"] { display: none; }
  /* Admin (only Alex sees it) doesn't fit beside Profile and Sign out on a phone; /admin.html still works. */
  .nav-links a.app-link[href="admin.html"] { display: none; }
  .nav-links a, .nav-links .btn { white-space: nowrap; }
  .btn-cta { display: block; width: 100%; text-align: center; }
}

/* Admin tabs: one panel at a time, the current tab underlined in the accent. */
.admin-tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tab { font: inherit; font-size: 15px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent;
  margin-bottom: -1px; padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.admin-tab:hover { color: var(--ink); }
.admin-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.admin-tab:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; border-radius: 4px; }
.admin-panel > .app-section:first-child, .admin-panel > .app-lede:first-child { margin-top: 24px; }
/* Overview totals: four tiles, two per row on a phone. */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 1.4rem; font-weight: 600; margin-top: 4px; }
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
/* Users: rows open that account's deals. */
.usage-table tr.is-clickable { cursor: pointer; }
.usage-table tr.is-clickable:hover td, .usage-table tr[aria-current] td { background: var(--paper-alt); }
.usage-table tr.is-clickable:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; }
/* Admin deals list: the feedback note wraps instead of widening the table. */
#account-deals th:last-child, #account-deals td:last-child { white-space: normal; min-width: 22ch; text-align: left; }

/* Scorecard feedback: thumbs under the band, then a one-line note with Save once rated. */
.feedback { margin-top: 18px; font-size: 15px; }
.feedback-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feedback-label { color: var(--muted); margin-right: 4px; }
.feedback-thumb { padding: 4px 12px; font-size: 16px; line-height: 1.4; background: var(--panel); }
.feedback-thumb[aria-pressed="true"] { border-color: var(--tone); background: color-mix(in srgb, var(--tone) 18%, var(--panel)); }
.feedback-status { color: var(--muted); font-size: 14px; }
.feedback-note { display: flex; gap: 8px; margin-top: 10px; max-width: 520px; }
.feedback-note[hidden] { display: none; }
.feedback-input { flex: 1; min-width: 0; padding-top: 8px; padding-bottom: 8px; background: var(--surface); }
