:root {
  --radius: 14px;
  /* The app's own typeface. The legibility setting swaps this one
     value, so every page and every control follows at once. */
  --app-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
}

/* Header ------------------------------------------------------------------ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--brand-bar);
  color: var(--on-brand);
  border-bottom: 4px solid var(--accent);
}

.app-header__inner {
  width: 100%;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.app-header__brand {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* The alpha statement is a badge on the wordmark: it lives in the header
   brand lockup, one include (templates/_alpha_pill.html), every page.
   Coral fill with white text, uppercase and letter-spaced, small enough to
   read as the brand's version tag rather than another nav link.  It is a
   statement, not a control: no link, no button, nothing to focus or click,
   so it takes no pointer events.  The coral role is an opaque pair, the
   same in Cream, Paper, Midnight and Slate, so the badge reads the same on
   every brand bar; it never wraps and never takes width from the nav. */
.alpha-pill {
  flex: 0 0 auto;
  align-self: center;
  padding: 3px 8px 2px;
  border-radius: 999px;
  background: var(--alpha-pill);
  color: var(--alpha-pill-text);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

@media (max-width: 560px) {
  .app-header__brand {
    gap: 7px;
  }

  .alpha-pill {
    padding: 2px 6px 1px;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
  }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-brand);
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.wordmark__mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.app-header__actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topnav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 18px;
}

.topnav__link {
  color: var(--on-brand-muted-strong);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.topnav__link:hover {
  color: var(--on-brand);
  border-bottom-color: var(--accent);
}

.topnav__link[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.topnav__link[aria-current="page"]:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Announcements keeps its label beside the sections, and its own count. */
.topnav__link--announcements {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topnav__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-danger);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

/* The public nav's one link is the amber pill the owner ruled for. */
.topnav__link--pill {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.topnav__link--pill:hover,
.topnav__link--pill[aria-current="page"],
.topnav__link--pill[aria-current="page"]:hover {
  border: 0;
  background: var(--accent-hover);
  color: var(--accent-text);
}

@media (max-width: 760px) {
  .app-header__inner {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 8px;
  }

  .app-header__brand {
    grid-column: 1;
    grid-row: 1;
  }

  .app-header__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .topnav {
    grid-column: 1 / -1;
    grid-row: 2;
    /* Five labeled items at phone width wrap rather than lose a label. */
    flex-wrap: wrap;
    row-gap: 6px;
  }
}

/* The account: one round avatar button, everything personal behind it. ---- */

.profile {
  position: relative;
}

.profile__button {
  position: relative;
  display: inline-flex;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  line-height: 0;
  cursor: pointer;
}

.profile__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--brand-line-soft);
  object-fit: cover;
}

.profile__avatar--large {
  width: 48px;
  height: 48px;
  border-color: var(--brand-border);
}

.profile__button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* With a name set the button is a chip: name, caret, face at the right end.
   No name means none of these rules apply and the face stands alone. */
.profile__button--chip {
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 3px 4px 3px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  line-height: 1;
}

.profile__button--chip .profile__avatar {
  border: 0;
}

.profile__name {
  max-width: 15ch;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile__chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
}

/* The nav's own breakpoint: the chip collapses back to the face alone, so
   the bar never wraps and the alpha pill is never covered. */
@media (max-width: 760px) {
  .profile__button--chip {
    gap: 0;
    padding: 0;
    background: transparent;
    border-color: transparent;
  }

  .profile__name,
  .profile__chevron {
    display: none;
  }
}

.display-name-form {
  display: grid;
  gap: 6px;
  max-width: 360px;
  padding: 4px 0 10px;
}

.display-name-form .btn {
  justify-self: start;
  margin-top: 4px;
}

.onboarding-avatar-name {
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin-bottom: 14px;
}

/* The unread pill: one count, on the avatar's corner, on every app page. */
.profile__pill {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-danger);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.profile__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: max-content;
  min-width: 232px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-strong);
  color: var(--text);
  text-align: left;
}

.profile__menu[hidden] {
  display: none;
}

.profile__header {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
}

.profile__header .profile__avatar--large {
  margin-bottom: 6px;
}

.profile__household {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.profile__email {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.profile__links {
  display: grid;
  gap: 2px;
}

.profile__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.profile__item:hover {
  background: var(--surface-alt);
}

.profile__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.profile__item[aria-current="page"] {
  background: var(--brand-tint);
  font-weight: 700;
}

.profile__item--button {
  width: 100%;
}

.profile__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--on-danger);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.profile__divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

.profile__logout {
  margin: 0;
}

.btn--nav {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.85rem;
}

.btn--nav:hover {
  background: var(--accent-hover);
}

.logout-form {
  margin: 0;
}

/* Layout ------------------------------------------------------------------ */

.app-main {
  width: 100%;
  padding: 28px 32px 72px;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn:hover,
.btn:focus,
.btn:focus-visible,
.btn:visited {
  text-decoration: none;
}

.btn--primary {
  width: 100%;
  background: var(--primary-button);
  color: var(--on-primary);
  margin-top: 4px;
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--on-brand);
  border-color: var(--on-brand-border);
  padding: 7px 14px;
  font-size: 0.85rem;
}

.btn--ghost:hover {
  background: var(--on-brand-wash);
}

.btn:focus-visible,
.field__input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Empty state ------------------------------------------------------------- */

.empty-state {
  position: relative;
  max-width: 720px;
  margin: 8vh auto 0;
  padding: 44px 44px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.empty-state::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
}

.empty-state__eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.empty-state__title {
  margin: 0;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--brand);
}

.empty-state__hint {
  margin: 16px 0 0;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Board shell ------------------------------------------------------------- */

.board-shell {
  min-height: 320px;
  padding: 28px;
  border: 1px dashed var(--brand-line-soft);
  border-radius: var(--radius);
  background: var(--brand-tint);
}

.board-shell__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Auth pages -------------------------------------------------------------- */

.auth-card {
  position: relative;
  max-width: 460px;
  margin: 5vh auto 0;
  padding: 38px 38px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
}

.auth-card__eyebrow {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-card__title {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.25;
  color: var(--brand);
}

.auth-card__sub {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-form {
  margin: 26px 0 0;
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.field__input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-background);
  font: inherit;
  color: var(--text);
}

.field__input:hover {
  border-color: var(--brand-border-hover);
}

.field__input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.field__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field__hint--error {
  color: var(--danger);
  font-weight: 600;
}

.field__error {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--danger);
}

.form-error {
  margin: 20px 0 0;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--danger-border);
  background: var(--danger-wash);
  color: var(--danger-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row__input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.checkbox-row__label {
  font-size: 0.9rem;
  color: var(--text);
}

.auth-switch {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Header extras ----------------------------------------------------------- */

.header-link {
  color: var(--on-brand);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--on-brand-border-soft);
  padding-bottom: 2px;
}

.header-link:hover {
  border-color: var(--on-brand);
}

/* Toasts ------------------------------------------------------------------ */
/* A confirmation floats in the top-right corner over the page rather than
   sitting in it, so the board never moves for a message that clears itself.
   The offset clears the sticky header. */

.toast-stack {
  position: fixed;
  top: 84px;
  right: 16px;
  z-index: 120;
  display: grid;
  justify-items: end;
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 10px 8px 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-in 180ms ease-out;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.toast__message {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow-wrap: break-word;
}

.toast__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.toast__close:hover {
  background: var(--brand-tint);
}

.toast__close:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.toast--success {
  border-color: var(--brand-border);
  background: var(--brand-tint);
  color: var(--brand);
}

.toast--error {
  border-color: var(--danger-border-strong);
  background: var(--danger-wash);
  color: var(--danger-text);
}

/* Reduce motion: the toast is simply there, and simply gone. The same account
   setting and device signal that clear every other animation drive this. */
html[data-reduce-motion="on"] .toast,
html[data-reduce-motion="on"] .toast-stack {
  animation: none;
  transition: none;
}

/* Board head -------------------------------------------------------------- */

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.board-head__eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.board-head__title {
  margin: 0;
  font-size: 1.7rem;
  color: var(--brand);
}

/* Guided setup modal ------------------------------------------------------ */

[x-cloak] {
  display: none !important;
}

body.onboarding-open,
body.add-modal-open,
body.instance-modal-open {
  overflow: hidden;
}

.onboarding-layer,
.add-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 12px;
}

.add-modal-layer[hidden] {
  display: none;
}

.add-modal [hidden] {
  display: none !important;
}

.add-modal__form {
  margin-top: 20px;
}

.add-modal__draft-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.onboarding-backdrop,
.add-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
}

.onboarding-modal,
.add-modal {
  position: relative;
  z-index: 1;
  width: min(640px, 94vw);
  height: min(640px, 92dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 28px 70px var(--modal-shadow);
}

.onboarding-header {
  flex: 0 0 auto;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.onboarding-header__eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.onboarding-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.onboarding-progress__item {
  padding: 3px 7px;
  border-radius: 999px;
}

.onboarding-progress__item.is-current {
  background: var(--accent-soft);
  color: var(--warning-text-deep);
  font-weight: 700;
}

.onboarding-progress__item.is-complete {
  color: var(--brand);
}

.onboarding-progress__dot {
  color: var(--border);
}

.onboarding-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.onboarding-title {
  margin: 0;
  color: var(--brand);
  font-size: 1.45rem;
  line-height: 1.25;
}

.onboarding-helper {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.onboarding-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.onboarding-add-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.onboarding-add-row .field {
  flex: 1;
}

.onboarding-add-row .btn {
  margin-bottom: 1px;
}

.onboarding-income-form,
.onboarding-bill-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.onboarding-income-list,
.onboarding-bill-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.onboarding-income-row,
.onboarding-bill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--brand-tint);
  font-size: 0.88rem;
}

.onboarding-income-row__name,
.onboarding-bill-row__name {
  color: var(--brand);
  font-weight: 700;
}

.onboarding-income-row__meta,
.onboarding-bill-row__meta {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: right;
}

.onboarding-income-row form,
.onboarding-bill-row form,
.onboarding-footer form {
  margin: 0;
}

.onboarding-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.onboarding-split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}

.onboarding-split .onboarding-income-form,
.onboarding-split .onboarding-bill-form {
  margin-top: 0;
}

/* The section's own action: adding is the strong button, Continue the quiet
   way past the step. */
.onboarding-form__actions {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 14px;
}


.onboarding-aside {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.onboarding-aside__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.onboarding-aside .onboarding-income-list,
.onboarding-aside .onboarding-bill-list {
  margin: 10px 0 0;
}

.onboarding-aside .onboarding-empty {
  margin: 10px 0 0;
}

.onboarding-aside__hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.onboarding-aside .onboarding-income-row,
.onboarding-aside .onboarding-bill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 8px;
  padding: 8px 10px;
}

.onboarding-aside .onboarding-income-row__name,
.onboarding-aside .onboarding-bill-row__name {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.onboarding-aside .onboarding-income-row__meta,
.onboarding-aside .onboarding-bill-row__meta {
  grid-column: 1 / -1;
  margin-left: 0;
  text-align: left;
}

.onboarding-aside .onboarding-income-row .link-button,
.onboarding-aside .onboarding-bill-row .link-button {
  grid-column: 2;
  grid-row: 1;
}

/* The row's name selects the paycheck for correction; Remove stays at the
   right. */
.onboarding-aside .onboarding-income-row .onboarding-income-row__edit {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
}

.onboarding-aside .onboarding-income-row .onboarding-income-row__edit:hover,
.onboarding-aside .onboarding-income-row .onboarding-income-row__edit:focus-visible {
  text-decoration: underline;
}

.onboarding-aside .onboarding-income-row.is-editing {
  box-shadow: inset 0 0 0 1px var(--brand);
}

@media (max-width: 760px), (max-height: 620px) {
  .onboarding-split {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Stacked: what has been added sits above the form, so the newest row is
     the last thing above the field the flow puts focus back on. */
  .onboarding-split .onboarding-aside {
    order: -1;
  }

  /* Full-width rows keep one line here, so several items fit in the short view. */
  .onboarding-aside .onboarding-income-row,
  .onboarding-aside .onboarding-bill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
  }

  .onboarding-aside .onboarding-income-row__meta,
  .onboarding-aside .onboarding-bill-row__meta {
    flex: 1 1 200px;
    margin-left: auto;
    text-align: right;
  }

  .onboarding-aside .onboarding-income-row .link-button,
  .onboarding-aside .onboarding-bill-row .link-button {
    flex: 0 0 auto;
  }

  /* Keep that list in view when focus lands in the form: the first field is
     scrolled in with room above it for the newest rows. */
  .onboarding-split .onboarding-income-form [name="name"],
  .onboarding-split .onboarding-bill-form [name="name"] {
    scroll-margin-top: 120px;
  }
}

.onboarding-summary {
  margin: 18px 0 0;
  color: var(--brand);
  font-size: 1rem;
  font-weight: 700;
}

.onboarding-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
}

.onboarding-footer__message {
  flex: 1 1 100%;
  min-height: 0;
}

.onboarding-saving {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.onboarding-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--danger-border);
  background: var(--danger-wash);
  color: var(--danger-text);
  font-size: 0.86rem;
  font-weight: 600;
}

.onboarding-footer__left,
.onboarding-footer__right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

/* The step's primary action wears the landing page's amber treatment, sized to
   the footer rather than the full width .btn--primary gives a form. */
.onboarding-footer__right .btn--primary {
  width: auto;
  margin-top: 0;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
}

.onboarding-footer__right .btn--primary:hover {
  background: var(--accent-hover);
}

.onboarding-footer__right .btn--primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.onboarding-quiet {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.onboarding-quiet:hover {
  color: var(--brand);
}

.onboarding-quiet:focus-visible,
.link-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.onboarding-quiet.is-disabled,
.onboarding-quiet:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn--amber-pill {
  width: auto;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
}

.btn--amber-pill:hover {
  background: var(--accent-hover);
}

.btn--amber-pill:disabled {
  opacity: 0.45;
  cursor: default;
}

.setup-form {
  display: grid;
  gap: 12px;
}

.setup-form .btn--primary {
  width: auto;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-group[hidden] {
  display: none;
}

.people-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--brand-tint);
  font-size: 0.9rem;
}

.person__name {
  font-weight: 600;
  color: var(--brand);
}

.person__note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.person__email {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.person__invite-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.access-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.access-chip--invited {
  background: var(--accent-soft);
  color: var(--access-invited-text);
}

.access-chip--member {
  background: var(--brand-tint);
  color: var(--brand);
}

.person__you {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.person__remove {
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--danger);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Slim setup bar ---------------------------------------------------------- */

.setup-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--brand-tint);
}

.setup-bar__status {
  margin: 0;
  font-weight: 700;
  color: var(--brand);
}

.setup-bar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn--secondary {
  background: var(--surface-raised);
  color: var(--brand);
  border-color: var(--brand-border);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn--secondary:hover {
  background: var(--primary-button);
  color: var(--on-primary);
}

/* Board columns ----------------------------------------------------------- */

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.board-column__date {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.board-column__flag {
  margin: 6px 0 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.board-column__flag--soon {
  margin-top: 2px;
  color: var(--warning-text);
}

.board-column__fit-total {
  margin: 6px 0 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.check-head__flag {
  margin: 6px 0 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--danger);
}

.check-head__flag--soon {
  margin-top: 2px;
  color: var(--warning-text);
}

.board-columns {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 14px;
}

.board-column {
  flex: 1 1 264px;
  min-width: 264px;
  min-height: 160px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-tint);
}

.board-column--backlog {
  background: var(--surface);
}

.board-column__head {
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.board-column__title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--brand);
}

.board-column__count {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.board-column__cards {
  display: grid;
  gap: 10px;
}

.board-column__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.board-add-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.board-add-row:hover,
.board-add-row:focus-visible {
  background: var(--hover-wash);
  color: var(--text);
}

.board-add-row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.board-add-row:disabled {
  cursor: wait;
  opacity: 0.6;
}

.check-new {
  margin-top: 0;
}

.check-column {
  background: var(--surface-raised);
}

.check-head__contributor {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand);
}

.check-head__income {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.check-head__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.check-head__identity {
  min-width: 0;
}

.check-head__tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: -2px;
}

.check-head__count {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}

.check-plan {
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  cursor: pointer;
}

.check-plan:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.check-plan:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.check-head__tools .check-menu {
  margin-top: 0;
}

.check-head[data-check-open] {
  cursor: pointer;
}

.check-head[data-check-open]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 6px;
}

.check-column .board-column__empty {
  font-size: 0.78rem;
}

.check-head__date {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.is-negative {
  color: var(--danger);
}

/* Bill cards -------------------------------------------------------------- */

.bill-card {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-line);
  border-radius: 10px;
}

.bill-card--arrears {
  border-left-color: var(--danger);
  background: var(--state-arrears-surface);
}

.bill-card--due-soon {
  border-left-color: var(--state-due-edge);
  background: var(--state-due-surface);
}

.bill-card--paid {
  opacity: 0.6;
  border-left-color: var(--brand);
}

.bill-card {
  position: relative;
}

.bill-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-right: 22px;
}

.card-menu {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 15;
}

.card-menu__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

.card-menu__toggle::-webkit-details-marker {
  display: none;
}

.card-menu__toggle:hover {
  background: var(--brand-tint);
  color: var(--brand);
}

.card-menu__list {
  position: absolute;
  right: 0;
  z-index: 40;
  width: 230px;
  max-height: 300px;
  overflow: auto;
  margin-top: 6px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* An open menu escapes its column's scroll box: the list is fixed and placed
   from the toggle by board.js, so the column can never clip it, cap its width
   or hand it a scrollbar.  It is as wide and as tall as its own labels. */
.card-menu[open] > .card-menu__list,
.check-menu[open] > .card-menu__list {
  position: fixed;
  right: auto;
  bottom: auto;
  width: max-content;
  max-width: calc(100vw - 16px);
  max-height: none;
  overflow: visible;
  margin-top: 0;
}

.card-menu__list button {
  padding: 7px 9px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.card-menu__list button:hover {
  background: var(--brand-tint);
  color: var(--brand);
}

.card-menu__list button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* Dragging ---------------------------------------------------------------- */

.bill-card {
  touch-action: none;
}

.bill-card--dragging {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0.96;
  transform: rotate(2deg);
  box-shadow: var(--shadow-strong);
}

.bill-card--source {
  opacity: 0.35;
}

body.is-dragging {
  user-select: none;
  cursor: grabbing;
}

.board-column--drop {
  outline: 2px dashed var(--focus);
  outline-offset: -4px;
  background: var(--drop-surface);
}

/* A drag tints each check by the Coverage Guard's own test: a check whose Left
   can cover the card stays lit, one that cannot dims.  That is an interaction
   state, not a colour meaning, so it is opacity alone.  Unplanned never takes
   it — a card can always go back. */
.board-page .board-column--no-cover {
  opacity: 0.45;
}

.drop-preview {
  margin: 6px 0 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.bill-card__name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.bill-card__amount {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.bill-card__meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.bill-card__state-tag {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.bill-card__state-tag--arrears {
  color: var(--danger);
}

.bill-card__state-tag--catchup {
  color: var(--text-muted);
  font-weight: 600;
}

.bill-card__due {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* An Unplanned due line carries how long it has left, so let it wrap. */
.bill-card__due--relative {
  white-space: normal;
}

/* The card's quiet fit line: information in the meta register, not a state. */
.bill-card__fits {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-card__behind {
  margin: 8px 0 0;
  color: var(--danger-text);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bill-card__behind--covered {
  color: var(--text-muted);
  font-weight: 600;
}

.bill-card__oneoff {
  padding: 2px 7px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: var(--page);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bill-card__tag {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.bill-card__autopay {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-button);
  color: var(--on-primary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bill-card__stamp {
  display: inline-block;
  margin-top: 8px;
  padding: 1px 8px;
  border: 1px solid var(--brand);
  border-radius: 4px;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.board-legend {
  margin: 14px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* Late-placement warning -------------------------------------------------- */

.warning-card {
  position: relative;
  max-width: 560px;
  margin: 6vh auto 0;
  padding: 36px 36px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.warning-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent);
}

.warning-card__eyebrow {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.warning-card__title {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.3;
  color: var(--brand);
}

.warning-card__facts {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--brand-tint);
}

.warning-card__facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.warning-card__facts dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.warning-card__facts dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: right;
}

.warning-form {
  margin-top: 22px;
}

.warning-form__ignore {
  margin-bottom: 18px;
}

.warning-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.warning-card__actions .btn--primary {
  width: auto;
  margin-top: 0;
}

/* Settings ---------------------------------------------------------------- */

.settings {
  /* Wide enough for the rail and a panel side by side. */
  max-width: 1140px;
  margin: 0 auto;
}

.settings__eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.settings__title {
  margin: 0;
  font-size: 1.6rem;
  color: var(--brand);
}

.settings__sub {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.settings__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.settings-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-card__title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: var(--brand);
}

.settings-id {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.settings-id__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.settings-id__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--brand);
  overflow-wrap: anywhere;
}

.settings__back {
  margin: 22px 0 0;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .settings__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-header__inner,
  .app-main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .onboarding-layer {
    padding: 0;
  }

  .onboarding-header,
  .onboarding-content,
  .onboarding-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .onboarding-quiet {
    font-size: 0.8rem;
  }

  .btn--amber-pill {
    padding: 9px 16px;
  }

  .account-chip__email {
    display: none;
  }

  .empty-state {
    padding: 32px 24px;
  }

  .auth-card {
    margin-top: 2vh;
    padding: 30px 22px 24px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

/* Splits ------------------------------------------------------------------ */

.card-menu__list form {
  display: grid;
  gap: 2px;
}

.card-menu__list form + form {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.card-menu__list button:disabled {
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.card-menu__list button:disabled:hover {
  background: none;
  color: var(--text-muted);
}

.bill-card__part {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Its own line, the card's full width to spend: one line wherever the column
   has the room, and a wrap between words on the narrowest check cards, never
   one character per line and never a clipped label. */
.bill-card__split {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.split-card {
  position: relative;
  max-width: 560px;
  margin: 4vh auto 0;
  padding: 34px 36px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.split-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
}

.split-card__eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.split-card__title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--brand);
}

.split-card__hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.split-form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.split-form__money {
  position: relative;
}

.split-form__currency {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.split-form__input {
  padding-left: 26px;
  font-variant-numeric: tabular-nums;
}

.split-form__slider-label {
  margin-bottom: -10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.split-slider {
  width: 100%;
  accent-color: var(--brand);
}

.split-ratios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split-ratio {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--brand);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.split-ratio:hover {
  border-color: var(--brand);
}

.split-preview {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.split-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.split-card__actions .btn--primary {
  width: auto;
  margin-top: 0;
}

.split-card__actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Membership, switcher, roles --------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.household-switcher {
  margin: 0;
}

.household-switcher__select {
  max-width: 190px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--on-brand-border-soft);
  background: var(--on-brand-field-wash);
  color: var(--on-brand);
  font: inherit;
  font-size: 0.82rem;
}

.household-switcher__select option {
  color: var(--text);
}

.role-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--warning-text-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* The two roadmap views ----------------------------------------------------- */

.road-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.road-switch__link {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.road-switch__link:hover {
  color: var(--accent-strong);
}

.road-switch__link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Roadmap admin ------------------------------------------------------------ */

.roadmap-admin__list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.roadmap-admin__row {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.roadmap-admin__form {
  display: grid;
  gap: 12px;
}

.roadmap-admin__fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.roadmap-admin__textarea {
  min-height: 74px;
  resize: vertical;
}

.roadmap-admin__actions,
.roadmap-admin__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.roadmap-admin__controls form {
  margin: 0;
}

.roadmap-admin__delete {
  color: var(--danger);
}

/* Suggestions admin -------------------------------------------------------- */

.suggestion-row__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.suggestion-row__title {
  margin: 0;
  font-size: 1rem;
}

.suggestion-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.suggestion-status {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
}

.suggestion-status--on-the-road {
  background: var(--accent);
  color: var(--accent-text);
}

/* Members ----------------------------------------------------------------- */

.settings-card--wide {
  margin-top: 18px;
}

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

.member-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.member-row:first-child {
  border-top: none;
}

.member-row__identity {
  display: grid;
  min-width: 210px;
}

.member-row__email {
  font-size: 0.9rem;
  font-weight: 600;
}

.member-row__joined {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.member-row__role {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand);
}

.member-row__form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.member-row__select {
  width: auto;
  padding: 6px 8px;
  font-size: 0.8rem;
}

/* One aligned form per person: name, email with its invite action, access,
   remove.  Every row shares the columns, so the list reads as one form. */
.person-row {
  display: grid;
  /* Fixed tracks, not content-sized ones: every row computes the same
     columns, so the list reads as a single form. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(160px, 0.65fr) 88px;
  gap: 12px 14px;
  align-items: end;
  width: 100%;
}

.person-row__cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.person-row__cell--actions {
  justify-items: end;
}

.person-row__form {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
}

.person-row__access {
  /* The email and the access select post as one form, but each cell belongs
     to the row's grid so every row keeps the same columns. */
  display: contents;
}

.person-row__line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.person-row__line .field__input {
  flex: 1 1 auto;
  min-width: 0;
}

.person-row__action {
  flex: 0 0 auto;
  align-self: stretch;
  white-space: nowrap;
}

.person-row__select {
  width: 100%;
  padding: 11px 8px;
  font-size: 0.9rem;
}

.person-row__value {
  padding: 11px 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.person-row__extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.person-row__note {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

@media (max-width: 900px) {
  .person-row {
    grid-template-columns: 1fr;
  }

  .person-row__cell--actions {
    justify-items: start;
  }
}

.member-row__note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.invite-result__row--inline {
  flex: 1 1 420px;
}

.invite-result__row--inline .field__input {
  flex: 1;
  min-width: 220px;
}

@media (max-width: 640px) {
  .onboarding-add-row {
    flex-wrap: wrap;
  }

  .onboarding-add-row .btn {
    width: 100%;
  }
}

.invite-form {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.invite-form__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.invite-form__row .field__input {
  max-width: 340px;
}

.invite-result {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--brand-tint);
}

.invite-result__title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand);
}

.invite-result__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invite-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.invite-actions .btn--primary {
  width: 100%;
}

.settings-readonly {
  margin: 0;
  font-weight: 600;
}

.danger-zone {
  border-color: var(--danger-border-soft);
}

.danger-zone__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--danger);
}

.danger-zone__text {
  font-weight: 600;
}

/* Start over: a native dialog, so escape and focus handling are the browser's. */
.reset-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--danger-border-soft);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.reset-dialog::backdrop {
  background: var(--scrim);
}

.reset-dialog__form {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.reset-dialog__title {
  margin: 0;
  font-size: 1.2rem;
}

.reset-dialog__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.reset-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.btn--danger {
  width: auto;
  background: var(--danger);
  color: var(--on-danger);
  border-color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-strong);
}

/* Use this check walk ----------------------------------------------------- */

.walk-start {
  margin: 12px 0 0;
}

.btn--walk {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.82rem;
  background: var(--surface-raised);
  color: var(--brand);
  border-color: var(--brand);
}

.btn--walk:hover:not(:disabled) {
  background: var(--primary-button);
  color: var(--on-primary);
}

.btn--walk:disabled {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--disabled-surface);
  cursor: not-allowed;
}

.walk-start__empty {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.bill-card__paid {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paid-surface);
  color: var(--paid-text);
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.walk-card {
  max-width: 560px;
  margin: 3vh auto 0;
  padding: 30px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.walk-card__eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.walk-progress {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}

.walk-card__bill {
  margin-top: 12px;
  padding: 16px;
}

.walk-card__bill .bill-card__name {
  font-size: 1.15rem;
}

.walk-card__bill .bill-card__amount {
  font-size: 1.05rem;
}

.walk-balance {
  display: grid;
  gap: 4px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--brand-tint);
}

.walk-balance__line {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.walk-form {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.walk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.walk-actions .btn--primary {
  width: auto;
  margin-top: 0;
}

.walk-actions .btn--secondary {
  padding: 11px 20px;
  font-size: 0.95rem;
}

.walk-stop {
  margin-top: 16px;
}

.walk-card__left {
  margin: 0;
  font-size: 1.5rem;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.actual-card__title {
  margin: 0;
  color: var(--brand);
  font-size: 1.55rem;
}

.actual-card__scheduled {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.actual-card__notice {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--warning-text);
  border-radius: 10px;
  background: var(--state-due-surface);
  color: var(--text);
}

.actual-card__notice-line,
.actual-card__notice-consequence {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.actual-card__notice-consequence {
  margin-top: 4px;
}

.actual-card__error {
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.actual-card__form {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.actual-card__use {
  width: auto;
  margin-top: 4px;
  justify-self: start;
}

.actual-card__saved {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.actual-card__continue {
  margin-top: 14px;
}

.actual-card__back {
  margin: 18px 0 0;
  font-size: 0.88rem;
}

.walk-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.walk-summary__title {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.walk-summary__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.walk-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.walk-summary__empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.walk-summary__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.walk-close,
.walk-retire {
  margin-top: 0;
}

.walk-close .btn--primary,
.walk-retire .btn--secondary {
  width: auto;
  margin-top: 0;
}

@media (max-width: 640px) {
  .walk-summary {
    grid-template-columns: 1fr;
  }
}

/* Auto-assigned placement lock ------------------------------------------- */

.board-lock-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid var(--brand-border-strong, var(--border));
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--text);
  flex: 0 0 auto;
}

.board-lock-notice[hidden] {
  display: none;
}

.board-lock-notice__text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
}

.board-lock-notice__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.board-lock-notice__open {
  white-space: nowrap;
}

.board-lock-notice__dismiss {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

/* A refused placement: the notice the eye must land on ------------------- */

.board-lock-notice--refusal {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 0 0 14px;
  padding: 16px 18px 16px 20px;
  border: 1px solid var(--brand-border-strong, var(--border));
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: var(--brand-tint);
  box-shadow: var(--shadow);
}

.board-lock-notice__body {
  display: grid;
  gap: 4px;
  flex: 1 1 260px;
  min-width: 0;
}

.board-lock-notice__heading {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.board-lock-notice--refusal .board-lock-notice__text {
  font-size: 0.86rem;
  line-height: 1.45;
}

.board-lock-notice--refusal .board-lock-notice__actions {
  align-self: center;
  gap: 12px;
}

.board-lock-notice__split {
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.board-lock-notice__dismiss-form {
  margin: 0;
}

.bill-card--auto-locked {
  cursor: default;
}

.instance-auto__locked {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--brand-border-strong, var(--border));
  border-radius: 8px;
  background: var(--brand-tint);
}

.instance-auto__locked-line {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.instance-auto__release {
  font-size: 0.78rem;
}

/* Linked bills ------------------------------------------------------------ */

.bill-card__auto {
  padding: 1px 7px;
  border: 1px solid var(--brand-border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Check column income menu ------------------------------------------------ */

.check-menu {
  position: relative;
  margin-top: 4px;
  text-align: left;
}

.check-menu .card-menu__list {
  left: 0;
  right: auto;
}

.check-menu .card-menu__toggle {
  display: inline-flex;
}

/* Full-height board ------------------------------------------------------- */

.board-page {
  --nav-height: 0px;
  --board-chrome-height: 0px;
  --board-panel-width: 300px;
  --board-bottom-space: 72px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-page .app-header {
  flex: 0 0 auto;
}

.board-page .app-main {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - var(--nav-height, 0px));
  height: calc(100dvh - var(--nav-height, 0px));
  padding: 28px 32px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-page .board {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.board-page .board-head,
.board-page .setup-bar,
.board-page .board-toolbar {
  flex: 0 0 auto;
}

.board-page .board-toolbar--slim {
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0;
  min-height: 34px;
}

.board-toolbar__left,
.board-toolbar__center,
.board-toolbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* The two side blocks give way equally, so the add buttons sit in the middle
   of the bar and the date range keeps the right edge. */
.board-toolbar__left {
  flex: 1 1 0;
  overflow: hidden;
}

.board-toolbar__center {
  flex: 0 0 auto;
}

.board-toolbar__right {
  flex: 1 1 0;
  justify-content: flex-end;
}

.board-page .board-toolbar__done {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.board-toolbar__actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.board-toolbar__actions .btn {
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Randall's walkthrough note: the two add pills were surface-coloured and sank
   into the bar.  The accent at low strength reads as a choice without
   shouting, and the hover is the solid accent fill the primary buttons use. */
.board-toolbar__add {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.board-toolbar__add:hover,
.board-toolbar__add:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.board-page .board-columns {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - var(--nav-height, 0px) - var(--board-chrome-height, 0px) - var(--board-bottom-space, 0px));
  height: calc(100dvh - var(--nav-height, 0px) - var(--board-chrome-height, 0px) - var(--board-bottom-space, 0px));
  align-items: stretch;
  overflow: hidden;
  padding-bottom: 0;
}

.board-page .board-column {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board-region {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.board-bottom-space {
  flex: 0 0 var(--board-bottom-space, 72px);
  width: 100%;
  min-height: 0;
}

.board-page .board-column__head {
  flex: 0 0 auto;
}

.board-page .board-column__cards {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
  grid-auto-rows: max-content;
}

.board-page .board-checks .board-column__cards {
  grid-template-columns: minmax(0, 1fr);
  scrollbar-width: thin;
}

/* Compact Trello-family card chrome, scoped to the board. */
.board-page .bill-card--compact {
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  background: var(--surface-raised);
  border: 0;
  border-left: 4px solid var(--brand-line);
  border-radius: 8px;
  box-shadow: 0 1px 2px var(--card-shadow),
    0 0 1px var(--card-shadow-strong);
}

.board-page .board-checks .bill-card--compact .bill-card__row {
  min-width: 0;
}

.board-page .board-checks .bill-card--compact .bill-card__name {
  min-width: 0;
  font-size: 0.82rem;
  overflow-wrap: break-word;
}

.board-page .board-checks .bill-card--compact .bill-card__amount {
  flex: 0 0 auto;
}

.board-page .board-checks .bill-card--compact .bill-card__meta {
  gap: 4px;
}

.board-page .board-checks .bill-card--compact .bill-card__due {
  white-space: nowrap;
}

.board-page .board-checks .bill-card--compact .bill-card__due--relative {
  white-space: normal;
}

.board-page .bill-card--compact.bill-card--arrears {
  background: var(--state-arrears-surface);
  border-left-color: var(--danger);
}

.board-page .bill-card--compact.bill-card--due-soon {
  background: var(--state-due-surface);
  border-left-color: var(--state-due-edge);
}

.board-page .bill-card--compact.bill-card--paid {
  opacity: 0.6;
  border-left-color: var(--brand);
}

.board-page .bill-card--compact.bill-card--source {
  opacity: 0.35;
}

.board-page .bill-card--compact.bill-card--dragging {
  box-shadow: var(--shadow-strong);
}

.check-ledger {
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* The label sits on its own line and the amounts below it, so a narrow column
   never clips a figure mid-number. */
.check-ledger__readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px;
  margin: 0;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.check-ledger__label {
  display: block;
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.check-ledger__remaining {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.check-ledger__separator,
.check-ledger__total {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

/* A check that holds only paid bills offers its one last act here. */
.check-retire {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}

.check-retire__line {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.check-retire__form {
  margin: 0;
}

.check-retire__button {
  width: 100%;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.check-retire .btn--primary {
  margin-top: 0;
  background: var(--accent);
  color: var(--accent-text);
}

.check-retire .btn--primary:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
}

/* Phone/narrow: keep today's document flow and page scroll. */
@media (max-width: 900px) {
  .board-page {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
    overflow-x: clip;
  }

  .board-page .app-main {
    height: auto;
    min-height: 0;
    padding-bottom: 72px;
    display: block;
    overflow: visible;
  }

  .board-page .board {
    display: block;
  }

  .board-page .board-columns {
    height: auto;
    flex: none;
    overflow-y: visible;
  }

  .board-page .board-column {
    height: auto;
    min-height: 160px;
    display: block;
  }

  .board-page .board-column__cards {
    overflow-y: visible;
  }
}

@media (max-width: 640px) {
  .board-page .app-main {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* Paged checks and frozen Backlog ---------------------------------------- */

.board-toolbar__range {
  margin: 0;
  color: var(--brand);
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.board-page .board-columns--paged {
  gap: 12px;
  overflow: hidden;
  padding: 4px 0 0;
}

.board-page .board-column--standard {
  flex: 0 0 auto;
}

.board-page .board-column--backlog {
  flex: 0 0 var(--board-panel-width, 300px);
  min-width: var(--board-panel-width, 300px);
  max-width: var(--board-panel-width, 300px);
  width: var(--board-panel-width, 300px);
  background: var(--brand-tint);
  border-color: var(--border-strong);
}

.board-panel__add {
  flex: 0 0 auto;
  margin: 0 0 10px;
}

.board-panel__add-mark {
  margin-right: 3px;
  color: var(--brand);
  font-size: 1rem;
  line-height: 1;
}

.board-page .board-checks {
  --board-check-min-width: 178px;
  --board-check-width: 178px;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 12px;
  overflow: hidden;
}

.board-page .board-checks .board-column--standard {
  flex: 0 0 var(--board-check-width);
  width: var(--board-check-width);
  min-width: 0;
  height: 100%;
}

.board-page .board-checks .check-column {
  padding: 8px;
}

.board-checks__empty {
  flex: 0 1 auto;
  align-self: flex-start;
  margin: 0;
  padding: 2px 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.board-page-arrow {
  flex: 0 0 30px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
}

.board-page-arrow:hover:not(:disabled),
.board-page-arrow:focus-visible:not(:disabled) {
  border-color: var(--border);
  background: var(--brand-tint);
}

.board-page-arrow:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.board-page-arrow:disabled,
.board-page-arrow.is-disabled {
  opacity: 0.22;
  cursor: default;
  pointer-events: none;
}

body.is-dragging .board-page-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 900px) {
  html:has(.board-page) {
    overflow-x: hidden;
  }

  .board-page .board-columns--paged {
    height: auto;
    overflow: hidden;
  }

  .board-page .board-checks {
    height: auto;
    overflow: hidden;
  }

  .board-page .board-column {
    height: auto;
    min-height: 160px;
    display: flex;
    flex-direction: column;
  }

  .board-page-arrow {
    min-height: 160px;
  }
}

/* Instance detail modal and notes ----------------------------------------- */

.bill-card__notes {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.instance-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 12px;
}

.instance-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
}

.instance-modal {
  position: relative;
  z-index: 1;
  width: min(620px, 94vw);
  max-height: min(760px, 92dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 28px 70px var(--modal-shadow);
}

.instance-modal__header {
  position: relative;
  flex: 0 0 auto;
  padding: 18px 54px 15px 22px;
  border-left: 6px solid var(--brand-line);
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.instance-modal__header--arrears {
  border-left-color: var(--danger);
  background: var(--state-arrears-surface);
}

.instance-modal__header--due-soon {
  border-left-color: var(--state-due-edge);
  background: var(--state-due-surface);
}

.instance-modal__header--paid {
  border-left-color: var(--brand);
  background: var(--surface-alt);
}

.instance-modal__header--later {
  border-left-color: var(--brand-line);
}

.instance-modal__eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.instance-modal__title {
  margin: 0;
  padding-right: 8px;
  color: var(--brand);
  font-size: 1.4rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.instance-modal__due {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The modal's full sentence: the Fits-on line's register, text only. */
.instance-modal__due-note {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.instance-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.instance-modal__close:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Check detail modal ------------------------------------------------------ */

.check-modal {
  width: min(560px, 94vw);
}

.check-modal__header {
  border-left-color: var(--brand);
  background: var(--surface-raised);
}

.check-modal__subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.check-modal__content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.check-modal__ledger {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.check-modal__ledger div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0;
}

.check-modal__ledger div + div {
  border-top: 1px dashed var(--border);
}

.check-modal__ledger dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.check-modal__ledger dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.check-modal__check-line dd {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.check-modal__actual-tag {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.check-modal__scheduled {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.check-modal__actual-edit {
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.check-modal__status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-modal__status-line {
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--state-arrears-surface);
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.check-modal__status-line--soon {
  background: var(--state-due-surface);
  color: var(--warning-text);
}

.check-modal__bills-title {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.9rem;
}

.check-modal__bill-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-modal__bill {
  padding: 7px 9px;
  border-left: 4px solid var(--brand-line);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: 0 1px 2px var(--card-shadow-soft);
}

.check-modal__bill--catchup {
  border-left-color: var(--danger);
  background: var(--state-arrears-surface);
}

.check-modal__bill--paid {
  border-left-color: var(--brand);
  opacity: 0.62;
}

.check-modal__bill-row,
.check-modal__bill-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.check-modal__bill-name {
  min-width: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.check-modal__bill-amount {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.check-modal__bill-meta {
  margin-top: 1px;
}

.check-modal__bill-due {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.check-modal__bill-state {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.check-modal__bill-state--catchup {
  color: var(--danger);
}

.check-modal__bill-state--paid {
  color: var(--brand);
}

.check-modal__empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Plan this check modal --------------------------------------------------- */

.plan-modal {
  width: min(560px, 94vw);
}

.plan-modal__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plan-modal__order {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.plan-modal__left {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.plan-modal__left-amount {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plan-modal__left-amount.is-negative {
  color: var(--danger);
}

.plan-modal__empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.plan-modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.plan-modal__list,
.plan-modal__leftout-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-modal__item {
  border-left: 4px solid var(--brand-line);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: 0 1px 2px var(--card-shadow-soft);
}

.plan-modal__label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  cursor: pointer;
}

.plan-modal__check {
  flex: 0 0 auto;
  margin-top: 3px;
  accent-color: var(--brand);
}

.plan-modal__bill {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.plan-modal__row,
.plan-modal__meta,
.plan-modal__leftout-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.plan-modal__name {
  min-width: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.plan-modal__amount {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plan-modal__meta {
  flex-wrap: wrap;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.plan-modal__late {
  color: var(--danger);
  font-weight: 700;
}

.plan-modal__after {
  margin-left: auto;
  font-weight: 700;
}

.plan-modal__leftout {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.plan-modal__leftout-title {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan-modal__leftout-item {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.plan-modal__leftout-item:last-child {
  border-bottom: 0;
}

.plan-modal__reason {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.plan-modal__actions {
  display: flex;
  justify-content: flex-end;
}

.plan-modal__error {
  margin: 0 0 12px;
  color: var(--danger);
  font-weight: 600;
}

.check-modal__walk {
  margin: 0;
}

.check-modal__walk-note {
  margin: 8px 0 0;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
}

.check-modal__walk-button {
  width: 100%;
}

.instance-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.instance-modal__loading {
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.instance-modal__amount {
  margin: 0;
  color: var(--brand);
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.instance-modal__paid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.instance-modal__location {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}

.instance-modal__behind {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--state-arrears-surface);
  color: var(--danger-text);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.instance-modal__behind--covered {
  background: var(--page);
  color: var(--text-muted);
  font-weight: 600;
}

.instance-modal__facts {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.instance-modal__facts div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
}

.instance-modal__facts div + div {
  border-top: 1px dashed var(--border);
}

.instance-modal__facts dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.instance-modal__facts dd {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.instance-edit {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--page);
}

.instance-edit__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.instance-edit__field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.instance-edit__grid .instance-edit__field {
  margin-top: 0;
}

.instance-edit__submit {
  margin-top: 14px;
}

@media (max-width: 520px) {
  .instance-edit__grid {
    grid-template-columns: 1fr;
  }
}

.instance-assign {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--page);
}

.instance-assign__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.instance-assign__title {
  margin: 0;
  color: var(--brand);
  font-size: 1rem;
}

.instance-assign__current {
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 700;
}

.instance-assign__helper {
  margin: 4px 0 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.instance-assign__split {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  color: var(--warning-text-deep);
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.45;
}

.instance-assign__banner {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--danger-border);
  border-radius: 9px;
  background: var(--danger-wash);
  color: var(--danger-text);
}

.instance-assign__banner-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
}

.instance-assign__banner-line {
  margin: 5px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.instance-assign__move {
  width: auto;
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.instance-assign__banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.instance-assign__split-toggle {
  margin: -4px 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.instance-assign__split-cta {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.instance-parts {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--page);
}

.instance-parts__title {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 1rem;
}

.instance-parts__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.instance-parts__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.instance-parts__row.is-this {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.instance-parts__label {
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 800;
}

.instance-parts__amount {
  justify-self: end;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
}

.instance-parts__location {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.instance-split {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.instance-split__helper {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.instance-assign__row--split {
  cursor: default;
}

.instance-assign__row--split.is-selected {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.instance-split__pick {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  cursor: pointer;
}

.instance-split__checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.instance-split__amount {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.instance-split__amount input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}

.instance-split__amount input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.instance-split__amount input:disabled {
  opacity: 0.55;
}

.instance-split__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.instance-split__even {
  width: auto;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.instance-split__cancel {
  font-size: 0.78rem;
}

.instance-split__remainder {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
}

.instance-split__confirm {
  width: 100%;
  margin-top: 2px;
}

.instance-split__warning {
  width: auto;
  max-width: none;
  margin: 12px 0 0;
  text-align: left;
}

.instance-split__warning .warning-card__title {
  font-size: 1rem;
}

.instance-split__warning .warning-card__facts {
  margin: 12px 0;
}

.instance-split__warning .warning-card__actions {
  flex-wrap: wrap;
}

.instance-split__warning-check {
  display: block;
}

.instance-assign__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.instance-assign__row {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.instance-assign__row:hover,
.instance-assign__row:focus-visible {
  border-color: var(--brand-border-hover);
  background: var(--surface-raised);
}

.instance-assign__row:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.instance-assign__row.is-current {
  border-color: var(--brand);
  background: var(--brand-tint);
  cursor: default;
}

.instance-assign__row:disabled {
  opacity: 0.72;
}

.instance-assign__row-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.instance-assign__who {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--brand);
}

.instance-assign__source {
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 600;
}

.instance-assign__date {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.instance-assign__now {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.instance-assign__figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.instance-assign__figure {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.instance-assign__label {
  color: var(--text-muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.instance-assign__value {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.instance-assign__value.is-negative {
  color: var(--danger-text);
}

.instance-assign__empty {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

.instance-auto {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--page);
}

.instance-auto__title {
  margin: 0;
  color: var(--brand);
  font-size: 1rem;
}

.instance-auto__helper {
  margin: 4px 0 14px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.instance-auto__field {
  display: grid;
  gap: 6px;
}

.instance-auto__direction {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.instance-auto__toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
}

.instance-auto__toggle button {
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.instance-auto__toggle button.is-active {
  background: var(--primary-button);
  color: var(--on-primary);
}

.instance-auto__toggle button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.instance-auto__target {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.instance-auto__saved {
  margin: 8px 0 0;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 700;
}

.instance-modal__notes {
  margin-top: 20px;
}

.instance-modal__notes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.instance-modal__notes-title {
  margin: 0;
  color: var(--brand);
  font-size: 1.05rem;
}

.instance-modal__note-count {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.instance-notes {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.instance-note {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: var(--surface-raised);
}

.instance-note__meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 9px;
}

.instance-note__author {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}

.instance-note__date {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.instance-note__delete {
  margin-left: auto;
  font-size: 0.74rem;
}

.instance-note__body {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 0.88rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.instance-notes__empty {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-style: italic;
}

.instance-note-form {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.instance-note-form__input {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  font: inherit;
  font-size: 0.88rem;
}

.instance-note-form__submit {
  justify-self: start;
  margin-top: 0;
}

.instance-modal__error {
  margin: 9px 0 0;
  color: var(--danger-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.instance-money {
  margin-top: 20px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
}

.instance-money__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.instance-money__title {
  margin: 0;
  color: var(--brand);
  font-size: 1rem;
}

.instance-money__remaining {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.instance-payment-form,
.instance-split-form {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.instance-payment-form .field__input {
  max-width: 190px;
  font-variant-numeric: tabular-nums;
}

.instance-money__submit {
  justify-self: start;
  margin-top: 2px;
}

.instance-money__paid {
  margin: 10px 0 0;
  color: var(--brand);
  font-size: 0.84rem;
  font-weight: 700;
}

.instance-payments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.instance-payments__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instance-payments__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.instance-payment {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.instance-payment__date {
  color: var(--text-muted);
}

.instance-payment__amount {
  color: var(--brand);
  font-weight: 700;
}

.instance-payments__empty {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.instance-split-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.instance-split-form__field {
  display: grid;
  gap: 4px;
}

.instance-split-form__field .field__input {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.instance-split-form__field input[readonly] {
  background: var(--page);
  color: var(--text-muted);
}

.instance-split-form__equation {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.instance-split-form .instance-money__submit {
  grid-column: 1 / -1;
}

.walk-notes {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: var(--walk-surface);
  list-style: none;
}

.walk-notes__title {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.walk-notes__item {
  color: var(--text);
  font-size: 0.86rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.walk-notes__item + .walk-notes__item {
  margin-top: 5px;
}

@media (max-width: 640px) {
  .instance-modal-layer {
    padding: 0;
  }

  .instance-modal {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .instance-modal__header,
  .instance-modal__body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .instance-modal__header {
    padding-right: 52px;
  }
}

/* Bills ------------------------------------------------------------------- */

.bills {
  max-width: 900px;
  margin: 0 auto;
}

.bills__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.bills__head .btn {
  flex-shrink: 0;
}

.bills__list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.bills__empty {
  margin-top: 24px;
}

.bill-row {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bill-row__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.bill-row__name {
  margin: 0;
  font-size: 1.05rem;
  color: var(--brand);
}

.bill-row__amount {
  margin: 3px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.bill-row__status {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.bill-row__status--arrears {
  background: var(--state-arrears-chip);
  color: var(--state-arrears-text-strong);
}

.bill-row__status--due_soon {
  background: var(--state-due-chip);
  color: var(--state-due-text-strong);
}

.bill-row__status--current {
  background: var(--state-current-chip);
  color: var(--state-current-text);
}

.bill-row__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}

.bill-row__fact {
  min-width: 0;
}

.bill-row__fact dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bill-row__fact dd {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text);
}

.bill-row__link-person {
  font-weight: 600;
}

.bill-row__direction {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
}

.bill-row__unlinked {
  color: var(--text-muted);
}

.bill-row__editor {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.bill-row__edit-toggle {
  width: fit-content;
  cursor: pointer;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 700;
}

.bill-row__edit-toggle:hover {
  color: var(--brand-strong);
}

.bill-form {
  margin-top: 16px;
  padding: 18px;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.bill-form__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bill-form__check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

/* Split definition editor: the parts a bill posts as. */
.split-def {
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.split-def .field__label {
  margin-bottom: 4px;
}

.split-def .field__hint {
  margin: 0 0 8px;
}

.split-def__parts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.split-def__part {
  display: flex;
  align-items: center;
  gap: 10px;
}

.split-def__part .field__input {
  max-width: 160px;
}

.split-def__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.split-def__even {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.split-def__count {
  width: 62px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.split-def [data-split-sum] {
  margin: 8px 0 0;
}

.bill-form__check input {
  margin-top: 2px;
}

.bill-form__actions,
.income-form__actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn--danger-ghost {
  width: auto;
  color: var(--danger);
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.btn--danger-ghost:hover {
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border-color: var(--danger);
}

.delete-review {
  margin-top: 16px;
  padding: 18px;
  background: var(--page);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  border-radius: 12px;
}

.delete-review__eyebrow {
  margin: 0 0 4px;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.delete-review__title {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.delete-review__intro,
.delete-review__line,
.delete-review__empty,
.delete-review__stay {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.delete-review__section {
  margin-top: 14px;
}

.delete-review__label {
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.delete-review__list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.delete-review__callout {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.delete-review__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.delete-review__stay {
  font-weight: 600;
  color: var(--text);
}

.delete-review__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 760px) {
  .bill-row__facts,
  .bill-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .bill-row__facts,
  .bill-form__grid {
    grid-template-columns: 1fr;
  }

  .bill-row__head {
    flex-direction: column;
  }

  .bill-row__status {
    text-align: left;
  }

  .bills__head .btn {
    width: 100%;
  }
}

/* Income ------------------------------------------------------------------ */

.income {
  max-width: 900px;
  margin: 0 auto;
}

.income__groups {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.income__empty {
  margin-top: 24px;
}

.income-group {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.income-group__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.income-group__name {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand);
}

.income-group__count {
  margin: 3px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.income-group__head .btn {
  flex-shrink: 0;
}

.income-streams {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.income-stream {
  padding: 16px;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.income-stream__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.income-stream__name {
  margin: 0;
  font-size: 1rem;
  color: var(--brand-strong);
}

.income-stream__amount {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.income-stream__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.income-stream__fact {
  min-width: 0;
}

.income-stream__fact dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.income-stream__fact dd {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text);
}

.income-group__empty {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--page);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.income-stream__editor {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.income-stream__edit-toggle {
  width: fit-content;
  cursor: pointer;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 700;
}

.income-stream__edit-toggle:hover {
  color: var(--brand-strong);
}

.income-form {
  margin-top: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.income-form__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 760px) {
  .income-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .income-group__head {
    flex-direction: column;
  }

  .income-group__head .btn {
    width: 100%;
  }

  .income-stream__head,
  .income-stream__facts,
  .income-form__grid {
    grid-template-columns: 1fr;
  }

  .income-stream__head {
    flex-direction: column;
    gap: 4px;
  }
}

/* Compact Bills and Income lists ------------------------------------------ */

.bills__list {
  display: block;
  margin-top: 20px;
  padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bill-row {
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.bill-row:last-child {
  border-bottom: 0;
}

.bill-row__summary {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  list-style: none;
}

summary.bill-row__summary {
  cursor: pointer;
}

.bill-row__summary::-webkit-details-marker,
.income-stream__summary::-webkit-details-marker {
  display: none;
}

.bill-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bill-row__identity {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.bill-row__amount {
  margin: 0;
}

.bill-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.bill-row__sep {
  color: var(--border);
}

.bill-row__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bill-row__link-person {
  color: var(--text);
  font-weight: 600;
}

.bill-row__split-flag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.bill-row__edit-hint {
  margin-left: auto;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.bill-row__edit-hint::after {
  content: " ▾";
  font-size: 0.8em;
}

.bill-row[open] .bill-row__edit-hint::after {
  content: " ▴";
}

.bill-form {
  margin: 2px 0 14px;
  padding: 16px;
}

.income__groups {
  gap: 12px;
  margin-top: 20px;
}

.income-group {
  padding: 16px 18px;
}

.income-streams {
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.income-stream {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.income-stream + .income-stream {
  border-top: 1px solid var(--border);
}

.income-stream__summary {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  list-style: none;
}

summary.income-stream__summary {
  cursor: pointer;
}

.income-stream__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.income-stream__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.income-stream__sep {
  color: var(--border);
}

.income-stream__edit-hint {
  margin-left: auto;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.income-stream__edit-hint::after {
  content: " ▾";
  font-size: 0.8em;
}

.income-stream[open] .income-stream__edit-hint::after {
  content: " ▴";
}

.income-form {
  margin: 2px 0 12px;
  padding: 16px;
  background: var(--page);
}

.income-group__empty {
  margin-top: 12px;
  padding: 12px 14px;
}

@media (max-width: 520px) {
  .bills__list {
    padding: 0 14px;
  }

  .bill-row__top {
    align-items: flex-start;
  }

  .bill-row__identity {
    flex-wrap: wrap;
    gap: 2px 10px;
  }

  .bill-row__edit-hint,
  .income-stream__edit-hint {
    margin-left: 0;
  }

  .bills__head .btn {
    width: auto;
  }
}

.bills__head .btn {
  width: auto;
  margin-top: 0;
}

/* Theme picker ------------------------------------------------------------ */

.theme-picker {
  border-top: 4px solid var(--accent);
}

.theme-picker__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.theme-picker__head .settings-card__title {
  margin-bottom: 4px;
}

.theme-picker__eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.theme-card__form {
  height: 100%;
  margin: 0;
}

.theme-card {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.theme-card:hover {
  border-color: var(--brand-border-hover);
}

.theme-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.theme-card--current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.theme-card__swatches {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.theme-card__swatch {
  display: block;
  width: 22px;
  height: 36px;
  background: var(--swatch);
}

.theme-card__meta {
  min-width: 0;
}

.theme-card__name {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.theme-card__mode {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.theme-card__current {
  align-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .theme-grid {
    grid-template-columns: 1fr;
  }
}

/* Platform admin --------------------------------------------------------- */

.admin-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px;
  width: min(1380px, calc(100% - 56px));
  margin: 0 auto;
  padding: 28px 0 56px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-sidebar__eyebrow,
.admin-main__eyebrow,
.admin-count-card__label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-sidebar__eyebrow {
  padding: 0 10px 12px;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav__link {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.admin-nav__link:hover {
  background: var(--brand-tint);
}

.admin-nav__link.is-active {
  background: var(--brand);
  color: var(--on-brand);
}

.admin-main {
  min-width: 0;
}

.admin-main__head {
  margin-bottom: 22px;
}

.admin-main__title {
  margin: 4px 0 0;
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  line-height: 1.1;
}

.admin-main__sub {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.admin-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.admin-counts--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.admin-count-card,
.admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-count-card {
  padding: 18px;
}

.admin-count-card__value {
  margin: 6px 0 0;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

.admin-card {
  padding: 20px;
  margin-bottom: 18px;
}

.admin-card__title {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.admin-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.admin-facts dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-facts dd {
  margin: 3px 0 0;
  font-weight: 650;
}

.admin-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-search .field__input {
  max-width: 420px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-card .admin-table-wrap {
  box-shadow: none;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table__strong {
  font-weight: 700;
}

.admin-household-role {
  display: block;
  margin-bottom: 3px;
}

.admin-household-role span,
.admin-muted {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-tag {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-empty {
  padding: 24px 14px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
    width: min(100% - 32px, 720px);
    padding-top: 18px;
  }

  .admin-sidebar {
    position: static;
  }

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

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

@media (max-width: 560px) {
  .admin-counts,
  .admin-counts--compact,
  .admin-facts {
    grid-template-columns: 1fr;
  }

  .admin-search {
    flex-direction: column;
  }
}


/* Platform admin actions and audit ---------------------------------------- */

.admin-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-card__head .admin-card__title {
  margin: 0;
}

.admin-card__link {
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-card__text {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.admin-card--danger {
  border-color: var(--danger-border-strong);
}

.admin-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 14px;
}

.admin-action-form {
  margin: 0;
}

.admin-tag--disabled {
  background: var(--danger-wash);
  color: var(--danger-text);
}

.admin-audit__time {
  white-space: nowrap;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.admin-empty--panel {
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.admin-card--danger .delete-review__eyebrow {
  margin: 0 0 10px;
}

.admin-card--danger .delete-review__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .admin-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Subscription banner ----------------------------------------------------- */

.subscription-banner {
  margin: 0 auto;
  padding: 12px 24px;
  background: var(--warning-soft);
  border-bottom: 1px solid var(--warning-border);
  color: var(--warning-text);
  font-weight: 700;
  text-align: center;
}

/* Billing ----------------------------------------------------------------- */

.billing-card {
  margin-top: 18px;
}

.billing-card__plan {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
}

.billing-card__status {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-weight: 600;
}

.billing-card__bill-line {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.billing-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.billing-card__actions form {
  margin: 0;
}

.admin-config-status {
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 700;
}

.admin-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.admin-card__actions form {
  margin: 0;
}

.admin-integration-form {
  display: grid;
  gap: 16px;
  max-width: 620px;
}

.admin-integration-form .btn--primary {
  width: auto;
  margin-top: 0;
}

@media (max-width: 900px) {
  .admin-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Export door --------------------------------------------------------------- */

.subscription-banner__export {
  margin-left: 8px;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.billing-card__exit {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.export-card .btn {
  margin-top: 10px;
}

/* Check lifecycle ---------------------------------------------------------- */

/* A finished check stays on the board until the user retires it. */
.check-head__finished {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 0;
  padding: 1px 9px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.check-head__finished-mark {
  font-size: 0.76rem;
  line-height: 1;
}

.check-column--finished {
  border-color: var(--brand-line);
}

/* The board-local Check log: a launcher in the bottom strip that opens the
   household's processed checks, newest activity first. Each row expands into
   its ledger and lifecycle history; Restore is the only action it carries. */
.check-log__toggle {
  position: fixed;
  left: 32px;
  bottom: 18px;
  z-index: 31;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.check-log__toggle:hover {
  border-color: var(--brand-line);
}

.check-log__toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.check-log__count {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.check-log {
  position: fixed;
  left: 32px;
  bottom: 58px;
  z-index: 30;
  width: min(720px, calc(100vw - 64px));
  max-height: 62vh;
  overflow-y: auto;
  padding: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
}

.check-log__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 8px;
}

.check-log__heading {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.check-log__close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.check-log__close:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.check-log__list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  list-style: none;
}

.check-log__row {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.84rem;
}

.check-log__line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
}

.check-log__details {
  flex: 1 1 auto;
  min-width: 0;
}

.check-log__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}

.check-log__summary::-webkit-details-marker {
  display: none;
}

.check-log__summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.check-log__summary::after {
  content: "›";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transition: transform 120ms ease;
}

.check-log__details[open] .check-log__summary::after {
  transform: rotate(90deg);
}

.check-log__identity {
  display: flex;
  flex-direction: column;
  min-width: 96px;
}

.check-log__person {
  font-weight: 700;
  color: var(--brand);
}

.check-log__income {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.check-log__facts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 72px;
}

.check-log__amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.check-log__left {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.check-log__state {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.check-log__state--finished,
.check-log__state--progress {
  border-color: var(--brand-line);
  color: var(--brand);
}

.check-log__when {
  display: flex;
  flex-direction: column;
  margin-left: auto;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.check-log__last {
  font-size: 0.72rem;
}

.check-log__record {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.check-log__subhead {
  margin: 6px 0 4px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.check-log__bills {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
  list-style: none;
}

.check-log__bill {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
}

/* A bill on a check's record opens its own panel, as a card does. */
.check-log__bill--open {
  cursor: pointer;
}

.check-log__bill--open:hover {
  border-color: var(--border-strong);
}

.check-log__bill--open:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.check-log__bill-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.check-log__bill-name {
  font-weight: 600;
}

.check-log__bill-amount {
  font-variant-numeric: tabular-nums;
}

.check-log__bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.check-log__bill-state {
  font-weight: 700;
}

.check-log__bill-state--paid {
  color: var(--brand);
}

.check-log__bill-state--catchup {
  color: var(--danger);
}

.check-log__bill-note {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.check-log__history {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  list-style: none;
}

.check-log__event {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 1px 10px;
  font-size: 0.78rem;
}

.check-log__event-label {
  font-weight: 600;
}

.check-log__event-when {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.check-log__event-detail {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.check-log__restore {
  flex: 0 0 auto;
  margin: 0;
}

.check-log__restore-button {
  padding: 3px 10px;
  font-size: 0.76rem;
}

.check-log__empty,
.check-log__empty-line {
  padding: 6px 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  list-style: none;
}

/* History: the same check-log rows, on a full page instead of the drawer. */
.history {
  max-width: 900px;
  margin: 0 auto;
}

.history__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.history__count {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* The board's arrears banner, now one slim line at the top of History. */
.history__arrears {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.check-log--page {
  position: static;
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* A restored check's record: occurrences that now live somewhere else. */
.check-modal__bill-note {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* --- Avatars: the chrome chip, the picker grid and the upload card -------- */

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-chip__identity {
  display: grid;
  gap: 1px;
}

.account-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-alt);
  object-fit: cover;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 64px));
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.avatar-grid li,
.avatar-grid form {
  height: 100%;
  margin: 0;
}

.avatar-tile {
  display: block;
  width: 100%;
  padding: 3px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 50%;
  line-height: 0;
  cursor: pointer;
}

.avatar-tile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
}

.avatar-tile:hover {
  border-color: var(--brand-border-hover);
}

.avatar-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.avatar-tile--current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.avatar-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.avatar-current__image {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-alt);
  object-fit: cover;
}

.avatar-upload {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  max-width: 420px;
}

.avatar-remove {
  margin-top: 8px;
}

.onboarding-avatar-upload {
  margin-top: 16px;
}

.onboarding-avatar-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.onboarding-avatar-preview .avatar-current__image {
  width: 56px;
  height: 56px;
}

/* The four-step flow: each step is one compact view over the board. */
.onboarding-header {
  position: relative;
}

.onboarding-step .onboarding-form {
  gap: 8px;
  margin-top: 10px;
}

.onboarding-step .onboarding-helper {
  margin-top: 4px;
}

.onboarding-content {
  padding: 18px 24px;
}

.onboarding-step .field-row {
  gap: 12px;
}

.onboarding-step .field {
  margin: 0;
}

.avatar-grid--onboarding {
  grid-template-columns: repeat(auto-fill, minmax(38px, 44px));
  gap: 6px;
  margin-top: 10px;
}

.onboarding-avatar-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 12px;
}

.onboarding-avatar-row .field {
  flex: 1;
  margin: 0;
}

.onboarding-avatar-current {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
}

.onboarding-footer {
  padding-top: 10px;
  padding-bottom: 10px;
}

.onboarding-footer__message {
  flex: 1 1 auto;
  min-width: 0;
}


/* Settings: a card's own switch, one per setting */
.switch-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  max-width: 560px;
}

.switch {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  cursor: pointer;
}

.switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 140ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-raised);
  box-shadow: 0 1px 3px var(--knob-shadow);
  transition: transform 140ms ease;
}

.switch__input:checked + .switch__track {
  background: var(--brand);
}

.switch__input:checked + .switch__track::after {
  transform: translateX(20px);
}

.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch__input:disabled + .switch__track {
  opacity: 0.55;
}

.switch__words {
  display: grid;
  gap: 2px;
}

.switch__name {
  font-weight: 600;
}

.switch__hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Settings side nav -------------------------------------------------------- */

.settings-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.settings-rail {
  position: sticky;
  top: 92px;
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-rail__eyebrow {
  margin: 0;
  padding: 0 10px 12px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-nav {
  display: grid;
  gap: 4px;
}

.settings-nav__link {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.settings-nav__link:hover {
  background: var(--brand-tint);
}

.settings-nav__link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.settings-nav__link.is-active {
  background: var(--brand);
  color: var(--on-brand);
}

.settings-main {
  min-width: 0;
}

.settings-main__head {
  margin-bottom: 20px;
}

.settings-panels {
  min-width: 0;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel > .settings-card + .settings-card {
  margin-top: 18px;
}

.settings-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  min-height: 20px;
  margin-bottom: 10px;
}

.settings-saved {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 220ms ease;
}

.settings-saved.is-visible {
  opacity: 1;
}

.settings-notice {
  margin: 0;
  color: var(--danger-text);
  font-size: 0.86rem;
  font-weight: 650;
}

.settings-notice[hidden] {
  display: none;
}

.settings-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings-add__field {
  flex: 1 1 220px;
  margin: 0;
}

@media (max-width: 900px) {
  .settings-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .settings-rail {
    position: static;
  }

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

/* Appearance: the account's own view settings ------------------------------ */

/* The legibility font ships with the app. Nothing is fetched from a font
   service, and the two weights are the ones the interface already uses. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Text size: everything sized against the root follows, so the whole app
   scales from one place. Default is the size it has always been. */
html[data-text-size="large"] {
  font-size: 18px;
}

html[data-text-size="xlarge"] {
  font-size: 20px;
}

html[data-font="legible"] {
  --app-font: "Atkinson Hyperlegible", system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;
}

/* Board density: padding and gaps only, so no text shrinks and no control
   moves. Compact stacks more of the same card in the same column. */
body.board-page[data-density="compact"] .board-columns {
  gap: 10px;
}

body.board-page[data-density="compact"] .board-region {
  gap: 8px;
}

body.board-page[data-density="compact"] .board-column {
  padding: 8px;
}

body.board-page[data-density="compact"] .board-column__head {
  padding-bottom: 6px;
  margin-bottom: 8px;
}

body.board-page[data-density="compact"] .board-column__cards {
  gap: 6px;
}

body.board-page[data-density="compact"] .bill-card--compact {
  padding: 3px 8px;
}

/* Reduced motion, resolved for this account: on makes every animation and
   transition land at once. The device signal reaches the same attribute
   through the head script, so this one rule covers both. */
html[data-reduce-motion="on"] *,
html[data-reduce-motion="on"] *::before,
html[data-reduce-motion="on"] *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

/* The landing page loads no behaviour script, so a device that asks for less
   motion says so here instead. A choice made in Settings still wins: this
   query only speaks for the Auto preference. */
@media (prefers-reduced-motion: reduce) {
  html[data-motion-preference="auto"] *,
  html[data-motion-preference="auto"] *::before,
  html[data-motion-preference="auto"] *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* A written state sits beside the colour, never instead of it, so a card can
   be read without seeing the difference between amber and coral. */
.bill-card__state-word {
  flex: 0 0 auto;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.bill-card__state-word--arrears {
  color: var(--state-arrears-text-strong);
}

.bill-card__state-word--due-soon {
  color: var(--state-due-text-strong);
}

.bill-card__state-word--paid {
  color: var(--paid-text);
}

html[data-state-labels="on"] .bill-card__meta {
  flex-wrap: wrap;
  row-gap: 4px;
}

/* Larger text needs room the columns do not have at Default. Letting the check
   head and its ledger wrap keeps every word readable instead of letting the
   name and the Plan button run into each other. Nothing wraps while it fits,
   so the Default size renders exactly as it did. */
html[data-text-size="large"] .check-head__top,
html[data-text-size="xlarge"] .check-head__top {
  flex-wrap: wrap;
  row-gap: 2px;
}

html[data-text-size="large"] .check-head__tools,
html[data-text-size="xlarge"] .check-head__tools {
  margin-left: auto;
}

html[data-text-size="large"] .check-ledger__readout,
html[data-text-size="xlarge"] .check-ledger__readout {
  flex-wrap: wrap;
  row-gap: 2px;
}

/* The Auto card: the two themes it pairs, each shown by its page colour. */
.theme-card__pair-swatch {
  display: block;
  width: 16px;
  height: 36px;
  background: var(--swatch);
}

.theme-card__pair {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* A two or three option control: the choice is a radio, the pill is its
   label, so the setting saves like every other control on the page. */
.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
}

.choice {
  position: relative;
  display: inline-flex;
}

.choice__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice__label {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.choice__input:checked + .choice__label {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.choice__input:focus-visible + .choice__label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* The overpayment question, in the payment panel and the check walk. */
.instance-extra,
.walk-extra {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.instance-extra__title,
.walk-extra__title {
  margin: 0;
  font-weight: 600;
}

.instance-extra__line,
.walk-extra__line {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
}

.instance-extra__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.instance-payment__carried {
  font-size: 12px;
  opacity: 0.75;
}


.instance-payment__undo {
  margin-left: auto;
  font-size: 0.78rem;
}

.instance-money__notice {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.walk-undo {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.walk-undo__line,
.walk-undo__form {
  margin: 0;
}

.walk-undo__error {
  flex-basis: 100%;
  margin: 2px 0 0;
  color: var(--danger);
}
