/* App shell styles. All color values come from tokens.css — no hex here. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--text-base);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--leading);
  background: var(--color-bg);
  color: var(--color-ink);
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
}

.skip-link:focus {
  left: var(--space-2);
  z-index: 10;
}

.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-surface);
}

.brand {
  margin-right: auto;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-ink);
  text-decoration: none;
}

/* Where a signed-in person can go, then the two controls every screen has. */
.site-nav,
.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.control-btn {
  font: inherit;
  font-size: 0.9rem;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-ink);
  cursor: pointer;
  white-space: nowrap;
}

.control-btn:hover {
  border-color: var(--color-accent);
}

/* A link dressed as a button is not underlined as well. */
a.control-btn {
  text-decoration: none;
}

/* In the page itself a long label may take a second line; a button that
   refuses to would push a narrow screen sideways. */
main .control-btn {
  white-space: normal;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.placeholder-note {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.who {
  align-self: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 24rem;
  margin: var(--space-6) 0;
}

.stacked-form label {
  font-weight: 600;
}

.stacked-form label.check {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-weight: 400;
}

.stacked-form input[type="text"],
.stacked-form input[type="email"],
.stacked-form input[type="password"] {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

.stacked-form .btn-primary {
  align-self: flex-start;
  margin-top: var(--space-2);
}

/* A link inside a form (Admin → Welcome email's "Open the template") is as wide as its words. */
.stacked-form > .lone-link {
  align-self: flex-start;
}

.btn-primary {
  display: inline-block;
  font-size: 1rem;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-ink);
  text-decoration: none;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
}

.message {
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--color-rule);
  background: var(--color-surface);
}

.message-error {
  border-left-color: var(--color-danger);
}

.message-info,
.message-success {
  border-left-color: var(--color-ok);
}

.steps li {
  margin-bottom: var(--space-3);
}

.qr {
  width: 14rem;
  max-width: 100%;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--color-qr-ground);
  border-radius: var(--radius);
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.secret,
.codes code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
}

.secret {
  overflow-wrap: anywhere;
}

.codes {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 12rem));
  gap: var(--space-2) var(--space-6);
}

.nav-link {
  align-self: center;
  font-size: 0.95rem;
}

/* --- Lead screens ------------------------------------------------------- */

.lead-rows {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0;
}

.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-rule);
}

.lead-name {
  font-weight: 600;
}

.lead-contact,
.lead-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.lead-meta {
  grid-column: 1 / -1;
}

/* Status is never colour alone: the name is always written out. */
.status {
  display: inline-block;
  padding: 0 var(--space-2);
  border-left: 4px solid var(--color-rule);
  background: var(--color-surface);
  font-size: 0.9rem;
}

.status-open { border-left-color: var(--color-accent); }
.status-working { border-left-color: var(--color-warn); }
.status-won { border-left-color: var(--color-ok); }
.status-lost { border-left-color: var(--color-muted); }
.status-do_not_contact { border-left-color: var(--color-danger); }

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  margin: var(--space-3) 0;
}

.facts dt {
  color: var(--color-muted);
}

.facts dd {
  margin: 0;
}

.revealed {
  font-weight: 600;
}

.stacked-form input[type="file"] {
  font: inherit;
}

.stacked-form select,
.stacked-form textarea {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

.note {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.note p {
  margin: var(--space-1) 0;
}

.timeline {
  list-style: none;
  padding: 0;
}

.timeline li {
  padding: var(--space-1) 0;
}

.pager {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  color: var(--color-muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Side by side, a big button and a small one are the same height, each
   with its words in the middle. */
.actions .control-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.waiting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  padding: var(--space-3);
  border-left: 4px solid var(--color-warn);
  background: var(--color-surface);
}

.sheet-card {
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.sheet-card h3 {
  margin: 0 0 var(--space-1);
  font-size: 1.05rem;
}

.sheet-card.is-paused {
  opacity: 0.75;
}

/* Trouble is said in words; the colour only underlines it. */
.trouble {
  color: var(--color-danger);
}

/* The pipeline board: columns side by side, scrolling sideways INSIDE the
   board on a small screen so the page itself never does. */
main.wide {
  max-width: 96rem;
}

.board {
  display: grid;
  grid-auto-flow: column;
  /* 14rem: all five columns fit a 1280px window without the board scrolling. */
  grid-auto-columns: minmax(14rem, 1fr);
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-3);
}

.board-column h2 {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  margin: 0 0 var(--space-3);
  padding: var(--space-1) var(--space-2);
}

.count {
  color: var(--color-muted);
  font-weight: 400;
}

.board-card {
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.board-card p {
  margin: var(--space-1) 0;
}

.card-move {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.card-move select {
  font: inherit;
  font-size: 0.85rem;
  min-width: 0;
  flex: 1;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Who is looking, and when — a photograph of the screen names its source.
   A deterrent, not a lock: it sits above the content and ignores the mouse. */
.watermark {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  align-content: space-around;
  justify-items: center;
  opacity: 0.11;
  color: var(--color-ink);
  font-size: 0.85rem;
  user-select: none;
}

.watermark span {
  transform: rotate(-24deg);
  white-space: nowrap;
  padding: var(--space-8) 0;
}

/* Agents: selecting and printing lead screens is switched off (a deterrent;
   the real protection is that full contact details are not on the page).
   Note boxes stay usable. */
.role-agent .lead-surface {
  user-select: none;
  -webkit-user-select: none;
}

.role-agent .lead-surface .copy-ok {
  user-select: text;
  -webkit-user-select: text;
}

/* The one line that prints of a lead screen; nothing on a screen. */
.print-line {
  display: none;
}

@media print {
  /* An agent prints nothing of any page. */
  .role-agent:not(.lead-screen) main {
    display: none;
  }

  /* A lead screen (leads/_guard) prints nothing of itself for anyone: not
     the title, not the list, not the watermark — one line saying so. */
  .lead-screen:not(.lead-prints) .site-header,
  .lead-screen:not(.lead-prints) .page-band,
  .lead-screen:not(.lead-prints) .watermark,
  .lead-screen:not(.lead-prints) .page-body > * {
    display: none !important;
  }

  .lead-screen:not(.lead-prints) .page-body > .print-line {
    display: block !important;
  }
}

/* Phones: the header must never push the page wider than the screen. */
@media (max-width: 40rem) {
  .site-header {
    flex-wrap: wrap;
    padding: var(--space-2) var(--space-4);
  }

  /* Two tidy rows: the name and the two controls, then the way around. */
  .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: var(--space-2) var(--space-4);
  }

  /* The person's name is for wide screens; on a phone the initials circle is the link to My account. */
  .who {
    display: none;
  }

  main {
    padding: var(--space-6) var(--space-4);
  }

  /* A row of the list is one column: a long status no longer squeezes the name. */
  .lead-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .lead-row .status {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .control-btn,
  a {
    transition: border-color 120ms ease, color 120ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Ticking leads on the list, and each agent's share of new leads. */
.lead-pick {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.lead-tick {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
}

.lead-pick input[type="checkbox"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}

.assign-many {
  border-left-color: var(--color-accent);
}

.assign-many select,
.assign-filter select,
.share-row input[type="number"] {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  max-width: 100%;
}

.share-rows {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.share-row label {
  flex: 1 1 10rem;
  font-weight: 600;
}

.share-row input[type="number"] {
  width: 5rem;
}

/* --- People and teams ---------------------------------------------------- */

/* A group of tick-boxes or either-or choices inside a stacked form. */
.stacked-form fieldset.choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.stacked-form fieldset.choices legend {
  padding: 0;
  font-weight: 600;
}

.stacked-form fieldset.choices p {
  margin: 0;
}

/* Alerts by email (ledger D188): My account → Alerts, a team's defaults, each role's. */
.stacked-form.alert-form {
  max-width: 34rem;
}

.stacked-form fieldset.alert-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.alert-modes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.stacked-form input[type="date"],
.stacked-form input[type="datetime-local"] {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

/* --- Handing out leads: the Assign screen, weights, the list's filters ---- */

/* What is marked hidden stays hidden, whatever a class says about its
   display (the Assign screen's two script-only buttons, until the script
   shows them). */
[hidden] {
  display: none !important;
}

/* Which of the list's filters is on (it is also said in words below them). */
.control-btn[aria-current="true"] {
  border-color: var(--color-accent);
  font-weight: 600;
}

/* A tick-box or an either-or with its words, outside a stacked form too. */
label.check {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.assign-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.assign-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  max-width: 100%;
}

.assign-field label {
  font-weight: 600;
}

.assign-filter label.check {
  flex-basis: 100%;
}

.assign-who,
.share-group {
  margin: var(--space-4) 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.assign-who legend,
.share-group legend {
  padding: 0;
  font-weight: 600;
}

.assign-who legend {
  font-size: 1.25rem;
}

.share-group .share-rows {
  margin-top: var(--space-1);
}

/* The team's switch: its button stands clear of the weights below it. */
.share-switch {
  margin: var(--space-3) 0 var(--space-6);
}

/* On a wide screen what is said beside each weight takes the same room on
   every row, so the weights line up from one group to the next. */
@media (min-width: 40rem) {
  .share-group .share-row .lead-meta {
    flex: 0 0 15rem;
  }
}

.assign-who label.check,
.assign-row {
  flex-wrap: wrap;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
  cursor: pointer;
}

.assign-who input[type="radio"],
.assign-row input[type="checkbox"],
.assign-filter input[type="checkbox"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}

.assign-name {
  font-weight: 600;
}

.assign-who .lead-meta {
  flex: 1 1 12rem;
}

.assign-rows {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
}

/* The whole row is the tick's target: the box, then what the list shows. */
.assign-row {
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
}

.assign-row input[type="checkbox"] {
  margin-top: var(--space-1);
}

.assign-row-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-4);
  flex: 1;
  min-width: 0;
}

/* A ticked row and the chosen person stand out by more than the tick. */
.assign-row:has(input:checked),
.assign-who label.check:has(input:checked) {
  background: var(--color-surface);
}

/* The heading of the list, with "tick all" and "untick all" beside it. */
.assign-pick-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.assign-pick-head h2,
.assign-pick-head .actions {
  margin: 0;
}

/* The bar below stays in view over the page's foot: anything the browser
   scrolls to (a row reached with Tab, a link to a place on the page) stops
   clear of it instead of underneath. */
html:has(.assign-bar) {
  scroll-padding-bottom: 8rem;
}

/* Who, how many, and the button: in view however long the list is. */
.assign-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3);
  border-top: 2px solid var(--color-accent);
  background: var(--color-surface);
}

.assign-said {
  font-weight: 600;
}

@media (max-width: 40rem) {
  .assign-row-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .assign-row-body .status {
    justify-self: start;
  }
}

/* --- The contact log and the Dictate button ------------------------------ */

/* What a person wrote when they logged a contact, under its line. */
.timeline-notes {
  display: block;
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* The button, then the sentence saying what it does and does not do. */
.dictate {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.dictate .control-btn {
  flex: none;
}

.dictate .placeholder-note {
  flex: 1 1 12rem;
}

.dictate-said {
  flex-basis: 100%;
}

.dictate-said:empty {
  display: none;
}

/* Listening is said in the button's words; the border only underlines it. */
.dictate-on .control-btn {
  border-color: var(--color-accent);
  font-weight: 600;
}

/* ==========================================================================
   === identity: "Night grid", soft and big (round two) ======================
   Everything from here to the end of the file is the visual identity. It only
   restates rules from above (nothing above was edited), and every colour —
   the overlays on pictures and the shadows too — is a custom property from
   tokens.css. Inline SVG is coloured from here by class, so the templates
   carry no colour either.

   The owner's three decisions, and where each lives:
     1  soft controls, with every state      "controls", "fields", "ticks"
     2  bigger: pictures, titles, cards       "page band", "sign-in family",
                                              "cards and lists"
     3  which pictures                        "pictures" (twelve files in img/)

   Layout contract with the templates (see partials/):
     <main>
       <header class="page-band band-N">      signed-in pages; N picked per load
         <div class="band-head"> [back link] <h1> </div>
         [<p class="actions">]
       </header>
       <div class="page-body"> … </div>       always
     </main>
   ========================================================================== */

/* === identity: pictures ===
   The server picks N at random on each page load and writes the class; the
   file comes from here. Phones get the small file. */
.band-1 { --band-img: url("../img/band-1-960.webp"); --band-pos: center 35%; }
.band-2 { --band-img: url("../img/band-2-960.webp"); }
.band-3 { --band-img: url("../img/band-3-960.webp"); }
.band-4 { --band-img: url("../img/band-4-960.webp"); --band-pos: right top; }
.band-5 { --band-img: url("../img/band-5-960.webp"); --band-pos: center 40%; }
.band-6 { --band-img: url("../img/band-6-960.webp"); }

.photo-1 { --photo-img: url("../img/photo-1-800.webp"); }
.photo-2 { --photo-img: url("../img/photo-2-800.webp"); --photo-pos: 72% center; }
.photo-3 { --photo-img: url("../img/photo-3-800.webp"); }
.photo-4 { --photo-img: url("../img/photo-4-800.webp"); }
.photo-5 { --photo-img: url("../img/photo-5-800.webp"); }
.photo-6 { --photo-img: url("../img/photo-6-800.webp"); --photo-pos: 60% center; }

@media (min-width: 40.01rem) {
  .band-1 { --band-img: url("../img/band-1-1920.webp"); }
  .band-2 { --band-img: url("../img/band-2-1920.webp"); }
  .band-3 { --band-img: url("../img/band-3-1920.webp"); }
  .band-4 { --band-img: url("../img/band-4-1920.webp"); }
  .band-5 { --band-img: url("../img/band-5-1920.webp"); }
  .band-6 { --band-img: url("../img/band-6-1920.webp"); }
  .photo-1 { --photo-img: url("../img/photo-1-1600.webp"); }
  .photo-2 { --photo-img: url("../img/photo-2-1600.webp"); }
  .photo-3 { --photo-img: url("../img/photo-3-1600.webp"); }
  .photo-4 { --photo-img: url("../img/photo-4-1600.webp"); }
  .photo-5 { --photo-img: url("../img/photo-5-1600.webp"); }
  .photo-6 { --photo-img: url("../img/photo-6-1600.webp"); }
}

/* === identity: ground and type === */

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
}

/* <main> is the full width of the window: the band runs edge to edge, and
   the page body brings the reading column back with its own side padding
   (a percentage of the window, so nothing here can push the page sideways). */
main,
main.wide {
  max-width: none;
  margin: 0;
  padding: 0;
}

main.wide {
  --page-w: 96rem;
}

.page-body {
  padding: var(--space-8) max(var(--gutter), calc(50% - var(--page-w) / 2)) var(--space-12);
}

h1 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-h1);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

/* Under every page title: a run of trace and one node. The app's signature —
   the same line and point as the mark and the header. */
h1::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 5px;
  margin-top: var(--space-3);
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--title-bar, var(--color-accent)) 0 3.25rem,
    transparent 3.25rem 3.75rem,
    var(--title-bar, var(--color-accent)) 3.75rem
  );
}

main h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-h2);
  font-weight: 700;
}

main h3 {
  font-size: var(--text-h3);
}

.page-body > p,
.entry-form > p {
  max-width: 44rem;
  font-size: 1.0625rem;
}

.placeholder-note {
  font-size: 0.95rem;
}

/* === identity: header — the night frame === */

.site-header {
  position: relative;
  isolation: isolate;
  gap: var(--space-3);
  padding: var(--space-3) var(--gutter);
  border-bottom: 0;
  background: var(--color-night);
  color: var(--color-night-ink);
}

/* A fine grid, fading in from the brand toward the controls. Lines only, one
   step off the ground: texture, never something to read through. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--color-night-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-night-line) 1px, transparent 1px);
  background-size: var(--grid-step) var(--grid-step);
  background-position: right -1px top -1px;
  -webkit-mask-image: linear-gradient(90deg, transparent 12%, var(--color-night) 75%);
  mask-image: linear-gradient(90deg, transparent 12%, var(--color-night) 75%);
}

/* The signal line: bright under the brand, cooling, then a quiet hairline. */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--color-signal) 0 6rem,
    var(--color-signal-2) 11rem,
    var(--color-night-rule) 22rem
  );
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-night-ink);
}

.brand-mark {
  flex: none;
  width: 2rem;
  height: 2rem;
}

.bm-tile { fill: var(--color-signal); }
.bm-l { fill: var(--color-night); }
.bm-dot { fill: var(--color-spark); }

/* Header navigation is a link, so it wears the link colour as it reads on
   night. Each is a pill. Where you are is a FILLED pill, bolder type and a
   bar of signal — never colour alone. */
.site-header .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-4);
  border-radius: var(--radius-chip);
  color: var(--color-night-link);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
}

.site-header .nav-link:hover {
  background: var(--color-night-raised);
  color: var(--color-night-ink);
}

.site-header .nav-link:active {
  background: var(--color-night-press);
}

.site-header .nav-link[aria-current="page"] {
  background: var(--color-night-soft);
  color: var(--color-night-ink);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--color-signal);
}

.site-nav {
  gap: var(--space-1);
}

.site-header .who {
  margin: 0 var(--space-2);
  color: var(--color-night-muted);
}

/* The person's initials in a circle: what stands in for the name wherever the
   name itself is put away (a laptop's full bar, a phone). */
.who-initials {
  display: none;
  flex: none;
  align-self: center;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-night-control);
  border-radius: 50%;
  color: var(--color-night-ink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.site-header .control-btn {
  border-color: var(--color-night-control);
  background: transparent;
  color: var(--color-night-ink);
  box-shadow: none;
}

.site-header .control-btn:hover {
  border-color: var(--color-signal);
  background: var(--color-night-raised);
  color: var(--color-night-ink);
}

.site-header .control-btn:active {
  background: var(--color-night-press);
}

.site-header :focus-visible,
.page-band :focus-visible,
.entry-art :focus-visible {
  outline-color: var(--color-signal);
}

/* === identity: controls — soft ===
   A quiet button is a tinted pill; the main button of a page is a filled
   one. Each has five looks: resting, pointer over it, pressed, holding the
   keyboard (the ring from :focus-visible above), and switched off. */
.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: var(--space-2) var(--space-5);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
}

.control-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
  color: var(--color-soft-ink);
}

.control-btn:active {
  border-color: var(--color-accent);
  background: var(--color-soft-press);
  transform: scale(0.97);
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  box-shadow: var(--shadow-card);
}

.btn-primary:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-accent-hover);
  color: var(--color-accent-ink);
  box-shadow: 0 0 0 4px var(--color-halo);
}

.btn-primary:active {
  border-color: var(--color-accent-press);
  background: var(--color-accent-press);
  box-shadow: none;
}

/* Switched off: flat, dashed, no tint — and it does not answer the pointer. */
.control-btn:disabled,
.control-btn[aria-disabled="true"],
.site-header .control-btn:disabled {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background: var(--color-off-bg);
  color: var(--color-off-ink);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.site-header .control-btn:disabled {
  border-color: var(--color-night-control);
  background: transparent;
  color: var(--color-night-off);
}

/* Links: underlined at rest; thicker and deeper under the pointer; the
   underline drops away while pressed. */
a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 0.14em;
}

a:active {
  text-decoration-style: dotted;
}

a.control-btn,
a.control-btn:hover,
.brand:hover {
  text-decoration: none;
}

/* The name is the way home: a line of signal under it when pointed at. */
.brand:hover {
  color: var(--color-night-ink);
}

.brand:hover .brand-name {
  box-shadow: inset 0 -3px 0 var(--color-signal);
}

.brand:active .brand-name {
  color: var(--color-signal);
}

/* A link standing on its own line is a little bolder, and tall enough to press. */
.lone-link,
.pager a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-weight: 650;
}

.lead-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* The skip link lands on the night header in both themes, so it is drawn in
   the frame's colours: night lettering on signal, ringed in night ink. */
.skip-link {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-chip);
  background: var(--color-signal);
  color: var(--color-night);
  font-weight: 700;
}

.skip-link:focus {
  z-index: 10;
  outline-color: var(--color-night-ink);
}

/* === identity: fields — soft ===
   A box you type in rests on a tinted fill inside a 3:1 edge; under the
   pointer the edge deepens; with the keyboard it turns to the clear field
   colour, takes the accent edge, a halo, and the focus ring. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select:not([hidden]),
textarea:not([hidden]) {
  min-height: 3rem;
  max-width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius);
  background-color: var(--color-field-rest);
  color: var(--color-ink);
  font: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):hover,
select:not([hidden]):hover,
textarea:not([hidden]):hover {
  border-color: var(--color-ink);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):focus,
select:not([hidden]):focus,
textarea:not([hidden]):focus {
  border-color: var(--color-accent);
  background-color: var(--color-field);
  box-shadow: 0 0 0 4px var(--color-halo);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):active,
select:not([hidden]):active,
textarea:not([hidden]):active {
  border-color: var(--color-accent);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):disabled,
select:not([hidden]):disabled,
textarea:not([hidden]):disabled {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background-color: var(--color-off-bg);
  color: var(--color-off-ink);
  box-shadow: none;
  cursor: not-allowed;
}

/* A list to choose from is a pill with its own arrow (two small triangles
   of the button ink), so it looks the same in every browser and theme. */
select:not([hidden]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.75rem;
  border-radius: var(--radius-chip);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-soft-ink) 50%),
    linear-gradient(135deg, var(--color-soft-ink) 50%, transparent 50%);
  background-position: right 1.25rem top 50%, right calc(1.25rem - 6px) top 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select:not([hidden]):disabled {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-off-ink) 50%),
    linear-gradient(135deg, var(--color-off-ink) 50%, transparent 50%);
}

textarea {
  min-height: 6rem;
  line-height: 1.5;
}

.stacked-form {
  gap: var(--space-2);
  max-width: 30rem;
}

.stacked-form label,
.stacked-form fieldset.choices legend {
  margin-top: var(--space-3);
  font-size: 1rem;
  font-weight: 650;
}

.stacked-form label.check {
  margin-top: 0;
}

.stacked-form .btn-primary {
  margin-top: var(--space-4);
  padding-inline: var(--space-8);
}

/* The browser's own "Choose file" button, drawn as one of ours. */
input[type="file"] {
  max-width: 100%;
  min-height: var(--touch);
  color: var(--color-ink);
  font: inherit;
}

::file-selector-button {
  min-height: var(--touch);
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-5);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

input[type="file"]:hover::file-selector-button {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
}

input[type="file"]:active::file-selector-button {
  background: var(--color-soft-press);
}

input[type="file"]:disabled::file-selector-button {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background: var(--color-off-bg);
  color: var(--color-off-ink);
  cursor: not-allowed;
}

/* Example text inside a field is the muted ink, not the browser's own grey
   (which fell under 4.5:1 on the dark field). */
::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

/* === identity: ticks and either-or choices — soft ===
   Drawn here, not by the browser: a rounded box (a circle for either-or)
   with a 3:1 edge; ticked, it fills with the accent and shows a tick (a
   dot), so "on" is a shape as well as a colour. */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  border: 2px solid var(--color-control-border);
  border-radius: 0.45rem;
  background: var(--color-field);
  vertical-align: middle;
  cursor: pointer;
}

input[type="radio"] {
  border-radius: 50%;
}

.lead-pick input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-halo);
}

input[type="checkbox"]:active,
input[type="radio"]:active {
  background: var(--color-soft-press);
  transform: scale(0.92);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 0.4rem;
  height: 0.75rem;
  border: solid var(--color-accent-ink);
  border-width: 0 0.19rem 0.19rem 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 0.3rem;
  border-radius: 50%;
  background: var(--color-accent-ink);
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background: var(--color-off-bg);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled:checked,
input[type="radio"]:disabled:checked {
  border-style: solid;
  background: var(--color-off-edge);
}

label.check,
.stacked-form label.check {
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  cursor: pointer;
}

.lead-tick {
  min-width: var(--touch);
  min-height: var(--touch);
  margin-left: calc(-1 * var(--space-2));
  cursor: pointer;
}

/* A disclosure is something you press: a small soft pill with an arrow that
   turns when it opens. */
summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: var(--space-1) var(--space-4);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.15em;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
}

details[open] > summary::before {
  transform: rotate(45deg);
}

summary:hover {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
}

summary:active {
  background: var(--color-soft-press);
}

details[open] > summary {
  margin-bottom: var(--space-3);
}

/* === identity: page band ===
   Behind every signed-in page's title: one of six abstract pictures, edge to
   edge, under a sheet of night that is strongest where the title can be.
   Desktop: the title and the page's main buttons sit on it. Phone: the
   picture is behind the title only (never more than a third of the screen)
   and the buttons follow on the plain page. */
.page-band {
  --title-bar: var(--color-signal);
  --band-inset: max(var(--gutter), calc(50% - var(--page-w) / 2));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 15rem;
  background-color: var(--color-night);
  background-image:
    linear-gradient(
      90deg,
      var(--shade-band-strong) 0,
      var(--shade-band-strong) calc(var(--band-inset) + 30rem),
      var(--shade-band-light) calc(var(--band-inset) + 58rem)
    ),
    var(--band-img);
  background-position: 0 0, var(--band-pos, center);
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--color-night-ink);
}

.band-head {
  padding: var(--space-8) var(--band-inset) var(--space-5);
}

.band-head:last-child {
  padding-bottom: var(--space-8);
}

.page-band h1,
.band-title {
  max-width: 36rem;
  margin: 0;
  color: var(--color-night-ink);
  text-shadow: var(--shade-text);
}

.page-band > .actions {
  margin: 0;
  padding: 0 var(--band-inset) var(--space-8);
  gap: var(--space-3);
}

/* The way back, above the title: a small pill of the frame. */
.band-crumb {
  margin: 0 0 var(--space-3);
}

.band-crumb .lone-link {
  min-height: var(--touch);
  padding: 0 var(--space-4);
  border: 1.5px solid var(--color-night-control);
  border-radius: var(--radius-chip);
  background: var(--color-night-soft);
  color: var(--color-night-ink);
  font-size: 0.95rem;
  text-decoration: none;
}

.band-crumb .lone-link:hover {
  color: var(--color-night-ink);
  border-color: var(--color-signal);
  background: var(--color-night-raised);
}

.band-crumb .lone-link:active {
  background: var(--color-night-press);
}

/* An agent's screens do not let lead text be selected; the lead's name in
   the band is lead text too. */
.role-agent .page-band {
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 40.01rem) {
  /* Buttons standing on the picture are solid pieces of the frame, so their
     words never depend on what the picture is doing behind them. */
  .page-band .control-btn {
    border-color: var(--color-night-control);
    background: var(--color-night-soft);
    color: var(--color-night-ink);
    box-shadow: none;
  }

  .page-band .control-btn:hover {
    border-color: var(--color-signal);
    background: var(--color-night-raised);
    color: var(--color-night-ink);
  }

  .page-band .control-btn:active {
    background: var(--color-night-press);
  }

  .page-band .btn-primary {
    border-color: var(--color-signal);
    background: var(--color-signal);
    color: var(--color-night);
  }

  .page-band .btn-primary:hover {
    border-color: var(--color-signal-2);
    background: var(--color-signal-2);
    color: var(--color-night);
    box-shadow: 0 0 0 4px var(--color-night-soft);
  }

  .page-band .btn-primary:active {
    border-color: var(--color-night-ink);
    background: var(--color-night-ink);
  }

  .page-band .control-btn:disabled,
  .page-band .control-btn[aria-disabled="true"] {
    border-style: dashed;
    border-color: var(--color-night-control);
    background: var(--color-night);
    color: var(--color-night-off);
  }
}

@media (max-width: 40rem) {
  .page-band {
    --band-inset: var(--space-4);
    display: block;
    min-height: 0;
    background: none;
    color: inherit;
  }

  .band-head {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 9.5rem;
    padding: var(--space-5) var(--space-4);
    background-color: var(--color-night);
    background-image: linear-gradient(var(--shade-band-phone), var(--shade-band-phone)), var(--band-img);
    background-position: 0 0, var(--band-pos, center);
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--color-night-ink);
  }

  .band-head:last-child {
    padding-bottom: var(--space-5);
  }

  .band-crumb {
    margin-bottom: var(--space-2);
  }

  .page-band > .actions {
    padding: var(--space-5) var(--space-4) 0;
  }

  .page-body {
    padding: var(--space-5) var(--space-4) var(--space-10);
  }
}

/* === identity: messages and banners === */

.messages {
  margin-bottom: var(--space-6);
}

.message,
.waiting {
  padding: var(--space-4) var(--space-5);
  border-left-width: 6px;
  border-radius: var(--radius-card);
  font-size: 1.0625rem;
}

.message {
  margin: 0 0 var(--space-3);
  font-weight: 600;
}

.message-error {
  background: var(--color-status-dnc-bg);
}

.message-info,
.message-success {
  background: var(--color-status-won-bg);
}

.waiting {
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
  background: var(--color-status-working-bg);
  font-weight: 600;
}

.waiting.assign-many {
  margin-top: var(--space-6);
  background: var(--color-status-open-bg);
}

/* === identity: status chips ===
   The word is always there. Beside it, a mark whose SHAPE differs by state
   as well as its colour: ring (open), half (working), full (won), bar
   (lost), block (do not contact). Bigger than round one: a pill you can
   read from across the desk. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.3rem 0.95rem 0.3rem 0.75rem;
  border: 1.5px solid var(--st, var(--color-control-border));
  border-radius: var(--radius-chip);
  background: var(--st-bg, var(--color-surface));
  color: var(--color-ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  align-self: start;
}

.status::before {
  content: "";
  flex: none;
  width: 0.85em;
  height: 0.85em;
  border: 2.5px solid var(--st, var(--color-muted));
  border-radius: 50%;
}

.status-open { --st: var(--color-accent); --st-bg: var(--color-status-open-bg); }
.status-working { --st: var(--color-warn); --st-bg: var(--color-status-working-bg); }
.status-won { --st: var(--color-ok); --st-bg: var(--color-status-won-bg); }
.status-lost { --st: var(--color-muted); --st-bg: var(--color-status-lost-bg); }
.status-do_not_contact { --st: var(--color-danger); --st-bg: var(--color-status-dnc-bg); }

.status-working::before {
  background: linear-gradient(90deg, var(--st) 50%, transparent 50%);
}

.status-won::before {
  background: var(--st);
}

.status-lost::before {
  height: 0;
  border-width: 3px 0 0;
  border-radius: 0;
}

.status-do_not_contact::before {
  border-radius: 2px;
  background: var(--st);
}

/* === identity: cards and lists ===
   Everything that carries lead or people data sits on a plain card: one flat
   colour, a hairline, a soft shadow. No picture, no pattern. */

.actions {
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
}

.lead-rows {
  margin: var(--space-6) 0;
}

.lead-row {
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.lead-row .status {
  justify-self: end;
  align-self: center;
}

.lead-contact,
.lead-meta {
  font-size: 0.975rem;
}

.lead-contact {
  color: var(--color-ink);
}

.facts {
  align-items: baseline;
  gap: var(--space-3) var(--space-6);
  margin: var(--space-2) 0 var(--space-4);
}

/* Fact labels stay in sentence case: quicker to read all day than capitals. */
.facts dt {
  padding-top: 0.1em;
  font-size: 0.95rem;
  font-weight: 600;
}

.facts dd {
  font-size: 1.0625rem;
}

.facts dd .inline-form {
  display: inline-block;
  margin-left: var(--space-2);
}

/* Each section of a page, each card of settings, and a page's own facts are
   a card. A section's heading carries a short live bar — a bus bar's tap. */
main section[aria-labelledby]:not(.board-column),
.sheet-card,
.page-body > .facts {
  position: relative;
  margin: 0 0 var(--space-6);
  padding: var(--space-6);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-panel);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

main section[aria-labelledby]:not(.board-column) > h2,
.sheet-card > h2,
.sheet-card > h3 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  font-size: var(--text-h2);
}

main section[aria-labelledby]:not(.board-column) > h2::before,
.sheet-card > h2::before,
.sheet-card > h3::before {
  content: "";
  flex: none;
  width: 6px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--color-accent);
}

main section[aria-labelledby]:not(.board-column) > :last-child,
.sheet-card > :last-child {
  margin-bottom: 0;
}

.note {
  padding: var(--space-4) 0;
}

/* The last note does not rule a second line under the section's own. */
.note:last-of-type {
  border-bottom: 0;
}

/* History as a trace: one line down, one node per event. */
.timeline {
  margin-left: 0.4rem;
  padding-left: var(--space-5);
  border-left: 3px solid var(--color-rule);
}

.timeline li {
  position: relative;
  padding: var(--space-2) 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 1.2em;
  left: calc(-1 * var(--space-5) - 1.5px);
  width: 0.7rem;
  height: 0.7rem;
  border: 3px solid var(--color-accent);
  border-radius: 50%;
  background: var(--color-card);
  transform: translateX(-50%);
}

/* A paused sheet is set back by a dashed outline and the word "Paused", not
   by fading the whole card (fading took its text and its button under the
   contrast bars). */
.sheet-card.is-paused {
  opacity: 1;
  border-style: dashed;
  border-color: var(--color-control-border);
  background: transparent;
  box-shadow: none;
}

.share-row {
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) 0;
}

.share-row label {
  font-size: 1.0625rem;
}

.share-row input[type="number"] {
  width: 6rem;
}

.pager {
  margin-top: var(--space-6);
  font-size: 1.0625rem;
}

.pager a {
  padding: 0 var(--space-5);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
  color: var(--color-soft-ink);
}

.pager a:active {
  background: var(--color-soft-press);
}

.qr {
  border-radius: var(--radius-card);
}

/* === identity: pipeline board ===
   Each column is a bay: a lane of surface, a segmented rail in the state's
   colour across the top (the rhythm of a rack), the count in a pill. Cards
   sit on the plain card colour; nothing is drawn behind them. */
.board {
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

.board-column {
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.board-column h2.status {
  position: relative;
  display: flex;
  justify-content: flex-start;
  margin: 0 0 var(--space-3);
  padding: calc(var(--space-3) + 8px) var(--space-2) var(--space-1);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 1.2rem;
  font-weight: 700;
}

.board-column h2.status::after {
  content: "";
  position: absolute;
  top: 0;
  left: var(--space-1);
  right: var(--space-1);
  height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--st) 0 1.25rem, transparent 1.25rem 1.6rem);
}

/* What a narrowed pipeline is showing, said once above the columns. */
.board-showing {
  margin: 0 0 var(--space-5);
  font-size: 1.0625rem;
}

.board-column .count {
  min-width: 2.25rem;
  margin-left: auto;
  padding: 0.1rem var(--space-3);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-chip);
  background: var(--color-card);
  color: var(--color-ink);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* position: the card's hidden "Move … to" label is absolutely placed; without
   a positioned card it escapes the board's own sideways scroll and widens the
   whole page on a phone (it does in the base files too). */
.board-card {
  position: relative;
  margin-bottom: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.board-card .lead-name {
  font-size: 1.1rem;
}

.board-card:last-child {
  margin-bottom: 0;
}

/* Each card carries its column's colour down its left edge, so a card half
   scrolled off its heading still says which bay it is in. The heading says it
   in words; this only repeats it. (Relies on the heading and the cards being
   siblings; if that changes the cards simply lose the edge.) */
.board-column h2.status ~ .board-card {
  border-left: 5px solid var(--color-control-border);
}

.board-column h2.status-open ~ .board-card { border-left-color: var(--color-accent); }
.board-column h2.status-working ~ .board-card { border-left-color: var(--color-warn); }
.board-column h2.status-won ~ .board-card { border-left-color: var(--color-ok); }
.board-column h2.status-lost ~ .board-card { border-left-color: var(--color-muted); }
.board-column h2.status-do_not_contact ~ .board-card { border-left-color: var(--color-danger); }

.card-move {
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.card-move select {
  flex: 1 1 9rem;
  min-width: 0;
  font-size: 0.95rem;
}

.card-move .control-btn {
  padding-inline: var(--space-4);
}

/* An empty bay says so in words, inside the outline of a free slot. */
.board-column > .placeholder-note {
  margin: 0;
  padding: var(--space-6) var(--space-2);
  border: 1.5px dashed var(--color-control-border);
  border-radius: var(--radius-card);
  text-align: center;
}

/* === identity: sign-in family — a photograph, half the screen ===
   Sign-in, the second step, the lock-out and "nothing at this address".
   Desktop: the photograph fills the left half, top to bottom; the form sits
   in the middle of the right half. Phone: the photograph is a tall band
   under the header and the form follows — the first field is still on the
   first screen. Night is laid over the top and bottom of the photograph,
   where the name and the line of words sit. */
main.entry > .page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: calc(100vh - 4.25rem);
  padding: 0;
}

.entry-art {
  position: relative;
  overflow: hidden;
  min-height: 34rem;
  background-color: var(--color-night);
  background-image:
    linear-gradient(
      180deg,
      var(--shade-photo-edge) 0,
      var(--shade-photo-mid) 32%,
      var(--shade-photo-mid) 48%,
      var(--shade-photo-edge) 84%
    ),
    var(--photo-img);
  background-position: 0 0, var(--photo-pos, center);
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--color-night-ink);
}

.entry-lockup,
.entry-line {
  position: absolute;
  left: var(--space-10);
  right: var(--space-10);
  margin: 0;
  text-shadow: var(--shade-text);
}

.entry-lockup {
  top: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.entry-lockup .brand-mark {
  width: 2.75rem;
  height: 2.75rem;
}

.entry-line {
  bottom: var(--space-10);
  max-width: 13em;
  font-size: clamp(1.9rem, 1rem + 2.2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.entry-form {
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 34rem;
  min-width: 0;
  padding: var(--space-10) var(--space-8);
}

.entry-form h1 {
  font-size: clamp(2rem, 1.3rem + 1.8vw, 2.9rem);
}

.entry-form .stacked-form {
  max-width: none;
  margin: var(--space-6) 0;
}

.entry-form .stacked-form .btn-primary {
  align-self: stretch;
  min-height: 3.25rem;
  font-size: 1.1rem;
}

@media (max-width: 52rem) {
  main.entry > .page-body {
    display: block;
    min-height: 0;
  }

  .entry-art {
    min-height: 0;
    height: 14rem;
    background-image:
      linear-gradient(180deg, var(--shade-photo-mid) 0, var(--shade-photo-mid) 30%, var(--shade-photo-edge) 80%),
      var(--photo-img);
  }

  /* The header just above already carries the name. */
  .entry-lockup {
    display: none;
  }

  .entry-line {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    font-size: 1.6rem;
  }

  .entry-form {
    max-width: 36rem;
    padding: var(--space-6) var(--space-4) var(--space-10);
  }
}

/* === identity: empty states — a picture, then the words ===
   Only where there is no lead data to show. */
.state-art {
  height: clamp(11rem, 30vw, 18rem);
  margin: 0 0 var(--space-6);
  border-radius: var(--radius-panel);
  background-color: var(--color-night);
  background-image: var(--photo-img);
  background-position: var(--photo-pos, center);
  background-size: cover;
  box-shadow: var(--shadow-raised);
}

.state-art + p {
  font-size: 1.3rem;
  font-weight: 700;
}

/* === identity: motion ===
   Only colour, edge and halo ease; nothing moves. Switched off entirely for
   anyone who has asked for less motion (the rule above the identity block). */
@media (prefers-reduced-motion: no-preference) {
  .control-btn,
  .nav-link,
  .lone-link,
  summary,
  input,
  select,
  textarea,
  .pager a {
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .control-btn:active,
  input[type="checkbox"]:active,
  input[type="radio"]:active {
    transform: none;
  }
}

/* === identity: narrow screens === */
@media (max-width: 40rem) {
  .site-header {
    gap: var(--space-1) var(--space-2);
    padding: var(--space-2) var(--space-4);
  }

  /* One row for the way around: plain words, the current one barred. */
  .site-nav {
    gap: 0 var(--space-3);
  }

  .site-header .nav-link {
    font-size: 0.95rem;
  }

  .site-header .control-btn {
    font-size: 0.9rem;
  }

  .site-header .nav-link,
  .site-header .nav-link[aria-current="page"],
  .site-header .nav-link:hover {
    padding: 0;
    border-radius: 0;
    background: none;
  }

  .site-header .nav-link:hover {
    box-shadow: inset 0 -3px 0 var(--color-night-control);
  }

  .site-header .nav-link[aria-current="page"] {
    box-shadow: inset 0 -3px 0 var(--color-signal);
  }

  .site-header .control-btn {
    padding-inline: var(--space-3);
  }

  .site-nav .inline-form {
    margin-left: auto;
  }

  .site-header .nav-count-word,
  .site-header .textsize-word {
    display: inline;
  }

  .lead-row {
    padding: var(--space-4);
  }

  .lead-row .status {
    justify-self: start;
  }

  main section[aria-labelledby]:not(.board-column),
  .sheet-card,
  .page-body > .facts {
    padding: var(--space-5) var(--space-4);
  }

  .facts {
    gap: var(--space-1) var(--space-4);
  }

  .facts dd .inline-form {
    display: block;
    margin: var(--space-2) 0 0;
  }

  /* A long label over a long value: the label goes above it. */
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts dd {
    margin-bottom: var(--space-3);
  }
}

/* === identity: the band's title on a phone ===
   The bar under a band's title is drawn by the band's head rather than by the
   title, so that on a phone the title itself can be cut off after two lines
   (the picture then never takes more than a third of the screen, however long
   a lead's name and however large the text). The whole title is still in the
   page for a screen reader, and in the browser's tab. */
.page-band h1::after {
  content: none;
}

.band-head::after {
  content: "";
  display: block;
  flex: none;
  width: 4.5rem;
  height: 5px;
  margin-top: var(--space-3);
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--color-signal) 0 3.25rem,
    transparent 3.25rem 3.75rem,
    var(--color-signal) 3.75rem
  );
}

@media (max-width: 40rem) {
  .page-band h1 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    padding-bottom: 0.08em;
    font-size: 1.75rem;
  }

  .band-head::after {
    margin-top: var(--space-2);
  }
}

/* === identity: handing out leads ===
   The Assign screen, the weights screen and the list's filters, in the same
   language: soft pills, plain cards, nothing pressable under 44px. */

/* Which leads the list shows. The one that is on is filled deeper, bolder,
   and has a dot before its word — never colour alone (and the line under the
   row says it in words as well). */
.control-btn[aria-current="true"] {
  border-color: var(--color-accent);
  background: var(--color-soft-press);
  color: var(--color-soft-ink);
  font-weight: 700;
}

.control-btn[aria-current="true"]::before {
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: currentColor;
}

/* What to show on the Assign screen: one card of choices. */
.assign-filter {
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-6);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-panel);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.assign-field label {
  font-weight: 650;
}

.assign-who,
.share-group {
  margin: 0 0 var(--space-6);
}

.assign-who legend {
  margin-bottom: var(--space-3);
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.share-group legend {
  font-size: 1.0625rem;
  font-weight: 700;
}

.assign-who input[type="radio"],
.assign-row input[type="checkbox"],
.assign-filter input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
}

/* Each person, and each lead, is a card you press anywhere on. */
.assign-who label.check,
.assign-row {
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
}

.assign-who label.check:hover,
.assign-row:hover {
  border-color: var(--color-accent);
}

/* Chosen: the open tint and the accent edge, beside the filled tick or dot. */
.assign-row:has(input:checked),
.assign-who label.check:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-status-open-bg);
}

.assign-name {
  font-size: 1.0625rem;
  font-weight: 700;
}

.assign-rows {
  margin-top: var(--space-4);
}

.assign-pick-head {
  margin-bottom: var(--space-2);
}

/* Who, how many, and the button: a raised shelf along the foot of the list. */
.assign-bar {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-rule);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--color-card);
  box-shadow: var(--shadow-raised);
}

.assign-said {
  font-weight: 650;
}

/* The weights screen: a team's card has two parts under its name. Their
   headings are plain, so the team's name stays the one with the bar. */
.sheet-card > h2 ~ h3 {
  display: block;
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-h3);
}

.sheet-card > h2 ~ h3::before {
  content: none;
}

.share-switch {
  margin: var(--space-4) 0 var(--space-5);
}

/* === identity: the contact log and the Dictate button === */

.timeline-notes {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-left-width: 3px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--color-surface);
  font-size: 0.975rem;
}

.dictate {
  gap: var(--space-2) var(--space-3);
}

/* Listening is said in the button's words; the deeper fill underlines it. */
.dictate-on .control-btn {
  border-color: var(--color-accent);
  background: var(--color-soft-press);
  font-weight: 700;
}

@media (max-width: 40rem) {
  .assign-filter {
    padding: var(--space-4);
  }

  .assign-bar {
    padding: var(--space-3) var(--space-4);
  }
}

/* === identity: the lead comes first — search, every lead, ages, marks (ledger D60) === */

/* "Search name, phone or email": the box takes the room, its button and
   "Clear" sit beside it and drop below it on a narrow screen. */
.search-field {
  flex: 1 1 18rem;
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.search-box input {
  flex: 1 1 12rem;
  min-width: 0;
}

/* Every lead of a column is in it, so a column is as tall as the window and
   scrolls inside itself; its heading and its count stay at the top. */
.board-column {
  max-height: max(26rem, calc(100vh - 12rem));
  overflow-y: auto;
  padding-top: 0;
}

.board-column h2.status {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: calc(var(--space-6) + 8px);
  background: var(--color-surface);
}

.board-column h2.status::after {
  top: var(--space-3);
}

/* A long column: a card off the screen is not laid out or painted until it
   is scrolled to (the browser keeps its place with the size below), so a
   pipeline of thousands opens and scrolls like one of dozens. Containing a
   card clips its shadow, so in a long column the cards go without one. */
.board-column[data-long] .board-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 15rem;
  box-shadow: none;
}

/* When it came in and how long it has been in its status. */
.lead-ages {
  color: var(--color-muted);
}

/* A lead somebody holds that has gone without a contact. The words are
   always there; beside them a diamond — hollow for "no contact for N days",
   solid for "never contacted" — so it is not told by colour alone, and is
   not mistaken for a status (those are round, a bar or a block). */
.quiet-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.15rem 0.75rem 0.15rem 0.6rem;
  border: 1.5px solid var(--color-warn);
  border-radius: var(--radius-chip);
  background: var(--color-status-working-bg);
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.quiet-mark::before {
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border: 2.5px solid var(--color-warn);
  transform: rotate(45deg);
}

.quiet-never {
  border-color: var(--color-danger);
  background: var(--color-status-dnc-bg);
}

.quiet-never::before {
  border-color: var(--color-danger);
  background: var(--color-danger);
}

.board-card > .quiet-mark {
  margin-top: var(--space-1);
}

/* === identity: a save says it is saved ===
   The words of a success, put up near the top of the window as well as in
   the strip under the heading (public/js/theme.js): in view wherever the
   page opened, gone in a few seconds or when pressed. At the top, so it
   never sits on the Assign bar (which keeps to the bottom); narrow enough
   to leave the page's own buttons alone. Pressing anywhere on it sends it
   away, and it is tall enough for a thumb. */
.saved-notice {
  position: fixed;
  z-index: 30;
  top: var(--space-3);
  left: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  width: fit-content;
  max-width: min(36rem, calc(100% - 2 * var(--space-4)));
  min-height: var(--touch);
  margin: 0 auto;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  border: 1.5px solid var(--color-ok);
  border-left-width: 6px;
  border-radius: var(--radius-card);
  background: var(--color-card);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
  font-size: 1.0625rem;
  font-weight: 650;
  cursor: pointer;
}

.saved-notice-words {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  overflow-wrap: anywhere;
}

.saved-notice-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border: 0;
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.saved-notice-close:hover {
  background: var(--color-soft-hover);
}

/* It slides down into place — only for someone who has not asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .saved-notice {
    animation: saved-notice-in 180ms ease-out;
  }

  .saved-notice-going {
    opacity: 0;
    transition: opacity 350ms ease-in;
  }

  @keyframes saved-notice-in {
    from {
      opacity: 0;
      transform: translateY(-0.75rem);
    }
  }
}

@media print {
  .saved-notice {
    display: none;
  }
}

/* === identity: end === */

/* --- Fingers ------------------------------------------------------------- */

/* On a touch screen everything that can be pressed is at least 44px tall
   (2.75rem is 44px at the smallest text size and more at the others). A
   mouse is precise, so none of this applies there and the desktop keeps its
   compact look. Kept last so it wins over the rules above. */
@media (pointer: coarse) {
  .control-btn,
  .nav-link,
  .brand,
  .lone-link,
  .lead-name,
  .pager a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  .control-btn {
    justify-content: center;
    min-width: 2.75rem;
  }

  .lead-tick {
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin-left: calc(-1 * var(--space-2));
  }

  .stacked-form label.check,
  .assign-filter label.check,
  .assign-who label.check,
  .assign-row {
    align-items: center;
    min-height: 2.75rem;
  }

  select,
  .stacked-form input[type="file"],
  .stacked-form input[type="datetime-local"] {
    min-height: 2.75rem;
  }
}

/* === the capture tripwire (leads/_guard, public/js/guard.js) === */

/* After a capture key: the lead content is gone for a moment. No fade — it
   goes and comes back, so there is nothing to slow down for reduced motion. */
.guard-blank main {
  visibility: hidden;
}

/* What the person is told was recorded: over the page, in view wherever
   they have scrolled to, and still there while the content is blanked. */
.guard-said {
  position: fixed;
  z-index: 20;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-rule);
  border-left: 6px solid var(--color-danger);
  border-radius: var(--radius-card);
  background: var(--color-card);
  color: var(--color-ink);
  font-weight: 600;
  box-shadow: var(--shadow-card);
  visibility: visible;
}

/* How many signals a manager has not seen, beside "Alerts" in the header. */
.nav-count {
  display: inline-block;
  min-width: 1.5rem;
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-chip);
  background: var(--color-signal);
  color: var(--color-night);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
}

/* Words that stand in for a tooltip on a phone (D278): "new replies" after the Leads count, "Text" before A±.
   Shown on narrow screens only (identity: narrow screens). */
.nav-count-word,
.textsize-word {
  display: none;
}

/* --- the Alerts page --- */
.device-mix,
.alert-rows,
.away-rows {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0;
}

.device-mix li,
.alert-row,
.away-rows li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-rule);
}

.device-mix .lead-meta,
.alert-row .lead-meta {
  display: block;
  margin-top: var(--space-1);
}

.alert-what {
  display: block;
  overflow-wrap: anywhere;
}

.alert-what .status {
  margin-right: var(--space-2);
}

/* LeadDesk's alerts about itself, for executives: set apart from what
   people did, at the top of the page. */
.system-alerts {
  margin-bottom: var(--space-6);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.system-alerts h2 {
  margin-top: var(--space-2);
}

.system-alerts .alert-row:last-child {
  border-bottom: 0;
}

.system-open {
  overflow-wrap: anywhere;
}

.system-open .status {
  margin-right: var(--space-2);
}

/* === follow-ups (ledger D60) === */

/* A lead's open follow-up, on a pipeline card, a list row, the lead's page
   and the Follow-ups page. The words are always there; beside them a mark
   whose SHAPE differs as well as its colour — an open arrow (coming up), a
   solid arrow (today), an exclamation mark (overdue) — and none of them is
   a status's shape (round, bar, block) or a quiet mark's (a diamond). */
.follow-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.15rem 0.75rem 0.15rem 0.6rem;
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-chip);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.follow-mark::before {
  content: "";
  flex: none;
  width: 0.45em;
  height: 0.45em;
  margin-left: -0.1em;
  border: solid var(--color-muted);
  border-width: 2.5px 2.5px 0 0;
  transform: rotate(45deg);
}

.follow-today {
  border-color: var(--color-accent);
  background: var(--color-status-open-bg);
}

.follow-today::before {
  width: 0;
  height: 0;
  margin-left: 0;
  border-style: solid;
  border-width: 0.38em 0 0.38em 0.6em;
  border-color: transparent transparent transparent var(--color-accent);
  transform: none;
}

.follow-overdue {
  border-color: var(--color-danger);
  background: var(--color-status-dnc-bg);
}

/* The mark as a button to move the follow-up (ledger D265): the same chip, with a pointer and a hint of lift. */
a.follow-mark-btn {
  display: inline-flex;
  text-decoration: none;
  cursor: pointer;
}

a.follow-mark-btn:hover .follow-mark {
  box-shadow: 0 0 0 2px var(--color-control-border);
}

/* On a touch screen the button is thumb-sized around the same chip. */
@media (pointer: coarse) {
  a.follow-mark-btn {
    min-height: 2.75rem;
    align-items: center;
  }
}

.follow-overdue::before {
  content: "!";
  width: auto;
  height: auto;
  margin-left: 0;
  border: 0;
  color: var(--color-danger);
  font-weight: 800;
  line-height: 1;
  transform: none;
}

.board-card > .follow-mark {
  margin-top: var(--space-1);
}

/* On the lead's page: the open follow-up, then Done and Clear. */
.follow-open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}

.follow-open .lead-meta {
  flex-basis: 100%;
}

.follow-actions {
  margin: 0 0 var(--space-4);
}

/* "A follow-up is open for this lead", above the contact form. */
.follow-note {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: 6px solid var(--color-warn);
  border-radius: var(--radius-card);
  background: var(--color-status-working-bg);
  font-weight: 600;
}

/* The Follow-ups page: the rows of a section sit inside the section's own
   card, so they are flat — a hairline, no shadow of their own. */
.follow-section .lead-rows {
  margin: 0;
}

.follow-section .lead-row {
  background: var(--color-bg);
  box-shadow: none;
}

.follow-section .lead-row:last-child {
  margin-bottom: 0;
}

.follow-due {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.follow-row .lead-contact {
  grid-column: 1 / -1;
}

.follow-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3);
  grid-column: 1 / -1;
  margin-top: var(--space-2);
}

.follow-controls .control-btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
}

.follow-move {
  min-width: 0;
  max-width: 100%;
}

.follow-move .assign-filter {
  margin: 0;
}

/* The managers' table: a person, and three numbers that are links. */
.follow-table {
  width: 100%;
  border-collapse: collapse;
}

.follow-table th,
.follow-table td {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-rule);
  text-align: left;
  vertical-align: middle;
}

.follow-table tbody tr:last-child th,
.follow-table tbody tr:last-child td {
  border-bottom: 0;
}

.follow-table thead th {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.follow-table tbody th {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.follow-table td,
.follow-table thead th:not(:first-child) {
  width: 6rem;
  text-align: center;
}

.follow-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0 var(--space-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-chip);
  font-weight: 700;
}

/* Overdue, and more than none: ringed, as well as being under its heading. */
.follow-count-overdue {
  border-color: var(--color-danger);
  background: var(--color-status-dnc-bg);
  color: var(--color-ink);
}

@media (max-width: 40rem) {
  .follow-table td,
  .follow-table thead th:not(:first-child) {
    width: 3.75rem;
  }

  .follow-table thead th {
    font-size: 0.8rem;
  }

  .follow-table th,
  .follow-table td {
    padding-inline: var(--space-1);
  }
}

@media (pointer: coarse) {
  .follow-count {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
}

/* === reports (ledger D60) ===
   Two tables of numbers. On a wide screen a table scrolls sideways inside
   its own frame — never the page — with the name of the row held at the
   left; on a phone each row is a card, every number beside its label. */
.report {
  margin: 0 0 var(--space-10);
}

.report-note {
  max-width: 60rem;
  margin: 0 0 var(--space-3);
}

.report-more {
  margin: 0 0 var(--space-4);
}

.report-more ul {
  max-width: 60rem;
  margin: 0;
  padding-left: var(--space-5);
  font-size: 0.95rem;
}

.report-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  /* A soft edge on whichever side has more columns to scroll to: the two
     shades stay with the frame, and the two covers travel with the table
     and hide a shade once that end is reached. */
  background:
    linear-gradient(to right, var(--color-card) 40%, transparent) left center / 3rem 100% no-repeat local,
    linear-gradient(to left, var(--color-card) 40%, transparent) right center / 3rem 100% no-repeat local,
    linear-gradient(to right, var(--color-rule), transparent) left center / 1rem 100% no-repeat scroll,
    linear-gradient(to left, var(--color-rule), transparent) right center / 1rem 100% no-repeat scroll,
    var(--color-card);
  box-shadow: var(--shadow-card);
}

.report-scroll:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.report-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.report-table th,
.report-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-rule);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.report-table thead th {
  max-width: 5rem;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  vertical-align: bottom;
  white-space: normal;
}

.report-table thead tr:first-child th[colspan] {
  max-width: none;
  color: var(--color-ink);
  text-align: left;
}

/* The row's name: on the left, and still there when the table is scrolled. */
.report-table .report-who {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 9rem;
  max-width: 14rem;
  background: var(--color-card);
  font-weight: 650;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Where one set of columns ends and the next begins. */
.report-table .report-start {
  border-left: 1px solid var(--color-rule);
}

.report-table tfoot th,
.report-table tfoot td {
  border-bottom: 0;
  background: var(--color-surface);
  font-weight: 700;
}

.report-table tbody tr:hover th,
.report-table tbody tr:hover td {
  background: var(--color-field-rest);
}

.report-zero {
  color: var(--color-muted);
}

.report-link {
  font-weight: 650;
}

.download-what ul {
  max-width: 44rem;
  padding-left: var(--space-5);
}

.download-what li {
  margin-bottom: var(--space-2);
}

.download-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.download-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-4);
  margin: 0 0 var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.download-many {
  font-weight: 700;
  text-align: right;
}

.download-row .lead-meta,
.download-reason {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  .report-scroll {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .report-table th,
  .report-table td {
    padding: var(--space-2) var(--space-3);
  }

  .report-table,
  .report-table tbody,
  .report-table tfoot,
  .report-table tr,
  .report-table th,
  .report-table td {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  /* The headings are said beside each number instead (data-label). */
  .report-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* A card for each row: its name across the top, then the numbers three
     abreast, each under its own label — a third of the height of a list. */
  .report-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3) var(--space-3);
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4) var(--space-4);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-card);
    background: var(--color-card);
    box-shadow: var(--shadow-card);
  }

  .report-table tfoot tr {
    background: var(--color-surface);
  }

  .report-table .report-who {
    position: static;
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
    padding: 0 0 var(--space-2);
    border-bottom: 1px solid var(--color-rule);
    background: none;
    font-size: 1.15rem;
  }

  .report-table td,
  .report-table tfoot td {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .report-table td::before {
    content: attr(data-label);
    color: var(--color-muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
  }

  .report-table .report-start {
    border-left: 0;
  }

  .report-table tbody tr:hover th,
  .report-table tbody tr:hover td {
    background: none;
  }

  .download-row {
    padding: var(--space-3) var(--space-4);
  }
}

@media (pointer: coarse) {
  .report-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }
}

/* === identity: the Assign screen in paint mode, and "Split these among…" ===
   With the page's script the Assign screen is "paint mode": the people sit
   in a strip that stays at the top, one of them is chosen, and every lead
   tapped goes to that person at once. What is here is hidden until the
   script shows it; without the script the screen is the plain form above. */

/* A person's mark: two letters on a shape, in one of six colours. The shape
   and the letters do the telling apart; the colour only helps. */
.mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--mark, var(--color-control-border));
  color: var(--color-mark-ink);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}

.mark-c0 { --mark: var(--color-mark-1); }
.mark-c1 { --mark: var(--color-mark-2); }
.mark-c2 { --mark: var(--color-mark-3); }
.mark-c3 { --mark: var(--color-mark-4); }
.mark-c4 { --mark: var(--color-mark-5); }
.mark-c5 { --mark: var(--color-mark-6); }

/* Five shapes: a circle, a square, a diamond, a hexagon, a shield. */
.mark.mark-s0 { border-radius: 50%; }
.mark.mark-s1 { border-radius: 0.3rem; }
.mark.mark-s2 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); font-size: 0.62rem; }
.mark.mark-s3 { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.mark.mark-s4 { clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%); padding-bottom: 0.3rem; }

/* Nobody: an empty ring. */
.mark.mark-none {
  border: 2px dashed var(--color-control-border);
  border-radius: 50%;
  background: none;
  color: var(--color-ink);
}

/* The people, across the top, in view however far down the list is. */
.paint-strip {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 0;
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-3) var(--space-2);
  border: 1px solid var(--color-rule);
  border-bottom: 3px solid var(--color-accent);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-raised);
}

/* Anything the browser scrolls to — a row reached with Tab — stops clear of the strip. */
html:has(.paint-strip:not([hidden])) {
  scroll-padding-top: 13rem;
}

.paint-armed {
  margin: 0 0 var(--space-2);
  font-weight: 700;
  line-height: 1.3;
}

/* One row that scrolls sideways inside the strip — the page itself never does. */
.paint-people {
  display: flex;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-1);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding: var(--space-2);
}

.paint-person {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 3.5rem;
  max-width: 18rem;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-card);
  background: var(--color-card);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.paint-person:hover {
  border-color: var(--color-accent);
}

/* Chosen: the open tint, a doubled accent edge, and the name underlined —
   and the line above the strip says who in words. */
.paint-person[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-status-open-bg);
  box-shadow: inset 0 0 0 2px var(--color-accent);
}

.paint-person[aria-pressed="true"] .paint-person-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.paint-person-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.paint-person-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paint-person-meta {
  color: var(--color-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.paint-session {
  color: var(--color-ink);
  font-weight: 700;
}

/* The number key that chooses the person. */
.paint-key {
  flex: none;
  margin-left: var(--space-1);
  padding: 0 0.4rem;
  border: 1px solid var(--color-control-border);
  border-radius: 0.35rem;
  color: var(--color-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (pointer: coarse) {
  .paint-key {
    display: none;
  }
}

@media (min-width: 48rem) {
  .paint-people {
    flex-wrap: wrap;
    max-height: 12rem;
    overflow-x: visible;
    overflow-y: auto;
  }
}

/* A lead's card is the list item: the row you tick or tap and, under it,
   who has the lead now. */
.assign-item {
  margin-bottom: var(--space-2);
  border: 1.5px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
}

.assign-item > .assign-row {
  margin: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: none;
}

.assign-item:hover,
.assign-item:has(input:checked) {
  border-color: var(--color-accent);
}

.assign-item:has(input:checked) {
  background: var(--color-status-open-bg);
}

.assign-form.is-armed .assign-item {
  cursor: pointer;
}

/* Given in this sitting: a thick edge in the person's colour beside their
   mark and name. Still on its way to the server: a dashed edge. */
.assign-item.is-painted {
  border-color: var(--mark, var(--color-control-border));
  border-left-width: 0.5rem;
}

.assign-item.is-saving {
  border-style: dashed;
}

.paint-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-4) var(--space-3);
  border-top: 1px dashed var(--color-rule);
  font-weight: 650;
}

.paint-now .mark {
  width: 2rem;
  height: 2rem;
}

.paint-undo {
  min-height: var(--touch);
  margin-left: auto;
}

/* The bar at the foot: what was just done, "Undo last", and anything that went wrong. */
.paint-troubles {
  flex-basis: 100%;
  /* Several at once scroll inside the bar: it never grows over the list. */
  max-height: 8.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.paint-trouble {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-left: 6px solid var(--color-danger);
  border-radius: var(--radius);
  background: var(--color-status-dnc-bg);
  font-weight: 600;
}

.paint-trouble .control-btn,
.paint-actions .control-btn {
  min-height: var(--touch);
}

.paint-actions {
  margin: 0;
}

/* "Split these among…": the choices, and the page that asks. */
.split-box {
  margin: 0 0 var(--space-6);
}

.split-body {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-panel);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.split-set {
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
}

.split-set legend {
  padding: 0;
  font-weight: 700;
}

.split-set label.check,
.split-agree label.check {
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  min-height: var(--touch);
}

.split-set input,
.split-agree input[type="checkbox"] {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
}

.split-said {
  font-size: 1.25rem;
  line-height: 1.35;
}

.split-counts {
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.split-counts li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.split-count {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.assign-many-pointer {
  margin: var(--space-4) 0 var(--space-2);
}

@media (max-width: 40rem) {
  .paint-strip {
    padding: var(--space-2) var(--space-2) var(--space-1);
  }

  .paint-person {
    max-width: 14rem;
  }

  .split-body {
    padding: var(--space-4);
  }
}

/* === the header's "Manage" menu ===
   What is opened now and then (People, Teams, the watch list) sits under one
   word, so the bar holds what is opened every hour. A plain disclosure: it
   works with no script. The list hangs under the word on a wide screen and
   runs the width of the bar on a phone. */
.site-header {
  z-index: 6;
}

.nav-menu {
  position: relative;
  align-self: center;
}

.nav-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* In the bar the word looks like the links beside it, not like a
   disclosure in a page (a soft pill with its arrow in front). */
.site-header .nav-menu > summary {
  gap: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--color-night-link);
  font-weight: 600;
}

.site-header .nav-menu > summary::before {
  content: none;
}

.site-header .nav-menu > summary:hover {
  background: var(--color-night-raised);
  color: var(--color-night-ink);
}

.nav-menu > summary::-webkit-details-marker {
  display: none;
}

/* A small chevron: down when shut, up when open. */
.nav-menu > summary::after {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: var(--space-2);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.15rem) rotate(45deg);
}

.nav-menu[open] > summary::after {
  transform: translateY(0.1rem) rotate(-135deg);
}

.site-header .nav-menu[open] > summary {
  background: var(--color-night-raised);
  color: var(--color-night-ink);
}

/* One of its pages is the one being looked at: the word is marked as the
   current page's own link is — filled, bolder, barred. */
.site-header .nav-menu > summary[aria-current] {
  background: var(--color-night-soft);
  color: var(--color-night-ink);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--color-signal);
}

.nav-menu-list {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 30;
  display: grid;
  gap: var(--space-1);
  min-width: 12rem;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  border: 1px solid var(--color-night-control);
  border-radius: var(--radius-card);
  background: var(--color-night);
  box-shadow: var(--shadow-raised);
}

/* Shut, the menu takes no room at all: a browser that still lays out a shut disclosure's content (WebKit) would
   otherwise measure its links, and let the list, placed where it would stand, widen a phone's page sideways. */
.nav-menu:not([open]) > .nav-menu-list {
  display: none;
}

.site-header .nav-menu-list .nav-link {
  display: flex;
  width: 100%;
  min-height: var(--touch);
  padding: 0 var(--space-4);
  border-radius: var(--radius);
}

@media (max-width: 40rem) {
  .nav-menu {
    position: static;
  }

  .nav-menu-list {
    top: 100%;
    left: var(--space-4);
    right: var(--space-4);
  }

  .site-header .nav-menu > summary,
  .site-header .nav-menu > summary:hover,
  .site-header .nav-menu > summary[aria-current],
  .site-header .nav-menu[open] > summary {
    padding: 0;
    border-radius: 0;
    background: none;
  }

  .site-header .nav-menu[open] > summary {
    box-shadow: inset 0 -3px 0 var(--color-night-control);
  }

  .site-header .nav-menu-list .nav-link,
  .site-header .nav-menu-list .nav-link:hover,
  .site-header .nav-menu-list .nav-link[aria-current="page"] {
    padding: 0 var(--space-3);
    border-radius: var(--radius);
  }

  .site-header .nav-menu-list .nav-link[aria-current="page"] {
    background: var(--color-night-soft);
  }
}

/* === reports: the summary, what needs attention, the charts ===
   The page reads from the top: what it is set against, the handful of
   numbers, what to do, then the pictures and the tables. Every chart is
   drawn by the page itself in plain SVG, coloured only from the tokens, and
   has its numbers in words beside it. */
.report-against {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-5);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.report-copied {
  color: var(--color-ink);
  font-weight: 600;
}

.report-summary {
  margin-bottom: var(--space-6);
}

.report-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.tile-name {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

.tile-figure {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.tile-fact,
.tile-also,
.tile-change {
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tile-fact {
  color: var(--color-muted);
}

/* Which way a number went is said by a shape and by words. Up is not
   always good (follow-ups overdue) and so no colour says it is. */
.tile-change {
  margin-top: auto;
  padding-top: var(--space-1);
  font-weight: 600;
}

.tile-none {
  color: var(--color-muted);
  font-weight: 400;
}

.tile-shape {
  font-size: 0.7rem;
}

.tile-then {
  color: var(--color-muted);
  font-weight: 400;
}

.report-attention h2 {
  margin-bottom: var(--space-3);
}

.attention-lines {
  max-width: 60rem;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-rule);
  border-left: 6px solid var(--color-warn);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.attention-lines li + li {
  border-top: 1px solid var(--color-rule);
}

.attention-line {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
}

/* --- the chart of days --- */
.chart-days {
  max-width: 60rem;
  margin: 0;
}

.chart-frame {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 9rem auto;
  column-gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.chart-counts {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  min-height: 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.chart-top,
.chart-nought,
.chart-first,
.chart-last {
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.chart-top,
.chart-nought {
  grid-column: 1;
  grid-row: 2;
  min-width: 1.25rem;
  text-align: right;
}

.chart-top {
  align-self: start;
}

.chart-nought {
  align-self: end;
}

.chart-svg {
  grid-column: 2;
  grid-row: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-first,
.chart-last {
  grid-column: 2;
  grid-row: 3;
  padding-top: var(--space-2);
}

.chart-last {
  justify-self: end;
}

.chart-bar {
  fill: var(--color-accent);
}

/* Duplicate returns: the hollow top of a bar — an outline, no fill. */
.chart-returns {
  fill: var(--color-card);
  stroke: var(--color-accent);
  stroke-width: 2;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}

.report-returns {
  max-width: 60rem;
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-left: 4px solid var(--color-control-border);
  background: var(--color-surface);
  font-size: 0.95rem;
}

span.attention-line {
  font-weight: 600;
}

.chart-line {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Leads assigned (ledger D217): the dark bar on the right of each day. */
.chart-assigned {
  fill: var(--color-ink);
}

/* The 7-day average of leads in: a solid line, thicker than the dashed line of contacts. */
.chart-average {
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 3;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Leads in today, this week, this month (ledger D217): a row of three above the tabs. */
.report-leads-in {
  max-width: 60rem;
  margin: 0 0 var(--space-4);
}

.leads-in-h {
  margin: 0;
  font-size: 1rem;
}

.leads-in-note {
  margin: 0 0 var(--space-2);
}

.report-tiles.leads-in-tiles {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.leads-in-tiles .tile-fact a {
  font-weight: 700;
}

.chart-rule {
  stroke: var(--color-rule);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-floor {
  stroke: var(--color-control-border);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-3) 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.chart-key strong {
  color: var(--color-ink);
}

.key-mark {
  width: 0.8rem;
  height: 0.8rem;
  vertical-align: -0.08rem;
}

.key-line {
  width: 1.6rem;
}

.chart-numbers {
  margin-top: var(--space-2);
}

.plain-table {
  margin-top: var(--space-3);
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.plain-table th,
.plain-table td {
  padding: var(--space-1) var(--space-4) var(--space-1) 0;
  border-bottom: 1px solid var(--color-rule);
  text-align: right;
}

.plain-table th:first-child {
  text-align: left;
}

/* --- where each row's leads stand now: one bar each, all on one scale --- */
.chart-stands {
  max-width: 60rem;
  margin: 0 0 var(--space-5);
}

.stand-rows {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.stand-rows li {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) minmax(0, 15rem);
  align-items: center;
  gap: var(--space-1) var(--space-3);
  font-size: 0.9rem;
}

.stand-who {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.stand-said {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.stand-bar {
  display: block;
  width: 100%;
  height: 0.9rem;
  border-radius: 0.25rem;
  background: var(--color-surface);
}

.stand-bar rect,
.key-mark rect {
  stroke: var(--color-card);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* The parts of the pipeline wear the colours their cards' rails wear; the
   order (left to right, as the pipeline's columns) and the words beside
   each bar say the same without colour. */
.stand-open { fill: var(--color-accent); }
.stand-working { fill: var(--color-warn); }
.stand-won { fill: var(--color-ok); }
.stand-lost { fill: var(--color-muted); }
.stand-do_not_contact { fill: var(--color-danger); }

/* --- "My reports" (ledger D161): an agent's own to-do lists --- */
.todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-4);
  max-width: 72rem;
}

.todo-box {
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.todo-box h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: 1rem;
}

.todo-count {
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.todo-list {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-2);
  padding: 0;
  border-bottom: 1px solid var(--color-rule);
  overflow-wrap: anywhere;
}

.todo-list li:last-child {
  border-bottom: 0;
}

.todo-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-weight: 650;
}

/* Overdue: said in words beside the name, and marked by an edge too. */
.todo-list li.todo-late {
  padding-left: var(--space-2);
  border-left: 4px solid var(--color-warn);
}

/* --- the tables: numbers that lead somewhere, headings that put in order --- */
.report-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-3);
}

.report-n {
  font-weight: 650;
}

.report-sort {
  color: inherit;
  text-decoration: none;
}

.report-sort:hover {
  text-decoration: underline;
}

.report-table thead th[aria-sort="ascending"],
.report-table thead th[aria-sort="descending"] {
  color: var(--color-ink);
}

.report-arrow {
  font-size: 0.65rem;
}

.report-table thead th {
  max-width: 6rem;
}

/* The by-campaign table has thirteen columns: its headings fold sooner, so
   the whole of it is in view on a laptop. */
#report-campaigns thead th:not(.report-who) {
  max-width: 4.5rem;
}

@media (min-width: 40.01rem) {
  #report-campaigns th,
  #report-campaigns td {
    padding-inline: 0.4rem;
    font-size: 0.95rem;
  }

  #report-campaigns thead th {
    font-size: 0.78rem;
  }
}

/* The order as a box is for a phone; a wide screen has the headings. */
.report-order {
  display: none;
}

.board-from {
  margin: 0 0 var(--space-4);
}

@media (max-width: 40rem) {
  .report-order {
    display: flex;
    margin-bottom: var(--space-3);
  }

  /* The headings are said beside each number (data-label) and the order is
     the box above: the row of headings is neither seen nor pressed here. */
  .report-table thead {
    visibility: hidden;
  }

  .report-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Three numbers abreast: "1 of 3 · 33%" has to fit in a third of a card. */
  .report-table td,
  .report-table tfoot td {
    font-size: 0.95rem;
  }

  .tile-figure {
    font-size: 1.6rem;
  }

  .chart-frame {
    grid-template-rows: auto 7.5rem auto;
    padding: var(--space-3);
  }

  .stand-rows li {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding-bottom: var(--space-2);
  }
}

@media (pointer: coarse) {
  .report-n,
  .tile-also,
  a.tile-figure {
    display: inline-flex;
    align-items: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .attention-line {
    min-height: 2.75rem;
  }
}

/* The Reports page on paper: the numbers, the charts and the tables — not
   the bar, the boxes or the buttons. (The watermark prints too: a printed
   page names who printed it.) */
@media print {
  .lead-prints .site-header,
  .lead-prints .page-band .actions,
  .lead-prints .messages,
  .lead-prints .guard-said,
  .lead-prints .assign-filter,
  .lead-prints .report-tools,
  .lead-prints .report-copy,
  .lead-prints .report-copied,
  .lead-prints .chart-numbers,
  .lead-prints .skip-link {
    display: none !important;
  }

  .lead-prints .page-band {
    min-height: 0;
    padding: 0;
    background: none;
    color: var(--color-ink);
  }

  .lead-prints .page-band h1 {
    color: var(--color-ink);
    text-shadow: none;
  }

  .lead-prints main {
    max-width: none;
    padding: 0;
  }

  .lead-prints .report-scroll {
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .lead-prints .report-table {
    width: 100%;
    font-size: 8.5pt;
  }

  .lead-prints .report-table th,
  .lead-prints .report-table td {
    padding: 2pt 3pt;
    white-space: normal;
  }

  .lead-prints .report-table .report-who {
    position: static;
  }

  .lead-prints .report-tile,
  .lead-prints .chart-frame,
  .lead-prints .attention-lines {
    box-shadow: none;
  }

  .lead-prints .report-tile,
  .lead-prints .chart-days,
  .lead-prints .stand-rows li,
  .lead-prints .report-table tr {
    break-inside: avoid;
  }

  .lead-prints a {
    color: inherit;
    text-decoration: none;
  }

  .lead-prints .chart-svg,
  .lead-prints .stand-bar,
  .lead-prints .key-mark {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* === the qualification form (leads/qualify_*, leads/qualification) ===
   The call screen is used live, mid-conversation, often on a phone. Three
   things must be told apart at a glance:
   - what is SAID to the prospect: the reading face, larger, in full ink;
   - what is for the agent only (when a question is asked, a hint, a note):
     small, muted, plain;
   - what is pressed: big cards with the real radio or tick box inside.
   One section at a time on every screen; where it is and the list of
   sections stay in view — across the top on a phone, at the side when wide. */
.qualify {
  max-width: 72rem;
  margin: 0 auto;
}

.qualify-single {
  max-width: 46rem;
}

.qualify-kicker {
  margin: 0 0 var(--space-2);
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 650;
}

/* Words read aloud. */
.say {
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.45;
}

.say-second {
  font-size: 1.125rem;
}

.say-block {
  margin: 0 0 var(--space-5);
  padding: var(--space-5) var(--space-6);
  border-left: 6px solid var(--color-accent);
  border-radius: var(--radius-card);
  background: var(--color-soft);
}

.say-block p {
  margin: 0 0 var(--space-4);
}

.say-block p:last-child {
  margin-bottom: 0;
}

.say-chip {
  display: inline-block;
  margin-right: var(--space-1);
  padding: 0 var(--space-3);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

/* For the agent only. */
.q-for-you,
.qualify-legend {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.q-when {
  font-style: italic;
}

/* --- the layout: the section, and where the call is --- */
.qualify-layout {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(0, 1fr);
}

.qualify-rail {
  order: -1;
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-bg);
}

.qualify-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 var(--space-4);
  margin: 0 0 var(--space-2);
  font-size: 1rem;
}

.qualify-saved {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.qualify-saved.is-unsaved {
  color: var(--color-danger);
  font-weight: 700;
}

.qualify-bar {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.5rem;
  margin: 0 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--color-rule);
  color: var(--color-accent);
  overflow: hidden;
}

.qualify-bar::-webkit-progress-bar {
  background: var(--color-rule);
}

.qualify-bar::-webkit-progress-value {
  background: var(--color-accent);
}

.qualify-bar::-moz-progress-bar {
  background: var(--color-accent);
}

.qualify-jump[open] > summary {
  margin-bottom: var(--space-2);
}

/* On a phone the opened list scrolls inside the bar, which itself stays put. */
.qualify-steps {
  display: grid;
  gap: var(--space-1);
  max-height: calc(100vh - 11rem);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.qualify-step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-3);
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: 0.975rem;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.qualify-step:hover {
  border-color: var(--color-soft-edge);
  background: var(--color-soft);
  color: var(--color-ink);
}

.qualify-step[aria-current] {
  border-color: var(--color-accent);
  background: var(--color-soft);
  font-weight: 700;
}

.qualify-step-n {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--color-control-border);
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Every question of the section that applies has an answer: the number is
   filled (and the words beside it say "answered"). */
.qualify-step.is-done .qualify-step-n {
  border-color: var(--color-ok);
  background: var(--color-ok);
  color: var(--color-card);
}

.qualify-step-s {
  grid-column: 2;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

@media (min-width: 62rem) {
  .qualify-layout {
    grid-template-columns: 19rem minmax(0, 1fr);
    align-items: start;
    gap: var(--space-8);
  }

  .qualify-rail {
    grid-column: 1;
    grid-row: 1;
    top: var(--space-4);
    margin: 0;
    padding: var(--space-5);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-panel);
    background: var(--color-card);
    box-shadow: var(--shadow-card);
  }

  .qualify-main {
    grid-column: 2;
    grid-row: 1;
  }

  .qualify-steps {
    max-height: calc(100vh - 14rem);
  }
}

/* On the call screen the picture behind the name is a strip, not a banner:
   the questions start as near the top as they can. */
.lead-screen:has(.qualify-layout) .page-band {
  min-height: 0;
}

.lead-screen:has(.qualify-layout) .band-head {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

/* --- a section --- */
.qualify .qualify-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  letter-spacing: -0.015em;
}

.qualify-title-n {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-size: 1.2rem;
}

.qualify-head {
  margin: 0 0 var(--space-5);
}

/* --- a question: a card --- */
.q {
  min-width: 0;
  margin: 0 0 var(--space-5);
  padding: var(--space-5) var(--space-6) var(--space-6);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-panel);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

/* The question itself sits inside the card, not on its edge. */
.q > legend {
  display: flex;
  float: left;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.q > legend + * {
  clear: both;
}

.q-n {
  flex: none;
  padding: 0.05rem 0.6rem;
  border-radius: var(--radius-chip);
  background: var(--color-surface);
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
}

/* "Why we ask", and what an accredited investor is: for the agent to read
   out if it is wanted. Set apart from the question by a dashed edge. */
.q-aside {
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1.5px dashed var(--color-control-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
}

.q-aside > :last-child {
  margin-bottom: 0;
}

.q-aside-h {
  margin: 0 0 var(--space-2);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.q-aside p.say {
  margin: 0 0 var(--space-2);
}

.q-aside ul.say {
  margin: 0;
  padding-left: 1.25rem;
}

.q-aside ul.say li {
  margin-bottom: var(--space-2);
}

/* --- choices: big cards --- */
.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-3);
}

.options-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.25rem;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-control-border);
  border-radius: var(--radius-card);
  background: var(--color-field);
  color: var(--color-ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.option:hover {
  border-color: var(--color-accent);
  background: var(--color-soft);
}

/* Chosen: the edge, the fill and the weight all change — and the box inside shows its tick. */
.option:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-soft);
  box-shadow: inset 0 0 0 1.5px var(--color-accent);
  font-weight: 750;
}

.option:focus-within {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.option-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* "Declined to say" is always offered, and is quieter than an answer. */
.option-declined {
  border-style: dashed;
  background: transparent;
  color: var(--color-muted);
  font-weight: 500;
}

.options-one {
  grid-template-columns: minmax(0, 20rem);
}

/* Which number key picks it: shown where there is a keyboard and the script is running. */
.option[data-key]::after {
  content: attr(data-key);
  display: none;
  margin-left: auto;
  padding: 0 0.45rem;
  border: 1.5px solid var(--color-rule);
  border-radius: 0.4rem;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .is-live .option[data-key]::after {
    display: inline-block;
  }
}

.q-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}

.q-box label {
  display: block;
  margin: 0 0 var(--space-1);
  font-size: 0.95rem;
  font-weight: 600;
}

.q-box input {
  width: 100%;
}

.q-other {
  max-width: 30rem;
  margin: var(--space-4) 0 0;
}

.q-plain {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.q-plain > legend {
  float: none;
  margin: 0 0 var(--space-2);
  font-weight: 600;
}

/* --- the buttons under a section: Back, then the way on; "later" apart --- */
.qualify-actions,
.qualify-agree {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-3);
}

.qualify-actions .btn-primary {
  order: 2;
  flex: 1 1 12rem;
  max-width: 24rem;
}

.qualify-actions .qualify-back {
  order: 1;
}

.qualify-actions .qualify-later {
  order: 3;
  margin-left: auto;
}

.qualify-agree .btn-primary {
  flex: 1 1 14rem;
  min-height: 3.25rem;
  font-size: 1.0625rem;
}

.stacked-form.qualify-finish {
  max-width: none;
}

/* --- the summary, the lead page card, the document --- */
.qual-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border: 2px solid var(--color-warn);
  border-radius: var(--radius-chip);
  background: var(--color-status-working-bg);
  color: var(--color-ink);
  font-weight: 800;
}

.qual-flag::before {
  content: "★";
  color: var(--color-warn);
}

.qual-unanswered {
  color: var(--color-muted);
  font-style: italic;
}

.qual-skipped,
.qual-earlier {
  margin: 0;
  padding-left: 1.25rem;
}

.qual-skipped li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  margin-bottom: var(--space-1);
}

.qual-skipped .lone-link {
  display: inline-block;
  min-height: var(--touch);
  padding: var(--space-3) 0;
  font-weight: 600;
}

.qualify-saved::before {
  content: "✓ ";
}

.qualify-saved.is-unsaved::before,
.qualify-saved[data-state="saving"]::before {
  content: "";
}

.qual-who {
  margin: 0 0 var(--space-5);
}

.qual-answers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1) var(--space-6);
  margin: 0;
}

.qual-answers dt {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 0.975rem;
}

.qual-answers dt:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.qual-answers dd {
  margin: 0 0 var(--space-3);
  font-size: 1.0625rem;
  font-weight: 600;
}

.qual-answers dd.qual-unanswered {
  font-weight: 400;
}

@media (min-width: 48rem) {
  .qual-answers {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    row-gap: 0;
  }

  .qual-answers dt,
  .qual-answers dd {
    margin: 0;
    padding: var(--space-3) 0;
    border-top: 1px solid var(--color-rule);
  }

  .qual-answers dt:first-of-type,
  .qual-answers dt:first-of-type + dd {
    padding-top: 0;
    border-top: 0;
  }
}

/* On a pipeline card and a list row. The words are always there; beside
   them a tick (qualified), a question mark (accreditation uncertain) or a
   dash (not accredited) — and a star for $1M+, a mark of its own. None is
   the shape of a status, the diamond of a quiet mark or the arrow of a
   follow-up. */
.qual-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.15rem 0.75rem 0.15rem 0.6rem;
  border: 1.5px solid var(--color-ok);
  border-radius: var(--radius-chip);
  background: var(--color-status-won-bg);
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.qual-mark::before {
  content: "✓";
  color: var(--color-ok);
  font-weight: 800;
  line-height: 1;
}

.qual-uncertain {
  border-color: var(--color-warn);
  background: var(--color-status-working-bg);
}

.qual-uncertain::before {
  content: "?";
  color: var(--color-warn);
}

.qual-no,
.qual-done {
  border-color: var(--color-control-border);
  background: var(--color-status-lost-bg);
}

.qual-no::before {
  content: "–";
  color: var(--color-muted);
}

.qual-done::before {
  color: var(--color-muted);
}

.qual-special {
  border: 2px solid var(--color-warn);
  background: var(--color-card);
}

.qual-special::before {
  content: "★";
  color: var(--color-warn);
}

.board-card > .qual-mark {
  margin-top: var(--space-1);
}

@media (max-width: 40rem) {
  .q {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  .say {
    font-size: 1.2rem;
  }

  .say-block {
    padding: var(--space-4);
  }

  .options-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .qualify-actions .btn-primary {
    max-width: none;
  }

  .qualify-actions .qualify-later {
    flex-basis: 100%;
    margin-left: 0;
  }
}

/* --- on paper: the document, for managers and above (leads/_guard) --- */
.print-only {
  display: none;
}

@media print {
  .lead-prints .site-header,
  .lead-prints .watermark,
  .lead-prints .messages,
  .lead-prints .guard-said,
  .lead-prints .band-crumb,
  .lead-prints .page-band > .actions,
  .lead-prints .no-print {
    display: none !important;
  }

  .lead-prints .print-only {
    display: block;
  }

  .lead-prints .page-band {
    min-height: 0;
    background: none;
    color: inherit;
  }

  .lead-prints .page-band h1 {
    color: inherit;
    text-shadow: none;
  }

  .lead-prints .band-head,
  .lead-prints .page-body {
    padding: 0;
  }

  .lead-prints main section[aria-labelledby] {
    margin-bottom: var(--space-4);
    padding: var(--space-3) 0;
    border: 0;
    border-top: 1px solid var(--color-rule);
    border-radius: 0;
    box-shadow: none;
  }

  .lead-prints .qual-answers dt,
  .lead-prints .qual-answers dd {
    break-inside: avoid;
  }
}

/* === the Feedback button and its panel ===
   The button (layouts/_feedback.blade.php) stays in the corner of the
   window on every page: small, above the phone's own bar at the foot of the
   screen, under the notices (a save's confirmation, what a lead screen says
   was recorded) so it never covers their words, and lifted above the Assign
   screen's bar when that is along the foot of the window
   (public/js/feedback.js sets --feedback-lift). The page ends with room for
   it, so the last button of a long form is clear of it once the page is
   scrolled to its end. */
.feedback-btn {
  position: fixed;
  z-index: 15;
  right: calc(var(--space-3) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px) + var(--feedback-lift, 0px));
  min-height: var(--touch);
  box-shadow: var(--shadow-raised);
}

body:has(.feedback-btn) .page-body {
  padding-bottom: calc(var(--space-12) + var(--touch) + var(--space-3) + env(safe-area-inset-bottom, 0px));
}

/* Without the script the bar's height is not known: clear of it by a fixed step. */
html:has(.assign-bar) .feedback-btn {
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px) + var(--feedback-lift, 7rem));
}

/* While a lead screen is saying that something was recorded, the button is out of its way. */
html:has(.guard-said:not([hidden])) .feedback-btn {
  visibility: hidden;
}

.feedback-panel {
  box-sizing: border-box;
  width: min(36rem, calc(100vw - 2 * var(--space-3)));
  max-width: none;
  max-height: calc(100vh - 2 * var(--space-3));
  max-height: calc(100dvh - 2 * var(--space-3));
  padding: var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
  overflow: auto;
}

.feedback-panel::backdrop {
  background: var(--shade-band-strong);
}

.feedback-panel h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-h3);
}

.feedback-form textarea {
  width: 100%;
  box-sizing: border-box;
}

.feedback-form .feedback-saved-with {
  margin: var(--space-2) 0 0;
}

/* Dictate, under the message box: its sentence is the form's small print. */
.feedback-form .dictate {
  margin-top: var(--space-2);
}

/* The files chosen to go with it (public/js/feedback.js lists them). */
.feedback-form input[type="file"] {
  max-width: 100%;
}

.feedback-form.feedback-drop {
  outline: 2px dashed var(--color-accent);
  outline-offset: var(--space-2);
}

.feedback-files {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.feedback-files li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.feedback-files .feedback-file-name {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.feedback-clear {
  margin-top: var(--space-2);
}

.feedback-files-said {
  margin: var(--space-2) 0 0;
  color: var(--color-danger);
  font-weight: 600;
}

.feedback-files-said:empty {
  display: none;
}

.feedback-files-said.feedback-files-fine {
  color: var(--color-ink);
  font-weight: 400;
}

.feedback-refused {
  margin: 0 0 var(--space-4);
  list-style: none;
}

/* In /admin: the paperclip on the list, and the files on a piece's own page. */
.feedback-clip {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}

.feedback-attached {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.feedback-attached li {
  display: grid;
  gap: var(--space-1);
  align-content: start;
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-card);
  min-width: 0;
}

.feedback-attached .feedback-file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.feedback-thumb {
  display: block;
}

.feedback-thumb img {
  display: block;
  width: 100%;
  height: 9rem;
  object-fit: scale-down;
  border-radius: var(--radius);
  background: var(--color-surface);
}

/* What was captured with a piece of feedback, in /admin. */
.feedback-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feedback-details {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-4) 0;
}

.feedback-details dt {
  color: var(--color-muted);
  font-weight: 600;
}

.feedback-details dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.feedback-details ul {
  margin: 0;
  padding-left: var(--space-5);
}

@media (max-width: 40rem) {
  .feedback-details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .feedback-details dd {
    margin-bottom: var(--space-3);
  }
}

/* Feedback as a conversation (ledger D184): My feedback, and Admin's reply view.
   The sender's messages sit on the card; the LeadDesk team's on the soft
   ground, with the accent down their edge, so who said what reads at a glance. */
.feedback-mine-link {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: 0 0 var(--space-4);
}

.feedback-mine-link .lone-link {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  min-height: var(--touch);
}

.feedback-unread-said {
  font-weight: 600;
}

.feedback-row-unread .lead-name {
  font-weight: 700;
}

.feedback-replies-count {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}

.feedback-thread {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-5);
  padding: 0;
  list-style: none;
}

.feedback-said {
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
}

.feedback-said-team {
  border-left: 4px solid var(--color-accent);
  background: var(--color-soft);
}

.feedback-said-who {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  align-items: center;
  margin: 0 0 var(--space-2);
}

.feedback-said .feedback-message {
  margin: 0;
}

.feedback-answer textarea {
  width: 100%;
  box-sizing: border-box;
}

.feedback-answer .dictate {
  margin-top: var(--space-2);
}

.feedback-answer-files {
  margin-top: var(--space-3);
}

.feedback-answer-files summary {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  min-height: var(--touch);
  cursor: pointer;
}

.feedback-answer-files input[type="file"] {
  max-width: 100%;
}

.feedback-answer .actions .control-btn {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

@media print {
  .feedback-btn,
  .feedback-panel {
    display: none;
  }
}

/* === the Feedback button: end === */

/* === the floating "Add a note" button (ledger D190) ===
   On a page with one lead in context only (layouts/_quicknote.blade.php): a
   round note button in the same corner as Feedback, stacked just above it,
   so the two never meet; alone in the corner when Feedback is switched off.
   Its panel is the Feedback panel's (.feedback-panel). Out of the way of
   what a lead screen says was recorded, as Feedback is. (Two classes: it
   wins over .icon-btn, which comes later in this file.) */
.icon-btn.quicknote-btn {
  position: fixed;
  z-index: 15;
  right: calc(var(--space-3) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  width: calc(var(--touch) + var(--space-1));
  height: calc(var(--touch) + var(--space-1));
  padding: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-raised);
}

body:has(.feedback-btn) .icon-btn.quicknote-btn {
  bottom: calc(var(--space-3) + var(--touch) + var(--space-3) + env(safe-area-inset-bottom, 0px));
}

/* Two buttons stacked in the corner: the page ends with room for both. */
body:has(.quicknote-btn):has(.feedback-btn) .page-body {
  padding-bottom: calc(var(--space-12) + 2 * var(--touch) + 2 * var(--space-3) + env(safe-area-inset-bottom, 0px));
}

body:has(.quicknote-btn):not(:has(.feedback-btn)) .page-body {
  padding-bottom: calc(var(--space-12) + var(--touch) + var(--space-3) + env(safe-area-inset-bottom, 0px));
}

html:has(.guard-said:not([hidden])) .quicknote-btn {
  visibility: hidden;
}

.quicknote-panel .quicknote-on {
  margin: calc(-1 * var(--space-3)) 0 var(--space-4);
}

.quicknote-form {
  max-width: none;
  margin: 0;
}

.quicknote-form textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Save note and Close side by side, the same height. */
.quicknote-form .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin: var(--space-2) 0 0;
}

.quicknote-form .actions .btn-primary {
  margin-top: 0;
}

@media print {
  .quicknote-btn {
    display: none;
  }
}

/* === the floating "Add a note" button: end === */

/* ==== Campaign IDs and providers (ledger D79) ============================ */

/* A campaign ID, a key or a posting address: letters and digits that must be
   read exactly, so each has its own width. */
.id-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.id-copy {
  margin-left: var(--space-2);
}

/* The lookup table is words, not numbers: read from the left. */
.id-table th,
.id-table td {
  text-align: left;
  white-space: normal;
}

.id-table thead th {
  max-width: none;
}

.id-table .report-who {
  white-space: nowrap;
}

.place-correct {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.place-correct input[type="text"] {
  width: auto;
  max-width: 12rem;
}

/* A new key, shown this once. */
.key-once {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  border: 2px solid var(--color-warn);
  border-radius: var(--radius-card);
  background: var(--color-status-working-bg);
}

.key-once code,
.code-block {
  display: block;
  max-width: 100%;
  margin: var(--space-2) 0;
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-card);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.key-once code {
  user-select: all;
}

/* Their field → LeadDesk's: one row each, wrapping on a phone. */
.map-rows {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0;
  padding: 0;
  list-style: none;
}

.map-rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.map-rows input[type="text"],
.map-rows select {
  width: auto;
  min-width: 10rem;
  max-width: 100%;
  flex: 1 1 10rem;
}

/* The field mapping's column names (D278): each takes the width of the box under it, so both wrap alike. */
.map-heads {
  color: var(--color-muted);
  font-size: 0.875rem;
  font-weight: 650;
}

.map-heads span {
  min-width: 10rem;
  flex: 1 1 10rem;
}

.map-heads .map-arrow {
  min-width: 0;
  flex: 0 0 auto;
  visibility: hidden;
}

.count-trio {
  font-variant-numeric: tabular-nums;
}

.check-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  padding: 0;
  list-style: none;
}

@media print {
  .guide-page .site-header,
  .guide-page .band-crumb,
  .guide-page .actions,
  .guide-page .no-print {
    display: none;
  }
}

/* An address is long: it may break anywhere rather than push the page wide. */
.id-address {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* === what's new (ledger D77) ===
   Beside "My account" in the header: the smallest of the links, close set,
   so an executive's bar still fits one line on a laptop. A dot of signal
   says there is something unseen — a shape, with the number in words for a
   screen reader; a class of its own, because the Alerts count is what
   other screens look for. */
.site-header .nav-link.nav-quiet {
  padding: 0 var(--space-2);
  font-size: 0.85rem;
  font-weight: 500;
}

.news-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: var(--space-1);
  border-radius: var(--radius-chip);
  background: var(--color-signal);
}

@media (max-width: 40rem) {
  .site-header .nav-link.nav-quiet {
    padding: 0;
  }
}

.feature-lede {
  margin: 0 0 var(--space-4);
  color: var(--color-muted);
}

.feature-all {
  margin-bottom: var(--space-4);
}

/* One entry: the heading and its short summary are the line to press, the
   whole width of the card; a rule between one entry and the next. */
.feature {
  border-top: 1px solid var(--color-rule);
}

.feature:first-of-type {
  border-top: 0;
}

.feature > summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--space-1) var(--space-3);
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-3) var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--color-ink);
  font-weight: 400;
}

.feature > summary::before {
  margin-top: 0.55em;
  color: var(--color-soft-ink);
}

.feature > summary:hover {
  background: var(--color-soft);
}

.feature > summary:active {
  background: var(--color-soft-hover);
}

.feature[open] > summary {
  margin-bottom: 0;
}

.feature-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.feature-title {
  color: var(--color-soft-ink);
  font-size: var(--text-h3);
  font-weight: 700;
}

.feature-summary {
  grid-column: 2;
  color: var(--color-ink);
}

/* "New" and "Switched off": words in a shape, never colour alone. */
.feature-chip {
  padding: 0 var(--space-3);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.feature-chip.feature-off {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background: var(--color-off-bg);
  color: var(--color-off-ink);
}

.feature-is-off .feature-title {
  color: var(--color-muted);
}

.feature-body {
  padding: 0 var(--space-2) var(--space-4) calc(var(--space-2) + 0.65em + var(--space-3));
}

.feature-body > p {
  margin: var(--space-3) 0;
}

.feature-body h3 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1rem;
}

.feature-steps {
  margin: 0;
  padding-left: var(--space-6);
}

.feature-steps li {
  margin: var(--space-2) 0;
}

.feature-waiting {
  padding: var(--space-3);
  border-left: 4px solid var(--color-off-edge);
  background: var(--color-off-bg);
  color: var(--color-ink);
}

@media (max-width: 40rem) {
  .feature-body {
    padding-left: var(--space-2);
  }
}

/* The bar is full on a laptop once "What's new" is in it: an executive's
   takes a second line as soon as the name is a long one. The name is the
   part that gives way, as it already does on a phone — "The person's name
   is for wide screens; My account is always there." It stays in the page. */
@media (max-width: 85rem) {
  /* The circle beside it is now the link to My account, named with the name (ledger D170): one link at this width. */
  .site-header .who {
    display: none;
  }

  .site-header .who-initials {
    display: inline-flex;
  }
}

/* --- Admin: leads not entered (ledger D83) ------------------------------- */

/* A field as it arrived can be one long unbroken value: it wraps, the page never scrolls sideways. */
.held-field,
.held-fields dt,
.held-fields dd,
.held-row .lead-meta {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* The tick that picks an item for deleting: on a line of its own under the item. */
.held-tick {
  grid-column: 1 / -1;
}

/* --- Campaign IDs: state, then city; and the hand-out (ledger D90) -------- */

/* The boxes a campaign's ID is made from, set apart inside the form. */
.stacked-form fieldset.place-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: var(--space-2) 0;
  padding: var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
}

.stacked-form fieldset.place-fields legend {
  padding: 0 var(--space-2);
  font-weight: 650;
}

.place-picker,
.place-state,
.place-city,
.place-new {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.place-picker [hidden] {
  display: none;
}

.place-picker select {
  max-width: 100%;
}

.place-picker [data-show-cities] {
  align-self: flex-start;
}

.place-new {
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-soft-edge);
}

/* The cities offered for adding (ledger D102): a long list, so in columns where there is room. */
.place-offers {
  columns: 16rem;
  column-gap: var(--space-5);
}

.place-offers li {
  break-inside: avoid;
}

/* Which ID the campaign would be issued: said once, where the eye is. */
.place-preview {
  margin: var(--space-2) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  overflow-wrap: anywhere;
}

/* The campaigns list: each campaign's ID, or that it has none. */
.campaign-row-id {
  justify-self: end;
}

@media (max-width: 40rem) {
  .campaign-row-id {
    justify-self: start;
  }
}

/* Under a campaign's name on the Reports page. */
.report-id {
  display: block;
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* "Give this to whoever generates the leads". */
.handout {
  margin: var(--space-4) 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  scroll-margin-top: var(--space-8);
}

/* Just issued: it is the thing to look at. */
#handout.is-new {
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-raised);
}

.handout h3 {
  margin-top: 0;
}

.handout h4 {
  margin: var(--space-4) 0 var(--space-1);
}

.handout-intro {
  margin: 0 0 var(--space-2);
}

.handout-lines {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  align-items: center;
  margin: 0;
}

.handout-lines dt {
  color: var(--color-muted);
  font-weight: 600;
}

.handout-lines dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
}

.handout-value {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.handout-lines .id-copy {
  margin-left: 0;
}

/* The ID itself: large, and read letter by letter. */
.handout-id .handout-value {
  font-size: 1.6rem;
  white-space: nowrap;
}

@media (max-width: 40rem) {
  .handout {
    padding: var(--space-4);
  }

  .handout-lines {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }

  .handout-lines dd {
    margin-bottom: var(--space-3);
  }
}

/* On paper: the hand-out and nothing else — no bar, no buttons, nothing that
   is LeadDesk's own (the team, the sheets, who may post). */
@media print {
  body:has(#handout) .site-header,
  body:has(#handout) .page-band,
  body:has(#handout) .messages,
  body:has(#handout) .page-body > :not(:has(#handout)),
  body:has(#handout) .page-body > section:has(#handout) > :not(#handout),
  #handout .handout-skip,
  #handout button {
    display: none !important;
  }

  #handout,
  #handout.is-new {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

/* --- the eye in a password box ---
   Put there by the page's script (public/js/theme.js): without it a password
   box is as it always was. The eye is a full-size target inside the box's
   right end; a line through it says the typing is hidden. */
.pw-field {
  position: relative;
  display: block;
}

.pw-field > input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 3.25rem;
}

.pw-eye {
  position: absolute;
  top: 50%;
  right: 0.125rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}

.pw-eye:hover,
.pw-eye[aria-pressed="true"] {
  color: var(--color-ink);
}

.pw-eye:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.pw-eye-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pw-eye[aria-pressed="true"] .pw-eye-slash {
  display: none;
}

/* --- email templates (ledger D108) ---------------------------------------------
   On a lead's page: the drop-down a template is picked from, the question asked
   before one replaces what was typed, and the list of what is still to be
   finished before the email may be sent. On the screen a template is written
   on: the form, the fields that can be put in beside it, and the preview. */
.stacked-form.email-form {
  max-width: 42rem;
}

.template-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.template-pick select {
  flex: 1 1 14rem;
  min-width: 0;
}

.template-ask,
.fill-in {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-left: 4px solid var(--color-warn);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.template-ask p,
.fill-in p {
  margin: 0 0 var(--space-2);
}

.template-ask .control-btn {
  margin: 0 var(--space-2) var(--space-1) 0;
}

.template-row .template-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.template-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.template-editor .stacked-form {
  margin-top: 0;
}

.template-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.template-buttons .btn-primary {
  margin-top: 0;
}

.template-side,
.template-preview {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.template-side h2,
.template-preview h2 {
  margin-top: 0;
}

.field-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.field-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.field-list .id-code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.field-list .lead-meta {
  flex-basis: 100%;
}

/* Line breaks are the template's own; long links wrap instead of pushing the page sideways. */
.template-preview-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 64rem) {
  .template-editor {
    grid-template-columns: minmax(0, 42rem) minmax(16rem, 24rem);
  }

  .template-preview {
    grid-column: 1 / -1;
  }
}

/* === the signature card (ledger D117) ===
   What every email to a lead ends with, shown on the email form and on My account. The card is the email's own
   HTML (App\Core\SignatureCard), which carries its colours with it — none is written here. On a narrow screen
   it stacks as it does in a mail program: the logo above, the rule lying flat, the text below. */
.signature-preview {
  margin: var(--space-2) 0;
}

.signature-preview > p {
  margin: var(--space-1) 0;
}

.signature-card {
  max-width: 100%;
  overflow-x: auto;
}

.signature-card .sig-text {
  overflow-wrap: anywhere;
}

.sent-signature {
  overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
  .signature-card .sig-logo,
  .signature-card .sig-text {
    display: block !important;
    width: auto !important;
  }

  .signature-card .sig-logo {
    padding: 10px 0 12px !important;
  }

  .signature-card .sig-text {
    border-left-width: 0 !important;
    border-top-width: 1px !important;
    padding: 12px 0 4px !important;
  }
}

/* === "Fill in" on the email form ===
   A box for each thing a template leaves for the sender to finish (App\Support\EmailFill). */
.fill-rows,
.fill-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.fill-row + .fill-row {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-rule);
}
/* A note typed on a request for documents (ledger D129): its line breaks are kept. */
.request-note {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
/* Manage → Archived leads (ledger D127): what the lead was, who archived it and why, one under the other;
   Restore beside them where there is room, and under them on a phone. */
.archived-row > * {
  grid-column: 1;
  overflow-wrap: anywhere;
}

.archived-row > .inline-form {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
}

@media (max-width: 40rem) {
  .archived-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .archived-row > .inline-form {
    grid-column: 1;
    grid-row: auto;
  }
}

/* === replies from leads (ledger D116) === */

/* "New reply" on a pipeline card, a list row and the lead's page; "Email not
   delivered" for one that came back. The words are always there; beside them
   a mark whose SHAPE differs from every other mark's — a turned-back corner
   for a reply, a cross for one not delivered — so it is not told by colour
   alone. */
.reply-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.15rem 0.75rem 0.15rem 0.6rem;
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.reply-mark::before {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  border: solid var(--color-soft-ink);
  border-width: 0 0 2.5px 2.5px;
  border-radius: 0 0 0 0.2em;
}

.reply-bounce {
  border-color: var(--color-danger);
  background: var(--color-status-dnc-bg);
  color: var(--color-ink);
}

.reply-bounce::before {
  content: "\00d7";
  width: auto;
  height: auto;
  border: 0;
  color: var(--color-danger);
  font-weight: 800;
  line-height: 1;
}

/* As a link (the lead's page: down to the emails) it is big enough for a thumb. */
a.reply-mark {
  min-height: 2.75rem;
  padding-right: var(--space-4);
}

a.reply-mark:hover {
  background: var(--color-soft-hover);
}

.board-card > .reply-mark {
  margin-top: var(--space-1);
}

/* The conversation on a lead's page: what we sent sits flat; what came back
   is set in from the left with a rule, so the two are told apart at a glance
   and without colour. */
.thread-actions {
  margin-bottom: var(--space-3);
}

.thread-item {
  overflow-wrap: anywhere;
}

.thread-in {
  margin-left: var(--space-2);
  padding-left: var(--space-4);
  border-left: 4px solid var(--color-soft-edge);
}

.thread-who {
  color: var(--color-ink);
}

.thread-subject {
  font-weight: 700;
}

.thread-text {
  white-space: normal;
}

.thread-chip {
  padding: 0 var(--space-3);
  border: 1.5px dashed var(--color-off-edge);
  border-radius: var(--radius-chip);
  background: var(--color-off-bg);
  color: var(--color-off-ink);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.thread-quoted {
  margin: var(--space-2) 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.thread-quoted summary {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.thread-quoted .thread-text {
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-rule);
}

.thread-files {
  margin: var(--space-3) 0;
  padding: 0;
  list-style: none;
}

.thread-files li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-rule);
}

.thread-file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.thread-thumb {
  display: block;
  flex-basis: 100%;
  min-height: 2.75rem;
}

.thread-thumb img {
  display: block;
  max-width: min(100%, 22rem);
  max-height: 16rem;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.thread-stop p {
  margin: 0 0 var(--space-2);
}

/* Folded (ledger D143): the conversation by month, then by week, and every
   email one closed line. The month and the week are the plain disclosure
   pill; an email's line is the whole width, at least a thumb tall, with the
   same arrow turning as it opens. A subject not opened yet is bold — and
   says "New" as well, so weight is never the only sign. */
.thread-all {
  margin: 0 0 var(--space-3);
}

.thread-group {
  margin: 0 0 var(--space-3);
}

.thread-week {
  margin-left: var(--space-3);
}

.thread-group-line {
  flex-wrap: wrap;
}

/* A long press opens the conversation's own menu, not the phone's. */
.thread-group-line,
.thread-line {
  -webkit-touch-callout: none;
}

.thread-group-name {
  color: var(--color-ink);
}

.thread-count {
  color: var(--color-muted);
  font-weight: 500;
}

.thread-count-new {
  color: var(--color-soft-ink);
  font-weight: 800;
}

.thread-only {
  margin: 0 0 var(--space-3);
}

details.thread-item {
  margin: 0 0 var(--space-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-card);
}

details.thread-in {
  margin-left: 0;
  padding-left: 0;
  border-left: 4px solid var(--color-soft-edge);
}

.thread-item > summary.thread-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  width: 100%;
  box-sizing: border-box;
  min-height: var(--touch);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-ink);
  font-weight: 400;
}

.thread-item > summary.thread-line::before {
  align-self: center;
}

.thread-item > summary.thread-line:hover {
  background: var(--color-soft);
}

.thread-item[open] > summary.thread-line {
  margin: 0;
  border-bottom: 1px solid var(--color-rule);
  border-radius: var(--radius) var(--radius) 0 0;
}

.thread-line .thread-subject {
  flex: 1 1 14rem;
  min-width: 0;
  font-weight: 400;
}

.thread-line .thread-unread {
  font-weight: 800;
}

.thread-line-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  font-size: 0.95rem;
}

.thread-body {
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.thread-email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Right-click, or a long press, on an email's line or a week's or a month's:
   a small menu at the pointer (public/js/emails.js). */
.thread-menu {
  position: fixed;
  z-index: 50;
  min-width: 12rem;
  margin: 0;
  padding: var(--space-1);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  background: var(--color-card);
  box-shadow: var(--shadow-raised);
  list-style: none;
}

.thread-menu button {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: calc(var(--radius) - 0.25rem);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.thread-menu button:hover,
.thread-menu button:focus {
  background: var(--color-soft);
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.mailbox-replies {
  margin: var(--space-1) 0;
}

/* A person's own inbox (ledger D153), laid out as approved (ledger D172): the folders one row of tabs (.tab-list,
   scrolling sideways inside itself on a phone, never the page), the search in place behind the magnifier, the bar of
   icons for the ticked emails, and every message one line at least a thumb tall — bold and "New" until opened, as on
   a lead's page. */
.inbox-whose {
  margin: 0 0 var(--space-2);
  overflow-wrap: anywhere;
}

.inbox-folders {
  margin: 0 0 var(--space-3);
}

.inbox-folders .tab[aria-current="page"] {
  border-bottom-color: var(--color-accent);
  color: var(--color-ink);
}

.inbox-tools,
.inbox-bulk,
.inbox-actions,
.inbox-send-row,
.inbox-attach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.inbox-search-panel,
.inbox-move-panel,
.inbox-copies {
  margin: 0 0 var(--space-3);
}

.inbox-search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}

.inbox-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  flex: 1 1 12rem;
}

.inbox-field input,
.inbox-field select,
.inbox-field textarea {
  width: 100%;
  box-sizing: border-box;
}

.inbox-pick-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-height: calc(var(--touch) + var(--space-2));
  margin: 0 0 var(--space-2);
}

.inbox-bulk[hidden],
.inbox-row-form {
  display: none;
}

.inbox-move {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.inbox-move select {
  min-width: 0;
  max-width: 100%;
}

.inbox-pick-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
}

.inbox-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2) 0 0;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-card);
  -webkit-touch-callout: none;
}

.inbox-line-new {
  border-left: 4px solid var(--color-soft-edge);
}

.inbox-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
}

.inbox-open {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  flex: 1 1 16rem;
  min-width: 0;
  min-height: var(--touch);
  padding: var(--space-2) 0;
  color: var(--color-ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.inbox-open:hover .inbox-subject {
  text-decoration: underline;
}

.inbox-who {
  flex: 0 1 14rem;
  min-width: 0;
  font-weight: 600;
}

.inbox-subject {
  flex: 1 1 14rem;
  min-width: 0;
}

.inbox-subject.thread-unread {
  font-weight: 800;
}

.inbox-marks {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.inbox-lead {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-weight: 700;
  text-decoration: none;
}

.inbox-lead:hover {
  background: var(--color-soft-hover);
}

.inbox-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}

.inbox-head {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0 0 var(--space-3);
}

.inbox-head dt {
  color: var(--color-muted);
  font-weight: 600;
}

.inbox-head dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.inbox-leads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.inbox-actions {
  margin: 0 0 var(--space-3);
}

/* Writing an email: "Cc/Bcc" opens the two copy boxes in place; the paperclip is the file box's own label, the box
   itself out of sight but still reached by the keyboard (its focus is shown on the paperclip). */
.inbox-cc-line {
  margin: 0;
}

.inbox-file-box {
  position: absolute;
  width: 0;
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
}

.inbox-file-box:focus-visible + .inbox-attach-btn {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.inbox-attach {
  margin: var(--space-2) 0;
}

.inbox-attach-help {
  flex: 1 1 100%;
}

.inbox-body {
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-card);
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  .inbox-head {
    grid-template-columns: 1fr;
  }

  .inbox-head dd {
    margin-bottom: var(--space-1);
  }
}

/* === requests to archive, and archiving ticked leads together (ledger D166) === */

/* Manage → Archived leads → "Requests to archive": what was asked, by whom and why, one under the other; Archive and
   Decline under them. Decline opens a one-line note in place. */
.archive-request-row > * {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.archive-request-row > .actions {
  margin: 0;
}

.archive-decline > summary {
  display: inline-flex;
  cursor: pointer;
  list-style: none;
}

.archive-decline > summary::-webkit-details-marker {
  display: none;
}

.archive-decline[open] > summary {
  margin-bottom: var(--space-2);
}

/* "Archive the ticked leads": a superadmin's, with one reason, under the list or the requests. */
.archive-many-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  flex-basis: 100%;
}

.archive-many-fields input[type="text"] {
  font: inherit;
  flex: 1 1 14rem;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

/* On a lead's page: where one's own request to archive stands. */
.archive-ask > .inline-form {
  display: inline-block;
}

/* ==========================================================================
   === icons, icon buttons, panels opened in place, tabs (ledger D162, D163) ===
   Reused by every screen given the same treatment: partials/_icons (the
   sprite), partials/_icon, partials/_icon_btn, components/panel,
   components/tabs. Colours are the tokens'; an icon is drawn in the colour of
   the words around it. */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* A small round-cornered square: the icon, and under it (optionally) a tiny word. */
.icon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: var(--space-1) var(--space-2);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font: inherit;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}

summary.icon-btn::-webkit-details-marker {
  display: none;
}

.icon-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
  color: var(--color-soft-ink);
}

.icon-btn:active {
  background: var(--color-soft-press);
  transform: scale(0.96);
}

.icon-btn .icon {
  width: 1.375rem;
  height: 1.375rem;
}

.icon-btn-captioned {
  min-width: 3.5rem;
  min-height: 3.25rem;
}

.icon-cap {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.icon-btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  box-shadow: var(--shadow-card);
}

.icon-btn-primary:hover {
  border-color: var(--color-accent-hover);
  background: var(--color-accent-hover);
  color: var(--color-accent-ink);
}

.icon-btn[aria-expanded="true"],
details[open] > summary.icon-btn {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-halo);
}

/* Beside a value (the eye after a masked number): round, no fill until pointed at. */
.icon-btn-small {
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted);
}

/* Its tiny word ("recorded" under the eye, Admin's Send now and Cancel, ledger D278) is for a touch screen, which shows no tooltip; with a mouse the
   tooltip says it, and the button stays its small round self. */
.icon-btn-small.icon-btn-captioned {
  min-width: var(--touch);
  min-height: var(--touch);
}

.icon-btn-small .icon-cap {
  display: none;
}

@media (pointer: coarse) {
  .icon-btn-small.icon-btn-captioned {
    border-radius: var(--radius);
  }

  .icon-btn-small .icon-cap {
    display: block;
  }
}

/* The microphone under a text box (ledger D156, D163): listening is said by its
   name and tooltip, and shown here by the danger colour and a ring. */
.dictate .dictate-btn {
  flex: none;
  border-radius: 50%;
}

.dictate-on .dictate-btn {
  border-color: var(--color-danger);
  color: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-halo);
}

@media (prefers-reduced-motion: no-preference) {
  .dictate-on .dictate-btn {
    animation: ld-listening 1.4s ease-in-out infinite;
  }
}

@keyframes ld-listening {
  50% { box-shadow: 0 0 0 6px var(--color-halo); }
}

/* --- open in place ------------------------------------------------------------ */
.inplace {
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

.inplace-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-4);
  font-weight: 650;
  cursor: pointer;
}

.inplace-body {
  padding: var(--space-4);
}

.inplace-body h2 {
  margin-top: 0;
  font-size: var(--text-h3);
}

/* With the script, a closed panel is out of sight and an open one has no line of its own: its button closes it. */
.js .inplace:not([open]),
.js .inplace > .inplace-line {
  display: none;
}

/* --- tabs ---------------------------------------------------------------------- */
.tabs {
  margin-top: var(--space-5);
}

.tab-list {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--color-rule);
  scrollbar-width: thin;
}

.tab {
  /* Holds its own words for the ear (a count's "not seen yet"): placed absolutely, they stay inside the tab, and
     so inside the row's own sideways scroll, instead of widening a phone's page. */
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-4);
  border-bottom: 3px solid transparent;
  color: var(--color-muted);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--color-ink);
}

.tab[aria-selected="true"],
.tab[aria-current="true"] {
  border-bottom-color: var(--color-accent);
  color: var(--color-ink);
}

.tab-count {
  font-size: 0.8rem;
}

.tab-panel {
  padding-top: var(--space-4);
}

/* With the tabs working, the part's own heading would only repeat its tab. */
.js [data-tabs-bound] .tab-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Before the script has taken the tabs up, only the part the page opens on is shown. */
.js [data-tabs]:not([data-tabs-bound]) .tab-panel:not([data-shown]) {
  display: none;
}

/* --- the lead's page: the top ---------------------------------------------------- */
.lead-head {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.lead-crumb {
  margin: 0;
}

.lead-who {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.lead-initials {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1.5px solid var(--color-soft-edge);
  border-radius: 50%;
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-size: 1.15rem;
  font-weight: 700;
  user-select: none;
}

.lead-title {
  min-width: 0;
}

.lead-title h1 {
  margin: 0;
  font-size: var(--text-h2);
  overflow-wrap: anywhere;
}

.lead-sub {
  margin: 0;
  color: var(--color-muted);
}

.lead-marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.archived-mark {
  font-weight: 650;
  color: var(--color-muted);
}

.lead-glance {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lead-glance li {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-glance li > .icon {
  color: var(--color-muted);
}

.lead-glance .glance-due > .icon {
  color: var(--color-danger);
}

.lead-glance .inline-form {
  display: inline-flex;
  margin: 0;
}

/* "Call" (ledger D169): on a touch screen only. Where the pointer is a mouse or a pen there is no dialer to hand the
   number to, so the button is not there at all; "Show number" and Log do the computer's part. */
.dial-form,
.lead-glance .dial-form {
  display: none;
}

@media (pointer: coarse) {
  .dial-form,
  .lead-glance .dial-form {
    display: inline-flex;
    flex: none;
    margin: 0;
  }
}

.dial-btn {
  color: var(--color-accent);
}

/* --- the row of icon buttons, and More ------------------------------------------- */
.lead-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-3);
}

.lead-qualify {
  margin-left: auto;
}

.more-menu {
  position: relative;
}

.more-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + var(--space-1));
  right: 0;
  min-width: 15rem;
  margin: 0;
  padding: var(--space-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-raised);
  list-style: none;
}

.more-list a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

.more-list a:hover {
  background: var(--color-soft-hover);
}

.lead-panels {
  display: grid;
  gap: var(--space-3);
}

/* --- Log: two parts, side by side on a computer, one above the other on a phone (ledger D165) --- */
.log-parts {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 52rem) {
  .log-parts {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.log-part .stacked-form {
  max-width: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
  margin: 0 0 var(--space-2);
  padding: 0;
  border: 0;
}

.chips legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-weight: 650;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-4) 0 var(--space-3);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-chip);
  background: var(--color-field);
  font-weight: 600;
  cursor: pointer;
}

.chip input {
  margin: 0;
  accent-color: var(--color-accent);
}

.chip:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-soft);
  box-shadow: 0 0 0 2px var(--color-halo);
}

/* --- the activity feed ----------------------------------------------------------- */
/* The Notes tab (ledger D291) is laid out as the feed. */
.feed,
.notes-list {
  padding: 0;
}

.feed > .feed-item,
.notes-list > .feed-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
  list-style: none;
}

.feed > li::before,
.notes-list > li::before {
  content: none;
}

.feed-icon {
  margin-top: 0.15rem;
  color: var(--color-muted);
}

.feed-body {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.feed-head {
  margin: 0;
}

.feed-line {
  font-weight: 600;
}

.feed-note .feed-line {
  font-weight: 400;
}

.feed-head .timeline-notes {
  display: block;
}

.feed-more > summary {
  cursor: pointer;
}

.feed-more[open] > .timeline-notes {
  margin: var(--space-2) 0 0;
}

/* Your own note (ledger D185): Edit, Hide or Show, small and quiet, on its line; the edit form opens under it. */
.feed-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.feed-action-form {
  display: contents;
}

.feed-edit {
  margin-top: var(--space-2);
}

.feed-versions > summary,
.feed-hidden-mine > summary {
  margin-top: var(--space-1);
  cursor: pointer;
}

.feed-version-list {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-rule);
}

.feed-version-list > li {
  margin-bottom: var(--space-2);
  list-style: none;
}

.feed-version-list > li::before {
  content: none;
}

.feed-version-list .timeline-notes,
.feed-version-list .lead-meta {
  margin: 0;
}

/* A hidden note, as managers still see it: dimmed, and saying so in words. */
.feed-hidden .feed-line,
.feed-hidden .notes-line {
  color: var(--color-muted);
}

.feed-hidden-said {
  margin: 0;
  font-style: italic;
}

.feed-hidden-mine {
  margin-top: var(--space-3);
}

@media (max-width: 40rem) {
  .lead-qualify {
    margin-left: 0;
  }

  .lead-panels .stacked-form input:not([type="radio"]),
  .lead-panels .stacked-form select,
  .lead-panels .stacked-form textarea {
    width: 100%;
  }
}

.timeline.feed,
.timeline.notes-list {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

.stacked-form .chips legend,
.stacked-form label.chip {
  margin-top: 0;
}

.stacked-form .chips {
  margin-top: var(--space-2);
}

.log-part .stacked-form,
.inplace-body .stacked-form {
  margin: var(--space-3) 0 0;
}

/* The name, or the initials circle, is the way to My account (ledger D170). */
.site-header .who-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  text-decoration: none;
}

.site-header .who-link:hover,
.site-header .who-link[aria-current="page"] {
  color: var(--color-night-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-header .who-initials.who-link {
  display: none;
  width: var(--touch);
  height: var(--touch);
  min-height: var(--touch);
}

.site-header .who-initials.who-link[aria-current="page"] {
  border-color: var(--color-night-ink);
  text-decoration: none;
}

@media (max-width: 85rem) {
  .site-header .who.who-link {
    display: none;
  }

  .site-header .who-initials.who-link {
    display: inline-flex;
  }
}

/* A summary that is an icon button (More): no arrow, no gap under it when open. */
summary.icon-btn::before {
  content: none;
}

.more-menu[open] > summary {
  margin-bottom: 0;
}

/* A line of the activity that opens in place: a plain line with the arrow, not a pill. */
.feed-more > summary {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-weight: inherit;
}

.feed-more > summary::before {
  display: inline-block;
  margin-right: 0.5em;
  vertical-align: 0.15em;
}

.feed-more > summary:hover,
.feed-more > summary:active {
  background: none;
}

.feed-more[open] > summary {
  margin-bottom: 0;
}

/* Two short fields side by side (a day and a time), one above the other on a narrow phone. */
.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.field-pair .field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

@media (max-width: 24rem) {
  .field-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==========================================================================
   === the leads list, the pipeline and Follow-ups reworked (ledger D168, D171, D172) ===
   On the shared icon buttons, panels and tabs above. */

/* The row of icon buttons at the top of a screen; More opens under the row, inside the page. */
.page-icons {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-3);
}

.page-icons .more-menu {
  position: static;
}

.page-icons .more-list {
  left: 0;
  right: auto;
  max-width: 100%;
}

.page-panels {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* --- the filter bar: search, Filters, chips ------------------------------------- */
.filter-bar {
  margin: var(--space-3) 0 var(--space-4);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.filter-search {
  display: flex;
  flex: 1 1 16rem;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.filter-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  background: var(--color-field);
  color: var(--color-ink);
  font: inherit;
}

.filter-panel {
  flex: 1 1 100%;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
}

.filter-fields select {
  max-width: 100%;
}

.filter-whose {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.filter-whose [aria-current="true"] {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-halo);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  min-height: var(--touch);
  padding: 0 var(--space-3) 0 var(--space-4);
  border: 1.5px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-weight: 650;
  text-decoration: none;
}

.filter-chip .chip-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-chip .icon {
  width: 1rem;
  height: 1rem;
}

.filter-chip:hover {
  border-color: var(--color-accent);
  background: var(--color-soft-hover);
}

.filter-count {
  color: var(--color-muted);
  font-weight: 650;
}

.filter-all {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
}

/* --- the leads list ---------------------------------------------------------------- */
.waiting-slim {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: 1rem;
}

.waiting-slim .waiting-words {
  flex: 1 1 12rem;
  min-width: 0;
}

.tick-all {
  margin: 0 0 var(--space-2);
}

.lead-rows-slim > .lead-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.lead-rows-slim .lead-tick {
  min-width: var(--touch);
  min-height: var(--touch);
}

.lead-rows-slim .lead-tick input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}

.row-main {
  display: grid;
  flex: 1 1 auto;
  gap: var(--space-1);
  min-width: 0;
}

.row-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-rows-slim .lead-name {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
}

.row-end {
  flex: none;
  max-width: 40%;
  text-align: right;
}

/* A follow-up's day at the end of a row wraps inside its narrow end rather than pushing past the screen's edge. */
.row-end .follow-mark {
  max-width: 100%;
  white-space: normal;
}

/* The marks beside a name, as icons: the shape alone, the words kept for a screen reader and as each mark's tooltip
   (its `title`, ledger D278). */
.row-marks {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.row-marks .quiet-mark,
.row-marks .qual-mark,
.row-marks .reply-mark,
.row-marks .follow-mark {
  justify-content: center;
  gap: 0;
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0 0.35rem;
  font-size: 0;
}

.row-marks .quiet-mark::before {
  width: 0.55rem;
  height: 0.55rem;
}

.row-marks .reply-mark::before {
  width: 0.5rem;
  height: 0.5rem;
}

.row-marks .qual-mark::before,
.row-marks .reply-bounce::before,
.row-marks .follow-mark::before {
  font-size: 0.9rem;
}

.row-marks .qual-special {
  font-size: 0.8rem;
}

.row-marks .qual-special::before {
  content: none;
}

/* A phone or a touch screen has no hover to show a tooltip (ledger D278): there the marks show their words again,
   small, beside the same shape. */
@media (max-width: 40rem), (pointer: coarse) {
  .row-marks .quiet-mark,
  .row-marks .qual-mark,
  .row-marks .reply-mark,
  .row-marks .follow-mark {
    gap: 0.35em;
    padding: 0.05rem 0.5rem 0.05rem 0.4rem;
    font-size: 0.75rem;
    white-space: normal;
  }
}

/* The bar at the foot of the page, while leads are ticked (public/js/ticks.js shows and hides it). */
.tick-bar {
  z-index: 20;
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--color-card);
  box-shadow: var(--shadow-raised);
}

/* With the script the bar shows only once leads are ticked, and then stays at the foot of the screen. Without it the
   bar is always there, so it stays where it stands, under the list, and covers nothing. */
.js .tick-bar {
  position: sticky;
  bottom: 0;
}

.tick-bar[hidden] {
  display: none;
}

.tick-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.tick-bar-count {
  font-weight: 700;
}

.tick-bar-give {
  display: flex;
  flex: 1 1 14rem;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.tick-bar-give select {
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 100%;
  min-height: var(--touch);
}

.tick-bar-panel {
  margin-top: var(--space-3);
}

.tick-bar-panel .archive-many-fields input[type="text"] {
  max-width: 100%;
}

/* --- the pipeline ---------------------------------------------------------------- */
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.card-head .lead-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-head .card-move-opener {
  margin-left: auto;
}

.card-move {
  margin-top: var(--space-2);
}

.card-move-choices {
  display: grid;
  gap: var(--space-2);
}

.card-move .inplace-body {
  padding: var(--space-2);
}

.card-move-choice {
  justify-content: flex-start;
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: left;
}

.card-move-choice[aria-current="true"] {
  border-color: var(--color-accent);
}

.btn-compact {
  min-height: var(--touch);
  padding: 0 var(--space-3);
  font-size: 0.9rem;
}

/* --- Follow-ups --------------------------------------------------------------- */
.count-overdue {
  color: var(--color-danger);
  font-weight: 800;
}

/* The rows are the boxes: neither the tab's part nor the section inside it draws another round them. */
.follow-tabs .tab-panel,
.follow-tabs .tab-panel > .follow-section {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.follow-tabs .tab-panel {
  padding-top: var(--space-4);
}

.follow-tabs .tab .count {
  margin-left: var(--space-1);
}

.follow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.follow-row .follow-controls {
  display: inline-flex;
  flex: none;
  gap: var(--space-2);
  margin-left: auto;
}

.follow-row .follow-move {
  flex: 1 1 100%;
}

@media (max-width: 40rem) {
  .row-end {
    max-width: 32%;
    font-size: 0.85rem;
  }

  .lead-rows-slim > .lead-row {
    padding: var(--space-3);
  }

  .tick-bar {
    margin-left: calc(-1 * var(--space-2));
    margin-right: calc(-1 * var(--space-2));
  }
}

/* === Documents and a request's review (ledger D173) ==================================================== */

/* One sent package, or one request waiting for review: a compact line that opens its facts in place, and beside it
   the things that can be done, as icon buttons. On a phone the buttons go under the line; nothing scrolls sideways. */
.doc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

/* Shut, a document's facts take no room: WebKit still lays out a shut disclosure's content, and would measure the
   lead's link inside it as a control too small to press. */
.doc-row-facts:not([open]) > :not(summary) {
  display: none;
}

.doc-row-facts {
  flex: 1 1 20rem;
  min-width: 0;
}

.doc-row-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-height: var(--touch);
  padding: var(--space-1) 0;
  color: var(--color-ink);
  text-decoration: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.doc-row-link {
  flex: 1 1 20rem;
  min-width: 0;
}

.doc-row-link:hover .doc-row-who,
summary.doc-row-line:hover .doc-row-who {
  text-decoration: underline;
}

.doc-row-who {
  min-width: 0;
  font-weight: 700;
}

.doc-row-amount {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.doc-row .status {
  padding: 0.1rem 0.7rem 0.1rem 0.55rem;
  font-size: 0.85rem;
}

.doc-row-body {
  padding: var(--space-2) 0 var(--space-3);
}

.doc-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.doc-row-actions .inline-form {
  margin: 0;
}

.doc-row-cancel {
  flex: 1 1 100%;
  margin: 0 0 var(--space-2);
}

.documents-filter .chips {
  margin-bottom: var(--space-2);
}

.documents-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}

.review-actions .control-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.review-panel {
  margin: 0 0 var(--space-3);
}

/* ---------------------------------------------------------------------------------------------------------------
   The admin screens reworked (ledger D173): on/off switches, filter chips, a person's summary header, rows of icon
   buttons, chevron pagers and the Manage menu's icons. The icon button, tabs and in-place panels are the shared ones.
   --------------------------------------------------------------------------------------------------------------- */

/* An on/off switch: a link to the same view with it changed, or a button that sends its form. 44px to touch. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-1);
  border: 0;
  background: none;
  color: var(--color-ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.switch-track {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 1.4rem;
  border: 1.5px solid var(--color-control-border);
  border-radius: 999px;
  background: var(--color-field-rest);
}

.switch-knob {
  position: absolute;
  top: 0.12rem;
  left: 0.15rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--color-muted);
}

.switch[aria-checked="true"] .switch-track {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.switch[aria-checked="true"] .switch-knob {
  left: auto;
  right: 0.15rem;
  background: var(--color-accent-ink);
}

.switch:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.switch-word {
  overflow-wrap: anywhere;
}

.switch-state {
  color: var(--color-muted);
  font-size: 0.9em;
}

@media (prefers-reduced-motion: no-preference) {
  .switch-knob,
  .switch-track {
    transition: background-color 0.15s, left 0.15s, right 0.15s;
  }
}

/* A row of switches, each a form of its own, with what it means under it. */
.switch-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.switch-rows > li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.switch-rows > li:last-child {
  border-bottom: 0;
}

.switch-rows .inline-form {
  display: inline;
}

/* What a page is narrowed to: chips, each with its × to take the choice away. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0;
  padding: 0;
  list-style: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding-left: var(--space-3);
  border: 1px solid var(--color-soft-edge);
  border-radius: var(--radius-chip);
  background: var(--color-soft);
  color: var(--color-soft-ink);
}

.filter-chip-word {
  overflow-wrap: anywhere;
}

.filter-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  color: inherit;
}

.filter-chip-x:hover {
  color: var(--color-danger);
}

/* A row of small icon buttons beside a heading or a row: the page's own actions. */
.icon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.icon-row .inline-form {
  display: inline-flex;
  margin: 0;
}

.row-icons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-left: auto;
}

.row-icons .inline-form {
  display: inline-flex;
  margin: 0;
}

/* A heading with its icon buttons at the end of the line. */
.heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.heading-row > h2,
.heading-row > h3 {
  margin-right: auto;
}

/* A person's page: who they are, at a glance. */
.person-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.person-head .lead-initials {
  flex: none;
}

.person-title {
  flex: 1 1 14rem;
  min-width: 0;
}

.person-title p {
  margin: 0;
  overflow-wrap: anywhere;
}

.person-marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
}

.person-marks li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.person-marks .mark-off {
  color: var(--color-danger);
}

/* Pages of a list: chevrons either side of where it stands. */
.pager-chevrons {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pager-chevrons .pager-off {
  visibility: hidden;
}

/* The Manage menu: an icon beside each item, items in groups. */
.nav-menu-list > ul {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-menu-group {
  margin: var(--space-2) 0 0;
  padding: 0 var(--space-4);
  color: var(--color-night-muted);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-menu-list .nav-link .icon {
  margin-right: var(--space-2);
}

/* The What's new view switch: two ways, one link each. */
.two-way {
  display: inline-flex;
  border: 1.5px solid var(--color-soft-edge);
  border-radius: 999px;
  overflow: hidden;
}

.two-way a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  color: var(--color-soft-ink);
  text-decoration: none;
}

.two-way a[aria-current="true"] {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}

/* --- Campaign IDs: a place's row (ledger D173) ------------------------------------ */
/* The pencil sits at the end of the row; the form it opens takes the row's whole width under it. */
#place-rows .lead-row > .row-icons {
  grid-column: -2;
  justify-self: end;
}

#place-rows .lead-row > .inplace {
  grid-column: 1 / -1;
}

/* The theme button: a moon in the light (a press makes it dark), a sun in the dark. */
.theme-toggle .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.theme-toggle .theme-sun,
[data-theme="dark"] .theme-toggle .theme-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-sun {
  display: inline-block;
}

/* === view as (ledger D191): the banner on every page, the menu beside the name, the dimmed buttons === */
.view-as-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-bottom: 2px solid var(--color-warn);
  background: var(--color-status-working-bg);
  color: var(--color-ink);
  font-weight: 600;
}

.view-as-banner p {
  margin: 0;
  overflow-wrap: anywhere;
}

/* The View as menu is drawn as the Manage menu is (.nav-menu), under its own name: a page has one Manage menu. */
.view-as-menu {
  position: relative;
  align-self: center;
}

.site-header .view-as-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  border: 0;
  background: none;
  color: var(--color-night-link);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.site-header .view-as-menu > summary::before {
  content: none;
}

.view-as-menu > summary::-webkit-details-marker {
  display: none;
}

.site-header .view-as-menu > summary:hover,
.site-header .view-as-menu[open] > summary {
  background: var(--color-night-raised);
  color: var(--color-night-ink);
}

.view-as-menu:not([open]) > .nav-menu-list {
  display: none;
}

.site-header .nav-menu-list .nav-menu-button {
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

/* Nothing can be changed while viewing as someone: the page's own buttons that would post are shown dimmed and
   do nothing when pressed (the server refuses them in any case). The banner and the top bar are outside main. */
.viewing-as main form[method="post" i] :is(button, input[type="submit"]) {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 40rem) {
  .view-as-menu {
    position: static;
  }

  .site-header .view-as-menu > summary,
  .site-header .view-as-menu > summary:hover,
  .site-header .view-as-menu[open] > summary {
    padding: 0;
    border-radius: 0;
    background: none;
  }

  .site-header .view-as-menu[open] > summary {
    box-shadow: inset 0 -3px 0 var(--color-night-control);
  }

  .site-header .view-as-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ==========================================================================
   === the booking calendar (ledger D216): My account → Calendar, People → Calendar, the lead's booking link ===
   ========================================================================== */

.stacked-form fieldset.calendar-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.calendar-day {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.calendar-day-name {
  flex: 0 0 7rem;
  font-weight: 600;
}

.calendar-range {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.copy-row input[type="text"] {
  flex: 1 1 16rem;
  min-width: 0;
}

/* --- The documents library, and files on a lead's email (ledger D219) ------------- */

.stacked-form fieldset.email-files {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  min-width: 0;
}

.stacked-form fieldset.email-files legend {
  padding: 0 var(--space-2);
  font-weight: 600;
}

.email-files input[type="file"] {
  max-width: 100%;
  min-height: 2.75rem;
}

.email-library summary {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 600;
}

.library-ticks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  border-left: 2px solid var(--color-rule);
}

.stacked-form label.library-tick {
  min-height: 2.75rem;
  align-items: flex-start;
}

.library-tick input[type="checkbox"] {
  margin-top: 0.3rem;
  flex: none;
}

.library-tick > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.library-tick-title {
  font-weight: 600;
}

.library-row .library-file {
  overflow-wrap: anywhere;
}

.library-row .library-about {
  color: var(--color-muted);
}

.email-files label[for="id_email_files"] {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* The files chosen for an email (ledger D293; public/js/files.js): one line each with "Remove", as on the feedback form. */
.file-picks {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.file-picks li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.file-picks .file-pick-name {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-picks-said {
  margin: var(--space-2) 0 0;
  color: var(--color-danger);
  font-weight: 600;
}

.file-picks-said:empty {
  display: none;
}

/* "Add a link to book a call" beside an email's message box (ledger D216): the button, then what it did. */
.book-call {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}

.book-call-said:empty {
  display: none;
}

/* "Add a link" and "Add a heading" beside an email's message box (ledger D316): the buttons, what they did, and the
   one small box open under them. */
.format-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}

.format-said:empty {
  display: none;
}

.format-box {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.format-box[hidden] {
  display: none;
}

.format-act {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* A heading in an email's words, wherever LeadDesk shows them (App\Core\Markup::shown): its own line, larger, bold. */
.email-heading {
  display: block;
  font-size: 1.3em;
  line-height: 1.3;
}

.icon-btn.book-call-btn:disabled {
  border-style: dashed;
  border-color: var(--color-off-edge);
  background: var(--color-off-bg);
  color: var(--color-off-ink);
  transform: none;
  cursor: not-allowed;
}

/* A Calendar tab's "Your upcoming calls" (the owner, 2026-10-21): one line each — when, who, and whether it moved. */
.calendar-call-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
}

.calendar-call {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.calendar-call-when {
  font-weight: 600;
}

/* Busy time on a Calendar tab (ledger D253): one line each — when, the label, Remove — and the calls already booked in it. */
.busy-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
}

.busy-item {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule);
}

.busy-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: center;
}

.busy-when {
  font-weight: 600;
}

.busy-label {
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.busy-remove {
  margin-left: auto;
}

.busy-overlap-note {
  margin: var(--space-2) 0 var(--space-1);
}

.busy-overlaps {
  margin: 0;
  padding-left: var(--space-5);
}

.busy-overlaps li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  align-items: baseline;
}

.busy-form {
  margin-top: var(--space-4);
}

.busy-sub {
  margin: 0;
  font-size: 1.05rem;
}

/* "Book a call" (ledger D253): the free times a day at a time, each a chip to pick. */
.book-call-days {
  margin-bottom: var(--space-3);
}

.book-call-day {
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-rule);
}

.book-call-day > summary {
  min-height: var(--touch);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  cursor: pointer;
}

.book-call-day-name {
  font-weight: 650;
}

.book-call-times {
  padding: var(--space-2) 0;
}

/* An email kept on the lead's Emails tab may hold a long address (a booking link): it wraps, never widens the page. */
.note details {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Client questions (ledger D223): the Feedback form sends feedback or a question clients ask; each set of
   fields is a part of the form, and only the chosen one is shown and sent. */
.feedback-form fieldset.feedback-part {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.feedback-form fieldset.feedback-part[hidden] {
  display: none;
}

.faq-wording {
  margin: var(--space-2) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.faq-submissions {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
}

.faq-submissions > li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-rule);
}

/* What are you sending? (ledger D226): two large, equal choices side by side, each a card pressed anywhere;
   stacked when there is no room for two. Still real radio buttons, so they work without the script. */
.feedback-form fieldset.feedback-sending {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-2);
}

.feedback-form fieldset.feedback-sending legend {
  margin-bottom: var(--space-2);
}

.feedback-form fieldset.feedback-sending noscript {
  grid-column: 1 / -1;
}

.feedback-form .feedback-sending label.check {
  justify-content: center;
  min-height: calc(var(--touch) * 1.5);
  padding: var(--space-3);
  border: 1.5px solid var(--color-control-border);
  border-radius: var(--radius-card);
  background: var(--color-card);
  font-weight: 650;
  text-align: center;
  align-items: center;
}

.feedback-form .feedback-sending label.check:hover {
  border-color: var(--color-accent);
}

.feedback-form .feedback-sending label.check:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-status-open-bg);
}

.feedback-form .feedback-sending input[type="radio"] {
  flex: none;
  margin: 0;
}

/* Without the script, a part that is not switched off shows even before a choice: with nothing chosen, both
   (over the [hidden] rule above, which is !important). */
html:not(.js) .feedback-form fieldset.feedback-part[hidden]:not(:disabled) {
  display: flex !important;
}

/* What is folded away under the message or the question (ledger D226): "More", "Add more (optional)". */
.feedback-form .feedback-more {
  margin-top: var(--space-2);
}

.feedback-form .feedback-more-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}


/* --- My calendar (ledger D228): the Calendar tab on Follow-ups ------------------------------------------------- */
.mycal-pick {
  margin-bottom: var(--space-3);
}

.mycal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-2) 0;
}

.mycal-nav,
.mycal-views {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.mycal-title {
  margin: 0;
  font-weight: 650;
  flex: 1 1 auto;
}

.mycal-view {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-4);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-chip);
  background: var(--color-field);
  color: var(--color-ink);
  text-decoration: none;
}

.mycal-view-on {
  background: var(--color-soft);
  color: var(--color-soft-ink);
  border-color: var(--color-soft-edge);
  font-weight: 650;
}

.mycal-note {
  margin-top: 0;
}

.mycal-grid-wrap {
  overflow-x: auto;
  margin: var(--space-3) 0 var(--space-6);
}

.mycal-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
}

.mycal-grid th,
.mycal-grid td {
  border: 1px solid var(--color-rule);
  padding: 2px var(--space-1);
  vertical-align: top;
}

.mycal-grid .mycal-corner,
.mycal-grid .mycal-hour {
  width: 5.5rem;
  color: var(--color-muted);
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
}

.mycal-grid .mycal-half td,
.mycal-grid .mycal-half th {
  border-top-style: dotted;
}

.mycal-grid td {
  height: 1.75rem;
}

.mycal-grid .mycal-open {
  background: var(--color-cal-open);
}

.mycal-grid .mycal-head {
  text-align: left;
}

.mycal-today {
  font-weight: 700;
}

.mycal-chip {
  display: block;
  margin: 1px 0;
  padding: 1px var(--space-1);
  border-left: 3px solid var(--color-cal-call);
  border-radius: 4px;
  background: var(--color-card);
  color: var(--color-ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.mycal-chip.mycal-follow_up {
  border-left-color: var(--color-cal-follow);
}

/* Busy time blocked out (ledger D253): nothing to open, so not a link — a grey edge on its own ground. */
.mycal-chip.mycal-busy {
  border-left-color: var(--color-cal-busy);
  background: var(--color-cal-busy-bg);
  color: var(--color-ink);
}

.mycal-kind {
  color: var(--color-muted);
}

.mycal-time {
  font-variant-numeric: tabular-nums;
}

.mycal-list .mycal-day {
  margin-bottom: var(--space-4);
}

.mycal-list h3 {
  margin: 0 0 var(--space-1);
  font-size: 1.05rem;
}

.mycal-open-words {
  display: inline-block;
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius);
  background: var(--color-cal-open);
}

.mycal-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mycal-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-3);
  padding-left: var(--space-2);
  border-left: 3px solid var(--color-cal-call);
  margin-bottom: var(--space-1);
}

.mycal-item.mycal-follow_up {
  border-left-color: var(--color-cal-follow);
}

.mycal-item.mycal-busy {
  border-left-color: var(--color-cal-busy);
}

.mycal-item .mycal-time {
  min-width: 6.5rem;
  color: var(--color-muted);
}

/* One day on a phone (public/js/mycal.js): the grid keeps the hours and that day's column. */
.mycal-one-day .mycal-grid .mycal-corner,
.mycal-one-day .mycal-grid .mycal-hour {
  width: 4.5rem;
}

@media (max-width: 40rem) {
  .mycal-grid {
    min-width: 0;
  }

  .mycal-days-7 {
    min-width: 46rem;
  }

  .mycal-one-day .mycal-days-7 {
    min-width: 0;
  }

  .mycal-bar {
    gap: var(--space-2);
  }
}

/* My account → Calendar: "Add to my phone's calendar" (ledger D228). */
.feed-link {
  margin-top: var(--space-4);
}

.feed-actions {
  margin: var(--space-3) 0;
}

.feed-how {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

/* On a touch screen every call or follow-up in the grid is big enough for a thumb. */
@media (pointer: coarse) {
  .mycal-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--space-1);
    min-height: var(--touch);
  }
}

/* === "Do not call" and "Do not contact" (ledger D232) ===
   The second status of the dead file: the same colour as Do not contact, its sign hollow. */
.status-do_not_call { --st: var(--color-danger); --st-bg: var(--color-status-dnc-bg); }

.status-do_not_call::before {
  border-radius: 2px;
}

.lead-row.status-do_not_call,
.board-card.status-do_not_call { border-left-color: var(--color-danger); }

.stand-do_not_call { fill: var(--color-danger); }

/* The check before saving: each detail in its own box, the full value large enough to read back. */
.stop-detail {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-rule);
  border-radius: 6px;
  min-width: 0;
}

.stop-detail .revealed {
  font-size: 1.15em;
  overflow-wrap: anywhere;
}

.stop-confirmed {
  font-weight: 650;
  color: var(--color-ok);
}

.stop-unconfirmed {
  font-weight: 650;
  color: var(--color-danger);
}

/* Manage → Do not contact: the two filters on one line where there is room. */
#dead-file-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}

.dead-row > * {
  overflow-wrap: anywhere;
}

.do-not-call-before {
  margin: var(--space-2) 0 0;
  font-weight: 650;
  color: var(--color-danger);
}

/* --- The first email after the qualification (ledger D232) ------------------ */

/* Queued emails: one line each — the lead, the subject, when it goes, Edit and Cancel. */
.queued-row {
  grid-template-columns: minmax(0, 1fr);
}

.queued-subject {
  overflow-wrap: anywhere;
}

.queued-actions {
  margin-left: 0;
}

/* On the lead's page, under its header: the button, or when the one waiting goes. */
.first-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
}

.first-email p {
  margin: 0;
}

.first-email .inline-form {
  display: inline-flex;
  margin: 0;
}

/* The edit page's files: one tick each. */
.queued-files {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0;
}

/* === the sequence editor (ledger D309; sequences/form) ===
   The steps in order on the left, the one being written on the right; on a narrow screen the right comes below.
   Without the page's script every step's boxes are shown, one after another. */
.seq-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
}

.seq-name {
  display: flex;
  flex-direction: column;
  flex: 1 1 22rem;
  min-width: 0;
}

.seq-sums {
  margin: 0;
}

.seq-said {
  min-height: 1.5rem;
  margin: var(--space-2) 0 0;
  color: var(--color-ok);
  font-weight: 600;
}

.seq-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: flex-start;
}

.seq-order {
  flex: 1 1 26rem;
  min-width: 0;
}

.seq-edit {
  flex: 1 1 28rem;
  min-width: 0;
  padding: var(--space-6);
  border-radius: var(--radius-panel);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.seq-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.seq-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 2px solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
}

.seq-step-on {
  border-color: var(--color-accent);
}

.seq-dragging {
  opacity: 0.5;
}

.seq-drop-before {
  box-shadow: inset 0 4px 0 var(--color-signal), var(--shadow-card);
}

.seq-drop-after {
  box-shadow: inset 0 -4px 0 var(--color-signal), var(--shadow-card);
}

.seq-grip {
  display: none;
  flex: none;
  align-self: center;
  color: var(--color-muted);
  cursor: grab;
}

.seq-scripted .seq-grip {
  display: inline-flex;
}

.seq-number {
  display: inline-flex;
  flex: none;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-2);
  box-sizing: border-box;
  border-radius: var(--radius-chip);
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-weight: 700;
}

.seq-step-branch .seq-number {
  background: var(--color-status-won-bg);
  color: var(--color-ink);
}

.seq-step-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.seq-day {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.seq-pick {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.seq-pick:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.seq-moves {
  flex: none;
}

.seq-stops {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

.seq-stops h3 {
  margin: 0 0 var(--space-1);
}

.seq-stops p {
  margin: 0;
}

.seq-from p {
  margin: 0 0 var(--space-1);
  overflow-wrap: anywhere;
}

.seq-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-6) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.seq-legend {
  margin-bottom: var(--space-2);
  font-size: 1.2rem;
  font-weight: 700;
}

.seq-wait {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.seq-wait input {
  width: 6rem;
}

.seq-branch {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-card);
}

.seq-branch-a {
  background: var(--color-status-won-bg);
}

.seq-branch-b {
  background: var(--color-surface);
}

.seq-fill {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.seq-fill-said {
  margin: var(--space-2) 0 0;
}

.seq-remove {
  align-self: flex-start;
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.seq-preview {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-rule);
}

.seq-preview-h {
  margin: 0 0 var(--space-2);
  font-weight: 700;
}

.seq-preview-mail {
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.seq-preview-head,
.seq-preview-subject {
  margin: 0;
  padding: var(--space-1) var(--space-4);
  background: var(--color-surface);
  overflow-wrap: anywhere;
}

.seq-preview-subject {
  padding-bottom: var(--space-3);
  font-weight: 600;
}

.seq-preview-body {
  margin: 0;
  padding: var(--space-4);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.seq-preview-foot {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* The editor is a form, but a wide one: the order beside the step being written. */
.stacked-form.seq-editor {
  max-width: none;
}

.seq-fields input[type="text"],
.seq-fields textarea {
  width: 100%;
  box-sizing: border-box;
}

/* The sender's address and the fill-ins are long words: on a phone they break rather than push the page sideways. */
.seq-editor .id-code {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* On a touch screen a step's title is pressed with a thumb: a full 44px to aim at. */
@media (pointer: coarse) {
  .seq-pick {
    min-height: 2.75rem;
  }
}

/* A lead's Sequence panel (ledger D310): the steps with what went and what is next; a sequence that ended, or why a lead
   cannot be put in one, on a quiet band. */
.sequence-steps {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sequence-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--color-bg);
}
.sequence-step.is-next { background: var(--color-soft); }
.sequence-mark {
  display: inline-flex;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  background: var(--color-surface);
  color: var(--color-ink);
}
.sequence-step.is-done .sequence-mark { background: var(--color-ok); color: var(--color-accent-ink); }
.sequence-step.is-next .sequence-mark { background: var(--color-accent); color: var(--color-accent-ink); }
.sequence-step-body { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.sequence-step-title { font-weight: 600; }
.sequence-blocked,
.sequence-ended {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--color-surface);
}
.sequence-replied { background: var(--color-status-won-bg); }
.sequence-blocked p,
.sequence-ended p { margin: 0 0 4px; }
.sequence-stop > summary { list-style: none; display: inline-flex; }
.sequence-stop > summary::-webkit-details-marker { display: none; }
.sequence-stop[open] > summary { display: none; }
.sequence-stop-ask {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-danger);
  background: var(--color-card);
}
.sequence-chip {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--color-soft);
  color: var(--color-soft-ink);
  font-size: 15px;
  font-weight: 600;
}
.sequence-chip.is-replied { background: var(--color-status-won-bg); color: var(--color-ink); }

/* Lead Response (ledger D302): its count of replies not opened is red, on the night header only (D304). */
.nav-count.nav-urgent {
  background: var(--color-urgent);
  color: var(--color-night);
  font-weight: 800;
}
.response-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.response-item {
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  overflow-wrap: anywhere;
}
.response-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.response-new {
  display: inline-block;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--color-status-working-bg);
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 22px;
}
.response-words { margin: 6px 0 0; }
.sequence-replies { margin-top: 12px; }
.sequence-reply { padding: 12px 16px; border-radius: 12px; background: var(--color-status-won-bg); margin-bottom: 8px; overflow-wrap: anywhere; }
.sequence-reply p { margin: 0 0 4px; }
