/* The look follows the company deck: near-black ink on light surfaces, with a yellow highlighter
   for what matters on a page. Colours are defined once here and nowhere else. */
:root {
  --bg: #e8ecf1; --surface: #fbfcfd; --panel: #f0f3f7;
  --ink: #0e1a2b; --ink-2: #3d4b5f; --muted: #6c7888; --line: #d4dae3;
  --hl: #ffdd8a; --hl-edge: #e5b94f; --hl-ink: #0e1a2b;
  --good: #117a55; --bad: #b5302f; --warn: #b85600; --info: #385098;
  /* A rep's day against the daily target: under way, met, ended short. */
  --day-going: #ffb85c; --day-met: #8fdcb4; --day-short: #f3a29f; --day-ink: #0e1a2b;
  --ghost: #ffd3e4; --ghost-edge: #f09abe; --ghost-ink: #5c0f33; --ghost-pink: #ec3f8f;
  /* Who is taking care of a website's submission: white on red, so it is seen (Michael, 20 October). */
  --taken: #b5302f; --taken-ink: #fff;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 10px 26px rgba(14, 26, 43, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f16; --surface: #151d2a; --panel: #1c2636;
    --ink: #eef2f7; --ink-2: #bcc6d3; --muted: #8b97a7; --line: #2b3748;
    --hl: #6b5300; --hl-edge: #8a6c0a; --hl-ink: #fff4c4;
    --good: #5fd0a4; --bad: #f08a88; --warn: #f6a04d; --info: #9db0ec;
    --day-going: #9a5300; --day-met: #1d6e4c; --day-short: #82302e; --day-ink: #fff;
    --ghost: #5a1838; --ghost-edge: #8c2f5c; --ghost-ink: #ffd9e8; --ghost-pink: #ff6fb1;
    --taken: #b23633; --taken-ink: #fff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 26px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--font-display); letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 12px; }
h2 { font-size: 1.12rem; font-weight: 600; margin: 18px 0 8px; }
.card > h2:first-child, details + h2 { margin-top: 0; }
/* Links are plain ink. In running text they carry a yellow underline; in tables, cards and menus they do not. */
a { color: var(--ink); text-decoration: none; border-radius: 3px; }
a:hover { background: var(--hl); color: var(--hl-ink); }
p a, .notice li a, dd a, .kb-cited a, .card-list span > a { text-decoration: underline; text-decoration-color: var(--hl-edge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* A list of links on its own reads as links: bold, as well as underlined. */
.kb-cited a, .card-list span > a { font-weight: 600; }
mark, .hl { background: var(--hl); color: var(--hl-ink); padding: .03em .25em; border-radius: .15em; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.bar { display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand:hover { background: none; }
.brand picture { display: flex; }
.brand img { height: 28px; width: auto; display: block; }
.menu { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.menu a { padding: 5px 8px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; }
.menu a:hover { background: var(--panel); color: var(--ink); }
.menu a.on { background: var(--hl); color: var(--hl-ink); }
/* The magnifying glass, which opens the search from any page. */
.searchlink { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.searchlink:hover { background: var(--hl); color: var(--hl-ink); border-color: var(--hl-edge); }
/* The person's name, which opens their own menu. */
.usermenu { position: relative; margin-left: auto; font-size: .93rem; }
.searchlink + .usermenu { margin-left: -12px; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-weight: 600; color: var(--ink); cursor: pointer; max-width: 12rem; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu summary::after { content: ""; flex: none; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.usermenu[open] summary { background: var(--panel); }
.usermenu[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.usermenu .pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 15.5rem; max-width: calc(100vw - 24px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(14, 26, 43, .18); }
.usermenu .me { display: flex; flex-direction: column; margin: 0 0 4px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); }
.usermenu .me span { color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.usermenu .pop a, .usermenu .pop button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.usermenu .pop a:hover, .usermenu .pop button:hover { background: var(--panel); }
.usermenu .pop form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }

main { max-width: 80rem; margin: 0 auto; padding: 20px 16px 72px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 24rem; margin: 7vh auto 0; }
.card.narrow .logo { display: block; height: 34px; width: auto; margin: 0 0 22px; }

label { display: block; margin: 0 0 14px; font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
label input { display: block; width: 100%; margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
input:focus, select:focus { border-color: var(--ink); }
button { font: inherit; font-weight: 600; padding: 8px 15px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--ink); }
button.primary { background: var(--hl); border-color: var(--hl-edge); color: var(--hl-ink); }
button.primary:hover { border-color: var(--hl-ink); }
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.search input[type="search"], .search input[type="text"] { flex: 1 1 16rem; min-width: 0; }
.search .check { margin: 0; white-space: nowrap; }
.search button { white-space: nowrap; }

.muted { color: var(--muted); font-size: .9rem; }
span.muted { margin-right: 12px; }
#link-state { margin-left: 12px; }
.error { color: var(--bad); font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: .88em; }
/* A migration's file name is one long word: on a phone it breaks where it must (QA, #qa-21). */
#sys-migrations li { overflow-wrap: anywhere; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.tile strong { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .86rem; }
a.tile:hover { background: var(--hl); border-color: var(--hl-edge); }
a.tile:hover strong, a.tile:hover span { color: var(--hl-ink); }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 8px 16px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:last-child, td:last-child { padding-right: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.when { white-space: nowrap; color: var(--ink-2); }
th { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: var(--panel); }
td a { font-weight: 600; }

.badge { display: inline-block; padding: 1px 9px; margin-right: 8px; border-radius: 999px; border: 1px solid currentColor; font-size: .78rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.badge.installed { color: var(--good); }
.badge.approved { color: var(--info); }
.badge.cancelled { color: var(--bad); }
.badge.never { color: var(--warn); }

.pager { display: flex; gap: 16px; align-items: center; margin: 16px 0 0; }
.crumb { margin: 0 0 6px; font-size: .88rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 8px 20px; margin: 0; }
.fields dt { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
details[open] summary { margin-bottom: 14px; }
.activity { margin: 0; padding-left: 1.2em; font: .86rem/1.6 var(--font-mono); overflow-wrap: anywhere; }
@media (max-width: 640px) { .bar { padding: 10px 14px; gap: 10px; } .card { padding: 18px 16px; } h1 { font-size: 1.4rem; } }
/* Viewing the portal as someone else. Pink, where every ordinary action is yellow, so it cannot be missed. */
.ghost { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 5px 16px; background: var(--ghost); color: var(--ghost-ink); border-bottom: 1px solid var(--ghost-edge); font-weight: 600; }
.ghost .short { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ghost button { padding: 3px 12px; margin-left: 6px; white-space: nowrap; line-height: 1.3; font-size: .93rem; }
.ghost [hidden] { display: none; }
.icon { flex: none; vertical-align: -3px; }
.ghost .icon { width: 18px; height: 18px; }
button.viewas { display: inline-flex; align-items: center; gap: 6px; }
.notice.ghostly { background: var(--ghost); color: var(--ghost-ink); border-color: var(--ghost-edge); }
button.viewas .icon { color: var(--ghost-pink); }
td.viewas-cell { width: 1%; white-space: nowrap; }
/* A row that opens its record from a click anywhere on it (ui.ts). */
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--panel); }
.usermenu .pop button.viewas { display: flex; }
a.button { display: inline-block; font-weight: 600; padding: 8px 15px; border-radius: 6px; border: 1px solid var(--line); text-decoration: none; }
a.button.primary { background: var(--hl); border-color: var(--hl-edge); color: var(--hl-ink); }
form.inline { display: inline; margin: 0; }
form.inline button { padding: 3px 10px; font-size: .86rem; font-weight: 500; }
.card.form { max-width: 34rem; }
.card.form select, .card.form input[type="text"], .card.form input[type="email"], .card.form input[type="password"] { display: block; width: 100%; margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 400; color: var(--ink); }
label.check input { display: inline; width: auto; margin: 0; }
p.hl { display: inline-block; }
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; width: 100%; resize: vertical; }
textarea:focus { border-color: var(--ink); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 4px 20px; }
.formgrid label input, .formgrid label select, .formgrid label textarea { display: block; width: 100%; margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.formgrid label.wide { grid-column: 1 / -1; }
input[readonly] { background: var(--panel); color: var(--muted); }
.actions { display: flex; align-items: center; gap: 18px; position: sticky; bottom: 0; }
.headline { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.headline h1 { margin: 0; }
.noteform { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 18px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline > li { border-left: 3px solid var(--line); padding: 2px 0 2px 14px; }
.timeline > li.note { border-left-color: var(--hl-edge); }
.timeline .meta { margin: 0 0 2px; font-size: .8rem; color: var(--muted); }
.timeline .body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline .changes { margin: 0; padding-left: 1.1em; overflow-wrap: anywhere; }
.notice { margin: 0; padding: 10px 16px; background: var(--hl); color: var(--hl-ink); border: 1px solid var(--hl-edge); border-radius: 8px; font-weight: 600; }
.notice[hidden] { display: none; }
.upload { margin: 16px 0 0; align-items: center; }
.upload input[type="file"] { flex: 1 1 14rem; min-width: 0; max-width: 100%; padding: 6px; }
.qr { width: 220px; max-width: 100%; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.codes { columns: 2; max-width: 22rem; padding-left: 1.2em; }
.card.narrow form.inline { display: block; margin-top: 12px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.plain { position: static; margin-top: 8px; }
.quick { display: flex; gap: 8px 24px; flex-wrap: wrap; }
.quick .search { margin: 0; max-width: 100%; }
/* A select with long choices shrinks to its row rather than widening the page (QA, #qa-10). */
.search select { max-width: 100%; min-width: 0; }
.visitform { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 8px; align-items: center; margin-bottom: 18px; }
.visitform textarea { grid-column: 1 / -1; }
.visitform button { justify-self: start; }
.notice ul { margin: 6px 0; padding-left: 1.2em; font-weight: 400; }
.notice p { margin: 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.lane { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.lane h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 4px 10px; font-size: .95rem; }
.lane .count { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.cards { list-style: none; margin: 0; padding: 0; min-height: 3rem; display: flex; flex-direction: column; gap: 8px; }
.cardlet { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; font-size: .88rem; cursor: grab; box-shadow: 0 1px 2px rgba(14, 26, 43, .05); }
.cardlet a { font-weight: 600; font-size: .93rem; line-height: 1.3; }
.cardlet span { color: var(--ink-2); overflow-wrap: anywhere; }
.cardlet .owner { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.cardlet .sub { color: var(--ink-2); font-size: .84rem; }
.sortable-ghost { opacity: .45; }
.lane .more { margin: 10px 4px 2px; font-size: .85rem; }
.badge.lead-signed { color: var(--good); }
.badge.lead-appointment_set, .badge.lead-contacted { color: var(--info); }
.badge.lead-not_qualified { color: var(--bad); }
.badge.lead-assigned, .badge.lead-attempted { color: var(--warn); }
main:has(.board) { max-width: none; }
.fields .wide { grid-column: 1 / -1; }
/* Tabs wider than the screen scroll inside themselves, never the page (QA, #qa-10). */
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 7px; overflow-x: auto; scrollbar-width: none; background: var(--surface); }
.seg a { padding: 7px 14px; font-weight: 600; font-size: .93rem; color: var(--ink-2); border-radius: 0; white-space: nowrap; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--hl); color: var(--hl-ink); }
/* The pages of Leads. How many submissions wait is a plain count, as on a lane, not a highlight. */
.lead-tabs a { white-space: nowrap; }
.lead-tabs .count { display: inline-block; margin-left: 6px; font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.lead-tabs a.on .count { color: var(--hl-ink); }
/* On a phone the four tabs are wider than the screen: they slide within themselves, the page does not. */
@media (max-width: 720px) {
  .toolbar .buttons:has(.lead-tabs), .toolbar .buttons:has(.seg) { min-width: 0; max-width: 100%; }
  .lead-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .lead-tabs a { padding: 7px 11px; }
}
.chip { display: inline-block; padding: 0 6px; margin-left: 6px; border-radius: 4px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px; }
.unowned { color: var(--muted); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar h1 { margin: 0; }
.toolbar .hint { color: var(--muted); font-size: .86rem; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; color: var(--ink-2); font-size: .93rem; margin: 0 0 14px; }
.facts .badge { margin: 0; }
.timeline-forms { margin-bottom: 14px; }
.twoforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 16px 28px; align-items: start; }
.twoforms strong { display: block; margin-bottom: 8px; font-family: var(--font-display); }
.twoforms .visitform { margin: 0; grid-template-columns: 1fr 1fr; }
.twoforms .visitform strong, .twoforms .visitform textarea, .twoforms .visitform .check { grid-column: 1 / -1; margin-bottom: 0; }
.twoforms .noteform { margin: 0; }
/* On a phone the visit form keeps to the screen: a column shrinks to its share whatever its choices say, where a
   grid column would grow to fit a select's longest choice (QA, #qa-18). */
.twoforms { grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); }
.twoforms > * { min-width: 0; }
.twoforms .visitform { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.visitform > * { min-width: 0; }
.visitform select { width: 100%; max-width: 100%; }
.visitform input { max-width: 100%; }
.timeline .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.timeline .kind { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); }
.timeline .kind.visit { background: var(--hl); border-color: var(--hl-edge); color: var(--hl-ink); }
.timeline .kind.origin { color: var(--info); border-color: currentColor; }
.timeline .kind.call { color: var(--warn); border-color: currentColor; }
.timeline .title { margin: 2px 0 2px; font-weight: 600; }
.timeline > li.visit { border-left-color: var(--hl-edge); }
.timeline > li.note { border-left-color: var(--ink-2); }
.timeline > li.origin { border-left-color: var(--info); }
.timeline .files { margin: 4px 0 0; padding-left: 1.1em; font-size: .88rem; }
.timeline .files a { text-decoration: underline; text-decoration-color: var(--hl-edge); }
.timeline .kind.appointment, .timeline .kind.sale { color: var(--good); border-color: currentColor; }
.timeline > li.appointment, .timeline > li.sale { border-left-color: var(--good); }
.badge.stage-approved, .badge.stage-installed, .badge.stage-completed { color: var(--good); }
.badge.stage-declined, .badge.stage-cancelled { color: var(--bad); }
.badge.stage-con_approved, .badge.stage-pending, .badge.stage-pending_review, .badge.stage-install_hold { color: var(--warn); }
.badge.stage-in_underwriting, .badge.stage-rewrite, .badge.stage-square_deal, .badge.stage-pending_install, .badge.stage-pending_courtesy_call { color: var(--info); }
input.short { flex: 0 0 5rem; width: 5rem; }

/* A board fills the window: the lanes scroll down inside themselves, so the sideways scrollbar
   is always at the bottom of the window, and the row of lane names above jumps to any lane. */
body:has(.board) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body:has(.board) main { flex: 1; min-height: 0; max-width: none; width: 100%; padding-bottom: 8px; display: flex; flex-direction: column; }
body:has(.board) main > .stack { flex: 1; min-height: 0; }
.board-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.lane-index { display: flex; gap: 6px; flex-wrap: wrap; }
.lane-index button { padding: 4px 11px; font-size: .84rem; font-weight: 600; border-radius: 999px; background: var(--surface); }
.lane-index .count { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-left: 4px; }
.board { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: auto; }
.lane { display: flex; flex-direction: column; min-height: 0; scroll-snap-align: start; }
.lane .cards { flex: 1; min-height: 3rem; overflow-y: auto; padding-right: 2px; }
/* On a board the toolbar sits tight above the lanes. Everywhere else it keeps its space. */
body:has(.board) .toolbar { margin-bottom: 0; }

dialog#modal { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(38rem, calc(100vw - 24px)); max-height: calc(100dvh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(14, 26, 43, .28); }
dialog#modal::backdrop { background: rgba(14, 26, 43, .45); }
.modal-body { padding: 22px 24px; overflow-y: auto; max-height: calc(100dvh - 34px); }
.modal-body > .stack > .card, .modal-body .card { border: 0; box-shadow: none; padding: 0; max-width: none; background: none; }
.modal-body .crumb { display: none; }
.modal-body h1 { font-size: 1.35rem; }
.modal-body.ask h2 { margin: 0 0 12px; }
.modal-body.ask label textarea { display: block; width: 100%; margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(26rem, calc(100vw - 32px)); }
/* Banners stay until closed, so several can be up at once: the stack scrolls rather than covering the page. */
#toasts:has(.banner) { max-height: min(50vh, 24rem); overflow-y: auto; padding: 4px; margin: -4px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 8px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: .93rem; }
.toast.error { background: var(--bad); color: #fff; }
.toast span { flex: 1; }
.toast a { color: inherit; text-decoration: underline; font-weight: 600; background: none; }
.toast button { background: none; border: 0; color: inherit; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
/* Taking a website's submission on (intake.tsx): who has it, white on red, then the ways on, one row each. */
.intake-step { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.intake-step:last-child { margin-bottom: 0; }
.intake-step p { margin: 0; }
.intake-step form.inline button, .intake-step a.button, .intake-reject button { padding: 8px 15px; font-size: .95rem; font-weight: 600; }
.intake-reject { padding-top: 16px; border-top: 1px solid var(--line); }
.intake-reject input { flex: 1 1 14rem; max-width: 26rem; }
.taken-by { display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--taken); color: var(--taken-ink); font-weight: 700; }
td .taken-by { padding: 2px 8px; border-radius: 4px; font-size: .9rem; }
/* A website's submission: stays until closed, marked with the portal's yellow (intake.ts, ui.ts). */
.toast.banner { border-left: 5px solid var(--hl); }
.toast.banner[hidden] { display: none; }
/* A reminder that is due (reminders.ts): its words on a line of their own, then what can be done with it. */
.toast.reminder { flex-wrap: wrap; row-gap: 6px; }
.toast.reminder span { flex-basis: 100%; }
.toast button.act { font-size: .86rem; font-weight: 600; padding: 3px 10px; border: 1px solid currentColor; border-radius: 999px; }
.banner-more { align-self: flex-end; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--hl-edge); background: var(--hl); color: var(--hl-ink); font-weight: 600; font-size: .86rem; box-shadow: var(--shadow); }
/* Something on the page just changed elsewhere and was put in place: three pulses of yellow. */
/* Between pulses each part keeps its own colours; a banner, dark already, is ringed instead of filled. */
@keyframes just-changed { 50% { background-color: var(--hl); box-shadow: 0 0 0 4px var(--hl); } }
@keyframes just-changed-ring { 50% { box-shadow: 0 0 0 4px var(--hl), var(--shadow); } }
.just-changed, tr.just-changed > td { animation: just-changed .7s ease-in-out 3; }
.toast.just-changed { animation-name: just-changed-ring; }
@media (prefers-reduced-motion: reduce) { .just-changed, tr.just-changed > td { animation-duration: 1.2s; animation-iteration-count: 1; } }
.lane-index button.on { background: var(--hl); color: var(--hl-ink); border-color: var(--hl); }
/* Save and Cancel stay in reach at the foot of a modal, however long the form above them is. */
.modal-body:has(.actions) { padding-bottom: 0; }
#modal .actions, #modal .actions.plain { position: sticky; bottom: 0; margin: 6px 0 0; padding: 14px 0 20px; background: var(--surface); border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
#modal .ask .actions { border-top: 0; margin: 0; padding-top: 4px; }

/* A form laid out on six columns, so short things like a state and a zip share a row. */
.grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 14px; }
.grid6 > label { grid-column: span 3; }
.grid6 > .src, .grid6 > .s2 { grid-column: span 2; }
.grid6 > .s1 { grid-column: span 1; }
.grid6 > .s4 { grid-column: span 4; }
.grid6 > .s6 { grid-column: 1 / -1; }
.grid6 label select, .grid6 label input, .grid6 label textarea { display: block; width: 100%; margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
/* A tick box or a choice in the grid keeps its own size, beside its words. */
.grid6 label.check input { display: inline; width: auto; margin: 0; }
@media (max-width: 520px) { .grid6 > label { grid-column: 1 / -1; } .grid6 > .s1 { grid-column: span 2; } .grid6 > .s2 { grid-column: span 4; } }
.board { scrollbar-color: var(--muted) transparent; }
/* A phone, or a very short window: the lane names run in one row, and a short window scrolls as a page again. */
/* The header at three sizes. The widths come from measuring the longest menu (a superadmin's twelve
   items, measured again on 21 October for Apps) beside the longest name the name button allows: if
   the menu grows, measure again. A browser test holds the menu to one row at every size. */
/* A laptop: the full logo leaves too little room for the menu, so the compact one, with everything a little closer. */
@media (max-width: 1419px) {
  .bar { gap: 14px; }
  .searchlink + .usermenu { margin-left: -6px; }
  .menu { gap: 3px; }
  .menu a { padding: 5px 6px; }
}
/* A long menu (more than eleven items: an admin's or a superadmin's since Jericho's round 3) is wider than the room
   beside the logo below 1680 px, so there it takes the row of its own a tablet gives every menu, on one line. */
@media (max-width: 1679px) {
  .menu.long { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .menu.long a { white-space: nowrap; }
}
/* A tablet or a phone: the logo and the person's name share the top row, and the menu has a row
   of its own that slides sideways if it has to, so it never breaks into a ragged block. */
@media (max-width: 1219px) {
  .bar { gap: 6px 12px; padding: 8px 16px; }
  .searchlink + .usermenu { margin-left: -4px; }
  .menu { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .menu a { padding: 5px 11px; white-space: nowrap; }
}
@media (max-width: 720px) {
  .bar { padding: 8px 12px; }
  .usermenu summary { padding: 5px 10px; max-width: 11rem; }
  body:has(.board) main { padding-top: 12px; }
  .toolbar .hint { display: none; }
}
@media (max-width: 720px) { .lane-index { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .lane-index button { white-space: nowrap; } .board { grid-auto-columns: minmax(82vw, 1fr); } }
@media (max-height: 520px) { body:has(.board) { height: auto; overflow: visible; } .board { min-height: 24rem; } }

/* Tickets */
.badge.ticket-new { color: var(--info); }
.badge.ticket-open { color: var(--good); }
.badge.ticket-on_hold { color: var(--warn); }
.badge.ticket-escalated { color: var(--bad); }
.badge.priority-high { color: var(--bad); }
.badge.priority-medium { color: var(--warn); }
.cardlet.tone-high { border-left: 4px solid var(--bad); }
.cardlet.tone-medium { border-left: 4px solid var(--warn); }
.cardlet.tone-low { border-left: 4px solid var(--line); }
.described { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px; }
.grid6 > .s2 select, .grid6 > .s3 select { min-width: 0; }

/* The knowledge base */
.badge.kb-article { color: var(--info); }
.badge.kb-sop { color: var(--good); }
.badge.kb-guide { color: var(--warn); }
.kb-filter { margin: 0; flex-wrap: wrap; }
.kb-filter a { white-space: nowrap; text-decoration: none; }
.headline form.inline button { padding: 8px 15px; font-weight: 600; }
.kb-hits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kb-hit { padding: 12px 0; border-bottom: 1px solid var(--line); }
.kb-hit:last-child { border-bottom: 0; padding-bottom: 0; }
.kb-hit-head { margin: 0 0 4px; }
.kb-hit-head a { font-weight: 600; font-size: 1.05rem; }
.kb-snippet { margin: 0 0 4px; color: var(--ink-2); overflow-wrap: anywhere; }
.kb-meta { font-size: .84rem; margin: 0; }
.kb-says { margin: 0; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .84rem; text-decoration: none; color: var(--ink-2); }
.kb-toc { margin: 0; padding-left: 2.2em; display: flex; flex-direction: column; gap: 4px; }
.kb-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.kb-links > li > a { font-weight: 600; }
.kb-add, .kb-edit { margin-top: 8px; }
.kb-add summary, .kb-edit summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); width: fit-content; }
.kb-linkform { margin-top: 12px; }
textarea.mono { font-family: var(--font-mono); font-size: .9rem; line-height: 1.5; }
/* An article's body, written in Markdown. */
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; margin: 1.5em 0 .5em; }
.prose h3 { font-size: 1.05rem; margin: 1.3em 0 .4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 .9em; }
.prose li { margin: .25em 0; }
.prose a { text-decoration: underline; text-decoration-color: var(--hl-edge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.prose pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }
.prose blockquote { margin: 0 0 .9em; padding: 4px 14px; border-left: 4px solid var(--hl-edge); color: var(--ink-2); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 .9em; }
.prose th, .prose td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }

/* The picture viewer: a picture opens over the page, without leaving the portal. */
dialog#viewer { border: 0; padding: 0; background: none; width: 100vw; height: 100dvh; max-width: none; max-height: none; color: #fff; }
dialog#viewer::backdrop { background: rgba(8, 13, 22, .88); }
dialog#viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-count { color: rgba(255, 255, 255, .7); font-size: .9rem; white-space: nowrap; }
.viewer-bar a.viewer-full { background: var(--hl); color: var(--hl-ink); border-color: var(--hl-edge); padding: 5px 12px; white-space: nowrap; }
.viewer-close { background: none; border: 0; color: #fff; font-size: 1.9rem; line-height: 1; padding: 0 6px; cursor: pointer; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px 14px; }
.viewer-stage img { max-width: 100%; max-height: 100%; min-width: 0; object-fit: contain; border-radius: 4px; background: #fff; }
.viewer-step { flex: none; width: 44px; height: 64px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.viewer-step:hover { background: rgba(255, 255, 255, .28); }
.viewer-step[hidden] { display: block; visibility: hidden; }
/* On a phone the picture takes the full width and the arrows sit over its edges. A swipe steps too. */
@media (max-width: 720px) {
  .viewer-bar { gap: 8px; padding: 8px 10px; }
  .viewer-stage { position: relative; padding: 0 6px 10px; }
  .viewer-step { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 56px; background: rgba(8, 13, 22, .5); }
  .viewer-step[data-step="-1"] { left: 8px; }
  .viewer-step[data-step="1"] { right: 8px; }
}

/* The AI server page */
.badge.ai-ready, .badge.ai-done, .badge.verdict-clean { color: var(--good); }
.badge.ai-failed, .badge.verdict-hostile { color: var(--bad); }
.badge.ai-starting, .badge.ai-queued, .badge.ai-running, .badge.ai-cancelled, .badge.verdict-suspicious { color: var(--warn); }
pre.mono { margin: 0; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: .88rem; }

/* The knowledge base's box: search, or ask the AI */
.kb-search { margin: 0 0 14px; }
.kb-search button.ask { background: var(--surface); border-color: var(--hl-edge); white-space: nowrap; }
.kb-search button.ask:hover { background: var(--hl); color: var(--hl-ink); }
.card > .search + .kb-search { margin-top: 10px; margin-bottom: 0; }
.kb-cited { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }

/* Pictures and videos on a knowledge base page */
/* Above a search's results: what was searched for, and the way to ask the AI instead. */
.card.asked { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.card.asked p { margin: 0; overflow-wrap: anywhere; }
.card.asked .buttons { align-items: center; }
.card.asked form.inline button { padding: 8px 15px; font-size: inherit; font-weight: 600; }
/* A record's number, beside the way back from its page. */
.ref { margin-left: 8px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); font: 500 .8rem var(--font-mono); color: var(--ink-2); user-select: all; }
/* What a search found, a few of each kind. */
.card.found .toolbar { margin-bottom: 8px; }
.card.found h2 { margin: 0; }
.card.found > h2 { margin-bottom: 8px; }
.found-list { list-style: none; margin: 0; padding: 0; }
.found-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.found-list li:first-child { border-top: 0; }
.found-list li a { font-weight: 600; }
.found-list li span { font-size: .9rem; }
.one-search { margin: 0; }
.one-search button.ask { background: var(--surface); border-color: var(--hl-edge); white-space: nowrap; }
.one-search button.ask:hover { background: var(--hl); color: var(--hl-ink); }

/* A button that opens a short list of things to do. */
.dropdown { position: relative; }
.dropdown summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-weight: 600; font-size: .93rem; cursor: pointer; }
.dropdown[open] summary { margin-bottom: 0; }
.toolbar .buttons { align-items: center; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: ""; flex: none; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.dropdown summary:hover { border-color: var(--ink); }
.dropdown[open] summary { background: var(--panel); }
.dropdown[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.dropdown .pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 13.5rem; max-width: calc(100vw - 24px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(14, 26, 43, .18); }
.dropdown .pop a { display: block; padding: 8px 10px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.dropdown .pop a:hover { background: var(--panel); color: var(--ink); }

/* A conversation with the AI, as a chat: no cards, the person's words on the right and the AI's on the left. */
.chat-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px 12px; }
.chat-top h1 { grid-column: 2; margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 1.45rem; }
.chat-top h1 small { font: 600 .72rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chat-top a.button { background: var(--surface); text-decoration: underline; text-decoration-color: var(--hl-edge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.chat-top a.button:hover { background: var(--hl); }
#chat-back { grid-column: 1; justify-self: start; }
#chat-new { grid-column: 3; justify-self: end; }
@media (max-width: 720px) {
  .chat-top { grid-template-columns: auto auto; justify-content: space-between; }
  .chat-top h1 { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .chat-top a.button { padding: 7px 10px; font-size: .88rem; white-space: nowrap; }
  #chat-new { grid-column: 2; }
}
.chat-empty { max-width: 46rem; margin: 4px 0 0; color: var(--ink-2); }
.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat .said { display: flex; flex-direction: column; max-width: min(54rem, 90%); scroll-margin-top: 14px; }
.chat .said.me { align-self: flex-end; align-items: flex-end; margin-top: 16px; }
.chat .said.me:first-child { margin-top: 0; }
.chat .said.ai { align-self: flex-start; align-items: flex-start; }
.chat .who { display: flex; align-items: center; gap: 7px; margin: 0 6px 3px; font-size: .78rem; color: var(--muted); }
.chat .who .badge { margin: 0; }
.chat .bubble { padding: 11px 16px; border: 1px solid var(--line); border-radius: 16px; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(14, 26, 43, .06); }
.chat .me .bubble { background: var(--hl); border-color: var(--hl-edge); color: var(--hl-ink); border-bottom-right-radius: 5px; }
.chat .me .bubble p { margin: 0; white-space: pre-wrap; font-weight: 500; }
.chat .ai .bubble { background: var(--surface); border-color: var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow); }
.chat .ai .bubble .prose > :first-child { margin-top: 0; }
.chat .ai .bubble .prose > :last-child { margin-bottom: 0; }
.chat .ai .bubble .error { margin: 0; }
.chat-cited { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .86rem; color: var(--ink-2); }
.chat-ask { margin: 4px 0 0; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.chat-ask input[type="text"] { flex: 1 1 14rem; }
.chat-page .kb-meta { margin: -8px 6px 0; }
#kb-sources h2 { margin-top: 0; }
#kb-sources summary { cursor: pointer; font-weight: 600; margin: 4px 0 8px; }
#kb-sources div + details { margin-top: 6px; }
/* The AI is at work: three dots that rise in turn. */
.thinking { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-2); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--info); animation: thinking 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes thinking { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .dots i { animation-name: thinking-still; }
  @keyframes thinking-still { 0%, 60%, 100% { opacity: .35; } 30% { opacity: 1; } }
}

/* How full a skill's context window is. */
.gauge { display: block; width: 9.5rem; max-width: 100%; height: 7px; margin: 5px 0 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); overflow: hidden; }
.gauge i { display: block; height: 100%; min-width: 2px; background: var(--info); }
.gauge.high i { background: var(--warn); }
.gauge.full i { background: var(--bad); }
.tile small { color: var(--muted); font-size: .78rem; line-height: 1.35; margin-top: 3px; }
.tiles.wide { grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); }

.turns { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.turns li { max-width: 46rem; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.turns li.staff { align-self: flex-end; background: var(--hl); border-color: var(--hl-edge); color: var(--hl-ink); }
.turns .who { display: block; font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .7; margin-bottom: 2px; }
.turns p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.kb-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 14px; margin: 0 0 14px; }
.kb-gallery:empty { display: none; }
.kb-gallery figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kb-gallery a { display: block; padding: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.kb-gallery img, .kb-gallery video { display: block; width: 100%; height: 9.5rem; object-fit: cover; background: var(--panel); border-radius: 8px; }
.kb-gallery video { object-fit: contain; border: 1px solid var(--line); }
.kb-gallery .yt iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #0e1a2b; }
@media (min-width: 721px) { .kb-gallery .yt { grid-column: span 2; } }
.kb-attach { display: flex; flex-direction: column; gap: 8px; }
.kb-attach .search { margin: 0; }
.kb-attach input[type="file"] { flex: 1 1 12rem; min-width: 0; }
#add-video input[type="url"] { flex: 2 1 16rem; min-width: 0; }
#add-video input[type="text"] { flex: 1 1 11rem; }

.kb-gallery figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-2); overflow-wrap: anywhere; }
button.small { padding: 2px 9px; font-size: .8rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }


/* Business cards: the photo, and each card read off it as a draft to check and save. */
.photo-pick { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.photo-pick input[type="file"] { padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel); font-weight: 400; max-width: 100%; }
.card-thumb { display: block; flex: none; width: 96px; height: 60px; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card-list li { display: flex; gap: 12px; align-items: center; }
.card-list li > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.card-reading { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; align-items: start; margin: 0 0 14px; }
.card-photo { display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.card-photo img { display: block; width: 100%; height: auto; }
.read-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.read-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.read-lines { list-style: none; margin: 0; padding: 0; color: var(--ink-2); font-size: .93rem; overflow-wrap: anywhere; }
.read-card .saved { margin: 0; font-weight: 600; }
#lead-card { display: flex; gap: 12px; align-items: center; margin: 14px 0 0; }
@media (max-width: 720px) { .card-reading { grid-template-columns: 1fr; } }

/* What a board does by itself: the gear on each board, and the list it opens. */
.iconlink { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.iconlink:hover { background: var(--hl); color: var(--hl-ink); border-color: var(--hl-edge); }
.rules { margin: 0 0 14px; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.lane-rules { margin: 0 0 14px; display: flex; flex-direction: column; gap: 12px; }
.lane-rules > div { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: 4px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#rules h2 { font-size: 1.25rem; margin: 22px 0 10px; }
.lane-rules dt { font-weight: 600; font-size: .95rem; }
.lane-rules dd { margin: 0; }
.lane-rules dd .rules { margin: 0; }
@media (max-width: 640px) { .lane-rules > div { grid-template-columns: 1fr; } }

/* Rep activity: each rep's week, a square a day against the daily target. */
.target { margin: 0 0 4px; font-size: 1.05rem; }
.rep-week th.group { text-align: center; border-bottom: 1px solid var(--line); }
.rep-week .day { text-align: center; min-width: 2.6rem; font-variant-numeric: tabular-nums; }
.rep-week th.day.today { background: var(--hl); color: var(--hl-ink); }
.rep-week td.day.today { box-shadow: inset 0 0 0 2px var(--hl-edge); }
.rep-week td.day.going { background: var(--day-going); color: var(--day-ink); font-weight: 700; }
.rep-week td.day.met { background: var(--day-met); color: var(--day-ink); font-weight: 700; }
.rep-week td.day.short { background: var(--day-short); color: var(--day-ink); font-weight: 700; }
/* A card whose text did not come through its checks. */
.read-card.is-held { border-color: var(--bad); }
.held { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border-radius: 6px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--surface)); }
.held.unchecked { background: var(--panel); border-color: var(--line); }
.held strong { color: var(--bad); }
.held p, .held ul { margin: 0; }
.held ul { padding-left: 1.2em; font-size: .9rem; overflow-wrap: anywhere; }
.from-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
/* On a phone the source and where-you-met each take a row of their own, so neither is cut short. */
@media (max-width: 520px) { .grid6 > .src, .grid6 > .s4 { grid-column: 1 / -1; } }
/* The field a form's problem is in: outlined in red, with the problem said under it. */
label.invalid > span, label.invalid { color: var(--bad); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.field-error { display: block; margin-top: 4px; color: var(--bad); font-weight: 600; font-size: .85rem; letter-spacing: 0; text-transform: none; }
label.invalid input, label.invalid select, label.invalid textarea { color: var(--ink); }
/* The day's AI spending: a gauge, and the card turns red once the limit is reached. */
.tile meter { width: 100%; height: 8px; }
.tile.stopped { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.tile.stopped strong, .tile.stopped small { color: var(--bad); }
/* What a skill did, step by step: on a task's page, and live while it works. */
.ai-steps { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
.ai-steps li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; overflow-wrap: anywhere; }
.ai-steps li > span:not(.muted):not(.error) { flex-basis: 100%; }
.ai-steps li.failed strong { color: var(--bad); }
.ai-steps details { flex-basis: 100%; }
.nowrap { white-space: nowrap; }
.ai-step-text { white-space: pre-wrap; max-height: 20rem; overflow: auto; margin: 6px 0 0; padding: 8px 10px; background: var(--panel); border-radius: 6px; font-size: .82rem; }
/* Your notifications: every notice the portal has shown, kept. */
.notifications { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.notifications li { display: grid; grid-template-columns: 11rem 1fr auto; gap: 4px 14px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.notifications li.is-error > span:nth-child(2) { color: var(--bad); }
.notifications a { font-weight: 600; text-decoration: underline; text-decoration-color: var(--hl-edge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (max-width: 640px) { .notifications li { grid-template-columns: 1fr auto; } .notifications li .when { grid-column: 1 / -1; } }
/* Ronnie down: a red banner across the top of the System panel. */
.banner-down { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 12px 18px; border-radius: 10px; background: var(--bad); color: #fff; }
.banner-down a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.banner-down a:hover { background: transparent; color: #fff; }
/* The job queue: each job's status at a glance. */
#job-grid .job-note { display: block; max-width: 40rem; overflow-wrap: anywhere; }
.badge.job-waiting { background: var(--day-going); color: var(--day-ink); }
.badge.job-queued, .badge.job-running { background: var(--hl); color: var(--hl-ink); }
.badge.job-done { background: var(--day-met); color: var(--day-ink); }
.badge.job-failed { background: var(--day-short); color: var(--day-ink); }
html { scroll-behavior: smooth; }

/* Ronnie as an assistant: a person's sign-ins, and the superadmin's switches for them. */
.state.ok { color: var(--good); font-weight: 600; }
#connection-microsoft .actions form.inline button, #connection-ringcentral .actions form.inline button { padding: 7px 14px; font-size: .95rem; }
#assistant form.stack-tight { display: grid; gap: 6px; margin: 10px 0; }

/* Log a visit: the photos fold away until wanted. */
.visit-photos { margin: 4px 0; }
.visit-photos summary { cursor: pointer; font-weight: 600; }
.visit-photos label { display: grid; gap: 3px; margin-top: 8px; font-size: .9rem; }
.visitform select[name="set_by"], .visitform .visit-photos { grid-column: 1 / -1; }

/* Submit a sale: Wufoo's questions as rows of choices, and the deal's note of what was submitted. */
fieldset.choices { border: 0; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.choices legend { font-weight: 600; padding: 0; margin-bottom: 6px; width: 100%; }
.prewrap { white-space: pre-wrap; }
.headline .buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* What Ronnie found in a person's mail. */
ul.findings { list-style: none; padding: 0; margin: 12px 0 0; }
ul.findings > li { border-top: 1px solid var(--line); padding: 10px 0; }
ul.findings p { margin: 3px 0; }
.finding-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
#daily-look label { display: inline; font-weight: 500; }

/* Forms, off Home: a simple file explorer, a folder or a file on each row (pages/form-files.tsx). */
table.explorer .file-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
table.explorer .file-name .icon { flex: none; color: var(--muted); }
table.explorer td:nth-child(2) { color: var(--ink-2); }

/* Home: Forms and the e-sign links side by side, one above the other on a phone. */
.home-pair { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.home-pair > .card:only-child { grid-column: 1 / -1; }
@media (max-width: 760px) { .home-pair { grid-template-columns: 1fr; } }
.link-list { list-style: none; margin: 0; padding: 0; columns: 2 13rem; column-gap: 24px; }
.link-list li { break-inside: avoid; padding: 5px 0; }
/* The links read as links, as in running text: regular weight, underlined in yellow, under the card's heading. */
.link-list .file-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 400; }
.link-list .file-name span { text-decoration: underline; text-decoration-color: var(--hl-edge); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.link-list .file-name .icon { flex: none; color: var(--muted); }

/* The merchant application (pages/application*.tsx): sections as rows, and one status colour each. */
.section-list { list-style: none; margin: 0; padding: 0; }
.section-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.section-list li:last-child { border-bottom: 0; }
.section-list .section-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.section-list .section-state { flex: none; }
.section-list .done { color: var(--good); font-weight: 600; }
.section-list .tofill { color: var(--warn); font-weight: 600; }
.badge.app-sent, .badge.app-signed, .badge.app-submitted { color: var(--good); }
.badge.app-declined { color: var(--bad); }
.badge.app-cancelled { color: var(--muted); }
/* A line under a field that explains it (a hint), and the clear-it box on a sealed field. */
.formgrid .hint { display: block; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.formgrid .sealed-clear { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: .9rem; color: var(--ink-2); }
.formgrid .sealed-clear input { display: inline; width: auto; margin: 0; }
/* A field asked only after another's answer stays out of sight until then (the form's labels are blocks, which [hidden] alone does not beat). */
.formgrid label[hidden] { display: none; }

/* The merchant application's "still needed" notice is pink (not the yellow notice), the Sections
   heading is bigger than an h2, and a breadcrumb with two levels is separated by a ">". */
.notice.incomplete { background: var(--ghost); color: var(--ghost-ink); border-color: var(--ghost-edge); }
.section-heading { font-size: 1.4rem; }
.crumb .sep { margin: 0 6px; color: var(--muted); }

/* The reports (pages/reports.tsx): headline numbers as tiles, one series as bars in the ink colour, each
   labelled with its count, and tables of counts. Net growth or loss may be green or red, with its words. */
.report-period { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.report-period .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.report-period .seg a { white-space: nowrap; }
.report-tiles { margin: 0 0 12px; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.report-tiles .tile strong { font-size: 2rem; }
.tile.good strong { color: var(--good); }
.tile.bad strong { color: var(--bad); }
.report-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
.report-pair h2 { margin-top: 0; }
@media (max-width: 760px) { .report-pair { grid-template-columns: 1fr; } }
.bars { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 11rem) 1fr 3rem; align-items: center; gap: 10px; padding: 3px 0; }
.bar-row:hover { background: var(--panel); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-track { display: block; height: 12px; }
.bar-fill { display: block; height: 100%; min-width: 2px; background: var(--ink-2); border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.matrix th[scope="row"] { font-size: inherit; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); white-space: nowrap; text-align: left; }
table.matrix td.zero { color: var(--muted); }
table.matrix td.total, table.matrix tfoot td, table.matrix tfoot th { font-weight: 700; }
table.matrix tfoot tr { border-top: 2px solid var(--line); }

/* Pricing (APP-7): the offer code's rates as a table of cards and charges, and its state at a glance. */
.badge.pricing-set, .badge.pricing-approved { color: var(--good); }
.badge.pricing-waiting { color: var(--warn); }
.badge.pricing-declined { color: var(--bad); }
table.rate-grid th[scope=row] { text-align: left; font-weight: 600; white-space: nowrap; }
table.rate-grid input { width: 7.5em; margin: 0; }
table.rate-grid, table.pricing-diff { width: auto; min-width: 50%; }
table.rate-grid .num, table.pricing-diff .num { text-align: right; padding-left: 28px; }
.formgrid label.check { display: flex; align-items: center; gap: 8px; }
.formgrid label.check input { display: inline-block; width: auto; margin: 0; }
table.pricing-diff tr.less td { color: var(--bad); font-weight: 600; }
table.pricing-diff .less-note { font-size: .82rem; }
#pricing .decide { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
#pricing .decide textarea { width: 100%; min-width: 16rem; }
.stack-tight { display: grid; gap: 10px; }
/* A wide table inside scrolls in its own box, rather than widening the page. */
.stack-tight > * { min-width: 0; }
.stack-tight > h3 { margin: 8px 0 0; }
#pricing .decide form.inline button { padding: 8px 15px; font-size: .95rem; font-weight: 600; }

/* Your reminders: each one's buttons sit on its own line, at the end. */
ol.notifications li .buttons { display: inline-flex; gap: 6px; margin-left: auto; }
/* Admin › Alerts: the people a rule tells, in columns. */
[id^="alert-"] fieldset.choices label { min-width: 13rem; }
[id^="alert-"] fieldset.choices .muted { font-size: .86rem; }

/* An install's proof: what is kept, and what is still missing. */
ul.checklist { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; }
ul.checklist li::before { display: inline-block; width: 1.4em; font-weight: 700; }
ul.checklist li.done::before { content: "✓"; color: var(--good); }
ul.checklist li.missing::before { content: "✗"; color: var(--bad); }
ul.checklist li.optional::before { content: "○"; color: var(--muted); }
#test-transaction p.ok { color: var(--good); font-weight: 600; }

/* The statement analysis: the figures as a table of boxes, and the estimate with its rough-estimate note. */
table.figures input { width: 100%; max-width: 11rem; margin: 0; text-align: right; }
table.figures td:first-child input { text-align: left; max-width: none; }
.estimate #savings strong { font-size: 1.6rem; }
.estimate-note { margin-top: 14px; font-size: .9rem; color: var(--muted); }
@media print {
  header, nav, #toasts, .noprint, .usermenu { display: none !important; }
  .card { box-shadow: none; border: 0; }
}

/* Where a rep was (ROAD-1): the note on the forms, and the report's table of where each visit was logged. */
.where-note { display: block; font-size: .8rem; margin-top: 6px; }
details.where { margin-top: 18px; }
details.where summary { cursor: pointer; font-weight: 600; }
.on-the-way h2 { text-transform: capitalize; }

/* Account tags (tags.ts): bright badges, in the colour an admin chose; what a tag means shows on hover. */
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; margin-right: 6px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .02em; line-height: 1.5; color: #fff; white-space: nowrap; }
.tag-red { background: #d92d20; }
.tag-orange { background: #e8590c; }
.tag-yellow { background: #f5c400; color: #1b1b1b; }
.tag-green { background: #15803d; }
.tag-blue { background: #1d64d8; }
.tag-purple { background: #7c3aed; }
.tag-grey { background: #5b6472; }

/* Every list's filters, sort headings and foot (lists.ts): one row that wraps, headings that sort, the spreadsheet link. */
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
form.filters input[type=search] { flex: 1 1 16rem; min-width: 12rem; }
form.filters .range { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.filters .range label { display: inline-flex; gap: 4px; align-items: center; font-size: .86rem; color: var(--muted); }
form.filters .clear { font-size: .86rem; }
th a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sort:hover { text-decoration: underline; }
.listfoot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.listfoot .pager { margin: 0; }

/* ---- Jericho's round 3 (5 November): tighter pages, folding cards, tabs and long lists a page at a time ---- */
/* Whatever a script hides stays hidden, whatever display its kind of element has. */
[hidden] { display: none !important; }
/* The MID, the account's most important identifier, bold right under its name. */
.mid-line { margin: -6px 0 8px; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
/* A card that is always there but folds away: its heading is the button. */
details.card.fold > summary { list-style: none; display: flex; align-items: baseline; gap: 12px; margin: 0; }
details.card.fold > summary::-webkit-details-marker { display: none; }
details.card.fold > summary h2 { margin: 0; }
details.card.fold > summary::after { content: ""; align-self: center; margin-left: auto; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); }
details.card.fold[open] > summary { margin-bottom: 12px; }
details.card.fold[open] > summary::after { transform: rotate(-135deg); }
/* Tabs over a page's panels: the tabs right-justified, in the same place on every record. */
.tabbed { display: flex; flex-direction: column; gap: 12px; }
.tabs-head { display: flex; justify-content: flex-end; }
/* "Show more", and the pages of a long list. */
div.pager { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 10px 0 0; }
div.pager button { padding: 5px 12px; font-size: .9rem; }
.paperwork-remove { margin: 0; }
.paperwork-remove button { padding: 3px 10px; font-size: .85rem; }
