/* imp-kit.css — P37: the shared building blocks every signed-in page uses, defined once.
   Loaded after every other app stylesheet, so these are the final word on:
     page header · cards and their footer bar · stat cards · badges · buttons (incl. danger and
     disabled) · form errors and the error summary · the filter bar · empty states · alerts ·
     tables · the getting-started list · the chat launcher's room.
   Sizes come from the type and spacing scales in brand.css (--fs-*, --sp-*); colours from its
   tokens only. Text is sentence case; no letter-spaced labels. */

/* ---------- page header: title, one-line purpose, the primary action on the right ---------- */
.page-header,
.page-header--ruled,
.page-header--split {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4) var(--sp-6);
  margin: 0 0 var(--gap-section); padding: 0; border: 0;
}
.page-header > .page-title, .page-header > .page-sub { flex: 1 1 100%; }
.page-header > .page-sub { margin-top: calc(-1 * var(--sp-4) + var(--sp-2)); }
.page-header__text { flex: 1 1 320px; min-width: 0; }
.page-header > div:not(.page-header__actions):not(.actions) { flex: 1 1 320px; min-width: 0; }
.page-title,
.page-header--ruled .page-title {
  font-family: var(--imp-display); font-size: var(--fs-7); font-weight: 700; font-stretch: 100%;
  line-height: 1.1; letter-spacing: -0.025em; color: var(--imp-ink); overflow-wrap: anywhere;
}
.page-sub,
.page-header--ruled .page-sub { margin-top: var(--sp-2); max-width: 70ch; color: var(--imp-muted); font-size: var(--fs-2); }
.page-header__actions,
.page-header > .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); flex: 0 1 auto; min-width: 0; }
.page-title--mono { font-family: var(--imp-font); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* ---------- cards: one rhythm between them, and a footer bar that owns the card's buttons ---------- */
.section-card + .section-card, .section-card + form, form + .section-card, form + form,
.desk-card + .desk-card, .desk-block, .section-card + .desk-card, .desk-card + .section-card,
.kpi-grid + .section-card, .kpi-grid + .desk-card, .start-card + .kpi-grid { margin-top: var(--gap-section); }
.section-card-head { padding: var(--sp-4) var(--pad-card); gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; }
.section-card-body { padding: var(--pad-card); }
.section-card-note { padding: var(--sp-3) var(--pad-card) 0; }
.section-card-title { font-size: var(--fs-3); font-weight: 700; }
.section-card-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-4) var(--pad-card);
  border-top: 1px solid var(--imp-rule); background: var(--imp-bg);
  border-radius: 0 0 var(--imp-radius) var(--imp-radius);
}
.section-card-foot__push { margin-left: auto; }
.imp-fieldset > .section-card-foot { clear: both; }
.form-narrow { max-width: var(--form-max); }

/* ---------- stat cards: one style everywhere — label, number, optional line. No rings, no rules. ---------- */
.kpi-grid { display: grid; gap: var(--sp-4); grid: auto-flow / repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin: 0; }
.kpi,
.metric-card {
  display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; position: static; overflow: visible;
  padding: var(--sp-4) var(--pad-card);
  background: var(--imp-surface); border: 1px solid var(--imp-rule); border-radius: var(--imp-radius);
  box-shadow: var(--imp-shadow-xs);
}
.kpi::before { content: none; }
.kpi__label, .kpi__key, .metric-card__label { margin: 0; font-size: var(--fs-2); font-weight: 600; color: var(--imp-muted); letter-spacing: 0; }
.kpi__value, .metric-card__value {
  margin: 0; font-family: var(--imp-display); font-size: var(--fs-5); font-weight: 700; line-height: 1.15;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--imp-ink); overflow-wrap: anywhere;
}
.kpi__sub, .metric-card__sub { margin: 0; font-size: var(--fs-1); color: var(--imp-muted); }
.kpi--lead { background: var(--imp-primary-wash); border-color: var(--imp-primary-wash-2); }
.metric-card__icon, .kpi__icon, .kpi__ring { display: none; }

/* ---------- badges: one shape, five tones (chips, job and role badges share it) ---------- */
.badge, .chip, .job-badge, .role-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 22px; padding: 0 var(--sp-2);
  border-radius: var(--imp-radius-badge); font-size: var(--fs-1); font-weight: 700; line-height: 1.2;
  white-space: nowrap; letter-spacing: 0;
}
.badge, .badge--info { background: var(--imp-primary-wash-2); color: var(--imp-primary-strong); }
.badge--neutral { background: var(--imp-bg); color: var(--imp-secondary); box-shadow: inset 0 0 0 1px var(--imp-rule); }
.badge--success { background: var(--imp-green-wash); color: var(--imp-green); }
.badge--warning { background: var(--imp-amber-wash); color: var(--imp-amber); }
.badge--danger { background: var(--imp-red-wash); color: var(--imp-red); }
.chip--muted, .job-badge--waiting { box-shadow: inset 0 0 0 1px var(--imp-rule); }

/* ---------- buttons: danger, text-danger, disabled ---------- */
.btn-imp-danger { border-color: var(--imp-red); color: var(--imp-red); background: var(--imp-surface); }
.btn-imp-danger:hover { background: var(--imp-red); color: var(--imp-on-ink); }
.btn-danger-text {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-1);
  border: 0; background: none; color: var(--imp-red); font: inherit; font-weight: 700; cursor: pointer;
  text-decoration: none;
}
.btn-danger-text:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-danger-text--sm { min-height: 32px; font-size: var(--fs-1); }
.btn-imp-primary:disabled, .btn-imp-secondary:disabled, .btn-imp-danger:disabled, .btn-quiet:disabled,
.btn-text:disabled, .btn-danger-text:disabled,
[aria-disabled="true"].btn-imp-primary, [aria-disabled="true"].btn-imp-secondary {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-imp-primary:disabled:hover { background: linear-gradient(135deg, var(--imp-primary), var(--imp-primary-2)); }
.btn-imp-secondary:disabled:hover { background: var(--imp-surface); color: var(--imp-ink); border-color: var(--imp-rule-strong); }
.btn-imp-primary--lg { min-height: 48px; padding: 0 var(--sp-6); font-size: var(--fs-3); }

/* ---------- forms: every invalid control looks invalid, the message sits right under it ---------- */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"],
input[type="text"][aria-invalid="true"], input[type="email"][aria-invalid="true"], input[type="password"][aria-invalid="true"],
input[type="number"][aria-invalid="true"], input[type="date"][aria-invalid="true"], input[type="search"][aria-invalid="true"] {
  border-color: var(--imp-red); border-width: 2px; background-color: var(--imp-red-wash);
}
input[aria-invalid="true"]:focus-visible, select[aria-invalid="true"]:focus-visible, textarea[aria-invalid="true"]:focus-visible {
  border-color: var(--imp-red); box-shadow: 0 0 0 3px var(--imp-red-wash);
}
.field-error { margin: 0; font-size: var(--fs-1); font-weight: 600; color: var(--imp-red); }
.field-error--form { font-size: var(--fs-2); }
.error-summary:focus { outline: none; }
.error-summary__list { margin: var(--sp-2) 0 0; padding-left: var(--sp-5); columns: 3 15rem; column-gap: var(--sp-7); }
.error-summary__list li { margin-bottom: var(--sp-1); break-inside: avoid; }
.error-summary__list a { color: var(--imp-red); font-weight: 600; text-underline-offset: 3px; }

/* ---------- filter bar: fields on one line, one verb (Apply), Clear as text; a disclosure on phones ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3) var(--sp-4); margin: 0 0 var(--gap-section); }
.filter-bar .field { flex: 0 1 180px; }
.filter-bar .filter-bar__search { flex: 1 1 260px; }
.filter-bar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); min-height: 44px; }
.filter-bar__note { flex: 1 1 100%; margin: 0; }
.filters { margin: 0 0 var(--gap-section); }
.filters > .filter-bar { margin: 0; }
.filters__toggle { display: none; }
.filters__count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--sp-1); border-radius: var(--imp-radius-badge); background: var(--imp-primary); color: var(--imp-primary-ink); font-size: var(--fs-0); font-weight: 800; }
@media (max-width: 600px) {
  .filters__toggle {
    display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-4); cursor: pointer; list-style: none;
    border: 1px solid var(--imp-rule-strong); border-radius: var(--imp-radius-ctl); background: var(--imp-surface);
    color: var(--imp-ink); font-weight: 700;
  }
  .filters__toggle::-webkit-details-marker { display: none; }
  .filters[open] > .filters__toggle { margin-bottom: var(--sp-3); }
}

/* segmented tabs carry their state for everyone, not only by colour */
.segmented { flex-wrap: wrap; }
.segmented__item { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 36px; font-size: var(--fs-2); }
.segmented__item[aria-current="page"] { font-weight: 800; }

/* ---------- empty states: an icon, one sentence, the next action ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-8) var(--pad-card); text-align: center;
}
.empty__icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--sp-2);
  border-radius: var(--imp-radius); background: var(--imp-primary-wash-2); color: var(--imp-primary-strong); font-size: var(--fs-4);
}
.empty__title { margin: 0; font-size: var(--fs-3); font-weight: 700; color: var(--imp-ink); }
.empty__text { margin: 0; max-width: 52ch; color: var(--imp-muted); }
.empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-3); }

/* ---------- alerts: an icon, a left rule and a wash, in both themes ---------- */
.imp-alert {
  position: relative; margin: 0 0 var(--gap-section); padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 26px);
  border: 1px solid var(--imp-rule); border-left: 4px solid var(--imp-primary); border-radius: var(--imp-radius-ctl);
  background: var(--imp-primary-wash); color: var(--imp-ink);
}
.imp-alert::before {
  position: absolute; left: var(--sp-4); top: calc(var(--sp-3) + 2px);
  font-family: 'icons'; font-size: var(--fs-3); line-height: 1; content: "\f431"; color: var(--imp-primary-strong);
}
.imp-alert > * + * { margin-top: var(--sp-2); }
.imp-alert-danger { border-left-color: var(--imp-red); background: var(--imp-red-wash); }
.imp-alert-danger::before { content: "\f33b"; color: var(--imp-red); }
.imp-alert-danger .field-error--form { color: var(--imp-ink); font-weight: 600; }
.imp-alert-success { border-left-color: var(--imp-green); background: var(--imp-green-wash); }
.imp-alert-success::before { content: "\f26b"; color: var(--imp-green); }
.imp-alert-warning { border-left-color: var(--imp-amber); background: var(--imp-amber-wash); }
.imp-alert-warning::before { content: "\f33b"; color: var(--imp-amber); }
.imp-alert-info { border-left-color: var(--imp-primary); background: var(--imp-primary-wash); }
.imp-alert .actions { gap: var(--sp-2) var(--sp-4); }

/* ---------- tables ---------- */
.imp-table { font-size: var(--fs-2); }
.imp-table th { font-size: var(--fs-1); font-weight: 700; letter-spacing: 0; }
.imp-table td.nowrap, .imp-table th.nowrap { white-space: nowrap; overflow-wrap: normal; }
.imp-table tfoot td, .imp-table tfoot th { border-top: 2px solid var(--imp-rule-strong); border-bottom: 0; font-weight: 800; color: var(--imp-ink); background: var(--imp-bg); }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.pager > .small-note:first-child, .pager__export { margin-right: auto; }

/* ---------- the "Get started" list for a new account (real steps, ticked from real data) ---------- */
.start-card { padding: var(--pad-card); background: var(--imp-surface); border: 1px solid var(--imp-primary-wash-2); border-radius: var(--imp-radius); box-shadow: var(--imp-shadow-xs); }
.start-card__title { margin: 0; font-family: var(--imp-display); font-size: var(--fs-4); font-weight: 700; color: var(--imp-ink); }
.start-card__sub { margin: var(--sp-1) 0 0; color: var(--imp-muted); }
.start-list { display: grid; gap: var(--sp-3); grid: auto-flow / repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin: var(--sp-4) 0 0; padding: 0; list-style: none; counter-reset: start; }
.start-step {
  display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; padding: var(--sp-4);
  border: 1px solid var(--imp-rule); border-radius: var(--imp-radius-ctl); background: var(--imp-bg);
}
.start-step__mark {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--imp-surface); border: 2px solid var(--imp-rule-strong); color: var(--imp-muted); font-size: var(--fs-1); font-weight: 800;
}
.start-step--done .start-step__mark { background: var(--imp-green); border-color: var(--imp-green); color: var(--imp-on-ink); }
.start-step__body { display: grid; gap: var(--sp-1); min-width: 0; }
.start-step__title { margin: 0; font-weight: 700; color: var(--imp-ink); }
.start-step--done .start-step__title { color: var(--imp-muted); text-decoration: line-through; text-decoration-color: var(--imp-rule-strong); }
.start-step__text { margin: 0; font-size: var(--fs-1); color: var(--imp-muted); }
.start-step__go { justify-self: start; font-size: var(--fs-2); }

/* ---------- the chat launcher never sits on top of the last fields or buttons ---------- */
body:has(.imp-chat:not([hidden])) main.main { padding-bottom: calc(var(--sp-10) + var(--sp-9)); }
.imp-chat.is-compact .imp-chat__launch { width: 52px; min-height: 52px; padding: 0; justify-content: center; }
.imp-chat.is-compact .imp-chat__launch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.imp-chat.is-compact .imp-chat__badge { position: absolute; top: -4px; right: -4px; }

/* ---------- the account menu's own theme switch (phones: the top bar has no room for it) ---------- */
.imp-account__theme { display: none; }
@media (max-width: 640px) {
  .imp-topbar__tools > .imp-theme { display: none; }
  html[data-theme-js] .imp-account__theme { display: flex; }
  .imp-account__theme.imp-theme { width: 100%; justify-content: flex-start; min-height: 40px; padding: var(--sp-2); border: 0; border-radius: var(--imp-radius-ctl); background: none; box-shadow: none; color: var(--imp-ink); font-weight: 600; }
  .imp-account__theme .imp-theme__label { display: inline; }
}

/* ---------- the signed-in "not found" page ---------- */
.lost { max-width: 560px; margin: var(--sp-8) auto 0; }
.lost .empty { padding: var(--sp-9) var(--pad-card); }
.lost__links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2) var(--sp-4); margin: 0; }

@media (max-width: 900px) {
  .page-header { margin-bottom: var(--sp-5); }
  .section-card-head, .section-card-body, .section-card-foot { padding-left: var(--sp-4); padding-right: var(--sp-4); }
}

/* ---------- dashboard: recent labels beside the wallet activity ---------- */
.dash-grid { display: grid; gap: var(--gap-section); grid: auto-flow / minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.dash-grid > .section-card + .section-card { margin-top: 0; }
.dash-grid + .section-card, .dash-grid + section { margin-top: var(--gap-section); }
@media (max-width: 1100px) { .dash-grid { grid: auto-flow / minmax(0, 1fr); } }
.move-list { margin: 0; padding: 0; list-style: none; }
.move-list__item { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--pad-card); border-bottom: 1px solid var(--imp-rule); }
.move-list__item:last-child { border-bottom: 0; }
.move-list__what { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-weight: 600; color: var(--imp-ink); }
.move-list__amount { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-card__name { font-size: var(--fs-2); }
.price-card th { font-size: var(--fs-1); letter-spacing: 0; }
.price-card .num { text-align: right; }
.faq-list { display: grid; gap: var(--sp-2); }
.faq-item > summary { font-size: var(--fs-2); }

/* phones: the top bar has room for the words "Add funds" now the theme switch sits in the menu */
@media (max-width: 640px) {
  .imp-topup { width: auto; padding: 0 var(--sp-3); }
  .imp-topup__label { display: inline; }
  .kpi { padding: var(--sp-3) var(--sp-4); }
  .kpi__value { font-size: var(--fs-4); }
}
@media (max-width: 374px) {
  .imp-topup { width: 40px; padding: 0; }
  .imp-topup__label { display: none; }
}

/* ---------- create label: the buy bar (summary + the one big button) ---------- */
.buy-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-6);
  margin-top: var(--gap-section); padding: var(--sp-4) var(--pad-card);
  background: var(--imp-surface); border: 1px solid var(--imp-rule-strong); border-radius: var(--imp-radius);
  box-shadow: var(--imp-shadow-md);
}
.buy-bar__facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin: 0; min-width: 0; }
.buy-bar__facts > div { min-width: 0; }
.buy-bar__facts dt { font-size: var(--fs-1); color: var(--imp-muted); font-weight: 600; }
.buy-bar__facts dd { margin: 0; font-weight: 700; color: var(--imp-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.buy-bar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); margin-left: auto; }
.btn-text--quiet { color: var(--imp-muted); font-weight: 600; }
@media (max-width: 640px) {
  .buy-bar { position: static; }
  .buy-bar__actions { width: 100%; flex-direction: column-reverse; align-items: stretch; }
  .buy-bar__actions .btn-imp-primary { width: 100%; }
  .buy-bar__actions .btn-text { justify-content: center; }
}
.confirm-dialog .imp-dialog__title { font-size: var(--fs-3); }
.imp-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-4); }

/* the address grid: City / State / ZIP, with room for the state's name */
.form-grid--address { grid: auto-flow / minmax(0, 1fr) minmax(0, 13rem) minmax(0, 7rem); }
@media (max-width: 900px) {
  .form-grid--address { grid: auto-flow / minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1360px) { .address-pair { grid: auto-flow / minmax(0, 1fr); } }

/* ---------- bulk upload: the stepper, the upload form, the money summary ---------- */
.bulk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-4); }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin: 0; padding: 0; list-style: none; counter-reset: none; }
.stepper__step { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--imp-muted); font-size: var(--fs-2); font-weight: 600; }
.stepper__step + .stepper__step::before { content: ''; width: 24px; height: 2px; border-radius: 2px; background: var(--imp-rule-strong); }
.stepper__num {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--imp-rule-strong); background: var(--imp-surface); font-size: var(--fs-1); font-weight: 800;
}
.stepper__step.is-current { color: var(--imp-ink); font-weight: 800; }
.stepper__step.is-current .stepper__num { border-color: var(--imp-primary); background: var(--imp-primary); color: var(--imp-primary-ink); }
.stepper__step.is-done .stepper__num { border-color: var(--imp-green); background: var(--imp-green-wash); color: var(--imp-green); }
.cols-help { margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--imp-rule); border-radius: var(--imp-radius-ctl); background: var(--imp-bg); }
.cols-help > summary { cursor: pointer; font-weight: 700; color: var(--imp-primary-strong); }
.cols-help[open] > summary { margin-bottom: var(--sp-3); }
.cols-help .chip-row { margin: 0 0 var(--sp-3); gap: var(--sp-2); }
.upload-form { display: grid; gap: var(--sp-4); margin-top: var(--sp-5); }
.upload-form__product { max-width: 560px; }
.upload-form .dropzone { margin-top: 0; }
.upload-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); }
.upload-form__actions .small-note { flex: 1 1 280px; margin: 0; }
.gen-shell .jobs { margin-top: var(--sp-5); }
.gen-shell .dropzone--link { margin-top: var(--sp-5); padding: var(--sp-6) var(--sp-5); }
.sum-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-6);
  margin: var(--sp-4) 0; padding: var(--sp-4); border: 1px solid var(--imp-primary-wash-2); border-radius: var(--imp-radius-ctl); background: var(--imp-primary-wash);
}
.sum-strip__facts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-6); margin: 0; }
.sum-strip__facts dt { font-size: var(--fs-1); color: var(--imp-muted); font-weight: 600; }
.sum-strip__facts dd { margin: 0; font-weight: 700; color: var(--imp-ink); font-variant-numeric: tabular-nums; }
.sum-strip__total { font-family: var(--imp-display); font-size: var(--fs-5); line-height: 1.1; }
.sum-strip__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); margin: 0 0 0 auto; }
.dialog-total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--imp-rule); border-bottom: 1px solid var(--imp-rule); }
.dialog-total strong { font-family: var(--imp-display); font-size: var(--fs-5); color: var(--imp-ink); font-variant-numeric: tabular-nums; }
.veil__foot--split { justify-content: space-between; align-items: center; }
.job-preview .cell-stack > span { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .stepper__word { font-size: var(--fs-1); }
  .stepper__step + .stepper__step::before { width: 12px; }
  .sum-strip__actions { width: 100%; flex-direction: column-reverse; align-items: stretch; margin: 0; }
  .sum-strip__actions .btn-imp-primary { width: 100%; }
  .sum-strip__actions .btn-text { justify-content: center; }
  /* stacked preview rows: the label above a long value, which wraps instead of clipping */
  .job-preview .imp-table td[data-label]:has(.cell-stack) { flex-direction: column; gap: 2px; }
  .job-preview .imp-table td[data-label]:has(.cell-stack) > * { text-align: left; }
  .upload-form__actions .btn-imp-primary { width: 100%; }
}

/* ---------- a row of facts under a page title (batch, label) ---------- */
.fact-row { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-7); margin: 0 0 var(--gap-section); padding: var(--sp-4) var(--pad-card); background: var(--imp-surface); border: 1px solid var(--imp-rule); border-radius: var(--imp-radius); }
.fact-row__item { min-width: 0; }
.fact-row dt { font-size: var(--fs-1); color: var(--imp-muted); font-weight: 600; }
.fact-row dd { margin: 0; font-weight: 700; color: var(--imp-ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cell-stack--end { align-items: flex-end; }
@media (max-width: 640px) { .cell-stack--end { align-items: flex-start; } }
.address-duo { display: grid; gap: var(--sp-5) var(--sp-7); grid: auto-flow / repeat(2, minmax(0, 1fr)); padding-bottom: var(--sp-5); margin-bottom: var(--sp-5); border-bottom: 1px solid var(--imp-rule); }
.address-duo__title { margin: 0 0 var(--sp-2); font-size: var(--fs-1); font-weight: 600; color: var(--imp-muted); }
.address-duo .address-block { font-size: var(--fs-3); line-height: 1.5; color: var(--imp-ink); }
@media (max-width: 640px) {
  .address-duo { grid: auto-flow / minmax(0, 1fr); }
  .page-title--mono { font-size: var(--fs-4); }
  .imp-table td.select { order: -2; margin: 0 0 var(--sp-1); }
}
.row-actions { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-1) var(--sp-4); }

/* ---------- the balance card (wallet): one full-width row, the stamp and what to do next ---------- */
.balance-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-7); margin: 0 0 var(--gap-section); padding: var(--sp-4); background: var(--imp-surface); border: 1px solid var(--imp-rule); border-radius: var(--imp-radius); }
.balance-row .stamp { min-width: 240px; padding: var(--sp-5) var(--sp-6); }
.stamp__label { margin: 0 0 var(--sp-1); opacity: .9; }
.balance-row__note { flex: 1 1 320px; display: grid; gap: var(--sp-2); max-width: 64ch; }
@media (max-width: 640px) { .balance-row .stamp { min-width: 0; width: 100%; } }
.pay-custom[hidden] { display: none; }
/* a button a script hides must really go (the class's display would otherwise win) */
.btn-imp-primary[hidden], .btn-imp-secondary[hidden], .btn-imp-danger[hidden], .btn-text[hidden], .btn-quiet[hidden], .btn-danger-text[hidden] { display: none; }
.btn-text.brackets__remove[hidden] { display: inline-flex; visibility: hidden; }  /* keeps the columns lined up */
.stamp__amount, .stamp__label { transform: none; }  /* P37: no depth offset, so the figure keeps the card padding */
.lost .empty__title { font-size: var(--fs-5); font-family: var(--imp-display); }

/* ---------- notifications (views/partials/toast.ejs, js/toasts.js) ----------
   One message, one notification. Without scripts it is a notice at the top of the page; with
   them it floats: top right on a desk, top centre on a phone, the most serious first. */
.toast {
  position: relative; display: flex; align-items: flex-start; gap: var(--sp-3);
  margin: 0 0 var(--gap-section); padding: var(--sp-4) var(--sp-5) var(--sp-4) var(--sp-4);
  background: var(--imp-surface); color: var(--imp-ink);
  border: 1px solid var(--imp-rule-strong); border-radius: var(--imp-radius);
  box-shadow: var(--imp-shadow-md); overflow: hidden;
}
.toast::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--toast-accent, var(--imp-primary)); }
.toast__icon {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--toast-wash, var(--imp-primary-wash-2)); color: var(--toast-accent, var(--imp-primary-strong));
}
.toast__icon::before { font-family: 'icons'; font-size: var(--fs-3); line-height: 1; content: "\f431"; }
.toast__body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; padding-top: 5px; }
.toast__title { margin: 0; font-weight: 800; font-size: var(--fs-2); color: var(--imp-ink); line-height: 1.35; }
.toast__text { margin: 0; font-size: var(--fs-2); color: var(--imp-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.toast__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-4); margin-top: var(--sp-2); }
.toast__actions form { margin: 0; }
.toast__action {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--toast-ink, var(--imp-primary-strong)); font: inherit; font-weight: 800; font-size: var(--fs-2);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.toast__close {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: -2px -8px 0 0; padding: 0; cursor: pointer;
  border: 0; border-radius: var(--imp-radius-ctl); background: none; color: var(--imp-muted);
}
.toast__close[hidden] { display: none; }
.toast__close:hover { background: var(--imp-bg); color: var(--imp-ink); }
.toast--danger { --toast-accent: var(--imp-red); --toast-wash: var(--imp-red-wash); --toast-ink: var(--imp-red); }
.toast--danger .toast__icon::before { content: "\f33b"; }
.toast--warning { --toast-accent: var(--imp-amber); --toast-wash: var(--imp-amber-wash); --toast-ink: var(--imp-ink); }
.toast--warning .toast__icon::before { content: "\f33b"; }
.toast--success { --toast-accent: var(--imp-green); --toast-wash: var(--imp-green-wash); --toast-ink: var(--imp-ink); }
.toast--success .toast__icon::before { content: "\f26b"; }
.toast--info { --toast-accent: var(--imp-primary); --toast-wash: var(--imp-primary-wash-2); }

.toast-region {
  position: fixed; top: 84px; right: var(--sp-5); z-index: 55;     /* under the top bar: never over its buttons */
  display: flex; flex-direction: column; gap: var(--sp-3);
  width: min(400px, calc(100vw - 2 * var(--sp-5))); pointer-events: none;
}
.toast-region:empty { display: none; }
.toast.is-floating { margin: 0; pointer-events: auto; animation: toast-in 220ms cubic-bezier(.2, .8, .2, 1); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 160ms ease, transform 160ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .toast-region { top: 64px; left: var(--sp-2); right: var(--sp-2); width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .toast.is-floating { animation: none; }
  .toast.is-leaving { transition: none; }
}
/* pages without the top bar (sign in, errors): the stack starts at the top */
body:not(:has(.imp-topbar)) .toast-region { top: var(--sp-5); }
.pay-form ~ .section-card { margin-top: var(--gap-section); }

/* ---------- P38: branch pages (dealer, sub-dealer, reseller) ---------- */
/* small buttons for table rows (the admin list has the same rule in imp-users.css) */
.btn-imp-secondary.btn-sm, .btn-imp-primary.btn-sm, .btn-imp-danger.btn-sm { min-height: 34px; padding: 0 var(--sp-3); gap: var(--sp-2); font-size: var(--fs-1); border-radius: var(--imp-radius-ctl); }
/* a page section with its own heading (the overview's "Branch activity": filters sit with what they change) */
.page-section { margin-top: var(--sp-7); }
.page-section__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-4); margin: 0 0 var(--sp-4); padding-top: var(--sp-5); border-top: 1px solid var(--imp-rule); }
.page-section__title { margin: 0; font-family: var(--imp-display); font-size: var(--fs-5); font-weight: 700; line-height: 1.15; color: var(--imp-ink); }
.page-section__sub { margin: 0; color: var(--imp-muted); font-size: var(--fs-2); }
.page-section > .kpi-grid { margin-bottom: var(--gap-section); }
.page-section > .section-card + .section-card { margin-top: var(--gap-section); }
/* facts beside the balance stamp */
.balance-row__facts { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-7); margin: 0; }
.balance-row__facts dt { font-size: var(--fs-1); font-weight: 600; color: var(--imp-muted); }
.balance-row__facts dd { margin: 0; font-family: var(--imp-display); font-size: var(--fs-5); font-weight: 700; line-height: 1.15; color: var(--imp-ink); font-variant-numeric: tabular-nums; }
.balance-row > .balance-row__note { margin: 0; }
/* the accounts list: words wrap between words; only an email may break inside itself */
.acct-table td { overflow-wrap: break-word; }
.imp-table .cell-email { overflow-wrap: anywhere; }
.acct-table .cell-action { width: 1%; white-space: nowrap; text-align: right; }
.acct-table .row-actions { flex-wrap: nowrap; gap: var(--sp-2); }
.acct-row.is-open > td { background: var(--imp-primary-wash); }
.acct-row.is-open > td:first-child { box-shadow: inset 3px 0 0 var(--imp-primary); }
.row-menu__panel hr { margin: var(--sp-1) 0; border: 0; border-top: 1px solid var(--imp-rule); }
.row-panel .panel-sub { margin: 0; font-size: var(--fs-2); color: var(--imp-secondary); max-width: 72ch; }
.row-panel .empty { padding: var(--sp-4) 0; }
.history-failed { display: flex; align-items: baseline; gap: var(--sp-2); color: var(--imp-ink); }
.history-failed .bi { color: var(--imp-amber); }
/* a data table card with its own export action in the head */
.section-card-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-left: auto; }
/* one read-only value where a form would offer a single choice */
.field-static { margin: 0; min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--imp-ink); }
/* a password box with its Generate / Copy buttons on one line */
.pw-line { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: stretch; }
.pw-line > input { flex: 1 1 200px; min-width: 0; }
.pw-line > button { flex: none; }
/* the new-account form: its two cards keep the section gap, the buttons sit in the last one's foot */
.stack-form { display: grid; gap: var(--gap-section); }
.stack-form > .section-card { margin: 0; }
@media (max-width: 640px) {
  .acct-table .cell-action { width: auto; }
  .acct-table .row-actions { justify-content: flex-start; }
  .acct-table td.cell-action { display: block; }
}
/* a card body that is itself a form grid lines its fields up (no stacked-flow gap above each) */
.section-card-body.form-grid > * + * { margin-top: 0; }
.acct-table [aria-expanded="true"].btn-imp-secondary { background: var(--imp-primary-wash); border-color: var(--imp-primary); color: var(--imp-primary-strong); }
.filter-bar--short .filter-bar__search { flex: 0 1 420px; }
@media (max-width: 640px) {
  /* a phone's filter fields take the full width (the kit's 180px basis above would win otherwise) */
  .filter-bar .field, .filter-bar .filter-bar__search, .filter-bar--short .filter-bar__search { flex: 1 1 100%; }
}
