/* DM Portal — the ONE stylesheet for the whole app.
 *
 * CSP is `style-src 'self'`: no inline style attributes anywhere, no style blocks, no web fonts, no images.
 * JavaScript shows and hides things with the `hidden` attribute, never element.style.
 *
 * The look follows HDR (the sibling form on the same server): calm, dense, high contrast, WCAG AA
 * (text >= 4.5:1, control borders >= 3:1), visible keyboard focus, usable at 360px wide. The top bar is
 * DM Portal's own deep blue, so the two apps are never mistaken for each other in a row of tabs.
 *
 * Vocabulary (shared by every page):
 *   Layout    .page .page-wide .card .narrow .row .inline .card-head .actions
 *   Type      h1 h2 h3 .eyebrow .muted .small .strong .mono .ref .ref-big .vh
 *   Messages  .notice (.notice-warn .notice-ok)  .error-box  .field-error  .hint
 *   Forms     .field [div.field > label + input|select|textarea + p.hint + p.field-error]
 *             .field-xs .field-md .field-wide .field-pc .field-date .field-area
 *             .btn .btn-primary .btn-danger .btn-sm .btn-quiet-danger .linkish
 *             .check [label.check > input[type=checkbox] + span]  .checks .checks-grid
 *   Data      .table (.num .nowrap .cell-sub)  .table-wrap  .facts  .tag (.tag-ok .tag-warn .tag-danger .tag-muted)
 *             .stag[data-status]  .otag[data-outcome]  .kpis/.kpi  .filters  .pager
 *   Chrome    .topbar .brand .nav .who .skip
 */

/* ---- tokens ---------------------------------------------------------------------------------- */
:root {
  --desk: #E8ECF0;          /* page background */
  --sheet: #FFFFFF;         /* surfaces */
  --sheet-2: #F7F9FB;       /* a quieter surface (save bar, action boxes) */
  --ink: #15202B;           /* body text: 16.5:1 on white */
  --ink-2: #3B4957;         /* secondary text: 9.2:1 */
  --muted: #5B6877;         /* quiet text: 5.7:1 on white, 4.8:1 on the desk */
  --rule: #D3DAE2;          /* hairlines (decorative) */
  --line-input: #7A8795;    /* control borders: 3.7:1, meets 1.4.11 */
  --hover: #F3F6F9;
  --wash: #EEF2F6;
  --focus: #1B5FD0;

  --bar: #173A5E;           /* the top bar: white 11.6:1, nav text 7.8:1 */
  --bar-text: #C9D5E1;
  --bar-quiet: #AFC0D0;

  --go: #0E6A48;  --go-dark: #0B5A3C;  --go-tint: #E3F3EA;  --go-line: #A9D8BF;
  --danger: #B3261E;  --danger-dark: #8F1E18;  --danger-tint: #FCEBEA;  --danger-line: #EFB2AE;
  --warn: #8A4B00;  --warn-tint: #FFF4DB;  --warn-line: #EBCB8B;  --amber: #B87700;
  --info: #1D4F91;  --info-tint: #EAF1FB;  --info-line: #B9CDEB;
  --picked: #DDE6EF;

  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---- base ------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
p { margin: 0 0 10px; }
ul { margin: 0 0 10px; }
code, kbd, pre { font-family: var(--mono); font-size: .92em; }
code { background: var(--wash); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.vh {                     /* visually hidden, still read by screen readers */
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--sheet); color: var(--ink);
  padding: 8px 12px; border-radius: var(--radius); font-weight: 600; }
.skip:focus { top: 8px; }

/* ---- app chrome ------------------------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap;
  min-height: 46px; padding: 0 16px;
  background: var(--bar); color: #FFFFFF;
}
.brand { color: #FFFFFF; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; padding: 11px 0; letter-spacing: .01em; }
.brand:hover { color: #FFFFFF; }
.topbar :focus-visible { outline-color: #FFFFFF; }
.nav { display: flex; align-items: stretch; flex-wrap: wrap; gap: 2px; min-width: 0; }
.nav a {
  display: flex; align-items: center; padding: 0 10px; min-height: 46px;
  color: var(--bar-text); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.nav a:hover { color: #FFFFFF; }
.nav a.on { color: #FFFFFF; border-bottom-color: #FFFFFF; font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 13px; padding: 6px 0; }
.who-name { font-weight: 600; }
.who-role { color: var(--bar-quiet); }
.who a, .who .linkish { color: var(--bar-text); }
.who a:hover, .who .linkish:hover { color: #FFFFFF; }

/* ---- page containers --------------------------------------------------------------------------- */
main.page { max-width: 1120px; margin: 0 auto; padding: 16px 16px 48px; }
main.page.page-wide { max-width: 1320px; }
.card {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  padding: 20px 24px; min-width: 0;
}
.card + .card, .card + section, section + .card, .switches + .card, .card + .switches { margin-top: 16px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
body.auth main.page { padding-top: 7vh; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.card-head .actions { margin: 0 0 10px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 0; }

/* ---- type ------------------------------------------------------------------------------------ */
h1 { font-size: 20px; line-height: 1.25; margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 16px; line-height: 1.3; margin: 22px 0 8px; font-weight: 700; }
h1:first-child, h2:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 18px 0 6px; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 2px; text-transform: none; }
.muted { color: var(--muted); }
h1 .muted, h2 .muted { font-weight: 400; }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); font-size: .93em; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.ref { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.ref-big { font: 700 28px/1.15 var(--mono); letter-spacing: .03em; margin: 0; user-select: all; overflow-wrap: anywhere; white-space: normal; }

/* ---- messages -------------------------------------------------------------------------------- */
.notice, .error-box {
  margin: 0 0 12px; padding: 9px 14px; border-radius: 4px; color: var(--ink);
}
.notice { background: var(--info-tint); box-shadow: inset 4px 0 0 var(--info); }
.notice-warn { background: var(--warn-tint); box-shadow: inset 4px 0 0 var(--amber); }
.notice-ok { background: var(--go-tint); box-shadow: inset 4px 0 0 var(--go); }
.error-box { background: var(--danger-tint); box-shadow: inset 4px 0 0 var(--danger); }
.error-box ul, .notice ul { margin: 4px 0 0; padding-left: 20px; }
.error-box p, .notice p { margin: 0; }
.error-box p + p, .error-box p + ul { margin-top: 4px; }
.error-box a { color: var(--danger); font-weight: 600; }
.error-box:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
.field-error { color: var(--danger); font-weight: 600; font-size: 13px; margin: 4px 0 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.hint-strong { color: var(--warn); font-weight: 600; font-size: 13px; }

/* JS-filled message boxes: the region itself stays in the page (so screen readers announce what is put in it);
   the <p class="msg …"> inside carries the colour. */
.msg { margin: 0; padding: 8px 12px; border-radius: 4px; font-weight: 600; color: var(--ink); }
.msg + .msg { margin-top: 6px; }
.msg a { font-weight: 700; }
.msg-bad { background: var(--danger-tint); box-shadow: inset 4px 0 0 var(--danger); }
.msg-ok { background: var(--go-tint); box-shadow: inset 4px 0 0 var(--go); }
.session-msg:not(:empty) { margin: 0 0 12px; }

/* ---- forms ----------------------------------------------------------------------------------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin: 0 0 12px; }
.field > label, .label-row > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > label .muted { font-weight: 400; }
.req { color: var(--danger); font-weight: 700; margin-left: 2px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="password"], input[type="search"], input[type="tel"], input[type="date"],
input[type="number"], input[type="email"], input:not([type]), select, textarea {
  width: 100%; min-height: 34px; padding: 5px 9px;
  background: var(--sheet); color: var(--ink);
  border: 1px solid var(--line-input); border-radius: 5px;
}
textarea { line-height: 1.4; resize: vertical; }
select { padding-right: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[readonly] { background: var(--wash); }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: inset 0 0 0 1px var(--danger); }
input::placeholder, textarea::placeholder { color: #6B7785; opacity: 1; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--ink); }
textarea:disabled { background: var(--wash); color: var(--muted); }

.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.row > .field { flex: 1 1 180px; margin: 0; }
.row > .field-xs { flex: 0 1 112px; }
.row > .field-date { flex: 0 1 172px; }
.row > .field-md { flex: 0 1 230px; }
.row > .field-pc { flex: 0 1 320px; }
.row > .field-wide { flex: 2 1 320px; }
.row + .row, .row + .field, .field + .row { margin-top: 12px; }
.inline { display: inline; margin: 0; }
.input-btn { display: flex; gap: 8px; align-items: stretch; }
.input-btn > input { flex: 1 1 auto; min-width: 0; }
.input-btn > .btn { flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 14px;
  background: var(--sheet); color: var(--ink);
  border: 1px solid var(--line-input); border-radius: var(--radius);
  font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); color: var(--ink); }
.btn-primary { background: var(--go); border-color: var(--go); color: #FFFFFF; }
.btn-primary:hover { background: var(--go-dark); border-color: var(--go-dark); color: #FFFFFF; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: #FFFFFF; }
.btn-quiet-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-quiet-danger:hover { background: var(--danger-tint); color: var(--danger-dark); }
.btn-sm { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .65; cursor: progress; }
.linkish {
  background: none; border: 0; padding: 0; margin: 0; min-height: 0;
  color: var(--info); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit;
}
.linkish:hover { color: var(--ink); }

/* Tick boxes as large targets. The real checkbox stays visible: it IS the state, with or without
   JavaScript, and it keeps Windows high-contrast mode honest. */
.checks { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 8px 0 0; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
label.check {
  display: inline-flex; align-items: center; gap: 9px; min-height: 36px; padding: 6px 14px 6px 10px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--line-input); border-radius: var(--radius);
  font-weight: 600; cursor: pointer; user-select: none;
}
label.check:hover { background: var(--hover); }
label.check:has(> input:checked) { background: var(--picked); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
label.check:has(> input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
label.check > input:focus-visible { outline: none; }
label.check-plain, label.check-plain:hover, label.check-plain:has(> input:checked) {
  min-height: 34px; padding: 0; border: 0; background: none; box-shadow: none; font-weight: 400;
}
label.check-line { display: flex; align-items: flex-start; gap: 9px; margin: 8px 0 12px; font-weight: 600; cursor: pointer; }
label.check-line > input { margin-top: 1px; }

/* ---- tables ---------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table-wrap + p { margin-top: 10px; }
.table { width: 100%; border-collapse: collapse; background: var(--sheet); font-size: 13.5px; }
.table th, .table td { padding: 6px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table thead th {
  vertical-align: bottom; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  border-bottom: 2px solid var(--line-input); background: var(--sheet);
}
.table tbody th { font-weight: 600; }
.table tbody tr:hover { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.total th, .table tr.total td { border-top: 2px solid var(--line-input); background: var(--wash); font-weight: 700; }
.table tr.inactive td { color: var(--muted); }
.table tr.locked td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.table td.detail { font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; min-width: 14em; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: normal; }
.cell-danger { color: var(--danger); font-weight: 700; }
.row-actions { white-space: nowrap; }
.row-actions .btn { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.row-actions > * { margin: 0 6px 4px 0; }

/* the 7-day grid: as wide as its days need, not the whole card */
.grid7 { width: auto; min-width: 420px; }
.grid7 td, .grid7 th { text-align: center; min-width: 7.5em; }
.counts-table { max-width: 900px; }
.grid7 th:first-child, .grid7 td:first-child, .grid7 tbody th { text-align: left; }
.grid7 .is-today { background: var(--info-tint); }
.grid7 .cell-n { font-weight: 700; font-size: 14px; text-decoration: none; }
.grid7 .cell-n:hover { text-decoration: underline; }
.grid7 .cell-sub { max-width: 11em; margin: 0 auto; }
.grid7 td.num, .grid7 th.num { text-align: center; }

/* ---- tags ------------------------------------------------------------------------------------ */
.tag, .stag, .otag {
  display: inline-block; vertical-align: middle; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1.5; padding: 0 8px; border-radius: 999px;
  background: var(--wash); color: var(--ink-2); border: 1px solid transparent;
  font-family: var(--font); letter-spacing: 0;
}
.tag-muted { background: transparent; color: var(--muted); border-color: var(--line-input); }
.tag-warn { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.tag-ok { background: var(--go-tint); color: var(--go-dark); border-color: var(--go-line); }
.tag-danger { background: var(--danger-tint); color: var(--danger); border-color: var(--danger-line); }

/* a lead's status: one look everywhere (lists, the status page, the detail page); status.js only changes data-status */
.stag { font-weight: 700; }
.stag[data-status="queued"], .stag[data-status="posting"] { background: var(--info-tint); color: var(--info); border-color: var(--info-line); }
.stag[data-status="sent"], .stag[data-status="done"] { background: var(--go-tint); color: var(--go-dark); border-color: var(--go-line); }
.stag[data-status="needs_look"] { background: var(--danger-tint); color: var(--danger); border-color: var(--danger-line); }
.stag[data-status="withdrawn"] { background: transparent; color: var(--muted); border-color: var(--line-input); }
.stag-lg { font-size: 15px; padding: 3px 14px; }

/* an attempt's outcome */
.otag[data-outcome="sent"] { background: var(--go-tint); color: var(--go-dark); border-color: var(--go-line); }
.otag[data-outcome="retry"] { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.otag[data-outcome="unknown"], .otag[data-outcome="refused"] { background: var(--danger-tint); color: var(--danger); border-color: var(--danger-line); }

/* ---- facts (dl) ------------------------------------------------------------------------------ */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; }
.facts dt { color: var(--muted); font-weight: 600; font-size: 13px; padding-top: 1px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts-tight { gap: 4px 14px; margin: 10px 0 0; font-size: 13px; }
.detail-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 36px; }
.addr-lines > span { display: block; }
.pre-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--wash); padding: 8px 12px; border-radius: 4px; max-width: 90ch; }
.note-pre {
  margin: 6px 0 0; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--wash); border-radius: var(--radius); font: 13px/1.5 var(--mono); max-width: 90ch;
}
.consent-list { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 5px; }
.consent-list .tag { min-width: 5.2em; text-align: center; margin-right: 6px; }

/* ---- filters, pager -------------------------------------------------------------------------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px;
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--sheet-2); border: 1px solid var(--rule); border-radius: 8px;
}
.filters .field { flex: 0 1 190px; margin: 0; }
.filters .btn, .filters .linkish { align-self: flex-end; }
.filters .linkish { min-height: 34px; display: inline-flex; align-items: center; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 14px 0 0; font-size: 13px; }
.pager a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--line-input); border-radius: var(--radius); background: var(--sheet);
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.pager a:hover { background: var(--hover); }
.pager span { color: var(--muted); }

/* ---- kpi tiles ------------------------------------------------------------------------------- */
.kpis { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; padding: 0; }
.kpi {
  display: inline-flex; flex-direction: column; gap: 2px; min-width: 150px; margin: 0;
  padding: 10px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  color: var(--ink); text-decoration: none;
}
a.kpi:hover { background: var(--hover); color: var(--ink); }
.kpi strong { font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-warn { box-shadow: inset 4px 0 0 var(--amber); background: var(--warn-tint); }
.kpi-danger { box-shadow: inset 4px 0 0 var(--danger); background: var(--danger-tint); }
a.kpi-warn:hover { background: #FFEDC2; }
a.kpi-danger:hover { background: #F9DEDC; }

/* =============================================================================================== */
/* THE LEAD FORM (/lead/new)                                                                       */
/* =============================================================================================== */
.lead-head { margin: 0 0 12px; }
.lead-head h1 { margin-bottom: 4px; }
.lead-head p { margin: 0; max-width: 92ch; }
.error-summary { margin: 0 0 14px; border: 1px solid var(--danger-line); }
.error-summary h2 { font-size: 15px; margin: 0 0 4px; }
.error-summary ul { margin: 0; }
.error-summary li + li { margin-top: 2px; }

.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; }
.lead-form { margin: 0; }
.fs { padding: 16px 22px 18px; border-top: 1px solid var(--rule); }
.lead-form > .fs:first-of-type { border-top: 0; }
.fs-h { font-size: 15px; margin: 0 0 10px; color: var(--ink); }
legend > .fs-h { margin-bottom: 4px; }
.sub-h { font-size: 14px; margin: 18px 0 2px; }
.field-area { max-width: 860px; margin: 12px 0 0; }
.fs-h + .field-area { margin-top: 0; }
.field-area textarea { width: 100%; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.is-near { color: var(--warn); font-weight: 700; }

.group.has-error, .cred-row.has-error {
  box-shadow: inset 4px 0 0 var(--danger); background: var(--danger-tint); border-radius: 4px; padding: 8px 10px 8px 14px;
}
/* a floated legend is laid out inside the fieldset (not on its border), so it sits inside the error box too */
.group > legend { float: left; width: 100%; }
.group > legend + * { clear: left; }
.group > .field-error { margin-top: 8px; }

/* address */
.addr-msg { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--ink-2); max-width: 70ch; }
.addr-msg:empty { margin: 0; }
.addr-pick { max-width: 680px; margin: 10px 0 0; }
.addr-off { margin: 8px 0 0; }

/* creditor rows: on wide screens a table without a table (row 1's labels head the columns; the others keep
   theirs for screen readers only); below 760px every row is a little stacked block with its own labels. */
.creditors { margin-top: 4px; }
.creditors > .hint { margin: 0 0 8px; max-width: 92ch; }
.cred-row {
  display: grid; grid-template-columns: 2.6em minmax(0, 2.4fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) 4.8em;
  gap: 4px 10px; align-items: end; padding: 3px 0;
}
.cred-row > .field { margin: 0; }
.cred-n { padding-bottom: 7px; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cred-joint { padding-bottom: 0; }
.cred-row > .field-error { grid-column: 1 / -1; margin: 0 0 4px; }
.cred-row .cred-lbl { font-size: 12.5px; }
.cred-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 0; }
@media (min-width: 760px) {
  .cred-word,
  .cred-row + .cred-row .cred-lbl {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}
@media (max-width: 759.98px) {
  .cred-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 0; border-top: 1px solid var(--rule); }
  .cred-n { grid-column: 1 / -1; text-align: left; padding: 0; color: var(--ink-2); }
  .cred-name, .cred-type { grid-column: 1 / -1; }
  .cred-joint { grid-column: 1 / -1; }
}

/* the repeat-mobile warning, right above Save */
.repeat-box {
  padding: 14px 22px 16px; border-top: 1px solid var(--warn-line);
  background: var(--warn-tint); box-shadow: inset 4px 0 0 var(--amber);
}
.repeat-box .fs-h { color: var(--warn); }
.repeat-box .field-area { margin-top: 8px; }

.save-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 18px;
  padding: 14px 22px; border-top: 2px solid var(--ink); border-radius: 0 0 8px 8px; background: var(--sheet-2);
}
.save-msg { flex: 1 1 340px; min-width: 0; }
.btn-save { min-width: 220px; min-height: 44px; font-size: 15px; padding: 6px 22px; }
.lead-form[inert] { cursor: progress; }            /* saving: nothing can be typed until the server answers */
.page-h { margin: 2px 0 12px; }

/* =============================================================================================== */
/* A LEAD'S STATUS (/leads/<ref>) AND DETAIL (/manager/leads/<ref>)                                */
/* =============================================================================================== */
.ref-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.copy-note { font-size: 13px; font-weight: 600; color: var(--go-dark); }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; }
.status-box {
  margin: 0 0 14px; padding: 14px 16px; border-radius: 8px;
  background: var(--info-tint); box-shadow: inset 4px 0 0 var(--info);
}
.status-card[data-status="sent"] .status-box, .status-card[data-status="done"] .status-box { background: var(--go-tint); box-shadow: inset 4px 0 0 var(--go); }
.status-card[data-status="needs_look"] .status-box { background: var(--danger-tint); box-shadow: inset 4px 0 0 var(--danger); }
.status-card[data-status="withdrawn"] .status-box { background: var(--wash); box-shadow: inset 4px 0 0 var(--line-input); }
.status-help { font-size: 15px; margin: 0; }
.status-hid { margin: 8px 0 0; font-size: 15px; }
.status-hid strong { font-size: 17px; }
.status-poll { margin: 8px 0 0; }
.status-poll:empty { margin: 0; }

.look-box { margin: 12px 0; padding: 10px 14px; border-radius: 4px; background: var(--danger-tint); box-shadow: inset 4px 0 0 var(--danger); }
.look-box p { margin: 0; }
.look-box p + p { margin-top: 4px; }
.action-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.action-form { padding: 14px 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet-2); }
.action-form h3 { margin: 0 0 6px; font-size: 15px; }
.action-form .field { margin-bottom: 10px; }
.action-danger { border-color: var(--danger-line); background: var(--danger-tint); }

/* ---- admin ----------------------------------------------------------------------------------- */
.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.switches > .card + .card { margin-top: 0; }
.switch-card h2 { margin-top: 0; }
.state { margin: 0 0 10px; padding: 10px 14px; border-radius: 4px; }
.state p { margin: 0; }
.state p + p { margin-top: 4px; }
.state-ok { background: var(--go-tint); box-shadow: inset 4px 0 0 var(--go); }
.state-plain { background: var(--wash); box-shadow: inset 4px 0 0 var(--line-input); }
.state-bad { background: var(--warn-tint); box-shadow: inset 4px 0 0 var(--amber); }
.state-alarm { background: var(--danger-tint); box-shadow: inset 6px 0 0 var(--danger); border: 1px solid var(--danger-line); font-size: 15px; }
.state-alarm strong { color: var(--danger); }

.settings-card { max-width: 860px; margin-left: auto; margin-right: auto; }
.settings-group { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--rule); }
.setting { max-width: 640px; }
.setting input { max-width: 340px; }

.pw-once-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 14px; }
input.pw-once {
  flex: 1 1 260px; width: auto; min-width: 0; min-height: 46px; padding: 8px 12px;
  font: 600 20px/1.3 var(--mono); letter-spacing: .05em;
  background: var(--warn-tint); border: 1px solid var(--amber); user-select: all;
}
.error-page h1 { font-size: 22px; }

/* ---- sign-in pages --------------------------------------------------------------------------- */
.auth .card h1 { font-size: 22px; }
.auth .card form .btn-primary { width: 100%; min-height: 40px; margin-top: 4px; }
.auth .card form + p { margin-top: 14px; }

/* =============================================================================================== */
/* RESPONSIVE                                                                                      */
/* =============================================================================================== */
@media (max-width: 700px) {
  main.page { padding: 12px 10px 36px; }
  .card { padding: 16px; }
  .topbar { padding: 0 12px; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 6px; scrollbar-width: none; }
  .nav a { min-height: 40px; }
  .who { font-size: 12.5px; }
  .who-role { display: none; }
  .fs, .repeat-box { padding: 14px 14px 16px; }
  .save-bar { padding: 12px 14px; }
  .btn-save { flex: 1 0 100%; min-width: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .facts dd { margin-bottom: 8px; }
  .ref-big { font-size: 22px; }
}
@media (max-width: 420px) {
  .row > .field, .row > .field-xs, .row > .field-md, .row > .field-pc, .row > .field-date, .row > .field-wide { flex-basis: 100%; }
  .kpi { flex: 1 1 40%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
/* Windows high contrast: backgrounds and box-shadows vanish, so draw what matters with borders. */
@media (forced-colors: active) {
  .stag, .otag, .tag, .kpi, .state, .msg, .notice, .error-box, .look-box, .status-box { border: 1px solid CanvasText; }
  label.check:has(> input:checked) { outline: 2px solid Highlight; }
  .group.has-error, .cred-row.has-error { border-left: 4px solid CanvasText; }
}
@media print {
  .topbar, .skip, .save-bar, .actions, .btn { display: none !important; }
  body { background: #FFFFFF; }
  .card, .sheet { border: 0; }
}
