/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-base)/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; margin: 0 0 var(--space-2); letter-spacing: -0.015em; color: var(--ink); text-wrap: balance; }
h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }
a { color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--oxblood-deep); text-decoration-thickness: 2px; }
.muted { color: var(--muted); }
::selection { background: var(--oxblood); color: #fff; }

:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; border-radius: 2px; }

/* ---------- Frame ---------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); }
.main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: max(var(--space-5), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) var(--space-6) max(var(--space-4), env(safe-area-inset-left));
}

/* Signed-out pages: light throughout. The logo (made for a light ground) sits centred on the
   paper as the focal point, a slim oxblood line in the star's gradient runs across the very top,
   and the card rests below the logo. Content is top-aligned with fixed padding. */
.bare {
  --bare-top: 56px;
  min-height: 100dvh;
  padding: calc(var(--bare-top) + env(safe-area-inset-top)) var(--space-4) var(--space-6);
  background:
    linear-gradient(90deg, var(--brand-star-deep), var(--brand-star) 50%, var(--brand-star-deep)) top / 100% calc(3px + env(safe-area-inset-top)) no-repeat,
    var(--paper);
}
.bare > div { width: min(420px, 100%); margin: 0 auto; }
.bare .bare-logo { display: block; width: 264px; max-width: 100%; margin: 0 auto var(--space-6); }
.bare .bare-logo img { display: block; width: 100%; height: auto; }

/* ---------- Navigation: tab bar on phones, sidebar from 900 px ---------- */
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  background: var(--charcoal);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border-top: 1px solid rgb(255 255 255 / 8%);
}
.nav .brand, .nav .nav-foot { display: none; }
.nav ul { display: flex; margin: 0; padding: 0; list-style: none; height: var(--tabbar-height); }
.nav li { flex: 1 1 0; min-width: 0; }
.nav li a {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-width: 44px;
  padding: 0 var(--space-1);
  color: var(--on-dark-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-tap-highlight-color: transparent;
  transition: color 120ms var(--ease);
}
.nav li a::before {
  /* The active marker is the brand's thin white rule. */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 28px;
  height: 2px;
  background: #fff;
  transform: translateX(-50%) scaleX(0);
  transition: transform 160ms var(--ease);
}
.nav li a:hover { color: #fff; }
.nav li a[aria-current="page"] { color: #fff; }
.nav li a[aria-current="page"]::before { transform: translateX(-50%) scaleX(1); }
.nav :focus-visible { outline-color: #fff; outline-offset: -4px; border-radius: var(--radius-sm); }

/* ---------- Layout helpers ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.page-header h1 { margin: 0 0 var(--space-1); }
.page-header p { margin: 0; }
.stack > * { margin-top: 0; margin-bottom: 0; }
.stack > * + * { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5) var(--space-4);
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: var(--space-3); }

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
  padding: var(--space-6) var(--space-5);
}
.auth-card h1 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.auth-card h1 + p { color: var(--muted); }
.auth-card form { margin-top: var(--space-5); }
.auth-card form + p {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  text-align: center;
}
.auth-card .btn-primary { width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--oxblood); color: #fff; }
.btn-primary:hover { background: var(--oxblood-deep); color: #fff; }
.btn-primary:active { background: #3d0d07; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--paper-2); color: var(--ink); border-color: #b9ae9f; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------- Form fields ---------- */
.field label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base); /* 16 px: stops iOS zooming on focus */
  color: var(--ink);
  background: var(--surface);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.field textarea { min-height: 112px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #8a8279; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b9ae9f; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
.field input[type="checkbox"], .field input[type="radio"] { display: inline-block; width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--oxblood); vertical-align: middle; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.field-error input:focus, .field-error select:focus, .field-error textarea:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgb(161 42 28 / 20%); }
.hint { color: var(--muted); font-size: var(--text-sm); margin: 6px 0 0; }
.error { color: var(--danger); font-size: var(--text-sm); font-weight: 500; margin: 6px 0 0; }

/* ---------- Alerts ---------- */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-left-width: 3px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  margin: 0 0 var(--gap);
}
.alert-error { border-color: var(--danger); background: var(--danger-tint); color: var(--danger); }
.alert-success { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.table th, .table td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: var(--paper-2); font-size: 0.8125rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.table tbody tr { transition: background-color 120ms var(--ease); }
.table tbody tr:hover { background: #fcfaf7; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--paper-2);
  color: var(--ink);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-tint); }
.badge-warn { color: var(--warn); background: var(--warn-tint); }
.badge-muted { color: var(--muted); background: var(--paper-2); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  h1 { font-size: 2rem; }
  .app { padding-bottom: 0; padding-left: var(--nav-width); }
  .main { padding: var(--space-7) var(--space-7) var(--space-7); }
  .card { padding: var(--space-5); }
  .table th, .table td { padding: 14px var(--space-4); }
  .auth-card { padding: 40px; }
  .bare { --bare-top: 96px; }
  .bare .bare-logo { width: 344px; margin-bottom: var(--space-7); }

  .nav {
    inset: 0 auto 0 0;
    width: var(--nav-width);
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-4) var(--space-5);
    border-top: 0;
    border-right: 1px solid rgb(255 255 255 / 6%);
  }
  .nav .brand {
    display: block;
    margin: 0 var(--space-2) var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid rgb(255 255 255 / 70%);
    color: #fff;
    font: 700 1.25rem/1.15 var(--font-display);
    letter-spacing: var(--tracking-brand);
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  .nav .brand:focus-visible { outline-offset: 4px; }
  .nav ul { flex-direction: column; height: auto; gap: 2px; }
  .nav li { flex: none; }
  .nav li a {
    place-items: center start;
    height: 44px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--on-dark);
    transition: background-color 120ms var(--ease), color 120ms var(--ease);
  }
  .nav li a::before { display: none; }
  .nav li a:hover { background: var(--charcoal-2); color: #fff; }
  .nav li a[aria-current="page"] { background: var(--oxblood); color: #fff; font-weight: 600; }
  .nav .nav-foot {
    display: block;
    margin-top: auto;
    padding: var(--space-4) var(--space-2) 0;
    border-top: 1px solid rgb(255 255 255 / 10%);
    color: var(--on-dark-muted);
    font-size: var(--text-sm);
    line-height: 1.4;
  }
  .nav .nav-foot form { margin-top: var(--space-3); }
  .nav .nav-foot .btn { width: 100%; background: transparent; color: #fff; border-color: rgb(255 255 255 / 28%); }
  .nav .nav-foot .btn:hover { background: var(--charcoal-2); border-color: rgb(255 255 255 / 50%); }
}

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

.dl { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.stat { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.1; margin: 0; white-space: nowrap; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.field input[type="checkbox"] { width: 22px; min-height: 22px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--gap); overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--oxblood); box-shadow: inset 0 -3px 0 var(--oxblood); }

fieldset { margin: 0; min-width: 0; }
fieldset legend { padding: 0 6px; }
fieldset legend h2 { margin: 0; }


/* ---------- Home: brand banner with the Nomad 1809 logo ---------- */
/* A white panel with a slim oxblood top edge; the logo, a hairline, then the portal name. */
.brand-banner {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "logo action" "text text";
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, var(--brand-star-deep), var(--brand-star)) top / 100% 3px no-repeat,
    var(--surface);
  box-shadow: var(--shadow-panel);
}
.brand-banner-logo { grid-area: logo; display: block; width: 120px; }
.brand-banner-logo img { display: block; width: 100%; height: auto; }
.brand-banner-text { grid-area: text; min-width: 0; padding-top: var(--space-4); border-top: 1px solid var(--line); }
.brand-banner-text h1 { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.brand-banner-text p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.brand-banner-action { grid-area: action; justify-self: end; }
@media (min-width: 900px) {
  .brand-banner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo text action";
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6);
  }
  .brand-banner-logo { width: 155px; }
  .brand-banner-text { padding: 6px 0 6px var(--space-6); border-top: 0; border-left: 1px solid var(--line); }
}

/* ======================================================================
   Dashboard: key figures, the building section, attention lists
   ====================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.empty { margin: 0; color: var(--muted); font-size: var(--text-sm); }

/* Key figures: one panel split into four cells by hairlines (2 x 2 on a phone). */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-4);
  border-color: var(--line);
  border-style: solid;
  border-width: 0;
}
.kpi:nth-child(odd) { border-right-width: 1px; }
.kpi:nth-child(-n+2) { border-bottom-width: 1px; }
.kpi-label {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  font: 600 0.6875rem/1.3 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kpi-figure {
  margin: 0;
  color: var(--ink);
  font: 600 1.75rem/1 var(--font-display);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-figure-money { font-size: 1.25rem; line-height: 1.4; letter-spacing: -0.015em; }
.kpi-figure-alert { color: var(--oxblood); }
.kpi-note { margin: var(--space-2) 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.kpi-note span { white-space: nowrap; }
/* Meters sit on the cell's floor, so they line up across a row however the notes wrap. */
.kpi .meter { margin-top: auto; }
.kpi .kpi-note:has(+ .meter) { margin-bottom: var(--space-3); }
.meter {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
}
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--charcoal); }

/* Layout: the building beside the attention lists from 1100 px. */
.dashboard { display: grid; gap: var(--space-5); align-items: start; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}
.panel-head h2 { margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
#building { padding: var(--space-4); }

.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: var(--text-xs); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; border: 1px solid; }
.legend-occupied::before { background: var(--ok-tint); border-color: var(--ok) !important; }
.legend-notice::before { background: var(--warn-tint); border-color: var(--warn) !important; }
.legend-vacant::before { background: var(--paper); border-color: var(--line-strong) !important; }

/* The building, drawn as a section: roof slab on top, floors as hairline-separated
   storeys, a ground line with a fine oxblood rule beneath. */
.building + .building { margin-top: var(--space-6); }
.building-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.building-name { margin: 0; font-size: var(--text-base); font-weight: 650; letter-spacing: -0.005em; }
.building-place { margin: 0; color: var(--muted); font-size: var(--text-xs); }
.building-section {
  margin-top: var(--space-3);
  border-top: 3px solid var(--charcoal);
  border-bottom: 2px solid var(--charcoal);
  box-shadow: 0 3px 0 -1px var(--oxblood-line);
}
.floor { padding: var(--space-3) 0; }
.floor + .floor { border-top: 1px solid var(--line); }
.floor-other { background: repeating-linear-gradient(-45deg, transparent 0 6px, rgb(207 198 185 / 18%) 6px 7px); }
.floor-name {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.floor-units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.unit-tile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "number" "tenant" "flag";
  align-content: center;
  column-gap: 6px;
  min-height: 60px; /* room for a third line (the notice flag) on a phone, so every storey is one height */
  height: 100%;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  line-height: 1.25;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.unit-tile::before {
  content: "";
  position: absolute;
  left: -1px; top: -1px; bottom: -1px;
  width: 3px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--line-strong);
}
.unit-tile:hover { color: var(--ink); border-color: var(--line-strong); box-shadow: 0 4px 12px -6px rgb(26 26 26 / 25%); }
.unit-tile-number { grid-area: number; font-weight: 650; font-size: 0.8125rem; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.unit-tile-tenant, .unit-tile-flag {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.6875rem;
}
.unit-tile-tenant { grid-area: tenant; color: var(--ink); }
.unit-tile-first { grid-area: tenant; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.6875rem; color: var(--ink); }
.unit-tile-full { display: none; } /* phone: the first name stands in for the full name */
.unit-tile-flag { grid-area: flag; color: var(--warn); font-weight: 700; }
.unit-tile[data-state="occupied"] { background: var(--ok-tint); border-color: rgb(31 107 69 / 22%); }
.unit-tile[data-state="occupied"]::before { background: var(--ok); }
.unit-tile[data-state="notice"] { background: var(--warn-tint); border-color: rgb(154 91 0 / 28%); }
.unit-tile[data-state="notice"]::before { background: var(--warn); }
.unit-tile[data-state="vacant"] { background: var(--paper); }
.unit-tile[data-state="vacant"] .unit-tile-tenant { color: var(--muted); }
.unit-tile[data-state="vacant"]::before { display: none; }

/* Attention lists */
.attention { padding: var(--space-4); }
.attention > section + section { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.attention-title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--text-base); letter-spacing: -0.005em; }
.attention-title .count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.attention-list { margin: 0; padding: 0; list-style: none; }
.attention-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "pill name" "pill date";
  align-items: center;
  column-gap: var(--space-3);
  padding: var(--space-2) 0;
  min-height: 52px;
}
.attention-list li + li { border-top: 1px solid var(--line); }
.attention-list-names li { grid-template-areas: "pill name"; min-height: 44px; }
.attention-list a { grid-area: name; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; color: var(--ink); text-decoration: none; }
.attention-list a:hover { color: var(--oxblood); text-decoration: underline; }
.attention-date { grid-area: date; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.unit-pill {
  grid-area: pill;
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi { padding: var(--space-5); border-width: 0; }
  .kpi:nth-child(odd), .kpi:nth-child(-n+2) { border-width: 0; }
  .kpi + .kpi { border-left-width: 1px; }
  .kpi-figure { font-size: 2.25rem; }
  .kpi-figure-money { font-size: 1.625rem; line-height: 1.385; }
  #building, .attention { padding: var(--space-5); }
  .floor { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: var(--space-4); }
  .floor-name { margin: 0; }
  .unit-tile { min-height: 58px; padding: 9px 10px 9px 12px; }
  .unit-tile-number { font-size: var(--text-sm); }
  .unit-tile-tenant { font-size: var(--text-xs); }
  .unit-tile { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "number flag" "tenant tenant"; }
  .unit-tile-first { display: none; }
  .unit-tile-full { display: block; }
  .attention > section + section { margin-top: var(--space-5); padding-top: var(--space-5); }
  .unit-tile-flag { align-self: center; justify-self: end; max-width: 100%; font-size: 0.6875rem; }
}
@media (min-width: 1100px) {
  .dashboard { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ======================================================================
   Units: status chips and a list grouped by floor
   ====================================================================== */
/* Phone: one segmented bar of four equal parts, count above label, so all four fit on one line. */
.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 var(--space-5);
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.chip {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 52px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.chip:hover { color: var(--ink); background: var(--paper-2); text-decoration: none; }
.chip-count { color: var(--ink); font-size: var(--text-lg); font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.chip[aria-current="page"], .chip[aria-current="page"]:hover { background: var(--oxblood); color: rgb(255 255 255 / 82%); }
.chip[aria-current="page"] .chip-count { color: #fff; }
.chip:focus-visible { outline-offset: -2px; }

.unit-cols { display: none; }
.unit-property + .unit-property { margin-top: var(--space-7); }
.property-heading { margin: 0 0 var(--space-4); font-size: var(--text-lg); }
/* Phone: each floor is a collapsible row (bold name and summary left, chevron right, bottom
   border). The script under the list collapses them on load unless a status filter is on. */
.floor-tools { display: flex; align-items: center; justify-content: space-between; margin: calc(var(--space-3) * -1) 0 0; padding: 0 var(--space-1); color: var(--muted); font-size: var(--text-sm); }
.floor-toggle-all {
  min-height: 44px;
  padding: 0 var(--space-1);
  border: 0;
  background: none;
  color: var(--oxblood);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.floor-toggle-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.floor-toggle-all[hidden] { display: none; }
.unit-floor { border-bottom: 1px solid var(--line); }
.unit-property > .unit-floor:first-of-type, .unit-groups > .unit-property:first-of-type .unit-floor:first-of-type { border-top: 1px solid var(--line); }
.floor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 60px;
  padding: var(--space-2) var(--space-1);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.floor-heading::-webkit-details-marker { display: none; }
.floor-heading:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm); }
.floor-title { display: flex; flex-direction: column; min-width: 0; }
.floor-name-text { color: var(--ink); font-weight: 700; font-size: var(--text-base); line-height: 1.3; }
.floor-summary { color: var(--muted); font-size: 0.8125rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.floor-chevron { flex: none; color: var(--muted); transition: transform 180ms var(--ease); }
.unit-floor[open] > .floor-heading .floor-chevron { transform: rotate(180deg); }
.unit-floor[open] > .unit-rows { margin-bottom: var(--space-4); }
.unit-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
/* Phone: a compact three-line card. Line 1 unit and status; line 2 tenant; line 3 type and rent. */
.unit-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "number status" "tenant tenant" "type rent";
  align-items: center;
  gap: 2px var(--space-3);
  padding: var(--space-3) var(--space-4);
  transition: background-color 120ms var(--ease);
}
.unit-row + .unit-row { border-top: 1px solid var(--line); }
.unit-row:hover { background: #fcfaf7; }
.unit-row:focus-within { background: #fcfaf7; }
.unit-row-number {
  grid-area: number;
  color: var(--ink);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
/* The unit link covers the whole row, so the row is one tap target. */
.unit-row-number::after { content: ""; position: absolute; inset: 0; }
.unit-row-number:hover { color: var(--ink); text-decoration: none; }
.unit-row-number:focus-visible { outline: none; }
.unit-row-number:focus-visible::after { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: inherit; }
.unit-row-status { grid-area: status; justify-self: end; }
.unit-row-tenant { grid-area: tenant; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
/* Not clipped: the action's enlarged hit area must reach past the line box. */
.unit-row-vacant { display: flex; align-items: center; gap: 0.3em; overflow: visible; color: var(--muted); font-weight: 400; }
.unit-row-action {
  position: relative; /* above the row link */
  z-index: 1;
  display: inline-block;
  padding: 12px 4px;
  margin: -12px -4px;
  font-weight: 600;
  text-decoration: none;
}
.unit-row-action:hover { text-decoration: underline; }
.unit-row-type { grid-area: type; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: var(--text-sm); }
.unit-row-rent { grid-area: rent; justify-self: end; font-size: var(--text-sm); font-weight: 600; }

.empty-state { padding: var(--space-6) var(--space-5); text-align: center; }
.empty-state-title { margin: 0 0 var(--space-2); font-weight: 650; font-size: var(--text-lg); color: var(--ink); }
.empty-state p { color: var(--muted); }
.empty-state .btn { margin-top: var(--space-3); }

/* Desktop: columns aligned across every row and floor. */
@media (min-width: 900px) {
  .chips { display: flex; gap: var(--space-2); padding: 0; border: 0; background: none; }
  .chip {
    flex-direction: row;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-2) 0 var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: var(--text-sm);
  }
  .chip:hover { border-color: #b9ae9f; }
  .chip-count {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1;
  }
  .chip[aria-current="page"], .chip[aria-current="page"]:hover { border-color: var(--oxblood); color: #fff; }
  .chip[aria-current="page"] .chip-count { background: rgb(255 255 255 / 18%); }
  .chip:focus-visible { outline-offset: 2px; }
  .unit-groups { --unit-cols: minmax(150px, 1.1fr) minmax(0, 2fr) 140px 120px; }
  .unit-cols {
    display: grid;
    grid-template-columns: var(--unit-cols);
    column-gap: var(--space-5);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .unit-cols .num { text-align: right; }
  /* Desktop: floors are always open; the heading is a quiet section label, not a control. */
  .floor-tools, .floor-chevron { display: none; }
  .unit-floor, .unit-property > .unit-floor:first-of-type, .unit-groups > .unit-property:first-of-type .unit-floor:first-of-type { border: 0; }
  .unit-floor + .unit-floor { margin-top: var(--space-5); }
  .unit-floor > .unit-rows { margin-bottom: 0; }
  .floor-heading {
    min-height: 0;
    padding: 0 var(--space-5) var(--space-2);
    cursor: default;
    pointer-events: none;
  }
  .floor-title { flex-direction: row; align-items: baseline; justify-content: space-between; gap: var(--space-3); width: 100%; }
  .floor-name-text { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
  .floor-summary { font-size: var(--text-xs); }
  .unit-row {
    grid-template-columns: var(--unit-cols);
    grid-template-areas: "number tenant rent status" "type tenant rent status";
    column-gap: var(--space-5);
    row-gap: 0;
    min-height: 64px;
    padding: var(--space-3) var(--space-5);
  }
  .unit-row-status { justify-self: start; }
  .unit-row-rent { font-size: var(--text-base); }
  .unit-row-type { font-size: 0.8125rem; }
}

/* ======================================================================
   Tenant profile: header, key facts, tabs, sections, leases, documents
   ====================================================================== */
/* Phone: avatar and Edit on one line, the name full width beneath, contact actions last.
   Desktop: the avatar holds the left column; name, standing and actions stack beside it. */
.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "avatar edit" "identity identity" "contact contact";
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.profile-avatar {
  grid-area: avatar;
  align-self: start;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--oxblood);
  color: #fff;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px rgb(111 26 15 / 30%);
  font: 650 1.25rem/1 var(--font-display);
  letter-spacing: 0.04em;
  user-select: none;
}
.profile-identity { grid-area: identity; min-width: 0; }
.profile-identity h1 { margin: 0 0 var(--space-2); font-size: 1.5rem; overflow-wrap: anywhere; }
.profile-standing { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.profile-edit { grid-area: edit; align-self: start; justify-self: end; padding: 0 var(--space-3); }
.profile-edit svg { color: var(--muted); }

.profile-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.profile-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.profile-status-current { color: var(--ok); background: var(--ok-tint); }
.profile-status-notice { color: var(--warn); background: var(--warn-tint); }
.profile-status-former { color: var(--muted); background: var(--paper-2); }

.profile-unit {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.8125rem;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease);
}
/* A 44 px tall hit area around the slim pill. */
.profile-unit::after { content: ""; position: absolute; inset: -8px -2px; }
.profile-unit:hover { color: var(--ink); border-color: var(--oxblood); background: var(--oxblood-tint); text-decoration: none; }
.profile-unit-number {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.profile-unit-place { color: var(--muted); }
.profile-unit-flag { color: var(--warn); font-weight: 650; }
.profile-unit-none { color: var(--muted); font-size: var(--text-sm); }

/* Contact actions: icon-over-label tiles on a phone, a row of buttons from 600 px. */
.profile-contact {
  grid-area: contact;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-1);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.profile-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.profile-action svg { flex: none; color: var(--oxblood); }
.profile-action:hover { color: var(--ink); background: var(--paper-2); border-color: #b9ae9f; text-decoration: none; }
.profile-action-detail { display: none; color: var(--muted); font-weight: 500; }

.profile-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--oxblood);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
}

/* Key facts: label small and uppercase, figure large and tabular, in hairline-split cells.
   The grid sits 1 px wider and taller than its clipped frame, so the outer cells' right and
   bottom hairlines fall outside it: any number of facts tiles cleanly. */
.facts {
  margin-bottom: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 -1px -1px 0;
}
.facts-cell {
  min-width: 0;
  padding: var(--space-4);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts-label {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  font: 600 0.6875rem/1.3 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.facts-figure {
  margin: 0;
  color: var(--ink);
  font: 600 1.25rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.facts-note { margin: var(--space-1) 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.facts-note-soon { color: var(--warn); font-weight: 600; }
.facts-note-alert { color: var(--oxblood); font-weight: 650; }

/* Tabs: the bar scrolls sideways within itself when the tabs outgrow it. On a phone a soft
   fade at the right edge hints at more; the trailing padding lets the last tab clear it. */
.profile-tabs {
  gap: 0;
  margin-bottom: var(--space-5);
  padding-right: var(--space-4);
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--space-4)), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - var(--space-4)), transparent);
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs a { flex: none; gap: var(--space-2); padding: 0 var(--space-3); scroll-snap-align: start; }
.profile-tabs a:first-child { padding-left: var(--space-1); }
.profile-tabs a:hover { color: var(--ink); }
.profile-tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--oxblood); }
.profile-tabs a:focus-visible { outline-offset: -4px; }
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}
.profile-tabs a[aria-current="page"] .tab-count { background: var(--oxblood-tint); color: var(--oxblood); }

/* Overview: grouped sections; rows read label left, value right. */
.profile-sections { display: grid; gap: var(--space-4); }
.profile-section {
  min-width: 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.profile-section-title {
  margin: 0 0 var(--space-1);
  color: var(--muted);
  font: 600 0.6875rem/1.3 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.profile-fields { margin: 0; }
.profile-fields > div {
  display: grid;
  grid-template-columns: minmax(92px, 30%) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.profile-fields > div + div { border-top: 1px solid var(--line); }
.profile-fields > div:last-child { padding-bottom: 0; }
.profile-fields dt { color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.profile-fields dd { margin: 0; font-weight: 500; overflow-wrap: break-word; min-width: 0; }
.profile-fields dd a { font-weight: 600; text-decoration: none; }
.profile-fields dd a:hover { text-decoration: underline; }
.profile-notes { margin: var(--space-3) 0 0; max-width: 70ch; }
.profile-section .not-given { color: var(--muted); font-weight: 400; font-style: italic; }
.profile-section .section-empty { margin: var(--space-3) 0 0; color: var(--muted); font-size: var(--text-sm); }

/* Leases */
.lease-list { display: grid; gap: var(--space-4); }
.lease-card {
  min-width: 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.lease-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title badge" "action action";
  align-items: start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.lease-title { grid-area: title; min-width: 0; }
.lease-title h2 { margin: 0; font-size: var(--text-xl); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
/* The unit link keeps its look but gets a 44 px tall hit area. */
.lease-unit { position: relative; display: inline-block; color: var(--ink); text-decoration: none; }
.lease-unit::after { content: ""; position: absolute; inset: -10px -6px; }
.lease-unit:hover { color: var(--oxblood); text-decoration: underline; }
.lease-place { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.lease-head .badge { grid-area: badge; margin-top: 4px; }
.lease-action { grid-area: action; width: 100%; }
.badge-void { color: var(--danger); background: var(--danger-tint); }
.lease-void-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--danger);
  background: var(--danger-tint);
  color: var(--ink);
  font-size: var(--text-sm);
}
.lease-card .facts { margin-bottom: var(--space-4); box-shadow: none; border-radius: var(--radius); }
.lease-terms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-5);
}
.lease-terms dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.lease-terms dd { margin: 2px 0 0; font-weight: 600; }
.lease-review-note { color: var(--warn); font-size: 0.8125rem; }
.lease-review-note.is-overdue { color: var(--oxblood); }
/* Ended and voided leases step back: no lift, paper ground. */
.lease-card-ended, .lease-card-void { background: var(--paper); box-shadow: none; }
.lease-card-void { border-style: dashed; border-color: var(--line-strong); }
.lease-card-ended .lease-title h2, .lease-card-void .lease-title h2 { font-size: var(--text-lg); }
.lease-card-ended .lease-unit, .lease-card-void .lease-unit { color: var(--muted); }

/* Rent history: a timeline, a fine spine with a node per change of terms. */
.history { border-top: 1px solid var(--line); padding-top: var(--space-4); }
.history-title {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  font: 600 0.6875rem/1.3 var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.history-cols { display: none; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "date mark" "rent rent" "sc sc";
  gap: 2px var(--space-3);
  padding: var(--space-3) 0 var(--space-3) var(--space-4);
}
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-row::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 1px; background: var(--line-strong); }
.history-row:first-child::before { top: 24px; }
.history-row:last-child::before { bottom: calc(100% - 24px); }
.history-row:only-child::before { display: none; }
.history-row::after { content: ""; position: absolute; left: 0; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); }
.history-row.is-current::after { background: var(--oxblood); border-color: var(--oxblood); }
.history-row.is-future::after { border-color: var(--oxblood); }
.history-date { grid-area: date; font-weight: 650; }
.history-rent { grid-area: rent; font-size: var(--text-sm); }
.history-sc { grid-area: sc; font-size: var(--text-sm); }
.history-key { color: var(--muted); }
.history-mark { grid-area: mark; justify-self: end; }
.history-row.is-past { color: var(--muted); }
.history-row.is-past .history-date { font-weight: 500; }
.mark { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 650; white-space: nowrap; }
.mark-current { background: var(--oxblood); color: #fff; }
.mark-future { border: 1px solid var(--oxblood); color: var(--oxblood); }

/* Documents */
.doc-layout { display: grid; gap: var(--space-4); align-items: start; }
.doc-panel, .doc-upload { padding: var(--space-4); }
.doc-panel-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.doc-panel-head h2, .doc-upload h2 { margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.doc-panel-head .count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}
.doc-list { margin: 0; padding: 0; list-style: none; }
.doc-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.doc-row + .doc-row { border-top: 1px solid var(--line); }
.doc-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); background: var(--oxblood-tint); color: var(--oxblood); }
.doc-main { min-width: 0; }
.doc-main p { margin: 0; }
.doc-name { font-weight: 650; overflow-wrap: anywhere; }
/* The type is a small tag, so the meta line wraps cleanly on a phone. */
.doc-main .doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); margin-top: 4px; font-size: 0.8125rem; }
.doc-kind { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink); font-size: var(--text-xs); font-weight: 600; }
.doc-scope { color: var(--muted); }
.doc-main .doc-added { margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }
.doc-download { width: 44px; padding: 0; }
.doc-download svg { color: var(--oxblood); }
.doc-download-text { display: none; }
.doc-empty { margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-sm); }
.doc-upload h2 { margin-bottom: var(--space-4); }
.doc-upload-fields { display: grid; gap: var(--space-4); margin-bottom: var(--space-5); }
.doc-upload input[type="file"] { padding: 6px; cursor: pointer; font-size: var(--text-sm); }
.doc-upload input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-right: var(--space-3);
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.doc-upload .btn-primary { width: 100%; }

@media (min-width: 600px) {
  .facts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-contact { display: flex; flex-wrap: wrap; }
  .profile-action { flex-direction: row; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); font-size: 0.9375rem; }
  .profile-action-detail { display: inline; }
  .profile-tabs { padding-right: 0; -webkit-mask-image: none; mask-image: none; }
  .profile-tabs a { padding: 0 var(--space-4); }
  .profile-tabs a:first-child { padding-left: var(--space-1); }
  .doc-download { width: auto; padding: 0 var(--space-4); }
  .doc-download-text { display: inline; }
  .lease-terms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .profile-hero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "avatar identity edit" "avatar contact contact";
    gap: var(--space-4) var(--space-5);
    padding: var(--space-5) var(--space-6) var(--space-5) var(--space-5);
  }
  .profile-avatar { width: 80px; height: 80px; font-size: 1.75rem; }
  .profile-identity h1 { font-size: 2rem; }
  .profile-contact { margin-top: 0; }
  .facts-cell { padding: var(--space-4) var(--space-5); }
  .facts-figure { font-size: 1.5rem; }
  /* Two balanced columns of cards sized to their content; the notes run across both. */
  .profile-sections { display: block; columns: 2; column-gap: var(--space-5); }
  .profile-section { padding: var(--space-5); margin-bottom: var(--space-5); break-inside: avoid; }
  .profile-section-wide { column-span: all; margin: var(--space-5) 0 0; }
  .profile-fields > div { grid-template-columns: minmax(120px, 36%) minmax(0, 1fr); gap: var(--space-4); }
  .lease-list { gap: var(--space-5); }
  .lease-card { padding: var(--space-5) var(--space-6); }
  .lease-head { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "title badge action"; align-items: center; gap: var(--space-4); }
  .lease-head .badge { margin-top: 0; }
  .lease-action { width: auto; }
  .lease-terms { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .history { --history-cols: 140px 140px 160px minmax(0, 1fr); }
  .history-cols {
    display: grid;
    grid-template-columns: var(--history-cols);
    gap: var(--space-4);
    padding: 0 0 var(--space-2) var(--space-5);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .history-cols .num { text-align: right; }
  .history-row { grid-template-columns: var(--history-cols); grid-template-areas: "date rent sc mark"; align-items: center; gap: var(--space-4); min-height: 48px; padding-left: var(--space-5); }
  .history-rent, .history-sc { text-align: right; font-size: var(--text-base); }
  .history-key { display: none; }
  .history-mark { justify-self: start; }
  .history-row::after { top: 50%; margin-top: -4px; }
  .history-row:first-child::before { top: 50%; }
  .history-row:last-child::before { bottom: 50%; }
  .doc-panel, .doc-upload { padding: var(--space-5); }
  .doc-upload-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-5); }
  .doc-upload .btn-primary { width: auto; }
}
@media (min-width: 1200px) {
  .doc-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-5); }
  .doc-upload-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ======================================================================
   Forms: money inputs, required marks, the error summary (shared)
   ====================================================================== */
.req { margin-left: 2px; color: var(--oxblood); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; }
/* Money: a "KES" prefix inside the field; figures in tabular numerals. */
.money-input { position: relative; display: block; }
.money-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.field .money-input input { padding-left: 50px; font-variant-numeric: tabular-nums; font-weight: 500; }

.form-errors {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  border: 1px solid rgb(161 42 28 / 30%);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-tint);
}
.form-errors-title { margin: 0 0 var(--space-2); color: var(--danger); font-weight: 700; }
.form-errors ul { margin: 0; padding-left: 1.1em; color: var(--ink); font-size: var(--text-sm); }
.form-errors li + li { margin-top: var(--space-1); }
.form-errors a { color: var(--danger); font-weight: 600; }

/* ======================================================================
   New tenant: three steps, unit tiles, the move-in summary
   ====================================================================== */
.ob { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
.ob-steps { display: grid; gap: var(--space-5); min-width: 0; }
.ob-step {
  min-width: 0;
  padding: var(--space-5) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  scroll-margin-top: var(--space-4);
}
.ob-step-head { margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.ob-step-head h2 { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-1); font-size: var(--text-lg); letter-spacing: -0.01em; }
.ob-step-head p { margin: 0; padding-left: 40px; color: var(--muted); font-size: var(--text-sm); }
.ob-step-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ob-step > * + * { margin-top: var(--space-5); }
.ob-step > .ob-step-head + * { margin-top: 0; }

/* Unit tiles: real radio inputs inside labels, grouped by floor as on the Units page. */
.ob-units { margin: 0; padding: 0; border: 0; min-width: 0; }
.ob-label { display: block; margin-bottom: var(--space-3); padding: 0; font-size: var(--text-sm); font-weight: 600; }
.ob-property + .ob-property { margin-top: var(--space-5); }
.ob-property-name { margin: 0 0 var(--space-3); font-weight: 650; }
.ob-floor + .ob-floor { margin-top: var(--space-4); }
.ob-floor-name { margin: 0 0 var(--space-2); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.ob-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr)); gap: var(--space-2); }
.ob-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.ob-tile input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ob-tile:hover { border-color: #b9ae9f; box-shadow: 0 4px 12px -8px rgb(26 26 26 / 30%); }
.ob-tile-number { font-weight: 700; font-size: var(--text-base); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.ob-tile-type { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: var(--text-xs); line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ob-tile-rent { margin-top: auto; padding-top: var(--space-1); font-size: 0.8125rem; font-weight: 600; }
/* Chosen: oxblood edge, tinted ground and a tick, so the choice never rests on colour alone. */
.ob-tile:has(input:checked) { border-color: var(--oxblood); background: var(--oxblood-tint); box-shadow: inset 0 0 0 1px var(--oxblood); }
.ob-tile:has(input:checked)::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--oxblood) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M5 9.2l2.6 2.6L13 6.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.ob-tile:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.ob-units-error .ob-tile { border-color: rgb(161 42 28 / 55%); }

/* Move-in date with its quick choices. */
.ob-date-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ob-date-row > input { flex: 1 1 180px; width: auto; min-width: 0; }
.ob-quick { display: flex; gap: var(--space-2); flex: 1 1 220px; }
.ob-quick[hidden] { display: none; }
.ob-quick-btn {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease);
}
.ob-quick-btn:hover { background: var(--paper-2); border-color: #b9ae9f; }
.ob-quick-btn:active { border-color: var(--oxblood); }

/* Tenant groups: a quiet label, then the fields; two columns where there is room. */
.ob-group + .ob-group { padding-top: var(--space-5); border-top: 1px solid var(--line); }
.ob-group-title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.ob-optional { padding: 1px 8px; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: 0.6875rem; letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
.ob-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4) var(--space-4); }
.ob-prorata strong { color: var(--ink); font-weight: 650; }

/* The move-in summary: on a phone, a card above the submit button. */
.ob-summary {
  min-width: 0;
  padding: var(--space-5) var(--space-4) var(--space-4);
  background:
    linear-gradient(90deg, var(--brand-star-deep), var(--brand-star)) top / 100% 3px no-repeat,
    var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  font-size: var(--text-sm);
}
.ob-summary[hidden] { display: none; }
.ob-summary-title { margin: 0 0 var(--space-3); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.ob-summary dl { margin: 0; }
.ob-summary dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding: 6px 0; }
.ob-summary dt { color: var(--muted); }
.ob-summary dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.ob-summary .ob-summary-what { padding-bottom: var(--space-2); margin-bottom: var(--space-2); border-bottom: 1px solid var(--line); }
.ob-summary-what dd { color: var(--ink); }
.ob-total { margin: var(--space-3) 0; padding: var(--space-4) 0; border-top: 2px solid var(--charcoal); border-bottom: 1px solid var(--line); }
.ob-total-label { margin: 0 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.ob-total-figure { margin: 0; color: var(--ink); font: 650 2rem/1.1 var(--font-display); letter-spacing: -0.025em; }
.ob-summary-terms dd { font-weight: 500; }
.ob-summary-note { margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.45; }

.ob-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ob-actions .btn-primary { flex: 1 1 220px; min-height: 52px; font-size: var(--text-base); }
.ob-actions .btn-quiet { flex: 0 1 auto; min-height: 52px; }

@media (min-width: 700px) {
  .ob-step { padding: var(--space-6); }
  .ob-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-5); }
  .field-wide { grid-column: 1 / -1; }
  .ob-tiles { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .ob-floor { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: var(--space-4); }
  .ob-floor + .ob-floor { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
  .ob-floor-name { margin: 0; padding-top: 12px; }
  .ob-actions .btn-primary { flex: 0 0 auto; }
}
@media (min-width: 1100px) {
  .ob {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "steps summary" "actions summary";
    column-gap: var(--space-6);
    align-items: start;
  }
  .ob > .ob-steps { grid-area: steps; }
  .ob > .ob-actions { grid-area: actions; }
  .ob-summary { grid-area: summary; position: sticky; top: var(--space-6); padding: var(--space-5); }
}

/* ======================================================================
   Tenants list: search, people as cards (phone) and aligned rows (desktop)
   ====================================================================== */
.search { position: relative; margin: 0 0 var(--space-5); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px 10px 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-base);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.search-input::placeholder { color: var(--placeholder); }
.search-input:hover { border-color: #b9ae9f; }
.search-input:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
.results-note { margin: calc(var(--space-2) * -1) 0 var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.results-note a { font-weight: 600; }

.people-cols { display: none; }
.people {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
/* Phone: avatar left; name and status on line 1, units and rent on line 2, phone on line 3. */
.person {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "avatar name status" "avatar units rent" "avatar phone phone";
  align-items: center;
  gap: 4px var(--space-3);
  padding: var(--space-3) var(--space-4);
  transition: background-color 120ms var(--ease);
}
.person + .person { border-top: 1px solid var(--line); }
.person:hover, .person:focus-within { background: #fcfaf7; }
.person-avatar {
  grid-area: avatar;
  align-self: start;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink);
  font: 650 0.875rem/1 var(--font-display);
  letter-spacing: 0.04em;
}
.person[data-status="former"] .person-avatar { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--muted); }
.person-name { grid-area: name; min-width: 0; overflow: hidden; color: var(--ink); font-weight: 650; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
/* The name link covers the whole row, so the row is one tap target. */
.person-name::after { content: ""; position: absolute; inset: 0; }
.person-name:hover { color: var(--ink); text-decoration: none; }
.person-name:focus-visible { outline: none; }
.person-name:focus-visible::after { outline: 2px solid var(--oxblood); outline-offset: -3px; }
.person-units { grid-area: units; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.person-units .unit-pill { min-width: 48px; height: 24px; }
.person-none { color: var(--muted); font-size: var(--text-sm); }
.person-phone { grid-area: phone; color: var(--muted); font-size: var(--text-sm); }
.person-rent { grid-area: rent; justify-self: end; font-size: var(--text-sm); font-weight: 600; }
.person-status { grid-area: status; justify-self: end; }

@media (min-width: 900px) {
  #tenant-results { --people-cols: minmax(0, 2fr) minmax(0, 1fr) 150px 130px 130px; }
  .people-cols {
    display: grid;
    grid-template-columns: 40px var(--people-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .people-cols span:first-child { grid-column: 1 / 3; }
  .people-cols .num { text-align: right; }
  .person {
    grid-template-columns: 40px var(--people-cols);
    grid-template-areas: "avatar name units phone rent status";
    column-gap: var(--space-4);
    min-height: 68px;
    padding: var(--space-3) var(--space-5);
  }
  .person-avatar { align-self: center; }
  .person-phone { color: var(--ink); font-size: var(--text-base); }
  .person-rent { font-size: var(--text-base); }
  .person-status { justify-self: start; }
}

/* ======================================================================
   Unit detail: hero, key facts (reuses .facts), lease history
   ====================================================================== */
.unit-hero { grid-template-areas: "avatar actions" "identity identity"; }
.unit-mark {
  grid-area: avatar;
  align-self: start;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  color: var(--ink);
}
.unit-hero-meta { margin: 0 0 var(--space-3); color: var(--muted); }
.unit-hero-actions { grid-area: actions; align-self: start; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.unit-hero-actions .btn { padding: 0 var(--space-4); }
.unit-hero-actions svg { color: var(--muted); }
.facts-figure-name { font-size: var(--text-lg); overflow-wrap: anywhere; }
.facts-figure-name a { color: var(--ink); text-decoration-color: var(--oxblood-line); }
.facts-figure-name a:hover { color: var(--oxblood); }
.facts-figure-word { font-size: var(--text-lg); }
.profile-status-void { color: var(--danger); background: var(--danger-tint); }

.unit-history { padding: var(--space-4); }
.unit-history .doc-panel-head h2 { margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.tenancies { margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.tenancy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main status" "main rent";
  align-items: center;
  gap: 4px var(--space-3);
  padding: var(--space-3) 0;
}
.tenancy + .tenancy { border-top: 1px solid var(--line); }
.tenancy-main { grid-area: main; min-width: 0; }
.tenancy-name { font-weight: 650; color: var(--ink); text-decoration: none; }
.tenancy-name:hover { color: var(--oxblood); text-decoration: underline; }
.tenancy-dates { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); }
.tenancy-rent { grid-area: rent; justify-self: end; font-size: var(--text-sm); font-weight: 600; }
.tenancy-rent-unit { color: var(--muted); font-weight: 400; }
.tenancy-status { grid-area: status; justify-self: end; }
.tenancy-ended .tenancy-name { color: var(--muted); }
.tenancy-void .tenancy-name, .tenancy-void .tenancy-dates { color: var(--muted); text-decoration: line-through; text-decoration-color: rgb(107 100 93 / 50%); }

@media (min-width: 900px) {
  .unit-hero { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "avatar identity actions"; }
  .unit-mark { width: 80px; height: 80px; }
  .unit-mark svg { width: 34px; height: 34px; }
  .unit-hero .profile-identity h1 { font-size: 2rem; }
  .unit-history { padding: var(--space-5); }
  .tenancy { grid-template-columns: minmax(0, 1fr) 180px 150px; grid-template-areas: "main rent status"; min-height: 64px; }
  .tenancy-rent { font-size: var(--text-base); }
  .tenancy-status { justify-self: start; }
}
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  cursor: pointer;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 6l8 8M14 6l-8 8' stroke='%236b645d' stroke-width='1.75' stroke-linecap='round'/%3E%3C/svg%3E") center / 20px no-repeat;
}
/* Empty states: the title reads in ink (the paragraph rule above made it muted). */
.empty-state .empty-state-title { color: var(--ink); }

/* ======================================================================
   Form pages (edit tenant, unit, renewal, invite): the New Tenant page's
   panels, groups and field styling, plus choice cards and checkboxes
   ====================================================================== */
.form-page { display: grid; gap: var(--space-5); max-width: 820px; }
.form-page > .ob-step > * + * { margin-top: var(--space-5); }
.ob-step-head-plain p { padding-left: 0; }
.ob-step-head-plain h2 { font-size: var(--text-lg); }
.unit-pill-inline { display: inline-grid; height: 24px; min-width: 48px; margin-right: 6px; color: var(--ink); vertical-align: 1px; }

/* Choice cards: real radio inputs; the whole card is the target. */
.choice-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.choice-set > legend { display: block; width: 100%; float: left; padding: 0 0 var(--space-4); }
.choice-set > legend + * { clear: both; }
.choice-legend { display: block; margin: 0 0 var(--space-1); color: var(--ink); font: 700 var(--text-lg)/1.2 var(--font-display); letter-spacing: -0.01em; }
.choice-legend-note { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 400; }
.choices { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
.choice {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-areas: "dot title" "dot text";
  column-gap: var(--space-3);
  row-gap: 2px;
  padding: var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  align-content: start;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.choice input { grid-area: dot; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--oxblood); cursor: pointer; }
.choice-title { grid-area: title; font-weight: 650; }
.choice-text { grid-area: text; color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.choice:hover { border-color: #b9ae9f; }
.choice:has(input:checked) { border-color: var(--oxblood); background: var(--oxblood-tint); box-shadow: inset 0 0 0 1px var(--oxblood); }
.choice:has(input:checked) .choice-text { color: var(--ink); }
.choice:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.choice input:focus-visible { outline: none; } /* the card carries the focus ring */
.choice-error .choice { border-color: rgb(161 42 28 / 55%); }
.choice-set > .error { margin-top: var(--space-3); }

/* Checkboxes: box left, label and hint right, a 44 px row. */
.check-list { display: grid; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: var(--space-3); align-items: start; min-height: 44px; padding: var(--space-2) 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--oxblood); cursor: pointer; }
.check label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.check-label { font-weight: 600; }
.check-hint { color: var(--muted); font-size: var(--text-sm); }
.check .error { grid-column: 2; }

@media (min-width: 700px) {
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Selects get the same quiet chevron everywhere; disabled fields read as fixed. */
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='%236b645d' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 20px no-repeat;
}
.field input:disabled, .field select:disabled, .field textarea:disabled { background-color: var(--paper-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.form-facts { max-width: 820px; }

/* ======================================================================
   Team: members as a refined list
   ====================================================================== */
.btn-small { min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-sm); }
.team-cols { display: none; }
.member {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "avatar who who" "avatar role status" "avatar action action";
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-4);
}
.member + .member { border-top: 1px solid var(--line); }
.member .person-avatar { grid-area: avatar; align-self: start; }
.member-who { grid-area: who; min-width: 0; }
.member-who p { margin: 0; }
.member-name { font-weight: 650; overflow-wrap: anywhere; }
.member-you { margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: var(--text-xs); font-weight: 600; }
.member-email { color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.member-role { grid-area: role; display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); }
.member-landlord { color: var(--muted); font-size: 0.8125rem; }
.member-status { grid-area: status; justify-self: end; }
.member-action { grid-area: action; }
.member-action:empty { display: none; }
.member-action .btn { width: 100%; }
.member-off .member-name, .member-off .member-email { color: var(--muted); }
.member-off .person-avatar { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--muted); }
.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
}
.role-pill-admin { border-color: var(--charcoal); background: var(--charcoal); color: #fff; }

@media (min-width: 900px) {
  .team-cols, .member { --team-cols: 40px minmax(0, 2fr) minmax(0, 1.4fr) 150px 160px; }
  .team-cols {
    display: grid;
    grid-template-columns: var(--team-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .team-cols span:first-child { grid-column: 1 / 3; }
  .member {
    grid-template-columns: var(--team-cols);
    grid-template-areas: "avatar who role status action";
    column-gap: var(--space-4);
    min-height: 72px;
    padding: var(--space-3) var(--space-5);
  }
  .member .person-avatar { align-self: center; }
  .member-status { justify-self: start; align-self: center; }
  .member-action { display: flex; justify-content: flex-end; }
  .member-action:empty { display: block; }
  .member-action .btn { width: auto; }
}

/* ======================================================================
   Activity: a timeline grouped by day; each change as "old → new"
   ====================================================================== */
.activity-day + .activity-day { margin-top: var(--space-6); }
.activity-date { margin: 0 0 var(--space-3); color: var(--ink); font-size: var(--text-sm); font-weight: 650; letter-spacing: 0; }
.activity-date .muted { font-weight: 400; }
.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.event { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); }
.event + .event { border-top: 1px solid var(--line); }
.event-avatar { grid-area: auto; align-self: start; width: 36px; height: 36px; font-size: 0.8125rem; }
.event-main { min-width: 0; }
.event-main p { margin: 0; }
.event-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--space-2); }
.event-title { font-weight: 650; }
.event-record { color: var(--ink); font-size: var(--text-sm); overflow-wrap: anywhere; }
.event-main .event-meta { margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }
.event-changes {
  display: grid;
  gap: 6px;
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: var(--text-sm);
}
.event-changes > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.event-changes dt { color: var(--muted); font-size: 0.8125rem; }
.event-changes dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.event-old { color: var(--muted); }
.event-arrow { color: var(--muted); padding: 0 2px; }
.event-new { color: var(--ink); font-weight: 600; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
.pager > :last-child { justify-self: end; }
.pager-where { color: var(--muted); font-size: var(--text-sm); }

@media (min-width: 700px) {
  .event-changes > div { grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-4); align-items: baseline; }
}
@media (min-width: 900px) {
  .event { padding: var(--space-4) var(--space-5); }
  .event-avatar { width: 40px; height: 40px; }
}

/* ======================================================================
   Signed-out cards, state pages, error pages, flash messages
   ====================================================================== */
.auth-card h1 + p { margin-bottom: 0; font-size: 0.9375rem; }
.auth-card .field label { font-size: var(--text-sm); }
.auth-card .btn-primary { min-height: 48px; }
.auth-card-state { text-align: center; }
.auth-card-state h1 + p { margin-bottom: var(--space-5); }
.auth-card-state .btn { min-width: 200px; }
.auth-card-state form { margin-top: 0; }
.auth-card .auth-foot { margin: var(--space-5) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: var(--text-sm); }
.auth-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--oxblood-tint);
  color: var(--oxblood);
}
.password-input { position: relative; display: block; }
.field .password-input input { padding-right: 76px; }
.password-toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  min-width: 64px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--oxblood);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.password-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.password-toggle:focus-visible { outline-offset: -3px; }

.error-state { max-width: 560px; margin: var(--space-6) auto 0; padding: var(--space-6) var(--space-5); text-align: center; }
.error-state h1 { margin-bottom: var(--space-2); }
.error-state p { color: var(--muted); }
.error-state .btn { margin-top: var(--space-3); }
.error-code { margin: 0 0 var(--space-2); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.auth-card .error-code + h1 { margin-top: 0; }

.flashes { margin-bottom: var(--space-5); }
.flashes .alert:last-child { margin-bottom: 0; }
.alert-icon { display: flex; align-items: flex-start; gap: var(--space-3); font-weight: 500; }
.alert-icon svg { flex: none; margin-top: 1px; }
.alert-info { border-color: var(--line-strong); border-left-color: var(--charcoal); background: var(--surface); color: var(--ink); }

/* Placeholders at 5:1 (the earlier #8a8279 was 3.8:1 on white). */
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.hint-list { margin: 6px 0 0; padding-left: 1.1em; }
.hint-list li + li { margin-top: 2px; }

/* ---------- New tenant: service charge start and months already invoiced (Task 9) ---------- */
.ob-note {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--charcoal);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.ob-summary-sub { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 500; }

/* ======================================================================
   Payments (Task 11): record payment, its preview, the receipt page, the list
   ====================================================================== */
/* Team is an occasional Admin task: sidebar only, so the phone tab bar keeps five items. */
@media (max-width: 899.98px) {
  .nav li.nav-sidebar-only { display: none; }
}

/* Home: the day's main action sits just above the figures. */
.home-actions { display: flex; justify-content: flex-end; margin: calc(var(--space-2) * -1) 0 var(--space-4); }
.home-actions .btn { width: 100%; min-height: 48px; }
.btn svg { flex: none; }

/* Tenant profile: Record payment gets its own row on a phone, beside Edit on a desktop. */
.profile-hero:has(> .profile-pay) { grid-template-areas: "avatar edit" "identity identity" "pay pay" "contact contact"; }
.profile-pay { grid-area: pay; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.profile-pay .btn { flex: 1 1 auto; min-height: 48px; }
.profile-pay-unit { font-weight: 500; opacity: 0.85; }

/* The form: one card with the fields, the preview card beneath it, then the button. */
.pay { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); max-width: 1040px; }
.pay-main { min-width: 0; }
.pay-card > * + * { margin-top: var(--space-5); }
.pay-card > .sr-only + * { margin-top: 0; }

.pay-who {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "label label label" "pill name change";
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--oxblood);
  border-radius: var(--radius);
  background: var(--paper);
}
.pay-who-label { grid-area: label; color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.pay-who .unit-pill { grid-area: pill; background: var(--surface); }
.pay-who-name { grid-area: name; min-width: 0; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.pay-who-place { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 400; }
.pay-who-change { grid-area: change; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); font-weight: 600; font-size: var(--text-sm); }

.pay-picker { padding: 0; border: 0; min-width: 0; }
.pay-search { margin: 0 0 var(--space-3); }
.pay-leases { display: grid; gap: var(--space-2); }
.pay-lease {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "pill name" "pill place";
  align-items: center;
  column-gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease);
}
.pay-lease input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pay-lease .unit-pill { grid-area: pill; }
.pay-lease-name { grid-area: name; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.pay-lease-place { grid-area: place; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 0.8125rem; }
.pay-lease:hover { border-color: #b9ae9f; }
/* Chosen: oxblood edge, tinted ground and a tick, never colour alone. */
.pay-lease:has(input:checked) { border-color: var(--oxblood); background: var(--oxblood-tint); box-shadow: inset 0 0 0 1px var(--oxblood); padding-right: 44px; }
.pay-lease:has(input:checked)::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 13px;
  margin-top: -9px;
  border: solid var(--oxblood);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.pay-lease:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.pay-picker-error .pay-lease { border-color: rgb(161 42 28 / 55%); }
.pay-leases-more, .pay-leases-empty { margin: var(--space-1) 0 0; }

/* The amount: the figure the whole form is about, set large. */
.pay-amount .money-input input { min-height: 56px; font-size: 1.375rem; font-weight: 650; letter-spacing: -0.01em; padding-left: 58px; }
.pay-amount .money-prefix { left: 16px; font-size: var(--text-sm); }

/* Paid by: a three-way segmented choice. */
.pay-method { padding: 0; border: 0; min-width: 0; }
.pay-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.pay-method-option { position: relative; display: grid; place-items: center; min-height: 46px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; font-size: 0.9375rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pay-method-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pay-method-option:hover { background: var(--paper-2); }
.pay-method-option:has(input:checked) { background: var(--charcoal); color: #fff; box-shadow: 0 1px 2px rgb(26 26 26 / 20%); }
.pay-method-option:has(input:checked) span::before { content: "✓ "; font-weight: 700; }
.pay-method-option:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.pay-method.choice-error .pay-methods { border-color: var(--danger); }
.pay-reference input { text-transform: uppercase; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.pay-reference input::placeholder { text-transform: none; letter-spacing: 0; }
.pay-reference[hidden], .pay-cash-note[hidden] { display: none; }
.pay-cash-note { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-left: 3px solid var(--charcoal); border-radius: var(--radius-sm); background: var(--paper-2); font-size: var(--text-sm); }

/* The preview card, and the allocation lines it shares with the receipt. */
.pay-preview { min-width: 0; }
.pay-preview-card {
  padding: var(--space-5) var(--space-4) var(--space-4);
  background:
    linear-gradient(90deg, var(--brand-star-deep), var(--brand-star)) top / 100% 3px no-repeat,
    var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.pay-preview-title { margin: 0 0 var(--space-3); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.pay-preview-empty { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.pay-preview-error { display: flex; align-items: flex-start; gap: var(--space-3); margin: 0; padding: var(--space-3) var(--space-4); border: 1px solid rgb(161 42 28 / 30%); border-left: 3px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger-tint); color: var(--danger); font-size: var(--text-sm); font-weight: 500; }
.pay-preview-error svg { flex: none; margin-top: 1px; }
.pay-preview-note { margin: var(--space-3) 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.45; }
.pay-lines { margin: 0; padding: 0; list-style: none; }
.pay-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label amount" "mark amount";
  align-items: center;
  column-gap: var(--space-3);
  padding: 10px 0;
  font-size: 0.9375rem;
}
.pay-line + .pay-line { border-top: 1px solid var(--line); }
.pay-line-label { grid-area: label; min-width: 0; }
.pay-line .mark { grid-area: mark; justify-self: start; margin-top: 4px; }
.pay-line-amount { grid-area: amount; font-weight: 600; text-align: right; }
.mark-ahead { border: 1px solid var(--charcoal); color: var(--ink); background: var(--paper); }
.mark-ahead::before { content: "→"; margin-right: 4px; font-weight: 700; }
.mark-plain { min-height: 20px; border: 1px solid var(--line-strong); color: var(--ink); font-weight: 600; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-top: var(--space-1); padding-top: var(--space-3); border-top: 2px solid var(--charcoal); font-weight: 700; }
.pay-total .num { font: 650 1.375rem/1.2 var(--font-display); letter-spacing: -0.015em; }

.pay-actions .btn-primary { min-height: 52px; }

@media (min-width: 700px) {
  .pay-card { padding: var(--space-6); }
  .pay-more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-leases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-actions .btn { width: auto; }
}
@media (min-width: 900px) {
  .home-actions { margin-top: 0; }
  .profile-hero:has(> .profile-pay) {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "avatar identity pay edit" "avatar contact contact contact";
  }
  .profile-pay { align-self: start; }
  .profile-pay .btn { flex: none; min-height: 44px; }
}
@media (min-width: 1100px) {
  .pay {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "main preview" "actions preview";
    column-gap: var(--space-6);
    align-items: start;
  }
  .pay > .pay-main { grid-area: main; }
  .pay > .pay-preview { grid-area: preview; position: sticky; top: var(--space-6); }
  .pay > .pay-actions { grid-area: actions; }
  .pay-preview-card { padding: var(--space-5); }
}

/* The receipt page. */
.rcpt-head h1 { letter-spacing: 0.01em; }
.rcpt-eyebrow { margin: 0 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.rcpt-tenant { position: relative; color: var(--ink); font-weight: 600; text-decoration-color: var(--oxblood-line); }
/* A 44 px tall hit area around the name. */
.rcpt-tenant::after { content: ""; position: absolute; inset: -13px -4px; }
.rcpt-pdf { width: 100%; }
.rcpt-layout { display: grid; gap: var(--space-5); align-items: start; }
.rcpt { padding: var(--space-5) var(--space-4); }
.rcpt-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.rcpt-label { margin: 0 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.rcpt-figure { margin: 0; color: var(--ink); font: 650 2.25rem/1.1 var(--font-display); letter-spacing: -0.025em; }
.rcpt-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-sm); }
.rcpt-state-text { color: var(--muted); }
.rcpt-state-text a { font-weight: 600; }
.rcpt-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin: var(--space-4) 0 var(--space-5); }
.rcpt-facts dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.rcpt-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.rcpt-facts-wide { grid-column: 1 / -1; }
.rcpt-facts-wide dd { font-weight: 400; }
.rcpt-code { letter-spacing: 0.04em; }
.rcpt-when { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 400; }
.rcpt-lines-title { margin: 0 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.rcpt-owed { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); margin: var(--space-4) 0 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); font-size: var(--text-sm); }
.rcpt-owed strong { font-size: var(--text-base); }
.rcpt-side { display: grid; gap: var(--space-4); }
.rcpt-email, .rcpt-reverse { padding: var(--space-4); }
.rcpt-email h2, .rcpt-reverse h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); letter-spacing: -0.01em; }
.rcpt-email-state { display: flex; align-items: flex-start; gap: var(--space-3); margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.rcpt-email-state svg { flex: none; margin-top: 1px; }
.rcpt-email-state strong { display: block; font-size: var(--text-base); }
.rcpt-email-detail { display: block; color: var(--muted); overflow-wrap: anywhere; }
.rcpt-email-sent svg { color: var(--ok); }
.rcpt-email-failed, .rcpt-email-failed svg { color: var(--danger); }
.rcpt-email-no_address svg, .rcpt-email-not_configured svg { color: var(--warn); }
.rcpt-email .hint { margin: 0 0 var(--space-3); }
.rcpt-email .btn, .rcpt-reverse .btn, .rcpt-next { width: 100%; }
.rcpt-reverse p { color: var(--muted); font-size: var(--text-sm); margin-bottom: var(--space-3); }

.rcpt-confirm { max-width: 640px; padding: var(--space-5) var(--space-4); border-left: 3px solid var(--oxblood); }
.rcpt-confirm-q { margin: 0 0 var(--space-4); font-size: var(--text-lg); line-height: 1.35; }
.rcpt-confirm-reason { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); }
.rcpt-confirm-reason dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.rcpt-confirm-reason dd { margin: 2px 0 0; font-weight: 500; }
.rcpt-confirm > p { font-size: var(--text-sm); }
.rcpt-confirm .ob-actions { margin-top: var(--space-5); }

@media (min-width: 600px) {
  .rcpt-pdf { width: auto; }
  .rcpt-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .rcpt { padding: var(--space-6); }
  .rcpt-figure { font-size: 2.75rem; }
  .rcpt-email, .rcpt-reverse { padding: var(--space-5); }
  .rcpt-confirm { padding: var(--space-6); }
}
@media (min-width: 1100px) {
  .rcpt-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); }
  .rcpt-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .rcpt-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* The list of this period's payments. */
.paylist-facts { max-width: none; }
.paylist-facts .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.paylist-cols { display: none; }
.paylist {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.paylist-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "who amount" "number date" "meta meta";
  align-items: center;
  gap: 2px var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.paylist-row + .paylist-row { border-top: 1px solid var(--line); }
.paylist-row:hover, .paylist-row:focus-within { background: #fcfaf7; }
.paylist-number { grid-area: number; color: var(--muted); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
/* The receipt link covers the whole row: one tap target. */
.paylist-number::after { content: ""; position: absolute; inset: 0; }
.paylist-number:focus-visible { outline: none; }
.paylist-number:focus-visible::after { outline: 2px solid var(--oxblood); outline-offset: -3px; }
.paylist-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.paylist-who .unit-pill { flex: none; min-width: 48px; height: 24px; }
.paylist-name { min-width: 0; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.paylist-meta { grid-area: meta; min-width: 0; color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.paylist-date { grid-area: date; justify-self: end; color: var(--muted); font-size: var(--text-sm); }
.paylist-amount { grid-area: amount; justify-self: end; font-weight: 650; }
.paylist-row.is-reversed .paylist-amount { color: var(--muted); text-decoration: line-through; text-decoration-color: rgb(107 100 93 / 60%); }
.paylist-row.is-reversal .paylist-amount { color: var(--muted); }

@media (min-width: 900px) {
  .paylist-cols, .paylist-row { --paylist-cols: 120px minmax(0, 1.4fr) minmax(0, 1fr) 80px 130px; }
  .paylist-cols {
    display: grid;
    grid-template-columns: var(--paylist-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .paylist-cols span:nth-child(2) { grid-column: 2 / 4; }
  .paylist-cols .num { grid-column: 5; text-align: right; }
  .paylist-row {
    grid-template-columns: var(--paylist-cols);
    grid-template-areas: "number who meta date amount";
    column-gap: var(--space-4);
    min-height: 60px;
    padding: var(--space-3) var(--space-5);
  }
  .paylist-number { color: var(--ink); font-size: var(--text-base); }
  .paylist-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .paylist-date { justify-self: start; color: var(--ink); }
}

/* ======================================================================
   Invoices (Task 12): the readings sheet, the review, issuing, delivery
   ====================================================================== */
.home-actions { gap: var(--space-2); }

.iv-crumb { margin: -10px 0 0; color: var(--muted); font-size: var(--text-sm); }
.iv-crumb a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.rd-step-head { margin: 0 0 var(--space-3); }
.rd-step-head h2, .rv-issue-title { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.rd-step-head p { margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.rd-step-num { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 999px; background: var(--charcoal); color: #fff; font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

/* The summary stays in view at the top while the agent works down the building. */
.rd-summary {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 calc(var(--space-2) * -1) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--oxblood);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}
.rd-summary.is-ready { border-left-color: var(--ok); }
.rd-summary-main { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); }
.rd-summary-main strong { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-base); }
.rd-summary.is-ready .rd-summary-main strong { color: var(--ok); }
.rd-summary-main strong svg { align-self: center; }
.rd-summary-count { color: var(--muted); font-size: var(--text-sm); }
.rd-summary.is-ready .meter > span { background: var(--ok); }
.rd-summary-warn { margin: var(--space-2) 0 0; color: var(--warn); font-size: var(--text-sm); font-weight: 600; }
.rd-summary-warn::before { content: "! "; font-weight: 800; }

.rd-cols { display: none; }
.rd-floor + .rd-floor { margin-top: var(--space-5); }
.rd-floor-name { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-2); padding: 0 var(--space-1); color: var(--ink); font: 700 var(--text-sm)/1.3 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }
.rd-floor-count { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.rd-rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }

.rd-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "unit who who" "label label state" "input input input" "foot foot foot";
  align-items: start;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}
.rd-row + .rd-row { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.rd-row:has(+ .rd-row) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.rd-row.rd-row-error { box-shadow: inset 3px 0 0 var(--danger); }
.rd-unit { grid-area: unit; margin-top: 1px; }
.rd-who { grid-area: who; display: flex; flex-direction: column; min-width: 0; margin: 0; line-height: 1.3; }
.rd-tenant { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.rd-last { color: var(--muted); font-size: 0.8125rem; }
.rd-state { grid-area: state; display: inline-flex; align-items: center; gap: 5px; margin: 0; min-height: 28px; padding: 0 10px 0 7px; border-radius: 999px; font-size: 0.8125rem; font-weight: 650; white-space: nowrap; }
.rd-state svg { flex: none; }
.rd-state-saved { color: var(--ok); background: var(--ok-tint); }
.rd-state-error { color: var(--danger); background: var(--danger-tint); }
.rd-state-adjust { color: var(--warn); background: var(--warn-tint); }
.rd-state-unread { color: var(--muted); background: var(--paper-2); }

.rd-input { grid-area: input; min-width: 0; }
.rd-label { grid-area: label; align-self: end; color: var(--muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rd-row .rd-state { margin-top: var(--space-1); }
.field.rd-input input { min-height: 56px; padding: 8px 16px; font-size: 1.5rem; font-weight: 650; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.rd-input .error { font-size: var(--text-sm); }

.rd-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-3); min-width: 0; }
.rd-result { margin: 0; min-width: 0; font-size: 0.9375rem; }
.rd-result strong { font-weight: 650; }
.rd-result-none { color: var(--muted); font-size: var(--text-sm); }
.rd-result-adjusted { display: inline-flex; align-items: center; min-height: 22px; margin-right: 4px; padding: 0 8px; border: 1px solid var(--charcoal); border-radius: 999px; font-size: var(--text-xs); font-weight: 650; }
.rd-result-why { display: block; color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.rd-adjust { min-width: 0; }
.rd-adjust > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 var(--space-1);
  color: var(--oxblood);
  font-size: var(--text-sm);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rd-adjust > summary::-webkit-details-marker { display: none; }
.rd-adjust > summary::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border: solid currentColor; border-width: 0 1.75px 1.75px 0; transform: rotate(45deg); transition: transform 160ms var(--ease); }
.rd-adjust[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.rd-adjust > summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd-adjust[open] { flex-basis: 100%; }
.rd-adjust-body { display: grid; gap: var(--space-3); margin-top: var(--space-1); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.rd-adjust-note { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.rd-adjust-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.rd-row.is-fresh { animation: rd-saved 1.6s var(--ease); }
@keyframes rd-saved { from { background: var(--ok-tint); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .rd-row.is-fresh { animation: none; } }

/* The review: one line per tenant; the four figures beneath the name on a phone. */
.rv { margin-top: var(--space-6); }
.rv .rd-step-head { margin-bottom: var(--space-3); }
.rv-cols { display: none; }
.rv-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-panel); }
.rv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "who due" "figs figs";
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.rv-list .rv-row + .rv-row { border-top: 1px solid var(--line); }
.rv-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.rv-who .unit-pill { flex: none; min-width: 48px; height: 24px; }
.rv-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.rv-figs { grid-area: figs; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 2px var(--space-4); }
.rv-fig { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.rv-k { color: var(--muted); }
.rv-pending { color: var(--muted); font-style: italic; }
.rv-due { grid-area: due; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.rv-due .rv-k { display: none; }
.rv-list .rv-due { max-width: 8rem; }
.rv-due strong { font-weight: 700; }
.rv-note { color: var(--muted); font-size: var(--text-xs); }
.rv-total { border: 1px solid var(--line); border-top: 2px solid var(--charcoal); border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--paper-2); }
.rv-total-label { font-weight: 700; }
.rv-total-count { color: var(--muted); font-size: var(--text-sm); }
.rv-total .rv-due strong { font: 650 1.25rem/1.2 var(--font-display); letter-spacing: -0.015em; }

.rv-issue { display: grid; gap: var(--space-3); margin-top: var(--space-5); padding: var(--space-5) var(--space-4); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-panel); }
.rv-issue.is-ready { border-left-color: var(--oxblood); }
.rv-issue-text { margin: 0; color: var(--muted); }
.rv-issue.is-ready .rv-issue-text { color: var(--ink); }
.rv-issue-btn { width: 100%; min-height: 52px; }
/* Not yet: a neutral button, its reason in words beside it. */
.rv-issue-btn:disabled { opacity: 1; background: var(--paper-2); border-color: var(--line-strong); color: var(--muted); }

.iv-confirm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); }
.iv-confirm-facts dt, .ih-label { color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.iv-confirm-facts dd { margin: 2px 0 0; font-weight: 650; }

/* Delivery of an issued month. */
.dv-resend { width: 100%; }
.dv-resend .btn { width: 100%; }
.dv-resend-count { font-weight: 500; opacity: 0.85; }
.dv-facts { max-width: none; }
.dv-facts-delivery { grid-column: 1 / -1; }
.dv-counts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.dv-count strong { font-size: var(--text-lg); font-weight: 650; }
.dv-count-failed strong { color: var(--danger); }
.dv-cols { display: none; }
.dv-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.dv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "who amount" "number number" "state state" "actions actions";
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4);
}
.dv-row + .dv-row { border-top: 1px solid var(--line); }
.dv-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.dv-who .unit-pill { flex: none; min-width: 48px; height: 24px; }
.dv-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.dv-number { grid-area: number; justify-self: start; display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; font-size: var(--text-sm); font-weight: 600; }
.dv-amount { grid-area: amount; justify-self: end; font-weight: 650; }
.dv-state { grid-area: state; display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; font-size: var(--text-sm); }
.dv-state svg { flex: none; margin-top: 1px; }
.dv-state-words { font-weight: 650; overflow-wrap: break-word; word-break: break-word; }
.dv-state-detail { display: block; color: var(--muted); overflow-wrap: anywhere; }
.dv-state-sent svg, .dv-state-hand svg { color: var(--ok); }
.dv-state-failed, .dv-state-failed svg { color: var(--danger); }
.dv-state-no_address svg, .dv-state-not_configured svg { color: var(--warn); }
.dv-state-pending svg { color: var(--muted); }
.dv-actions { grid-area: actions; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.dv-actions form { display: contents; }
.dv-actions .btn { width: 100%; padding: 0 6px; font-size: 0.8125rem; white-space: normal; text-align: center; }
.dv-next { margin: var(--space-5) 0 0; }
.dv-next .btn { width: 100%; }

/* One invoice. */
.iv-line-detail { display: block; color: var(--muted); font-size: 0.8125rem; }
.pay-line.is-cancelled .pay-line-amount { color: var(--muted); text-decoration: line-through; }
.iv-sums { margin: var(--space-3) 0 0; }
.iv-sums > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 6px 0; font-size: var(--text-sm); }
.iv-sums dt { color: var(--muted); }
.iv-sums dd { margin: 0; font-weight: 600; }
.iv-sums .iv-sums-due { margin-top: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); font-size: var(--text-base); }
.iv-sums .iv-sums-due dt { color: var(--ink); font-weight: 650; }
.iv-sums .iv-sums-due dd { font-weight: 700; }
.iv-email-actions { display: grid; gap: var(--space-2); }
.iv-email-actions .btn { width: 100%; }

/* The invoices home. */
.ih { padding: var(--space-5) var(--space-4); }
.ih + .ih { margin-top: var(--space-5); }
.ih-head h2 { margin: 0; font-size: var(--text-xl); }
.ih-head p { margin: 2px 0 0; font-size: var(--text-sm); }
.ih-next { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); margin: var(--space-4) 0 var(--space-5); padding: var(--space-4); border: 1px solid var(--line); border-left: 3px solid var(--oxblood); border-radius: var(--radius); background: var(--paper); }
.ih-next p { margin: 0; }
.ih-next-month { margin-top: 2px; font: 650 var(--text-xl)/1.2 var(--font-display); letter-spacing: -0.015em; }
.ih-next-btn { width: 100%; min-height: 48px; }
.ih-months-title { margin: 0 0 var(--space-2); }
.ih-months { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ih-month {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name total" "count count" "delivery delivery";
  gap: 2px var(--space-3);
  padding: var(--space-3) var(--space-1);
  border-bottom: 1px solid var(--line);
}
.ih-month:hover, .ih-month:focus-within { background: #fcfaf7; }
.ih-month-name { grid-area: name; color: var(--ink); font-weight: 650; text-decoration: none; }
.ih-month-name::after { content: ""; position: absolute; inset: 0; }
.ih-month-name:focus-visible { outline: none; }
.ih-month-name:focus-visible::after { outline: 2px solid var(--oxblood); outline-offset: -3px; }
.ih-month-count { grid-area: count; color: var(--muted); font-size: var(--text-sm); }
.ih-month-total { grid-area: total; justify-self: end; font-weight: 650; }
.ih-month-delivery { grid-area: delivery; display: flex; flex-wrap: wrap; gap: 0 var(--space-3); color: var(--muted); font-size: 0.8125rem; }
.ih-flag { color: var(--danger); font-weight: 650; }

@media (min-width: 600px) {
  .dv-resend, .dv-resend .btn, .dv-next .btn, .ih-next-btn { width: auto; }
  .rv-issue { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .rv-issue-title { grid-column: 1 / -1; }
  .rv-issue-btn { width: auto; min-width: 200px; }
}
@media (min-width: 900px) {
  .rd-summary { margin-left: 0; margin-right: 0; }
  .rd-cols, .rd-row { --rd-cols: 72px minmax(0, 1.2fr) 240px minmax(0, 1fr) 150px; }
  .rd-cols {
    display: grid;
    grid-template-columns: var(--rd-cols);
    column-gap: var(--space-4);
    margin: 0 0 var(--space-2);
    padding: 0 var(--space-5) var(--space-2);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .rd-row {
    grid-template-columns: var(--rd-cols);
    grid-template-areas: "unit who input foot state";
    align-items: center;
    column-gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
  }
  .rd-state { justify-self: start; }
  .rd-row .rd-state { margin-top: 0; }
  .rd-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .field.rd-input input { min-height: 48px; font-size: 1.25rem; }
  .rd-foot { align-self: center; }
  .rd-floor-name { padding: 0 var(--space-5); }

  .rv-cols, .rv-row { --rv-cols: minmax(0, 2.2fr) repeat(4, minmax(0, 0.9fr)) minmax(0, 1.2fr); }
  .rv-cols {
    display: grid;
    grid-template-columns: var(--rv-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-5) var(--space-2);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .rv-cols span:not(:first-child) { text-align: right; }
  .rv-row { grid-template-columns: var(--rv-cols); grid-template-areas: none; column-gap: var(--space-4); padding: var(--space-3) var(--space-5); }
  .rv-who, .rv-due { grid-area: auto; }
  .rv-figs { display: contents; }
  .rv-fig { justify-content: flex-end; font-size: 0.9375rem; }
  .rv-fig .rv-k { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .rv-issue { padding: var(--space-5) var(--space-6); }

  .dv-facts .facts-grid { grid-template-columns: 1fr 1fr 2fr; }
  .dv-facts-delivery { grid-column: auto; }
  .dv-cols, .dv-row { --dv-cols: minmax(0, 1.2fr) 104px minmax(0, 1.6fr) 120px; }
  .dv-cols {
    display: grid;
    grid-template-columns: var(--dv-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-5) var(--space-2);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .dv-cols span:nth-child(4) { text-align: right; }
  /* The three actions sit on a second line under the delivery and the amount. */
  .dv-row { grid-template-columns: var(--dv-cols); grid-template-areas: "who number state amount" "who number actions actions"; align-items: start; column-gap: var(--space-4); row-gap: var(--space-2); padding: var(--space-4) var(--space-5); }
  .dv-who, .dv-amount { min-height: 28px; align-self: start; }
  .dv-number { margin: -8px 0; }
  .dv-actions { display: flex; justify-content: flex-end; margin-top: 0; }
  .dv-actions .btn { width: auto; padding: 0 var(--space-4); white-space: nowrap; }

  .ih { padding: var(--space-6); }
  .ih-month { grid-template-columns: 180px 120px 150px minmax(0, 1fr); grid-template-areas: "name count total delivery"; align-items: center; min-height: 52px; padding: var(--space-2) var(--space-3); }
  .ih-month-total { justify-self: end; }
}

/* ======================================================================
   Statements, arrears and collection (Task 13)
   ====================================================================== */
/* The tenant's statement: one panel per lease. */
.st-list { display: grid; gap: var(--space-5); }
.st { padding: 0; overflow: hidden; }
.st-head { padding: var(--space-4) var(--space-4) var(--space-3); }
.st-head h2 { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-lg); }
.st-head h2 .unit-pill { flex: none; }
.st-head p { margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.st-cols { display: none; }
.st-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.st-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  /* Phone: the balance ends the date line (inside .st-meta), so the amount column stays narrow. */
  grid-template-areas: "what amount" "meta meta";
  align-items: baseline;
  gap: 2px var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.st-row + .st-row { border-top: 1px solid var(--line); }
.st-what { grid-area: what; min-width: 0; }
.st-label { font-weight: 600; overflow-wrap: anywhere; }
.st-what .mark { margin-left: 2px; vertical-align: 1px; }
.st-detail { display: block; color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.st-debit, .st-credit { grid-area: amount; justify-self: end; font-weight: 650; }
.st-debit:empty, .st-credit:empty { display: none; }
.st-sign { color: var(--muted); font-weight: 500; }
.st-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.st-doc a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; font-weight: 600; }
.st-balance { grid-area: balance; justify-self: end; color: var(--muted); font-size: var(--text-sm); }
.st-k { font-size: var(--text-xs); }
.st-row.is-reversed .st-debit, .st-row.is-reversed .st-credit { color: var(--muted); text-decoration: line-through; text-decoration-color: rgb(107 100 93 / 60%); }
.st-row.is-reversal .st-label { color: var(--muted); }
.st-row.is-ahead { background: var(--paper); }
.st-sums { margin: 0; padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); }
.st-sums-note { display: block; font-size: var(--text-xs); }
.st-empty { padding: 0 var(--space-4) var(--space-4); }
.lease-held-of { color: var(--muted); font-weight: 500; }

/* The email log on the tenant's Emails tab. */
.em-cols { display: none; }
.em-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.em-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "doc" "when" "to" "state";
  gap: 2px;
  padding: var(--space-3) var(--space-4);
}
.em-row + .em-row { border-top: 1px solid var(--line); }
.em-doc { grid-area: doc; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); }
.em-kind { font-weight: 650; }
.em-doc a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; font-weight: 600; }
.em-doc .unit-pill { min-width: 44px; height: 22px; }
.em-when { grid-area: when; color: var(--muted); font-size: var(--text-sm); }
.em-to { grid-area: to; min-width: 0; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.em-state { grid-area: state; margin-top: var(--space-1); }

/* The arrears list. */
.ar-facts { max-width: none; }
.ar-facts .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ar-cols { display: none; }
.ar-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.ar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "who amount" "since since" "pay pay";
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4);
}
.ar-row + .ar-row { border-top: 1px solid var(--line); }
.ar-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.ar-who .unit-pill { flex: none; min-width: 48px; height: 24px; }
.ar-name { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; min-width: 0; overflow: hidden; color: var(--ink); font-weight: 650; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.ar-name:hover { color: var(--oxblood); text-decoration: underline; }
.ar-amount { grid-area: amount; justify-self: end; font-weight: 700; }
.ar-since { grid-area: since; color: var(--muted); font-size: var(--text-sm); }
.ar-days { color: var(--ink); font-weight: 650; }
.ar-pay { grid-area: pay; width: 100%; margin-top: var(--space-2); }

/* Home: a fifth key figure, the period's collection; arrears among the attention lists. */
.attention-total { margin-left: auto; font-size: var(--text-sm); font-weight: 650; }
.attention-more { margin: var(--space-2) 0 0; font-size: var(--text-sm); }
.attention-more a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
/* The collection runs the full width under the four figures: a money figure and a sentence
   need more room than a fifth of the row, and the meter reads better long. */
.kpis .kpi-collected { grid-column: 1 / -1; border-width: 1px 0 0; }
.kpi-collected-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.kpi-collected .kpi-note { margin: 0; }
.kpi-collected .kpi-meter { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.kpi-collected .meter { flex: 1; margin-top: 0; }
.kpi-pct { color: var(--ink); font-size: var(--text-sm); font-weight: 650; }

@media (min-width: 900px) {
  .st-head { padding: var(--space-5) var(--space-5) var(--space-4); }
  .st-cols, .st-row { --st-cols: 112px minmax(0, 1fr) 104px 112px 112px 128px; }
  .st-cols {
    display: grid;
    grid-template-columns: var(--st-cols);
    column-gap: var(--space-4);
    padding: var(--space-2) var(--space-5);
    border-top: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .st-cols .num { text-align: right; }
  .st-rows { border-top: 1px solid var(--line); }
  .st-row {
    grid-template-columns: var(--st-cols);
    grid-template-areas: "date what doc debit credit balance";
    column-gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
  }
  .st-meta { display: contents; }
  .st-date { grid-area: date; color: var(--ink); }
  .st-due { color: var(--muted); }
  .st-doc { grid-area: doc; }
  .st-debit { grid-area: debit; }
  .st-credit { grid-area: credit; }
  .st-debit:empty, .st-credit:empty { display: block; }
  .st-sign, .st-k { display: none; }
  .st-balance { color: var(--ink); font-size: var(--text-base); font-weight: 600; }
  .st-sums { display: grid; justify-content: end; padding: var(--space-4) var(--space-5) var(--space-5); }
  .st-sums > div { min-width: 360px; }

  .em-cols, .em-row { --em-cols: 150px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr); }
  .em-cols {
    display: grid;
    grid-template-columns: var(--em-cols);
    column-gap: var(--space-4);
    padding: 0 var(--space-5) var(--space-2);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .em-row { grid-template-columns: var(--em-cols); grid-template-areas: "when doc to state"; align-items: start; column-gap: var(--space-4); padding: var(--space-3) var(--space-5); }
  .em-when { color: var(--ink); padding-top: 1px; }
  .em-state { margin-top: 0; }
  .em-doc a { margin: -12px 0; }

  .ar-cols, .ar-row { --ar-cols: minmax(0, 1.3fr) minmax(0, 1.3fr) 150px 170px; }
  .ar-cols {
    display: grid;
    grid-template-columns: var(--ar-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-5) var(--space-2);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .ar-cols .num { text-align: right; }
  .ar-row { grid-template-columns: var(--ar-cols); grid-template-areas: "who since amount pay"; column-gap: var(--space-4); min-height: 64px; padding: var(--space-2) var(--space-5); }
  .ar-k { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ar-pay { width: auto; margin-top: 0; justify-self: end; }

  .kpis .kpi-collected { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--space-6); padding-top: var(--space-4); padding-bottom: var(--space-4); }
  .kpi-collected .kpi-label { grid-column: 1 / -1; }
  .kpi-collected .kpi-meter { margin-top: 0; }
}
.st-in-credit { font-size: var(--text-xs); font-weight: 650; }
.st-meta .st-balance { margin-left: auto; }
@media (min-width: 900px) {
  .st-balance { text-align: right; }
  .st-in-credit { display: block; color: var(--muted); }
  .st-meta .st-balance { margin-left: 0; }
}

/* ---------- Task 14: removing a future change, cancelling a lease entered in error ---------- */
/* A quiet destructive action: no fill, the danger colour only in its words. */
.btn-quiet-danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn-quiet-danger:hover { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.history-mark { display: flex; align-items: center; gap: var(--space-2); }
.history-remove {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -10px 0;
  padding: 0 var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.history-remove:hover { color: var(--danger); text-decoration-color: currentColor; }
.lease-foot {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.lease-foot-note { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.lease-cancel { width: 100%; }
.term-remove-facts { display: grid; gap: var(--space-2); margin: 0 0 var(--space-4); }
.term-remove-facts > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--space-3); }
.term-remove-facts dt { color: var(--muted); font-size: var(--text-sm); }
.term-remove-facts dd { margin: 0; font-weight: 600; }
.term-remove-back { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.rcpt-confirm-danger { border-left-color: var(--danger); }
.cancel-effects { margin: 0 0 var(--space-4); padding-left: 1.2em; font-size: var(--text-sm); }
.cancel-effects li + li { margin-top: var(--space-1); }
@media (min-width: 900px) {
  .history-mark { justify-self: stretch; }
  .history-remove { margin-left: auto; }
  .lease-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .lease-cancel { width: auto; }
}

/* ---------- Task 15: charges added by hand, reversed and raised again ---------- */
.st-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.st-add { gap: 6px; }
/* A row with an action gains a line beneath it for the action. */
.st-row.has-act { grid-template-areas: "what amount" "meta meta" "act act"; }
.st-act { grid-area: act; min-width: 0; }
.st-act-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -6px 0 -8px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}
.st-act-link:hover { color: var(--oxblood); text-decoration-color: currentColor; }
.st-reverse > summary { list-style: none; }
.st-reverse > summary::-webkit-details-marker { display: none; }
.st-reverse > summary:hover { color: var(--danger); }
.st-reverse[open] > summary { color: var(--ink); text-decoration: none; }
.st-reverse-form { display: grid; gap: var(--space-2); max-width: 520px; margin: var(--space-2) 0 var(--space-2); }
.st-reverse-form label { font-size: var(--text-sm); font-weight: 600; }
.st-reverse-form textarea, .st-confirm textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-base); /* 16 px: stops iOS zooming on focus */
  resize: vertical;
}
.st-reverse-form textarea:focus, .st-confirm textarea:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
.st-reverse-form .hint { margin: 0; }
.st-reverse-form .btn { justify-self: start; }
.st-act-note { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); }
/* The confirmation sits under its row, inside the statement. */
.st-confirm { max-width: 640px; margin: var(--space-2) 0 var(--space-1); background: var(--surface); box-shadow: none; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: var(--radius-sm); }
.st-row.has-act:has(.st-confirm) { background: var(--paper); }
.st-confirm .rcpt-confirm-q { font-size: var(--text-base); }
.st-confirm .field { margin-bottom: var(--space-4); }
.iv-note { margin: 2px 0 0; color: var(--oxblood); font-weight: 650; }
.reraise-was { max-width: 640px; margin-bottom: var(--space-4); padding: var(--space-4); }
.reraise-was-title { margin: 0 0 var(--space-3); color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.reraise-was .term-remove-facts { margin: 0; }
@media (min-width: 900px) {
  .st-row.has-act { grid-template-areas: "date what doc debit credit balance" ". act act act act act"; }
  .st-confirm { padding: var(--space-5); }
  .reraise-was { padding: var(--space-5); }
}

/* ======================================================================
   Settings (Admin): each property's billing settings, and the form that changes them
   ====================================================================== */
.settings-card { max-width: 820px; padding: var(--space-4); }
.settings-card + .settings-card { margin-top: var(--space-5); }
.settings-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.settings-card-title { min-width: 0; }
.settings-card-title h2 { margin: 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.settings-card-title p { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); }
.settings-card-head .btn { min-height: 44px; }
.settings-label { margin: 0 0 var(--space-2); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.settings-list { display: grid; gap: var(--space-4); margin: var(--space-4) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--line); }
.settings-list dd { margin: 0; }
.settings-value { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.settings-text { font-weight: 500; line-height: 1.5; }
.settings-unset { color: var(--muted); font-weight: 500; }
.settings-note { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.4; }
.settings-fixed-label { margin: 0 0 6px; font-size: var(--text-sm); font-weight: 600; }
.settings-fixed .settings-value { padding: 10px 0 0; }

/* Water rates, newest first: the date, the price, and its standing in words. */
.rates { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.rate { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "from state" "figure state"; align-items: center; gap: 2px var(--space-3); min-height: 56px; padding: var(--space-3) var(--space-4); }
.rate + .rate { border-top: 1px solid var(--line); }
.rate-from { grid-area: from; color: var(--muted); font-size: var(--text-sm); }
.rate-figure { grid-area: figure; color: var(--ink); font-weight: 650; font-size: var(--text-base); }
.rate-per { color: var(--muted); font-weight: 500; font-size: var(--text-sm); }
.rate-state { grid-area: state; justify-self: end; }
.rate-earlier .rate-figure { color: var(--muted); font-weight: 500; }
.rate-earlier-word { color: var(--muted); font-size: var(--text-sm); }
.rates-empty { padding: var(--space-3) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.rate-add { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.rate-add .ob-actions { margin-top: var(--space-2); }
@media (min-width: 700px) {
  .settings-card { padding: var(--space-6); }
  .settings-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-5); }
  .settings-list > :last-child { grid-column: 1 / -1; }
  .rate { grid-template-columns: 160px minmax(0, 1fr) auto; grid-template-areas: "from figure state"; }
}

/* ---------- Whole-branch fix: the invoice page's hero is what is owed now ---------- */
.iv-owed-note { max-width: 36ch; margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-sm); }

/* ---------- Phase 3: expenses and advances ---------- */
.xp-header { align-items: flex-start; }
.xp-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.xp-header-actions .btn { min-height: 44px; }
.period-pick select { min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; }
.xp-pending { padding: var(--space-4); border-left: 3px solid var(--warn); }
.xp-pending h2 { margin: 0 0 var(--space-1); font-size: var(--text-base); }
.xp-pending p { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.5; }
.xp { padding: var(--space-4); }
.xp + .xp { margin-top: var(--space-5); }
.xp-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.xp-head h2 { margin: 0; font-size: var(--text-xl); }
.xp-head p { margin: 2px 0 0; font-size: var(--text-sm); }
.xp-total { display: grid; margin: 0; text-align: right; font-weight: 700; font-size: var(--text-lg); }
.xp-total-label { color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.xp-group + .xp-group { margin-top: var(--space-5); }
.xp-group-title { display: flex; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-2); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.xp-group-total { color: var(--ink); font-size: var(--text-sm); letter-spacing: 0; text-transform: none; }
.xp-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.xp-list-plain { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.xp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "what amount" "state state" "actions actions"; align-items: start; gap: var(--space-1) var(--space-3); padding: var(--space-3) var(--space-4); }
.xp-row + .xp-row { border-top: 1px solid var(--line); }
.xp-what { grid-area: what; display: grid; gap: 2px; min-width: 0; }
.xp-item { font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.xp-item .unit-pill { vertical-align: 1px; margin-left: 4px; }
.xp-meta { color: var(--muted); font-size: var(--text-sm); }
.xp-amount { grid-area: amount; justify-self: end; font-weight: 700; white-space: nowrap; }
.xp-state { grid-area: state; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.xp-note { color: var(--muted); font-size: var(--text-sm); }
.xp-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }
.xp-actions form { display: contents; }
.xp-reverse { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.xp-reverse:hover { color: var(--oxblood); }
.xp-row.is-rejected .xp-amount, .xp-row.is-withdrawn .xp-amount, .xp-row.is-reversed .xp-amount { color: var(--muted); text-decoration: line-through; }
.xp-row.is-reversal .xp-amount { color: var(--muted); }
.xp-row.is-rejected .xp-item, .xp-row.is-withdrawn .xp-item { color: var(--muted); }
.xp-empty { padding: var(--space-3) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.choices-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice-compact { flex: 1 1 120px; }
.choice-set-compact .choice-legend { display: block; margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
@media (min-width: 900px) {
  .xp { padding: var(--space-6); }
  .xp-row { grid-template-columns: minmax(0, 1fr) 150px 140px auto; grid-template-areas: "what state amount actions"; align-items: center; }
  .xp-actions { margin-top: 0; justify-content: flex-end; }
  .xp-state { justify-content: flex-start; }
}

/* ---------- Phase 3: statements and the month close ---------- */
.sm { padding: var(--space-4); }
.sm + .sm { margin-top: var(--space-5); }
.sm-head { margin-bottom: var(--space-3); }
.sm-head h2 { margin: 0; font-size: var(--text-xl); }
.sm-head p { margin: 2px 0 0; font-size: var(--text-sm); }
.sm-months { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.sm-month { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name net" "dates net" "state state"; gap: 2px var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); }
.sm-month + .sm-month { border-top: 1px solid var(--line); }
.sm-month-name { grid-area: name; display: inline-flex; align-items: center; min-height: 32px; color: var(--ink); font-weight: 650; text-decoration: none; }
.sm-month-name:hover { color: var(--oxblood); text-decoration: underline; }
.sm-month-dates { grid-area: dates; color: var(--muted); font-size: var(--text-sm); }
.sm-month-state { grid-area: state; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.sm-number { color: var(--muted); font-size: var(--text-sm); }
.sm-month-net { grid-area: net; justify-self: end; font-weight: 700; white-space: nowrap; }
.sm-k { color: var(--muted); font-weight: 500; font-size: var(--text-sm); }
.sd-number { color: var(--muted); font-weight: 500; font-size: var(--text-lg); }
.sd-returned { padding: var(--space-4); border-left: 3px solid var(--warn); }
.sd-returned h2 { margin: 0 0 var(--space-1); font-size: var(--text-base); }
.sd-returned p { margin: 0; line-height: 1.5; }
.sd-returned p + p { margin-top: var(--space-1); font-size: var(--text-sm); }
.sd-layout { display: grid; gap: var(--space-5); }
.sd-main { display: grid; gap: var(--space-5); min-width: 0; }
.sd-hero { padding: var(--space-5) var(--space-4); }
.sd-hero .rcpt-figure { margin: var(--space-1) 0; }
.sd-hero .muted { margin: 0; font-size: var(--text-sm); }
.sd-sums { display: grid; gap: var(--space-5); }
.sd-table { padding: var(--space-4); }
.sd-table h2 { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.sd-link { font-size: var(--text-sm); font-weight: 600; }
.sd-lines > div dt { max-width: 60%; }
.sd-adjust dt, .sd-adjust dd { color: var(--muted); font-size: var(--text-sm); }
.sd-cols { display: none; }
.sd-rows { margin: 0; padding: 0; list-style: none; }
.sd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who total" "cells cells"; gap: var(--space-1) var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.sd-who { grid-area: who; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.sd-who a { color: var(--ink); font-weight: 650; text-decoration: none; }
.sd-who a:hover { color: var(--oxblood); text-decoration: underline; }
.sd-months { flex-basis: 100%; color: var(--muted); font-size: var(--text-xs); }
.sd-cell { font-size: var(--text-sm); }
.sd-row > .sd-cell:nth-of-type(2) { grid-area: cells; }
.sd-row .sd-cell { display: inline; }
.sd-row .sd-cell + .sd-cell::before { content: " · "; color: var(--muted); }
.sd-k { color: var(--muted); }
.sd-total { grid-area: total; justify-self: end; text-align: right; font-weight: 700; white-space: nowrap; }
.sd-total .sd-months { display: block; font-weight: 500; }
.sd-row-expense { grid-template-areas: "who total"; }
.sd-row.is-reversal .sd-total { color: var(--muted); }
.sd-side { display: grid; gap: var(--space-5); align-content: start; }
.sd-check { padding: var(--space-4); }
.sd-check h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); }
.sd-check p { line-height: 1.5; }
.sd-checks { margin: 0 0 var(--space-4); padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.sd-checkrow { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.sd-check-mark { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: var(--text-xs); }
.is-ok .sd-check-mark { color: var(--ok); background: var(--ok-tint); }
.is-blocked .sd-check-mark { color: var(--danger); background: var(--danger-tint); }
.is-warn .sd-check-mark { color: var(--warn); background: var(--warn-tint); }
.sd-check-label { display: block; font-weight: 600; color: var(--ink); }
.sd-check-detail { display: block; color: var(--muted); }
.sd-submit, .sd-decide { display: grid; gap: var(--space-3); }
.sd-submit .btn, .sd-decide .btn { width: 100%; min-height: 48px; }
.sd-submit-note { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.sd-submit .check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.sd-return { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.sd-return label { font-size: var(--text-sm); font-weight: 600; }
.sd-return textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; }
@media (min-width: 700px) {
  .sm-month { grid-template-columns: 150px minmax(0, 1fr) auto auto; grid-template-areas: "name dates state net"; }
  .sd-sums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sd-cols, .sd-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 100px 100px 120px; grid-template-areas: "who c1 c2 c3 total"; gap: var(--space-3); align-items: center; }
  .sd-cols { padding: 0 0 var(--space-2); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
  .sd-row > .sd-cell { display: block; text-align: right; }
  .sd-row > .sd-cell:nth-of-type(2) { grid-area: c1; }
  .sd-row > .sd-cell:nth-of-type(3) { grid-area: c2; }
  .sd-row > .sd-cell:nth-of-type(4) { grid-area: c3; }
  .sd-row .sd-cell + .sd-cell::before { content: none; }
  .sd-k { display: none; }
  .sd-row-expense { grid-template-columns: minmax(0, 1fr) 120px; grid-template-areas: "who total"; }
}
@media (min-width: 1100px) {
  .sd-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .sd-table, .sd-check { padding: var(--space-5); }
}
.settings-items { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.settings-items-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.settings-items-head .settings-label { margin: 0; }
.items .rate-state { display: flex; align-items: center; gap: var(--space-2); }

/* ---------- Phase 4: the move-out screens ---------- */
/* The marks: each says its state in words; the colour only repeats it. */
.mo-mark-short { border: 1px solid var(--warn); color: var(--warn); background: var(--warn-tint); }
.mo-status-open, .mo-status-proposed, .mo-status-refund { color: var(--warn); background: var(--warn-tint); }
.mo-status-settled, .mo-status-nothing { color: var(--ok); background: var(--ok-tint); }
.mo-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.mo-head-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2) !important; font-size: var(--text-sm); }

/* One page for the whole move-out: the work in the main column, the settlement beside it on a
   wide screen. On a phone the settlement comes first once it has been proposed (the landlord
   reads it there); before that the work comes first (the agent stands in the empty unit). */
.mo-layout { display: grid; gap: var(--space-4); align-items: start; }
.mo-main { display: grid; gap: var(--space-4); min-width: 0; }
.mo-side { min-width: 0; }
.mo-section { padding: var(--space-4); }
.mo-section h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); letter-spacing: -0.01em; }
.mo-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.mo-section-head h2 { margin: 0; }
.mo-section-total { margin: 0; font-weight: 650; }
.mo-number { margin-left: var(--space-1); color: var(--muted); font-size: var(--text-base); font-weight: 600; }
.mo-lead { margin: 0 0 var(--space-4); color: var(--muted); font-size: var(--text-sm); line-height: 1.5; }
.mo-note { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--charcoal); border-radius: var(--radius-sm); background: var(--paper-2); font-size: var(--text-sm); }
.mo-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin: 0; }
.mo-facts dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.mo-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.mo-facts-wide { grid-column: 1 / -1; }
.mo-facts-wide dd { font-weight: 450; }
.mo-links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }

/* Recording the move-out: big inputs, the water bill worked out under the reading. */
.mo-form { display: grid; gap: var(--space-5); }
.mo-fields { display: grid; gap: var(--space-4); }
.mo-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mo-reading input { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.mo-water { margin-top: var(--space-2); }
.mo-water-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-1) var(--space-3); margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); font-size: var(--text-sm); }
.mo-water-line strong { font-size: var(--text-lg); }
.mo-water-line.is-error { border-left: 3px solid var(--danger); color: var(--danger); background: var(--danger-tint); font-weight: 500; }
.mo-water .hint { margin-top: var(--space-2); }

/* The deductions: what, how much, and the photos as thumbnails. */
.mo-item-list { margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.mo-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main edit" "thumbs thumbs" "photos photos";
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) 0;
}
.mo-item + .mo-item { border-top: 1px solid var(--line); }
.mo-item-main { grid-area: main; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "kind amount" "what amount"; column-gap: var(--space-3); min-width: 0; }
.mo-item-kind { grid-area: kind; margin: 0; color: var(--muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.mo-item-what { grid-area: what; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mo-item-amount { grid-area: amount; align-self: center; margin: 0; font-weight: 650; }
.mo-item-edit { grid-area: edit; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2); font-weight: 600; }
.mo-item-charged { grid-area: edit; margin: 0; align-self: center; color: var(--muted); font-size: var(--text-xs); }
.mo-thumbs { grid-area: thumbs; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mo-thumbs a { display: block; border-radius: var(--radius-sm); }
.mo-thumbs img { display: block; width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-2); }
.mo-item-photos { grid-area: photos; margin: 0; color: var(--muted); font-size: var(--text-xs); }
.mo-add { width: 100%; min-height: 48px; }

/* The settlement block: the answer first, then the lines. */
.mo-settle { padding: var(--space-4); }
.mo-when { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.mo-fig-hero { margin-bottom: var(--space-4); padding: var(--space-4); border-radius: var(--radius); background: var(--paper-2); border-left: 3px solid var(--charcoal); }
.mo-fig-hero.is-owed { border-left-color: var(--warn); background: var(--warn-tint); }
.mo-fig-figure { margin: 0; color: var(--ink); font: 650 2.25rem/1.1 var(--font-display); letter-spacing: -0.025em; }
.mo-fig-note { margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-sm); }
.mo-fig-lines { margin: 0; }
.mo-fig-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.mo-fig-lines dd { margin: 0; white-space: nowrap; }
.mo-fig-row { padding: var(--space-2) 0; }
.mo-fig-row.is-head { margin-top: var(--space-2); border-top: 1px solid var(--line); font-weight: 650; }
.mo-fig-row.is-head:first-child { margin-top: 0; border-top: 0; }
.mo-fig-sub { padding: 2px 0 2px var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.mo-fig-sub dt { min-width: 0; overflow-wrap: anywhere; }
.mo-fig-photos { display: inline-block; color: var(--muted); font-size: var(--text-xs); }
.mo-fig-how { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 2px solid var(--charcoal); }
.mo-fig-how .mo-fig-row { padding: 6px 0; font-size: var(--text-sm); }
.mo-fig-how .is-total { margin-top: var(--space-1); border-top: 1px solid var(--line); font-size: var(--text-base); font-weight: 700; }
.mo-actions { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.mo-actions > .btn { width: 100%; min-height: 52px; }
.mo-actions .hint { margin: 0; }
.mo-refusal { margin: 0; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--warn); border-radius: var(--radius-sm); background: var(--warn-tint); font-size: var(--text-sm); }
.mo-return { display: grid; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.mo-return label { font-size: var(--text-sm); font-weight: 600; }
.mo-return textarea { width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-size: var(--text-base); }
.mo-return textarea:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
.mo-return .btn { width: 100%; min-height: 48px; }
.mo-returned { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--warn); border-radius: var(--radius-sm); background: var(--warn-tint); font-size: var(--text-sm); }
.mo-returned p { margin: 0; }
.mo-returned p + p { margin-top: var(--space-1); }
.mo-returned-title { font-weight: 650; }
.mo-refund { padding: var(--space-3) var(--space-4); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); background: var(--ok-tint); font-size: var(--text-sm); }
.mo-refund p { margin: 0; }
.mo-refund-title { font-weight: 700; }
.mo-refund-reverse { display: inline-flex; align-items: center; min-height: 44px; color: var(--danger); font-weight: 600; }
.mo-doc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.mo-doc .btn, .mo-doc form .btn { width: 100%; }
.mo-history { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); font-size: var(--text-sm); }
.mo-history summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.mo-history ul { margin: 0; padding-left: 1.2em; color: var(--muted); }

/* Giving notice: the short-notice block shows when the dates make it short. */
.mo-notice-dates { display: grid; gap: var(--space-4); }
.mo-short { padding: var(--space-4); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--warn-tint); }
.mo-short-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-base); }
.mo-short-text { margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.mo-short-fields { display: grid; gap: var(--space-3); }
.mo-short [hidden] { display: none; }

/* An item's photos: a large tap target that opens the camera or the library. */
.mo-photo-field { position: relative; }
.mo-photo-field input[type="file"] { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; }
.mo-photo-pick { display: flex !important; align-items: center; justify-content: center; gap: var(--space-2); min-height: 56px; margin: 0 !important; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: var(--text-base) !important; cursor: pointer; }
.mo-photo-pick:hover { border-color: #b9ae9f; background: var(--paper-2); }
.mo-photo-field:focus-within .mo-photo-pick { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.mo-photo-field.field-error .mo-photo-pick { border-color: var(--danger); }
.mo-photo-chosen { margin: var(--space-2) 0 0; font-weight: 600; font-size: var(--text-sm); }
.mo-photo-chosen[hidden] { display: none; }
.mo-photo-list { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.mo-photo-list li { display: grid; gap: 4px; justify-items: center; }
.mo-photo-list img { display: block; width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mo-photo-remove { min-height: 44px; padding: 0 var(--space-3); border: 0; background: none; color: var(--danger); font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.mo-item-remove { margin: 0; }
.mo-item-remove a { display: inline-flex; align-items: center; min-height: 44px; color: var(--danger); font-weight: 600; }
.mo-refund-sum { padding: var(--space-4); }
.mo-refund-sum .muted { margin: var(--space-2) 0 0; font-size: var(--text-sm); }
.mo-confirm-layout { display: grid; gap: var(--space-4); align-items: start; }

/* The lease card: what the lease's state allows. */
.lease-moveout { display: grid; gap: var(--space-3); margin: 0 0 var(--space-4); padding: var(--space-3); border-radius: var(--radius); background: var(--paper-2); }
.lease-moveout-state { margin: 0; font-weight: 650; }
.lease-moveout-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.lease-moveout-actions .btn-primary { flex: 1 1 100%; }
.lease-moveout.is-ended { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 48px; color: var(--ink); font-weight: 600; text-decoration: none; }
.lease-moveout.is-ended:hover { color: var(--oxblood); }
.lease-moveout.is-ended svg { flex: none; }
.lease-moveout:not(.is-notice):not(.is-ended) { background: none; padding: 0; }

/* The Move-outs list. */
.mol { padding: var(--space-4); }
.mol + .mol { margin-top: var(--space-4); }
.mol-property { margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.mol-group { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-4) 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.mol-group .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--paper-2); color: var(--ink); letter-spacing: 0; }
.mol-rows { margin: 0; padding: 0; list-style: none; }
.mol-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pill who" "pill act"; align-items: center; column-gap: var(--space-3); padding: var(--space-2) 0; }
.mol-row + .mol-row { border-top: 1px solid var(--line); }
.mol-who { grid-area: who; display: grid; min-width: 0; }
.mol-who a { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mol-who a:hover { color: var(--oxblood); text-decoration: underline; }
.mol-detail { color: var(--muted); font-size: 0.8125rem; }
.mol-act, .mol-done { grid-area: act; justify-self: start; }
.mol-act { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: var(--text-sm); }
.person-settle { margin-left: 4px; }

@media (min-width: 700px) {
  .mo-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mo-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mo-fields > .mo-reading, .mo-fields > .field:last-child { grid-column: 1 / -1; }
  .mo-add { width: auto; }
  .mol-row { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "pill who act"; }
  .mol-act, .mol-done { justify-self: end; }
  .lease-moveout-actions .btn-primary { flex: 0 1 auto; }
}
@media (min-width: 900px) {
  .mo-section, .mo-settle, .mol { padding: var(--space-5); }
  .mo-fig-figure { font-size: 2.5rem; }
}
@media (min-width: 1100px) {
  .mo-layout { grid-template-columns: minmax(0, 1fr) 400px; grid-template-areas: "main side"; gap: var(--space-5); }
  .mo-layout > .mo-main { grid-area: main; }
  .mo-layout > .mo-side { grid-area: side; position: sticky; top: var(--space-5); }
  .mo-confirm-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.mo-notice-live { display: grid; gap: var(--space-5); }
.mo-item-charged { grid-area: auto; grid-column: 1 / -1; }
.mol-who a { position: relative; }
.mol-who a::after { content: ""; position: absolute; inset: -10px -4px; }

/* Phase 4 sweep: Home's action row wraps on a phone (each button a full-width row) instead of
   scrolling sideways. */
.home-actions { flex-wrap: wrap; }

/* ======================================================================
   Phase 5: letters (Write a letter, the letter page, Letters, Send reminders,
   the Communications tab, the notice letters on the lease card and move-out page)
   ====================================================================== */
/* Write a letter: the kinds as cards; a kind the lease does not allow is greyed with the reason. */
.lt-card > * + * { margin-top: var(--space-5); }
.lt-kinds { grid-template-columns: minmax(0, 1fr); }
.choice.is-disabled { background: var(--paper-2); border-style: dashed; cursor: not-allowed; }
.choice.is-disabled input { cursor: not-allowed; }
.choice.is-disabled .choice-title { color: var(--muted); }
.choice.is-disabled .choice-text { color: var(--muted); }
.choice.is-disabled .choice-text::before { content: "Not available: "; font-weight: 650; }
.choice.is-disabled:hover { border-color: var(--line-strong); }
[data-pay-by][hidden] { display: none; }
.lt-actions .btn { flex: 1 1 220px; }
.lt-actions-note { flex: 1 1 100%; margin: 0; }

/* The letter as it reads: the preview card on the form, the body of the letter page. */
.lt-sheet {
  padding: var(--space-5) var(--space-4) var(--space-4);
  background:
    linear-gradient(90deg, var(--brand-star-deep), var(--brand-star)) top / 100% 3px no-repeat,
    var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.lt-letter .lt-sheet { padding: var(--space-4) 0 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.lt-eyebrow { margin: 0 0 var(--space-3); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.lt-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.lt-meta > div:first-child { grid-column: 1 / -1; }
.lt-meta dt { color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.lt-meta dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.lt-meta-sub { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 400; }
.lt-subject { margin: 0 0 var(--space-3); font: 650 1.25rem/1.3 var(--font-display); letter-spacing: -0.01em; }
.lt-p { margin: 0 0 var(--space-3); max-width: 66ch; line-height: 1.6; overflow-wrap: break-word; }
.lt-charges { margin-top: var(--space-2); }
.lt-due { display: block; color: var(--muted); font-size: var(--text-xs); }
.lt-close { margin-top: var(--space-5); }
.lt-close p { margin: 0; }
.lt-sign { margin-top: var(--space-4) !important; font-weight: 650; }
.lt-sign span { display: block; color: var(--muted); font-weight: 400; }
.lt-sheet.is-cancelled .lt-subject { text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* The letter page. */
.lt-cancelled { margin: 0 0 var(--space-5); padding: var(--space-4); border-left: 3px solid var(--danger); }
.lt-cancelled h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.lt-cancelled p { margin: 0; }
.lt-cancelled p + p { margin-top: var(--space-1); font-size: var(--text-sm); }
.lt-figure-date { font-size: 1.75rem; }
.lt-batch { margin: var(--space-3) 0 0; color: var(--muted); font-size: var(--text-sm); }
.lt-history { display: grid; gap: var(--space-3); margin: 0 0 var(--space-4); padding: var(--space-3) 0 0; border-top: 1px solid var(--line); list-style: none; }
.lt-history-row { grid-area: auto; margin: 0; }
.lt-signed { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 -12px; font-weight: 600; }
.dv-state-whatsapp svg { color: var(--ok); }
.dv-state-none svg, .dv-state-cancelled svg { color: var(--muted); }
.lt-delivery-actions { margin-top: var(--space-1); }

/* Letters: the kind filter, one row per letter. */
.lt-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); }
.lt-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.lt-chip:hover { background: var(--paper-2); text-decoration: none; }
.lt-chip-count { font-weight: 700; }
.lt-chip[aria-current="page"], .lt-chip[aria-current="page"]:hover { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }
.lt-property + .lt-property, .lt-results + .lt-results { margin-top: var(--space-6); }
.lt-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.lt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "doc" "who" "when" "figure" "state";
  gap: 2px;
  padding: var(--space-3) var(--space-4);
}
.lt-row + .lt-row, .lt-tick-row + .lt-tick-row { border-top: 1px solid var(--line); }
.lt-row-doc { grid-area: doc; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); }
.lt-row-number { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; font-weight: 650; }
.lt-row-kind { font-weight: 600; }
.lt-row-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.lt-row-who .unit-pill { flex: none; min-width: 44px; height: 22px; }
.lt-row-who a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }
.lt-row-when { grid-area: when; color: var(--muted); font-size: var(--text-sm); }
.lt-row-figure { grid-area: figure; font-size: var(--text-sm); }
.lt-row-state { grid-area: state; margin-top: var(--space-1); }
.lt-done { margin-top: var(--space-6); }

/* Send reminders: every tenant in arrears, ticked. */
.ar-remind { flex: 0 0 auto; }
.lt-tick { margin: 0; padding: 0; border: 0; min-width: 0; }
.lt-tick > legend { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); width: 100%; float: left; }
.lt-tick > legend + * { clear: both; }
.lt-tick-count { color: var(--muted); font-weight: 500; }
.lt-tick-row { margin: 0; }
.lt-tick-label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-areas: "box who amount" "box detail detail";
  align-items: center;
  gap: 2px var(--space-3);
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
}
.lt-tick-label:hover { background: var(--paper); }
.lt-tick-label input { grid-area: box; width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); cursor: pointer; }
.lt-tick-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.lt-tick-who .unit-pill { flex: none; min-width: 44px; height: 22px; }
.lt-tick-name { min-width: 0; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.lt-tick-amount { grid-area: amount; font-weight: 700; }
.lt-tick-detail { grid-area: detail; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.lt-tick-detail strong { color: var(--ink); }
.lt-no-email { color: var(--warn); font-weight: 600; }

/* The Communications tab: the letters, then the email log. */
.comm-section + .comm-section { margin-top: var(--space-6); }
.comm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-3); }
.comm-title { margin: 0; font-size: var(--text-lg); }
.comm-write { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.comm-write .btn { min-height: 44px; }

/* The notice letters on the lease card and the move-out page. */
.lt-notice-letter { margin: 0; }
.lt-notice-link { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--ink); font-weight: 600; text-decoration-color: var(--oxblood-line); }
.lt-notice-link svg { flex: none; color: var(--oxblood); }
.lt-notice-link:hover { color: var(--oxblood); }
.mo-letters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }

@media (min-width: 700px) {
  .lt-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lt-card { padding: var(--space-6); }
  .lt-actions .btn { flex: 0 1 auto; }
}
@media (min-width: 900px) {
  .lt-row {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-areas: "doc who figure state" "when when when state";
    column-gap: var(--space-4);
    align-items: center;
  }
  .lt-list-plain .lt-row, .comm-section .lt-row { grid-template-areas: "doc figure figure state" "when when when state"; }
  .lt-row-state { margin-top: 0; }
  .lt-sheet { padding: var(--space-6); }
  .lt-letter .lt-sheet { padding: var(--space-5) 0 0; }
}
@media (min-width: 1100px) {
  .lt-form { max-width: 1180px; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); }
}

/* Settings: the landlord's details per property (Phase 5, Task 3). */
.settings-landlord-list { display: grid; gap: var(--space-3); margin: 0; }
.settings-landlord-list > div { min-width: 0; }
.settings-landlord-list dt { margin: 0 0 2px; color: var(--muted); font-size: var(--text-sm); }
.settings-landlord-list dd { margin: 0; }
.settings-landlord-list .settings-unset { font-size: var(--text-sm); line-height: 1.4; }
.settings-phone { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 700px) {
  .settings-landlord-list { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--space-5); }
}

/* Statements: the months grouped by year, and the imported month's page (Phase 5, Task 4) */
.sm-year + .sm-year { margin-top: var(--space-3); }
.sm-year-name { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); font-weight: 700; color: var(--ink); cursor: pointer; }
.sm-year > .sm-months { margin-top: var(--space-1); }
.sd-imported-note { color: var(--muted); font-size: var(--text-sm); }

/* Home's landlord figures: a second row of key figures, above the agent's for an Admin and
   below them for an Agent (Phase 5, Task 5). */
.kpis + .kpis { margin-top: calc(-1 * var(--space-2)); }
.kpis-3 .kpi:last-child { grid-column: 1 / -1; border-right-width: 0; }
.kpi-link { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.kpi-link:hover { color: var(--oxblood); text-decoration: underline; }
.kpi-ratio { margin-top: var(--space-1); }
.kpis-money .kpi-note span { white-space: normal; }
@media (min-width: 900px) {
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-3 .kpi:last-child { grid-column: auto; }
}

/* A loaded lease's words on the lease card, and the unit's Meter block (Phase 6, Task 3). */
.lease-held-note { color: var(--muted); font-size: var(--text-sm); font-weight: 500; white-space: normal; }
.unit-meter .btn { margin-top: var(--space-3); }
.lease-terms dd, .lease-terms dd .num, .lease-terms .lease-held-of { white-space: normal; }
.unit-meter { padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5); }
.unit-meter .doc-panel-head { padding: 0; margin-bottom: var(--space-3); }
.unit-meter .lease-terms { margin: 0; }

/* The Reports page and the report tables (Phase 5, Task 6). */
.rp-chooser { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-4); }
.rp-chooser label { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.rp-chooser select { min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong, var(--line)); border-radius: var(--radius); background: var(--surface); font: inherit; }
.rp-cards { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
.rp-card { padding: var(--space-4) var(--space-5); }
.rp-card h2 { margin: 0 0 var(--space-1); font-size: var(--text-xl); }
.rp-card p { margin: 0 0 var(--space-3); }
.rp-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.rp-table { padding: var(--space-4); margin-bottom: var(--space-5); }
.rp-table h2 { margin: 0 0 var(--space-3); font-size: var(--text-xl); }
.rp-table .table tfoot th { background: var(--paper-2); font-weight: 700; border-top: 2px solid var(--ink); }
.rp-table .table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-note { margin: var(--space-2) 0 0; font-size: var(--text-sm); }
@media (min-width: 900px) { .rp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rp-chooser input[type="date"], .rp-chooser input[type="month"] { min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong, var(--line)); border-radius: var(--radius); background: var(--surface); font: inherit; }
.rp-table .table th, .rp-table .table td { white-space: nowrap; }
.rp-table .table th, .rp-table .table td { padding: var(--space-2) var(--space-2); font-size: var(--text-sm); }
.rp-table .table th:first-child, .rp-table .table td:first-child { padding-left: var(--space-3); }
.rp-table .table th:last-child, .rp-table .table td:last-child { padding-right: var(--space-3); }
.rp-table { padding: var(--space-3) var(--space-2); }
.rp-table .table th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
.rp-links { list-style: none; margin: 0; padding: 0; }
.rp-links li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.rp-links li:last-child { border-bottom: 0; }
/* Six tabs on a phone (Home, Units, Tenants, Payments, Reports, Activity): tighter labels so none is cut off. */
@media (max-width: 599px) { .nav li a { letter-spacing: 0; padding: 0 2px; font-size: 0.6875rem; text-overflow: clip; } }
/* The Reports list: grouped rows; a row opens to show its choices and View, Excel and PDF. */
.rl { display: grid; gap: var(--space-5); max-width: 880px; }
.rl-group-title { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rl-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 1px 2px rgb(23 25 26 / 4%); }
.rl-item + .rl-item { border-top: 1px solid var(--line); }
.rl-summary { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-3) var(--space-4); cursor: pointer; list-style: none; transition: background-color 120ms var(--ease); }
.rl-summary::-webkit-details-marker { display: none; }
.rl-summary:hover { background: #fcfaf7; }
.rl-summary:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
.rl-text { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.rl-name { font-weight: 650; color: var(--ink); }
.rl-desc { font-size: var(--text-sm); color: var(--muted); line-height: 1.4; }
.rl-tag { display: inline-block; margin-left: var(--space-2); padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); vertical-align: 2px; }
.rl-chevron { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 160ms var(--ease); margin-right: 4px; }
.rl-item[open] > .rl-summary { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--oxblood); }
.rl-item[open] > .rl-summary .rl-chevron { transform: rotate(45deg); border-color: var(--oxblood); }
.rl-item[open] > .rl-summary .rl-name { color: var(--oxblood); }
.rl-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); padding: var(--space-4); background: var(--paper-2); box-shadow: inset 3px 0 0 var(--oxblood); border-top: 1px solid var(--line); }
.rl-field { display: grid; gap: 4px; }
.rl-field label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.rl-field select { min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font: inherit; }
.rl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.rl-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2); color: var(--oxblood); font-weight: 600; }

/* Dry-run fix D-M7: a unit let from a later date. Paper like a vacant tile with a dashed
   charcoal edge, and the words "Leased from <date>": not by colour alone. */
.legend-leased::before { background: var(--paper); border-style: dashed !important; border-color: var(--charcoal) !important; }
.unit-tile[data-state="leased"] { background: var(--paper); border-style: dashed; border-color: var(--line-strong); }
.unit-tile[data-state="leased"]::before { display: none; }
.unit-tile[data-state="leased"] .unit-tile-from { color: var(--muted); font-weight: 600; }
/* The Units list's status column fits "Leased from 14 Oct 2026" on the desktop layout. */
@media (min-width: 900px) {
  .unit-groups { --unit-cols: minmax(150px, 1.1fr) minmax(0, 2fr) 140px 190px; }
}
/* Dry-run fix D-I2: the tick that keeps a first amount sits inside its field; keep the
   checkbox row's own grid over the field's label rule. */
.field .check { display: grid; margin-top: var(--space-2); font-weight: 400; }
/* Dry-run fix D-I4: the collection card's two figures, received and the month's invoices paid;
   the meter (the invoices' share) keeps a usable width beside them on wide screens. */
.kpi-received { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2); color: var(--ink); }
.kpi-collected-body .kpi-invoices-paid { flex-basis: 100%; color: var(--ink); }
@media (min-width: 900px) {
  .kpis .kpi-collected { grid-template-columns: minmax(0, 1fr) minmax(180px, 280px); }
}
/* Dry-run fix (Group B review): the collection card's meter is the invoices' share, so it sits
   on the "<Month> invoices paid" line, not beside the received figure; it wraps under the line
   on a phone. */
.kpis .kpi-collected { display: block; }
.kpi-collected-body .kpi-invoices-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
.kpi-invoices-row .kpi-invoices-paid { flex: 1 1 auto; flex-basis: auto; margin: 0; }
.kpi-invoices-row .kpi-meter { flex: 1 1 200px; max-width: 320px; margin-top: 0; }
/* Dry-run fix D-I5: a month or settlement returned to the Agent, with the landlord's note. */
.attention-returned { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
/* Dry-run fix D-M19: the final statement's and the refund's emails, one labelled line each. */
.mo-emails { margin: 0; display: grid; gap: var(--space-1); color: var(--muted); font-size: var(--text-sm); }
.mo-emails div { display: block; }
.mo-emails dt { display: inline; font-weight: 600; color: var(--ink); }
.mo-emails dd { display: inline; margin: 0; }
.attention-list li.attention-no-pill { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "date"; }
/* Dry-run fix D-M11: "Remove" on a photo is a link to the confirmation, shaped as before. */
a.mo-photo-remove { display: inline-flex; align-items: center; text-decoration: none; }
a.mo-photo-remove:hover { text-decoration: underline; }
/* Dry-run fix D-M1: the sidebar fits a short window. The nav list takes the room left between
   the brand and the user block and scrolls within itself when it must, so the user's name and
   "Sign out" stay inside the charcoal column at 1280x800 and 1280x700. */
@media (min-width: 900px) {
  .nav ul { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / 28%) transparent; }
  .nav .nav-foot { flex: none; }
}
@media (min-width: 900px) and (max-height: 860px) {
  .nav { padding-top: var(--space-5); padding-bottom: var(--space-4); }
  .nav .brand { margin-bottom: var(--space-4); padding-bottom: var(--space-3); }
  .nav .nav-foot { padding-top: var(--space-3); }
  .nav .nav-foot form { margin-top: var(--space-2); }
}
/* Dry-run fix D-M17: on a phone the rent roll is a two-line card per unit (unit and tenant;
   status and rent) with the rent total under it; the full table stays from 700 px. */
.rp-cards, .rp-cards-total { display: none; }
@media (max-width: 699.98px) {
  .rp-table-carded .table-wrap { display: none; }
  .rp-table-carded .rp-cards { display: block; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
  .rp-card { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  .rp-card-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-2); min-width: 0; }
  .rp-card-line + .rp-card-line { justify-content: space-between; }
  .rp-card-tenant { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
  .rp-card-status { color: var(--muted); font-size: var(--text-sm); }
  .rp-table-carded .rp-cards-total { display: flex; justify-content: space-between; margin: 0; padding-top: var(--space-3); font-weight: 700; }
}
/* Dry-run fix (Group D review): the sidebar's nav list shows that more is below while it
   scrolls. A soft light fade sits at its bottom edge (and at its top once scrolled), painted
   behind the links; charcoal covers that scroll with the list hide each band at its end, so
   nothing shows when the list fits. Paint only, no motion; the phone tab bar is untouched. */
@media (min-width: 900px) {
  .nav ul {
    background:
      linear-gradient(var(--charcoal) 40%, rgb(26 26 26 / 0%)) center top / 100% 36px no-repeat local,
      linear-gradient(rgb(26 26 26 / 0%), var(--charcoal) 60%) center bottom / 100% 36px no-repeat local,
      linear-gradient(rgb(255 255 255 / 12%), rgb(255 255 255 / 0%)) center top / 100% 16px no-repeat scroll,
      linear-gradient(rgb(255 255 255 / 0%), rgb(255 255 255 / 14%)) center bottom / 100% 24px no-repeat scroll;
    background-color: var(--charcoal);
  }
}
/* ======================================================================
   Sidebar in three groups: Home, then Tenancy, Money and Office under folding headers (bold
   label left, chevron right that turns, a rule below), a line icon on each link, counts on
   Arrears and Move-outs, a footer with initials, name, role and Sign out as an icon, and an
   icon rail of 68 px. Below 900 px none of it shows: the tab bar is exactly as before.
   ====================================================================== */
@media (max-width: 899.98px) {
  .nav-top, .nav-group-toggle, .nav-icon, .nav-count, .nav-tip { display: none; }
  /* The groups dissolve, so the tab bar's links stay one row in their old order. */
  .nav .nav-group, .nav .nav-group-body, .nav .nav-group-body > ul, .nav .nav-label { display: contents; }
}
.nav-mark { display: none; }
.nav-tip { position: fixed; top: 0; left: 0; z-index: 30; transform: translateY(-50%); padding: 6px 10px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; font: 600 0.8125rem/1.2 var(--font-body); white-space: nowrap; box-shadow: 0 6px 18px rgb(0 0 0 / 25%); opacity: 0; pointer-events: none; transition: opacity 120ms var(--ease); }
.nav-tip.is-shown { opacity: 1; }
@media (min-width: 900px) {
  .nav { --nav-alert: #e0a46a; padding: 0; transition: width 180ms var(--ease); }
  .app { transition: padding-left 180ms var(--ease); }
  .nav-top { display: flex; flex: none; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-4) var(--space-2) var(--space-3) var(--space-4); border-bottom: 1px solid rgb(255 255 255 / 8%); }
  .nav .nav-top .brand { display: flex; align-items: center; min-width: 0; min-height: 44px; margin: 0; padding: 0 var(--space-1); border: 0; font: 700 1.0625rem/1.2 var(--font-display); letter-spacing: var(--tracking-brand); white-space: nowrap; }
  .nav-brand-name { overflow: hidden; text-overflow: ellipsis; }
  .nav-mark { place-items: center; width: 32px; height: 32px; border-radius: var(--radius); background: var(--oxblood); color: #fff; font-size: 0.875rem; letter-spacing: 0; }
  .nav-icon-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--on-dark-muted); cursor: pointer; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
  .nav-icon-btn:hover { background: var(--charcoal-2); color: #fff; }
  .nav-icon-btn svg { transition: transform 180ms var(--ease); }

  .nav .nav-list { padding: var(--space-2) var(--space-3) var(--space-3); }
  .nav .nav-list a { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); }
  .nav-icon { flex: none; color: var(--on-dark-muted); transition: color 120ms var(--ease); }
  .nav .nav-list a:hover .nav-icon, .nav .nav-list a[aria-current="page"] .nav-icon { color: #fff; }
  .nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-count { display: grid; place-items: center; flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgb(224 164 106 / 18%); color: var(--nav-alert); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
  .nav .nav-list a[aria-current="page"] .nav-count { background: rgb(255 255 255 / 20%); color: #fff; }

  /* A group: its header folds and unfolds the links below it. */
  .nav-group { margin-top: var(--space-2); }
  .nav-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; min-height: 44px; padding: 0 var(--space-3); border: 0; border-bottom: 1px solid rgb(255 255 255 / 9%); border-radius: 0; background: none; color: var(--on-dark-muted); font: 700 0.71875rem/1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; transition: color 120ms var(--ease); }
  .nav-group-toggle:hover { color: #fff; }
  .nav-group-meta { display: flex; align-items: center; gap: var(--space-2); }
  .nav-chevron { transform: rotate(90deg); transition: transform 180ms var(--ease); }
  .nav-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--nav-alert); }
  .nav-group.is-folded .nav-dot { display: block; }
  .nav-group.is-folded .nav-chevron { transform: rotate(0deg); }
  .nav-group-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 200ms var(--ease), visibility 0s linear 0s; }
  .nav-group.is-folded .nav-group-body { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 200ms var(--ease), visibility 0s linear 200ms; }
  .nav .nav-group-body > ul { display: flex; flex: none; flex-direction: column; gap: 2px; min-height: 0; height: auto; padding-top: 6px; overflow: hidden; background: none; transition: padding-top 200ms var(--ease); }
  .nav-group.is-folded .nav-group-body > ul { padding-top: 0; }

  /* The footer: initials, name and role, and Sign out as an icon. */
  .nav .nav-foot { display: flex; flex: none; align-items: center; gap: 10px; margin: 0; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-top: 1px solid rgb(255 255 255 / 8%); }
  .nav .nav-foot form { margin: 0; }
  .nav-avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: #302d2b; color: #fff; font-size: 0.78125rem; font-weight: 700; letter-spacing: 0.02em; }
  .nav-who { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
  .nav-who b { display: block; overflow: hidden; color: #fff; font-size: 0.84375rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .nav-who span { color: var(--on-dark-muted); font-size: 0.75rem; }

  /* The icon rail: 68 px of icons, a hairline between the groups, names as tooltips. */
  :root[data-nav-rail] .app { padding-left: 68px; }
  :root[data-nav-rail] .nav { width: 68px; }
  :root[data-nav-rail] .nav-top { flex-direction: column; justify-content: center; gap: var(--space-1); padding: var(--space-3) 0 var(--space-2); }
  :root[data-nav-rail] .nav .nav-top .brand { justify-content: center; padding: 0; }
  :root[data-nav-rail] .nav-mark { display: grid; }
  :root[data-nav-rail] .nav-brand-name, :root[data-nav-rail] .nav-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  :root[data-nav-rail] .nav-rail-toggle svg { transform: rotate(180deg); }
  :root[data-nav-rail] .nav .nav-list { padding: var(--space-2) var(--space-3); scrollbar-width: none; }
  :root[data-nav-rail] .nav .nav-list a { justify-content: center; width: 44px; padding: 0; }
  :root[data-nav-rail] .nav-count { position: absolute; top: 8px; right: 7px; min-width: 0; width: 8px; height: 8px; padding: 0; overflow: hidden; background: var(--nav-alert); color: transparent; font-size: 0; box-shadow: 0 0 0 2px var(--charcoal); }
  :root[data-nav-rail] .nav-group { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid rgb(255 255 255 / 9%); }
  :root[data-nav-rail] .nav-group-toggle { display: none; }
  :root[data-nav-rail] .nav-group.is-folded .nav-group-body { grid-template-rows: 1fr; visibility: visible; }
  :root[data-nav-rail] .nav .nav-group-body > ul { padding-top: 0; }
  :root[data-nav-rail] .nav .nav-foot { flex-direction: column; gap: var(--space-1); padding: var(--space-3) 0; }
  :root[data-nav-rail] .nav-who { display: none; }
}
/* The sidebar's groups fit an Agent's whole list in a 1280x800 window: a tighter brand row,
   group spacing and footer (every target stays 44 px). */
@media (min-width: 900px) {
  .nav-top { padding: 10px var(--space-2) 10px var(--space-4); }
  .nav .nav-list { padding-top: 6px; }
  .nav-group { margin-top: 4px; }
  .nav .nav-group-body > ul { gap: 0; padding-top: 4px; }
  .nav .nav-foot { padding-top: 10px; padding-bottom: 10px; }
}
/* ======================================================================
   The Reports flow: the Reports page is one linked row per report (icon, name, a hint of what it
   asks for, an arrow); a report opens on its own page with its choices and Run report, Excel and
   PDF waiting; once run the choices fold into a summary line and the downloads go live. The
   report's own tables (.rp-*) are untouched.
   ====================================================================== */
.rh { max-width: none; }
@media (min-width: 1100px) { .rh { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--space-5) var(--space-5); } }
.rh-row { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-4); color: var(--ink); text-decoration: none; transition: background-color 120ms var(--ease); }
.rh-row + .rh-row { border-top: 1px solid var(--line); }
a.rh-row:hover { background: #fcfaf7; color: var(--ink); text-decoration: none; }
a.rh-row:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
.rh-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--paper-2); color: var(--oxblood); }
.rh-name { flex: 1 1 auto; min-width: 0; font-weight: 650; }
.rh-hint { flex: none; font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.rh-go { display: grid; flex: none; color: #b3a79a; transition: transform 120ms var(--ease), color 120ms var(--ease); }
a.rh-row:hover .rh-go { color: var(--oxblood); transform: translateX(2px); }
.rh-row-export { flex-wrap: wrap; }
.rh-exports { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 599.98px) { .rh-hint { display: none; } }
@media (prefers-reduced-motion: reduce) { .rh-row, .rh-go { transition: none; } }

.rr-download { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.rr-download-label { margin-right: 2px; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rr-download .btn svg { flex: none; }
.rr-panel { display: grid; gap: var(--space-4); margin: 0 0 var(--space-5); padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rr-panel h2 { margin: 0; font-size: 0.9375rem; }
.rr-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); }
.rr-field { display: grid; gap: 6px; min-width: 180px; }
.rr-field label { font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.rr-field select, .rr-field input { min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
.rr-waiting { display: grid; justify-items: start; gap: var(--space-2); padding: var(--space-5); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); }
.rr-waiting b { color: var(--ink); }
.rr-cols { display: flex; flex-wrap: wrap; gap: 6px; }
.rr-col { padding: 3px 10px; border-radius: 999px; background: var(--paper-2); color: var(--ink); font-size: var(--text-sm); }
.rr-ran { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-5); padding: var(--space-2) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rr-chips { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.rr-chip { padding: 5px 12px; border-radius: 999px; background: var(--paper-2); font-size: var(--text-sm); }
.rr-chip b { font-weight: 600; }
.rr-ranat { font-size: var(--text-sm); color: var(--muted); }
.rr-change { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); color: var(--oxblood); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 599.98px) {
  .rr-field { flex: 1 1 100%; min-width: 0; }
  .rr-fields .btn-primary { flex: 1 1 100%; }
}
/* The summary line keeps one height with or without its Change link. */
.rr-ran { min-height: 62px; }

/* --- Phase 7: access ------------------------------------------------------------------------ */
/* The frame's "View only" note: the section can be looked at, not changed (words and an eye). */
.view-only-note { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); padding: var(--space-2) var(--space-3); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-size: var(--text-sm); }
.view-only-note svg { flex: none; color: var(--muted); }

/* Team: five status chips, a search, and rows that open the member's page. */
.tm-chips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tm-search { display: flex; gap: var(--space-2); margin: 0 0 var(--space-5); }
.tm-search input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
.tm-search input:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
.tm-list { padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tm-row { position: relative; grid-template-areas: "avatar who who" "avatar role status" "avatar seen seen"; }
.tm-row:hover, .tm-row:focus-within { background: #fcfaf7; }
.tm-link { color: var(--ink); text-decoration: none; }
.tm-link::after { content: ""; position: absolute; inset: 0; } /* the whole row is one tap target */
.tm-link:focus-visible { outline: none; }
.tm-row:has(.tm-link:focus-visible) { box-shadow: inset 0 0 0 3px rgb(111 26 15 / 22%); }
.tm-seen { grid-area: seen; color: var(--muted); font-size: var(--text-sm); }
.tm-custom { padding: 1px 8px; border: 1px dashed var(--line-strong); border-radius: 999px; color: var(--ink); font-size: var(--text-xs); font-weight: 600; }
.role-pill-viewer { border-style: dashed; }
.avatar-photo { object-fit: cover; padding: 0; }
.person-avatar.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
@media (max-width: 599.98px) { .tm-chips .chip { font-size: 0.6875rem; } }
@media (min-width: 900px) {
  .tm-chips { display: flex; }
  .tm-cols, .tm-row { --team-cols: 40px minmax(0, 2fr) minmax(0, 1.4fr) 130px 130px; }
  .tm-row { grid-template-areas: "avatar who role status seen"; }
  .tm-seen { align-self: center; }
}

/* A member's page: who and their status, the access level with its matrix, and the status actions. */
.tm-who { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.tm-who h1 { overflow-wrap: anywhere; }
.tm-email { margin: 0; overflow-wrap: anywhere; }
.tm-standing { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 0; }
.tm-layout { display: grid; gap: var(--space-5); align-items: start; }
.tm-access h2, .tm-status h2, .tm-history h2 { margin: 0 0 var(--space-4); font-size: var(--text-lg); }
.tm-side { display: grid; gap: var(--space-5); }
.tm-facts { display: grid; gap: var(--space-3); margin: 0 0 var(--space-4); }
.tm-facts div { display: grid; gap: 2px; }
.tm-facts dt { color: var(--muted); font-size: var(--text-sm); }
.tm-facts dd { margin: 0; }
.tm-actions { display: grid; gap: var(--space-2); }
.tm-actions form, .tm-actions .btn { width: 100%; }
.tm-actions form .btn { width: 100%; }
.tm-actions .hint { margin: 0 0 var(--space-2); }
.tm-events { margin: 0; padding: 0; list-style: none; }
.tm-events li + li { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.tm-event-title { margin: 0; font-weight: 650; }
.tm-event-meta { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); }
.tm-save { margin-top: var(--space-5); }
.ax-level { max-width: 360px; }
.ax-customise { margin-top: var(--space-4); }
.ax-customise > summary { display: flex; align-items: center; min-height: 44px; color: var(--oxblood); font-weight: 600; cursor: pointer; }
@media (min-width: 1100px) { .tm-layout { grid-template-columns: minmax(0, 1fr) 320px; } }

/* The access matrix. Phone: one card per section, a 44 px toggle row per action it has.
   From 900 px: a table, one column per action, sections grouped Tenancy, Money and Office. */
.mx { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.mx-preset { margin: 0; padding: var(--space-3); background: var(--paper-2); border-radius: var(--radius); font-size: var(--text-sm); }
.mx-head { display: none; }
.mx-group-name { margin: 0 0 var(--space-2); color: var(--muted); font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
.mx-rows { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.mx-row { display: grid; gap: 2px; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.mx-module { font-weight: 650; }
.mx-cell { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.mx-cell input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); }
.mx-cell input:disabled { cursor: not-allowed; }
.mx-cell.is-locked { cursor: default; color: var(--muted); }
.mx-text { display: grid; flex: 1 1 auto; min-width: 0; }
.mx-action { font-weight: 600; }
.mx-words { color: var(--muted); font-size: var(--text-sm); }
.mx-tag { flex: none; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }
.mx-tag-locked { background: var(--paper-2); color: var(--muted); }
.mx-tag-custom { border: 1px dashed var(--oxblood-line); color: var(--oxblood); }
.mx-tag[hidden] { display: none; }
.mx-na { display: none; }
@media (min-width: 900px) {
  .mx { --mx-cols: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
  .mx-head { display: grid; grid-template-columns: var(--mx-cols); padding: 0 var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
  .mx-head span:not(:first-child) { text-align: center; }
  .mx-group-name { margin: var(--space-3) 0 var(--space-1); padding: 0 var(--space-3); }
  .mx-rows { gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .mx-row { grid-template-columns: var(--mx-cols); align-items: center; gap: 0; padding: 0 var(--space-3); border: 0; border-radius: 0; background: none; }
  .mx-row + .mx-row { border-top: 1px solid var(--line); }
  .mx-cell { flex-direction: column; justify-content: center; gap: 2px; padding: var(--space-2) 0; text-align: center; }
  .mx-text { display: block; }
  .mx-action { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* the column head names it */
  .mx-words { display: none; }
  .mx-na { display: flex; align-items: center; justify-content: center; min-height: 44px; color: var(--line-strong); }
}
.tm-access, .tm-status, .tm-history, .tm-revoke { padding: var(--space-5); }
@media (max-width: 599.98px) { .tm-access, .tm-status, .tm-history, .tm-revoke { padding: var(--space-4); } }

/* Profile: the person's photo, details, access, password and sign out. */
.pf-main { display: grid; gap: var(--space-5); min-width: 0; }
.pf-card { padding: var(--space-5); }
.pf-card h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); }
.pf-photo-form { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.pf-file { position: relative; overflow: hidden; }
.pf-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pf-file:focus-within { box-shadow: var(--ring); }
.pf-name-form { display: grid; gap: var(--space-4); max-width: 480px; }
.pf-name-form .btn { justify-self: start; }
.pf-signout .btn { width: 100%; }
.pf-password { max-width: 480px; }
@media (max-width: 599.98px) { .pf-card { padding: var(--space-4); } .pf-photo-form .btn { flex: 1 1 100%; } }

/* The phone tab bar's last item is Profile (in Activity's place); from 900 px the sidebar's foot,
   the person's name and photo, opens it instead. */
@media (min-width: 900px) {
  .nav li.nav-tab-only { display: none; }
  .nav-me { display: flex; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; min-height: 44px; border-radius: var(--radius); color: inherit; text-decoration: none; }
  .nav-me:hover .nav-who b, .nav-me[aria-current="page"] .nav-who b { text-decoration: underline; text-underline-offset: 3px; }
  .nav-avatar-photo { object-fit: cover; padding: 0; }
  :root[data-nav-rail] .nav-me { flex: none; justify-content: center; }
}
.pf-file-name { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }

/* Home on a phone: no Sign out in the banner (the owner, 5 October 2026); it is on Profile, the
   last tab. The logo keeps the banner's first row on its own. */
@media (max-width: 899.98px) {
  .brand-banner-action { display: none; }
  .brand-banner { grid-template-columns: auto; grid-template-areas: "logo" "text"; }
}

/* Settings as four cards per property (6 October 2026): Property, Landlord, Management agreement,
   Billing and invoices; two columns from 1100 px. */
.st-place + .st-place { margin-top: var(--space-7); }
.st-place-head { margin-bottom: var(--space-3); }
.st-place-head h2 { margin: 0; font-size: var(--text-xl); }
.st-place-head p { margin: 2px 0 0; }
.st-index { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.st-index a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.st-index a:hover { border-color: var(--line-strong); }
.st-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.st-card { min-width: 0; padding: var(--space-4); scroll-margin-top: var(--space-4); }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.st-card-head h3 { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: var(--text-lg); }
.st-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); background: var(--paper-2); color: var(--oxblood); }
.st-card-sub { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.st-sub { margin: var(--space-4) 0 var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.st-card-sub + .st-sub { margin-top: var(--space-1); padding-top: 0; border-top: 0; }
.st-lock { margin-left: var(--space-2); color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: var(--text-xs); }
.st-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3) var(--space-5); margin: 0; }
.st-facts > div { min-width: 0; }
.st-facts dt { margin: 0 0 2px; color: var(--muted); font-size: var(--text-sm); }
.st-facts dd { margin: 0; overflow-wrap: anywhere; }
.st-facts .settings-unset { font-size: var(--text-sm); }
.st-full { grid-column: 1 / -1; }
.st-number { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.st-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); font-size: var(--text-sm); font-weight: 600; }
.st-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--oxblood); font-weight: 600; }
.st-card .settings-phone { min-height: 0; }
.st-card .rates { margin: 0; }
@media (min-width: 600px) {
  .st-card { padding: var(--space-5); }
  .st-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) { .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); } }

/* The landlord form's payout groups: shown by the chosen method (all shown without script). */
.ll-group { margin: var(--space-5) 0 0; padding: 0; border: 0; min-width: 0; }
.ll-group[hidden] { display: none; }
.ll-group legend { padding: 0; margin-bottom: var(--space-3); }
.ll-form [data-kind][hidden] { display: none; }

/* Expense items, under Office (6 October 2026). */
.ei-place + .ei-place { margin-top: var(--space-6); }
.ei-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.ei-head h2 { margin: 0; font-size: var(--text-lg); }
.ei-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.ei-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center; min-height: 60px; padding: var(--space-3) var(--space-4); }
.ei-row + .ei-row { border-top: 1px solid var(--line); }
.ei-row-head { display: none; }
.ei-name { display: grid; min-width: 0; overflow-wrap: anywhere; }
.ei-meta, .ei-meta-inline { color: var(--muted); font-size: var(--text-sm); }
.ei-amount { grid-column: 1; grid-row: 2; }
.ei-action { grid-column: 2; grid-row: 1 / span 2; }
.ei-retired b { color: var(--muted); font-weight: 600; }
.ei-foot { margin-top: var(--space-4); font-size: var(--text-sm); }
@media (min-width: 600px) {
  .ei-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: var(--space-4); }
  .ei-amount, .ei-action { grid-column: auto; grid-row: auto; }
  .ei-row-head { display: grid; min-height: 0; padding-block: var(--space-2); background: var(--paper-2); color: var(--muted); font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
}
.st-link { gap: 0.25em; } /* inline-flex drops the space between the count and "units" */
/* The head lines up with the rows: the action column has one width on every row. */
@media (min-width: 600px) { .ei-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 7rem; } .ei-action { justify-self: end; } }

/* The statement page's totals rows (6 October 2026): bold, ruled above, the sums of the rows. */
.sd-row-sum { border-top: 1.5px solid var(--ink); font-weight: 700; }
.sd-row-sum > .sd-who { font-weight: 700; }
.sd-row-sum .sd-months { font-weight: 500; }

/* The Property Management Commission form on the Management agreement tab (6 October 2026). */
.cm-later { margin-bottom: var(--space-4); }
.cm-form { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.cm-fields { display: grid; gap: var(--space-3); }
.cm-actions .btn { min-height: 44px; }
@media (min-width: 700px) { .cm-fields { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); align-items: start; } }
.st-card .cm-later { margin: 0 0 var(--space-4); }

/* Settings › Setups (6 October 2026): every editable rate, a group per heading. */
.su-group { margin-top: var(--space-6); }
.su-fields { display: grid; gap: var(--space-3); }
@media (min-width: 700px) { .su-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* Home banner without the portal name (the owner, 6 October 2026): the logo on the left; on the
   right, Sign out with the member's name and role under it. No hairline, no empty middle. The
   portal name stays as the page's heading for screen readers (h1.sr-only). */
.brand-banner { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo action"; justify-content: space-between; align-items: center; }
.brand-banner-action { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); justify-self: end; min-width: 0; text-align: right; }
.brand-banner-who { margin: 0; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .brand-banner { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo action"; }
}
/* On a phone Sign out stays on Profile (the owner, 5 October 2026): only the form is hidden, so
   the name and role stay on the logo's row, on the right. */
@media (max-width: 899.98px) {
  .brand-banner { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo action"; }
  .brand-banner-action { display: flex; }
  .brand-banner-signout { display: none; }
}

/* Nomad Labs (the owner, 7 October 2026). The sidebar's top is the mark alone, light red on the
   charcoal, and the collapsed rail shows the same mark. The Home banner and the pages without a
   sidebar show the logo (an outlined SVG). */
.nav-logo { display: block; width: 36px; height: 36px; flex: none; }
@media (min-width: 900px) {
  .nav .nav-top .brand { gap: 0; }
  :root[data-nav-rail] .nav-logo { width: 32px; height: 32px; }
}
.brand-banner-logo { width: 150px; }
.brand-banner-logo img, .bare .bare-logo img { display: block; width: 100%; height: auto; }
@media (min-width: 900px) { .brand-banner-logo { width: 190px; } }
.bare .bare-logo { width: 240px; }
@media (min-width: 900px) { .bare .bare-logo { width: 300px; } }

/* Settings › Property: the property's logo, on every document's letterhead (7 October 2026). */
.st-logo { margin: 0 0 var(--space-2); }
.st-logo-frame { display: inline-block; max-width: 100%; padding: var(--space-3); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.st-logo-img { display: block; max-width: min(320px, 100%); max-height: 96px; width: auto; height: auto; }
.st-logo-none { margin: 0; }
.st-logo .hint { margin: var(--space-2) 0 0; }
.st-logo-form { margin: var(--space-3) 0 var(--space-2); }
@media (max-width: 599.98px) { .st-logo-form .btn { flex: 1 1 100%; } }

/* One-step pictures and logos (the owner, 7 October 2026): the drop zone of
   templates/partials/_dropzone.html, the preview with its small remove, and the sidebar's top
   row with the collapse control alone (no logo). */
.dz-form { margin: var(--space-3) 0 var(--space-2); }
.dz { position: relative; display: grid; justify-items: center; gap: var(--space-1); min-height: 120px; padding: var(--space-5) var(--space-4); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--paper); text-align: center; transition: border-color 120ms var(--ease), background-color 120ms var(--ease); }
.dz-icon { color: var(--oxblood); }
.dz-text { font-weight: 600; cursor: pointer; }
.dz-choose { color: var(--oxblood); text-decoration: underline; text-underline-offset: 3px; }
.dz-hint { color: var(--muted); font-size: var(--text-sm); }
.dz-status { min-height: 1.25em; color: var(--oxblood); font-size: var(--text-sm); font-weight: 600; }
.dz-status:empty { min-height: 0; }
.dz-input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.dz:hover { border-color: var(--oxblood); }
.dz:focus-within { border-color: var(--oxblood); box-shadow: var(--ring); }
.dz.is-over { border-color: var(--oxblood); border-style: solid; background: var(--oxblood-tint); }
.dz.is-busy { opacity: 0.75; pointer-events: none; }
.dz-add { margin-top: var(--space-2); }
.dz-add[hidden] { display: none; }
.dz-preview { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-2); }
.dz-preview form { margin: 0; }
.dz-preview-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.dz-remove { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius); background: none; color: var(--muted); font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.dz-remove:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.dz-remove:focus-visible { outline: none; box-shadow: var(--ring); color: var(--danger); }
@media (max-width: 599.98px) { .dz { min-height: 112px; padding: var(--space-4) var(--space-3); } }
@media (min-width: 900px) {
  .nav-top { justify-content: flex-end; }
  :root[data-nav-rail] .nav-top { justify-content: center; }
}

/* The drop zone's refusal (review of 2f4e14f): a file that is not a picture, said in the zone. */
.dz-status.is-refused { color: var(--danger); }

/* Sign-in codes (7 October 2026): the code page's field, the trust box and its two ways out. */
.auth-card .check { margin-top: var(--space-1); }
.auth-card input[autocomplete="one-time-code"] { font-variant-numeric: tabular-nums; font-size: 1.375rem; letter-spacing: 0.3em; }
.code-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.code-foot form { margin: 0; }
.code-foot .btn-quiet { width: auto; }
.btn-link { min-height: 44px; padding: 0; border: 0; background: none; color: var(--oxblood); font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.btn-link:hover { color: var(--oxblood-deep); text-decoration-thickness: 2px; }
.btn-link:focus-visible { outline: none; box-shadow: var(--ring); }

/* Profile's trusted devices (sign-in codes, 7 October 2026). */
.pf-devices { list-style: none; margin: var(--space-3) 0 var(--space-4); padding: 0; display: grid; gap: var(--space-3); }
.pf-devices li { display: grid; gap: 2px; padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.pf-device-name { font-weight: 600; }
.pf-device-when { color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }

/* Water amount sheet (8 October 2026): the KES prefix cleared of the typed digits, and the move-out hint. */
.field.rd-input .money-input input { padding-left: 60px; }
.rd-hint { margin: 0; font-size: var(--text-sm); }

/* Settings › Management Agency (12 October 2026): its cards stacked, and the sign-off preview as a letter ends. */
.st-card + .st-card { margin-top: var(--space-4); }
.st-signoff { padding: var(--space-3) var(--space-4); border-left: 3px solid var(--line); background: var(--paper); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.st-signoff p { margin: 0; line-height: 1.5; }
.st-signoff-space { height: var(--space-5); }
.st-signoff-name { font-weight: 650; }
/* The letter preview's sign-off by the lead manager (12 October 2026). */
.lt-signoff { margin-top: var(--space-4) !important; overflow-wrap: anywhere; }
.lt-signoff-name { font-weight: 650; }
.lt-signoff-contact { color: var(--muted); }
/* Branding on Settings › Property (12 October 2026): the logo and the business stamp side by side,
   stacked on a phone; "Stamp every new letter" and the sample letter below them. */
.st-brand { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--space-4); }
.st-brand-item { min-width: 0; }
.st-brand-label { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 650; }
.st-stamp { margin: 0 0 var(--space-2); }
.st-stamp .hint { margin: var(--space-2) 0 0; }
.st-stamp-frame { display: grid; place-items: center; width: 96px; height: 96px; background: #fff; border: 1px solid var(--line); border-radius: 50%; overflow: hidden; }
.st-stamp-img { display: block; width: 84px; height: 84px; object-fit: contain; }
.st-stamp-use { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); margin: var(--space-3) 0 var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.st-stamp-use-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); min-width: 0; }
.st-check { display: flex; align-items: flex-start; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.st-check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--oxblood); }
.st-check small, .st-stamp-state small { display: block; color: var(--muted); font-size: var(--text-sm); }
.st-stamp-state { margin: 0; }
@media (max-width: 599.98px) { .st-stamp-preview, .st-stamp-use-form .btn { flex: 1 1 100%; } }
/* The letter's sign-off with the business stamp beside it, as on the PDF (12 October 2026). */
.lt-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); }
.lt-end .lt-close { flex: 1 1 220px; min-width: 0; }
.lt-stamp { flex: none; width: 112px; height: auto; margin-left: auto; margin-right: var(--space-5); transform: rotate(-6deg); opacity: 0.9; mix-blend-mode: multiply; }
@media (max-width: 599.98px) { .lt-stamp { width: 88px; margin-right: var(--space-2); } }

/* Settings › Rental Tax (the owner, 13 October 2026): the switch's fields, the rate history,
   this year against the band, the payments to KRA. */
.tx-fields { display: grid; gap: var(--space-3); }
@media (min-width: 700px) { .tx-fields { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); align-items: start; } .tx-fields > .field:nth-child(2) { grid-column: span 2; } }
@media (min-width: 1100px) { .tx-fields { grid-template-columns: 7rem minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.4fr) 7rem; } .tx-fields > .field:nth-child(2) { grid-column: auto; } }
.tx-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tx-history { margin-top: var(--space-4); }
.tx-band { display: grid; gap: var(--space-2); }
.tx-band .meter { height: 8px; }
.tx-band-words { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); margin: 0; color: var(--muted); font-size: var(--text-sm); }
.tx-cancelled td { color: var(--muted); }
/* "Stamp every document" saves on change (the owner, 14 October 2026): the word that it was saved
   sits after the box; the Save button is for a browser without JavaScript. */
.st-stamp-saved { display: block; min-height: 1.5em; font-size: var(--text-sm); color: var(--muted); }
.st-stamp-saved.is-error { color: var(--oxblood); }
.st-stamp-saved:empty { display: none; }
/* Give notice beside Renew or change rent on an ACTIVE lease's card (the owner, 14 October 2026): both
   buttons sit in the `.lease-head` header row, Give notice last; on a phone they stack full-width under
   the title and badge, Renew first. Auto-placement, so a missing button leaves no empty track or gap
   behind and whichever shows still sits at the right of the row. */
.lease-head { grid-template-areas: "title badge"; }
.lease-action, .lease-notice { grid-area: auto; grid-column: 1 / -1; width: 100%; }
@media (min-width: 900px) {
  .lease-head { grid-template-columns: minmax(0, 1fr); grid-auto-columns: auto; grid-auto-flow: column; grid-template-areas: none; }
  .lease-title, .lease-head .badge, .lease-action, .lease-notice { grid-area: auto; }
  .lease-action, .lease-notice { width: auto; }
}
/* The on-notice strip's four actions on one line (the owner, 14 October 2026): Change Date, Withdraw
   Notice, Move Out (primary) and the letter the notice calls for (the button, then the issued letter's
   link) share one row of four equal tracks from the 900 px breakpoint; the row never wraps, a caption
   may wrap inside its button and the type steps down with the strip's width (a container query on the
   strip; where `cqi` is unsupported the two media-query sizes below stand). On a phone the same order
   runs two by two. Every track is at least 44 px tall. */
.lease-moveout.is-notice { container-type: inline-size; }
.lease-moveout.is-notice .lease-moveout-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.lease-moveout.is-notice .lease-moveout-actions > * { min-width: 0; min-height: 44px; padding: var(--space-1) var(--space-2); text-align: center; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
.lease-moveout.is-notice .lease-moveout-actions .lt-notice-link { display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-sm); }
@media (min-width: 900px) {
  .lease-moveout.is-notice .lease-moveout-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lease-moveout.is-notice .lease-moveout-actions > * { font-size: 13px; }
}
@media (min-width: 1100px) {
  .lease-moveout.is-notice .lease-moveout-actions > * { font-size: 14px; }
}
@supports (font-size: 1cqi) {
  @media (min-width: 900px) {
    .lease-moveout.is-notice .lease-moveout-actions > * { font-size: clamp(11.5px, 1.6cqi + 6px, 14px); }
  }
}

/* Automations (the owner, 14 October 2026): the tick grids of Bulk Invoicing and Bulk Receipts.
   A row is tick, unit and tenant, amount, then its state; on a phone the state wraps under. */
.au-pick { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: 0 0 var(--space-3); }
.au-pick select { min-height: 44px; max-width: 100%; }
.au-month { margin: 0 0 var(--space-4); overflow-wrap: anywhere; }
.au-grid { padding: var(--space-4); }
.au-counter { margin: 0 0 var(--space-2); font-weight: 650; }
.au-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.au-row { list-style: none; }
.au-tick { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "box who amount" "box state state"; gap: var(--space-1) var(--space-3); align-items: center; min-height: 44px; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.au-row:last-child .au-tick { border-bottom: 0; }
.au-tick input { grid-area: box; width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); cursor: pointer; }
.au-tick input:disabled { cursor: not-allowed; }
.au-who { grid-area: who; min-width: 0; display: flex; align-items: center; gap: var(--space-2); }
.au-who .unit-pill { flex: none; }
.au-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.au-amount { grid-area: amount; white-space: nowrap; }
.au-state { grid-area: state; min-width: 0; font-size: var(--text-sm); color: var(--muted); overflow-wrap: anywhere; }
.au-state .dv-state { display: inline-flex; align-items: center; vertical-align: middle; }
.au-state a { display: inline-block; min-height: 24px; }
.au-warn { color: var(--warn); font-weight: 650; }
.au-missing .au-name, .au-no_rate .au-name, .au-no_address .au-name { color: var(--muted); }
.au-actions { margin-top: var(--space-2); }
.au-summary { margin: var(--space-3) 0 0; }
@media (min-width: 900px) {
  .au-tick { grid-template-columns: 24px minmax(0, 1fr) 130px minmax(0, 1.3fr); grid-template-areas: "box who amount state"; }
  .au-amount { text-align: right; }
}

/* ---------- Automations, review fixes (15 October 2026): 44 px links in a row's state, the viewer's locked mark, hover parity with the letters grid ---------- */
.au-state a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }
.au-tick:hover { background: var(--paper); }
label.au-tick { cursor: pointer; }
.au-mark { grid-area: box; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--surface); }
.au-mark-done { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }
.au-noscript { margin: var(--space-2) 0 0; font-size: var(--text-sm); }

/* ---------- List density (the owner, 15 October 2026): one row rhythm on every list ----------
   At 900 px and up a row is one line: identifier · title or kind · who · date · figure · state.
   Values never break (.num, dates, amounts, addresses, pills, document numbers); free text is cut
   short with an ellipsis and carries its full text in `title`; a row is space-2 / space-4 with a
   44 px floor. Below 900 px a row still stacks, two fields to a line. An email address never
   wraps: its cell is nowrap + ellipsis and its column is sized to the address first.
   The rule and the rows it covers: docs/decisions/2026-10-15-list-density.md. */
.lt-row-kind, .lt-row-name, .lt-row-when, .lt-row-state > .dv-state-words, .em-kind, .em-to,
.dv-row .dv-state > span, .em-state > span, .au-state .dv-state-words, .au-address, .doc-name,
.xp-item, .xp-meta-text, .mol-detail, .member-email, .tm-email, .event-record, .ei-name b,
.lt-tick-detail, .st-detail, .paylist-meta, .rcpt-email-detail, .doc-added-by {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
/* On a phone the free text may still wrap; the values and the addresses never do. */
@media (max-width: 899.98px) {
  .doc-name, .xp-item, .xp-meta-text, .mol-detail, .event-record, .ei-name b, .st-detail, .lt-row-kind,
  .paylist-meta, .lt-tick-detail, .doc-added-by { white-space: normal; overflow-wrap: anywhere; }
}
.lt-row .num, .em-row .num, .dv-row .num, .xp-row .num, .mol-row .num, .attention-list .num, .st-row .num, .paylist-row .num,
.ar-row .num, .au-tick .num, .lt-tick-label .num, .doc-row .num, .event-head .num, .member .num, .ei-row .num { white-space: nowrap; }
.dv-row .dv-state-detail, .em-state .dv-state-detail { display: inline; margin-left: var(--space-2); }
.au-state .dv-state { max-width: 100%; min-width: 0; }
.rcpt-email-state > span { flex: 1 1 0; min-width: 0; contain: inline-size; }
.tm-who, .tm-who > div { flex: 1 1 auto; min-width: 0; }
.attention-list a { display: block; padding: 10px 0; margin: -10px 0; }

/* Letters and the Communications tab's invoices: number and kind on one line; the date and the
   figure share a line on a phone. */
.lt-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "doc doc" "who who" "when figure" "state state";
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
}
.comm-section .lt-row { grid-template-areas: "doc doc" "when figure" "state state"; }
.lt-row-doc { flex-wrap: nowrap; min-width: 0; }
.lt-row-doc .unit-pill, .lt-row-doc .mark, .lt-row-number { flex: none; white-space: nowrap; }
.lt-row-figure { min-width: 0; }
.lt-row-figure .num { white-space: nowrap; }
.lt-row-state { min-width: 0; margin-top: 0; }
.lt-row-state.dv-state { align-items: center; }

/* The email log: date and outcome share a line on a phone, the document and the address take a
   line each. */
.em-row {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "when state" "doc doc" "to to";
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
}
.em-doc { flex-wrap: nowrap; min-width: 0; }
.em-doc a, .em-doc .unit-pill { flex: none; white-space: nowrap; }
.em-state { margin-top: 0; justify-self: end; min-width: 0; max-width: 100%; }

/* The delivery page: who and the amount, then the outcome and the number, then the actions. */
.dv-row {
  grid-template-areas: "who amount" "state number" "actions actions";
  padding: var(--space-2) var(--space-4);
}
.dv-row .dv-number { justify-self: end; margin: -10px 0; }
.dv-row .dv-state { min-width: 0; }

/* Rows that stacked two lines at every width. */
.doc-row { min-height: 44px; padding: var(--space-2) 0; }
.doc-main .doc-added { display: flex; flex-wrap: wrap; gap: 0 0.3em; }
.doc-added-on { flex: none; white-space: nowrap; }
.xp-row { min-height: 44px; padding: var(--space-2) var(--space-4); }
.xp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-1); min-width: 0; }
.xp-receipt { display: inline-flex; align-items: center; flex: none; min-height: 44px; margin: -12px 0; font-weight: 600; }
.xp-reverse { min-height: 44px; margin: -4px 0; }
.mol-row { min-height: 44px; }
.mol-who a { display: block; min-width: 0; padding: 10px 0; margin: -10px 0; } /* a 44 px target, the row no taller */
.member { min-height: 44px; }
.event { min-height: 44px; padding: var(--space-2) var(--space-4); }
.ei-row:not(.ei-row-head) { min-height: 44px; padding: var(--space-2) var(--space-4); }
.attention-list li { min-height: 44px; }
.lt-tick-label { min-height: 44px; padding: var(--space-2) var(--space-4); }
.st-row { padding: var(--space-2) var(--space-4); }

/* Rows already one line on a desktop: the same rhythm. */
.rate { min-height: 44px; padding: var(--space-2) var(--space-4); }
.sm-month { min-height: 44px; padding: var(--space-2) var(--space-4); }
.sm-month-name { min-height: 44px; margin: -8px 0; }
.rh-row { min-height: 44px; }
.au-tick { padding: var(--space-2) 0; }
.au-address { display: inline-block; max-width: 100%; vertical-align: bottom; }

@media (min-width: 900px) {
  .lt-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr) 88px minmax(0, max-content) minmax(0, 1.4fr);
    grid-template-areas: "doc who when figure state";
    column-gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
  }
  .lt-list-plain .lt-row, .comm-section .lt-row {
    grid-template-columns: minmax(0, 2fr) 140px minmax(0, max-content) minmax(0, 1.2fr);
    grid-template-areas: "doc when figure state";
  }
  .lt-row-figure { white-space: nowrap; }

  /* The email log shares one set of columns across the header and every row (subgrid), so the
     address column is as wide as the widest address on the page, and nothing else. */
  #comm-emails { display: grid; grid-template-columns: 150px minmax(0, 1.1fr) minmax(0, max-content) minmax(0, 1fr); column-gap: var(--space-4); }
  #comm-emails > * { grid-column: 1 / -1; }
  .em-list { display: grid; grid-template-columns: subgrid; }
  .em-cols, .em-row { grid-template-columns: subgrid; }
  .em-row { grid-column: 1 / -1; grid-template-areas: "when doc to state"; align-items: center; min-height: 44px; padding: var(--space-2) var(--space-5); }
  .em-state { justify-self: start; }
  .em-doc a { margin: -10px 0; }

  .dv-row { grid-template-areas: "who number state amount" "who number actions actions"; padding: var(--space-2) var(--space-5); }
  .dv-row .dv-number { justify-self: start; margin: -8px 0; }

  .doc-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(min-content, 1fr); align-items: center; column-gap: var(--space-4); }
  .doc-main .doc-added { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 0.3em; }
  .doc-main .doc-meta, .doc-main .doc-added { margin-top: 0; white-space: nowrap; }
  .doc-main .doc-meta { overflow: hidden; }
  .doc-main .doc-meta { flex-wrap: nowrap; min-width: 0; }
  .doc-kind { flex: none; }
  .doc-scope { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  .xp-what { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); align-items: baseline; column-gap: var(--space-3); }
  .xp-item { max-width: 30ch; }
  .xp-row { grid-template-columns: minmax(0, 1fr) 120px 130px auto; }
  .xp-meta { flex-wrap: nowrap; }

  .mol-who { grid-template-columns: minmax(0, 1fr) minmax(0, max-content); align-items: baseline; column-gap: var(--space-3); }

  .team-cols, .member, .tm-cols, .tm-row { --team-cols: 40px minmax(0, 3fr) minmax(0, 1fr) 120px 130px; }
  .member-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
  .member { min-height: 44px; padding: var(--space-2) var(--space-5); }
  .member-who { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, max-content); align-items: baseline; column-gap: var(--space-3); }

  .event-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head meta" "changes changes"; align-items: baseline; column-gap: var(--space-4); }
  .event-head { grid-area: head; flex-wrap: nowrap; min-width: 0; }
  .event-title { flex: none; white-space: nowrap; }
  .event-record { flex: 0 1 auto; }
  .event-main .event-meta { grid-area: meta; margin-top: 0; white-space: nowrap; }
  .event-changes { grid-area: changes; }

  .ei-name { grid-template-columns: minmax(0, 1fr) minmax(0, max-content); align-items: baseline; column-gap: var(--space-2); }


  .lt-tick-label { grid-template-columns: 24px minmax(0, 1fr) auto minmax(0, max-content); grid-template-areas: "box who amount detail"; padding: var(--space-2) var(--space-4); }

  .st-row { min-height: 44px; padding: var(--space-2) var(--space-5); }
  .st-what { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
  .st-what .mark { flex: none; }
  .st-label { flex: 0 1 auto; }
  .st-detail { flex: 1 1 0; display: block; }

  .person { min-height: 44px; padding: var(--space-2) var(--space-5); }
  .history-row { min-height: 44px; padding: var(--space-2) 0 var(--space-2) var(--space-5); }
  .ih-month { min-height: 44px; }
  .paylist-row { min-height: 44px; padding: var(--space-2) var(--space-5); }
  .ar-row { min-height: 44px; }
  .unit-groups { --unit-cols: minmax(96px, 0.8fr) minmax(0, 1fr) minmax(0, 2fr) 140px 190px; }
  .unit-cols span:first-child { grid-column: 1 / 3; }
  .unit-row { grid-template-areas: "number type tenant rent status"; min-height: 44px; padding: var(--space-2) var(--space-5); }
  .unit-row-type { align-self: center; }
  .rate { padding: var(--space-2) var(--space-4); }
  .event { padding: var(--space-2) var(--space-4); }
}
@media (min-width: 1200px) {
  .doc-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* ---------- List density, review fixes (15 October 2026) ---------- */
/* Expenses on a phone: the item and the amount, then the state and the actions. */
.xp-row { grid-template-areas: "what amount" "state actions"; }
.xp-actions { margin-top: 0; justify-self: end; }
.xp-meta .unit-pill { flex: none; min-width: 44px; height: 22px; }
/* The move-outs name link: a 44 px target that stays inside its own row. */
.mol-who a::after { inset: 0 -4px; }
.lt-row-who a { min-width: 0; max-width: 100%; }
@media (min-width: 900px) {
  .xp-row { grid-template-areas: "what state amount actions"; }
  /* Letters, the Communications tab, the reminder results and the reminder picker: the list is the
     grid and every row a subgrid of it, so a column is as wide as its widest value on the page and
     never jogs between rows. The per-row tracks declared before each `subgrid` line are the
     fallback for a browser without it. The tenant's name takes the slack. */
  .lt-list { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr) 84px minmax(0, max-content) minmax(0, max-content); column-gap: var(--space-3); }
  .lt-row {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, max-content) minmax(0, 1fr) 84px minmax(0, max-content) minmax(0, max-content);
    grid-template-columns: subgrid;
    column-gap: var(--space-3);
  }
  .comm-section .lt-list { grid-template-columns: minmax(0, 1fr) 140px minmax(0, max-content) minmax(0, max-content); }
  .comm-section .lt-row { grid-template-columns: minmax(0, 1fr) 140px minmax(0, max-content) minmax(0, max-content); grid-template-columns: subgrid; }
  .lt-results .lt-list { grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, max-content); }
  .lt-results .lt-row { grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, max-content); grid-template-columns: subgrid; grid-template-areas: "doc who figure state"; }
  .lt-results .lt-list:has(.lt-row-skipped) { grid-template-columns: minmax(0, 1fr) minmax(0, max-content); }
  .lt-results .lt-row-skipped { grid-template-columns: minmax(0, 1fr) minmax(0, max-content); grid-template-columns: subgrid; grid-template-areas: "who state"; }
  .lt-tick .lt-list { grid-template-columns: 24px minmax(0, 1fr) auto minmax(0, max-content); column-gap: var(--space-3); }
  .lt-tick-row { grid-column: 1 / -1; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto minmax(0, max-content); grid-template-columns: subgrid; }
  .lt-tick-label { grid-column: 1 / -1; grid-template-columns: 24px minmax(0, 1fr) auto minmax(0, max-content); grid-template-columns: subgrid; }
  /* Documents: only the title is cut short (it carries `title`); the kind, scope and "Added" are whole. */
  .doc-main { grid-template-columns: minmax(0, 1fr) max-content max-content; }
}
/* Beside the upload form (1200 px and up) the list is too narrow for one line until 1600 px, so the
   row keeps two lines there: the title, then the kind and scope beside the "Added" line. */
@media (min-width: 1200px) and (max-width: 1599.98px) {
  .doc-main { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); grid-template-areas: "name name" "meta added"; row-gap: 2px; }
  .doc-name { grid-area: name; }
  .doc-main .doc-meta { grid-area: meta; }
  .doc-main .doc-added { grid-area: added; }
}
/* Review pass, second turn: the name gets ~18 characters at 1280 px (tighter gap, 80 px date); on the
   reminder results the outcome is the long cell, so it takes the ellipsis (with `title`) and the name
   stays whole; the statement label is cut short on a desktop with its full text in `title`. */
@media (min-width: 900px) {
  .lt-list { grid-template-columns: minmax(0, max-content) minmax(0, 1fr) 84px minmax(0, max-content) minmax(0, max-content); column-gap: var(--space-2); }
  .lt-row { grid-template-columns: minmax(0, max-content) minmax(0, 1fr) 84px minmax(0, max-content) minmax(0, max-content); grid-template-columns: subgrid; column-gap: var(--space-2); }
  .comm-section .lt-list { grid-template-columns: minmax(0, 1fr) 140px minmax(0, max-content) minmax(0, max-content); }
  .comm-section .lt-row { grid-template-columns: minmax(0, 1fr) 140px minmax(0, max-content) minmax(0, max-content); grid-template-columns: subgrid; }
  .lt-results .lt-list { grid-template-columns: minmax(0, max-content) minmax(0, max-content) minmax(0, max-content) minmax(0, 1fr); }
  .lt-results .lt-row { grid-template-columns: minmax(0, max-content) minmax(0, max-content) minmax(0, max-content) minmax(0, 1fr); grid-template-columns: subgrid; }
  .lt-results .lt-list:has(.lt-row-skipped) { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
  .lt-results .lt-row-skipped { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); grid-template-columns: subgrid; }
  .st-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
}
@media (min-width: 1200px) and (max-width: 1599.98px) {
  .doc-main { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); grid-template-areas: "name name" "added meta"; }
}
/* A long outcome ("not sent (email not set up)") would otherwise take the whole row from the name on
   every row of the list: the state cell is capped and cut short, its full words in `title`. */
@media (min-width: 900px) {
  .lt-row .lt-row-state { max-width: 20ch; }
}
/* Documents: when the row is too narrow for the scope beside the kind tag and the "Added" line (the
   list beside the upload form), the scope steps out rather than leaving a cut fragment. */
@media (min-width: 900px) {
  .doc-main { container-type: inline-size; }
}
@container (max-width: 560px) {
  .doc-scope { display: none; }
}

/* The delivery page: a tick per invoice and one bar above the list (the owner, 15 October 2026).
   The bar's buttons are greyed until something is ticked; the tick column leads every row. */
.dv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); padding: var(--space-1) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.dv-all, .dv-tick { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.dv-all { gap: var(--space-2); justify-content: flex-start; font-size: var(--text-sm); font-weight: 600; }
.dv-all input, .dv-tick input { width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); cursor: pointer; }
.dv-bar-count { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.dv-bar-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--space-2); flex: 1 1 100%; }
.dv-bar-actions .btn { width: 100%; padding: 0 4px; font-size: 0.8125rem; white-space: nowrap; }
.dv-bar-note { flex: 1 1 100%; color: var(--muted); font-size: var(--text-sm); }
.dv-tick { grid-area: box; margin: -10px 0 -10px -10px; align-self: center; }
.dv-row { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "box who amount" "box state number"; }
@media (min-width: 900px) {
  .dv-bar { padding: var(--space-1) var(--space-5); }
  .dv-bar-actions { display: flex; flex: 0 1 auto; margin-left: auto; }
  .dv-bar-actions .btn { width: auto; padding: 0 var(--space-4); font-size: var(--text-sm); }
  .dv-cols, .dv-row { --dv-cols: 28px minmax(0, 1.2fr) 104px minmax(0, 1.6fr) 136px; }
  .dv-cols span:nth-child(4) { text-align: left; }
  .dv-cols span:nth-child(5) { text-align: right; white-space: nowrap; }
  .dv-row { grid-template-columns: var(--dv-cols); grid-template-areas: "box who number state amount"; align-items: center; }
  .dv-row .dv-number { justify-self: start; }
  .dv-row .dv-who, .dv-row .dv-amount { align-self: center; }
}

/* Additional Services (the owner, 16 October 2026), Task 4: Settings › Additional Services' catalogue
   rows, one line from 900 px (the list-density rule, 15 October 2026), the rate history folded under each. */
.sv-list { margin: 0 0 var(--space-3); padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.sv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "pricing state" "rate rate" "who actions" "rates rates"; gap: 2px var(--space-3); align-items: center; min-height: 44px; padding: var(--space-2) var(--space-4); }
.sv-row + .sv-row { border-top: 1px solid var(--line); }
.sv-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.sv-pricing { grid-area: pricing; color: var(--muted); font-size: var(--text-sm); }
.sv-rate { grid-area: rate; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.sv-who { grid-area: who; color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.sv-state { grid-area: state; justify-self: end; }
.sv-actions { grid-area: actions; display: flex; gap: var(--space-3); justify-self: end; font-size: var(--text-sm); }
.sv-actions a, .sv-rates summary { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }
.sv-rates { grid-area: rates; }
.sv-rates summary { color: var(--muted); font-size: var(--text-sm); cursor: pointer; }
.sv-rates .rates { margin: var(--space-2) 0 var(--space-2); }
.sv-retired .sv-name, .sv-retired .sv-rate { color: var(--muted); font-weight: 500; }
@media (min-width: 900px) {
  /* The pricing sits under the name, so the rate words keep their width beside the sidebar. */
  .sv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 5rem 0 10.5rem; grid-template-areas: "name rate who state actions" "pricing rate who state actions" "rates rates rates rates rates"; column-gap: var(--space-3); padding: var(--space-2) var(--space-5); }
  /* A state column only when a row carries a tag (Retired, New rate), the same width on every row. */
  .sv-list:has(.sv-state .profile-status) .sv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 5rem 9rem 10.5rem; }
}

/* Additional Services, Task 5: the Services cell under a sheet row (the fixed lines and the metered
   counts beside water), the review's Services column, Bulk Invoicing's lock for a service with no rate.
   Only a row that bills a service gains the services area, so the other rows keep their height. */
.rd-row:has(> .rd-services) { grid-template-areas: "unit who who" "label label state" "input input input" "foot foot foot" "services services services"; }
.rd-services { grid-area: services; display: grid; gap: var(--space-1); min-width: 0; margin: 0; padding-top: var(--space-2); border-top: 1px dashed var(--line); }
.rd-service { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-height: 44px; min-width: 0; font-size: 0.9375rem; }
.rd-service-name { font-weight: 650; overflow-wrap: anywhere; }
.field.rd-service-input { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.field.rd-service-input input { display: inline-block; width: 7ch; min-height: 44px; padding: 6px 10px; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.rd-service-unit { color: var(--muted); font-size: var(--text-sm); }
.rd-service-figure { font-weight: 650; white-space: nowrap; }
.rd-warn { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); font-size: var(--text-sm); font-weight: 650; }
.rd-warn svg { flex: none; }
.rd-service .error { flex-basis: 100%; margin: 0; font-size: var(--text-sm); }
.rd-service-hint { color: var(--muted); font-size: var(--text-sm); }
.rd-service-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); font-size: var(--text-sm); font-weight: 600; }
.au-no_service_rate .au-name { color: var(--muted); }
@media (min-width: 900px) {
  .rd-row:has(> .rd-services) { grid-template-areas: "unit who input foot state" ". services services services services"; }
  .rd-service { gap: var(--space-1) var(--space-3); }
  .rv-cols, .rv-row { --rv-cols: minmax(0, 2.2fr) repeat(5, minmax(0, 0.9fr)) minmax(0, 1.2fr); }
}

/* Additional Services, Task 6: the Services block on the lease card (the tenant's Leases tab). */
.lease-services { margin-top: var(--space-4); }
.lease-service-list { margin: 0; padding: 0; list-style: none; }
.lease-service { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }
.lease-service-what { min-width: 0; overflow-wrap: anywhere; font-size: var(--text-sm); }
.lease-service-name { font-weight: 650; font-size: var(--text-base); }
.lease-service-stop { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; flex: none; }
.lease-service-none { margin: 0 0 var(--space-2); }
.lease-service-add { margin-top: var(--space-2); }

/* ======================================================================
   Phone menu and Home, Task 2 (the owner, 16 October 2026; the mockup
   docs/superpowers/specs/2026-10-16-phone-menu-and-home-mockup.html, phone on the right, tab set A,
   rows). Below 900 px the sidebar is hidden and a five-tab bar serves: Home, Tenants, Payments,
   Reports and Menu, a 22 px icon over an 11 px label, the open tab's icon on a 56 x 30 pill in the
   logo's star gradient with a white 700 label (a shape as well as a colour). Menu opens a bottom
   sheet with every sidebar page in its groups as rows, the quick actions, a search row, Settings'
   tabs as chips, the member and Sign out (static/js/menu.js). This block supersedes the old phone
   rules (`.nav li.nav-sidebar-only`, the `display: contents` flatten), which stay in the file.
   ====================================================================== */
@media (max-width: 899.98px) {
  .nav { display: none; }
  .app { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  html.is-menu-open, html.is-menu-open body { overflow: hidden; }

  /* The bar */
  .tabbar { --nav-alert: #e0a46a; position: fixed; inset: auto 0 0 0; z-index: 20; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--charcoal); border-top: 1px solid rgb(255 255 255 / 8%); }
  .tabbar ul { display: flex; height: 64px; margin: 0; padding: 0 4px; list-style: none; }
  .tabbar li { display: flex; flex: 1 1 0; min-width: 0; }
  .tabbar-item { position: relative; display: grid; grid-template-rows: 30px auto; justify-items: center; align-content: center; row-gap: 2px; width: 100%; min-width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--on-dark-muted); font: 600 11px/1.2 var(--font-body); letter-spacing: 0.01em; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color 120ms var(--ease); }
  .tabbar-item:hover { color: #fff; }
  .tabbar-item:focus-visible { outline: 2px solid #fff; outline-offset: -4px; border-radius: 10px; }
  .tabbar-icon { position: relative; display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; transition: background 160ms var(--ease), transform 120ms var(--ease); }
  .tabbar .nav-icon { display: block; width: 22px; height: 22px; color: currentColor; }
  .tabbar-item:active .tabbar-icon { transform: scale(0.94); background: rgb(255 255 255 / 8%); }
  .tabbar-item[aria-current], .tabbar-menu[aria-expanded="true"] { color: #fff; font-weight: 700; }
  .tabbar-item[aria-current] .tabbar-icon, .tabbar-menu[aria-expanded="true"] .tabbar-icon { background: linear-gradient(160deg, var(--brand-star), var(--oxblood)); box-shadow: 0 1px 0 rgb(255 255 255 / 10%) inset; }
  .tabbar-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .tabbar-menu-close, .tabbar-menu[aria-expanded="true"] .tabbar-menu-open { display: none; }
  .tabbar-menu[aria-expanded="true"] .tabbar-menu-close { display: block; }
  /* The count follows the label in the markup (read as "Payments, 3 in arrears") and is drawn on
     the icon's corner: the icon and label take fixed rows, the count shares the icon's cell. */
  .tabbar-icon { grid-row: 1; grid-column: 1; }
  .tabbar-label { grid-row: 2; grid-column: 1; }
  .tabbar-count { position: relative; grid-row: 1; grid-column: 1; align-self: start; justify-self: center; margin-top: -2px; transform: translateX(calc(50% + 6px)); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--nav-alert); color: var(--charcoal); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--charcoal); }

  /* The scrim and the sheet (over the bar; 86 % of the screen at most, scrolling inside) */
  .menu-scrim { position: fixed; inset: 0; z-index: 30; background: rgb(26 26 26 / 55%); opacity: 0; transition: opacity 200ms var(--ease); }
  .is-menu-open .menu-scrim { opacity: 1; }
  .menu-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; display: flex; flex-direction: column; max-height: 86vh; max-height: 86dvh; background: var(--paper); color: var(--ink); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px -16px rgb(26 26 26 / 45%); transform: translateY(102%); transition: transform 220ms var(--ease); will-change: transform; }
  .is-menu-open .menu-sheet { transform: translateY(0); }
  .menu-sheet.is-dragging { transition: none; }
  .menu-sheet[hidden], .menu-scrim[hidden] { display: none; }
  .menu-sheet .nav-icon { display: block; flex: none; width: 20px; height: 20px; }
  .menu-sheet-head { flex: none; padding: 8px max(8px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); border-radius: 18px 18px 0 0; background: var(--paper); touch-action: none; }
  .menu-handle { width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 2px; background: var(--line-strong); }
  .menu-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; }
  .menu-title { margin: 0; font: 650 20px/1.5 var(--font-display); letter-spacing: -0.015em; }
  .menu-title:focus { outline: none; }
  .menu-title small { display: block; color: var(--muted); font: 500 12px/1.5 var(--font-body); letter-spacing: 0; }
  .menu-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .menu-close:active { background: var(--paper-2); }
  .menu-close .nav-icon { width: 22px; height: 22px; }
  .menu-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); scrollbar-width: none; }
  .menu-sheet-body::-webkit-scrollbar { display: none; }

  /* Search over tenants and units (the results are Task 3's) */
  .menu-search { position: relative; margin: 4px 0 14px; }
  .menu-search > .nav-icon { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
  .menu-search input { display: block; width: 100%; height: 48px; margin: 0; padding: 0 14px 0 44px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: 400 16px/1.2 var(--font-body); -webkit-appearance: none; appearance: none; }
  .menu-search input::-webkit-search-cancel-button, .menu-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
  .menu-search input::placeholder { color: var(--placeholder); }
  .menu-search input:focus { outline: none; border-color: var(--oxblood); box-shadow: var(--ring); }
  .menu-results { margin: 8px 0 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .menu-results:empty { display: none; }
  .menu-results > li { border-top: 1px solid var(--line); }
  .menu-results > li:first-child { border-top: 0; }
  .menu-results a, .menu-results-none { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px; color: var(--ink); font-size: 14px; text-decoration: none; }
  .menu-results-none { color: var(--muted); }

  /* Quick actions, 2 x 2 */
  .menu-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
  .menu-quick li { display: flex; min-width: 0; }
  .menu-quick a { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: border-color 120ms var(--ease), background-color 120ms var(--ease); }
  .menu-quick a:hover { color: var(--ink); border-color: var(--line-strong); }
  .menu-quick a:active { background: var(--oxblood-tint); border-color: var(--oxblood); }
  .menu-quick-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--oxblood-tint); color: var(--oxblood); }

  /* The groups as rows */
  .menu-group { margin-top: 18px; }
  .menu-group-name { margin: 0 0 6px 2px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
  .menu-rows { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .menu-rows > li { border-top: 1px solid var(--line); }
  .menu-rows > li:first-child { border-top: 0; }
  .menu-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px 6px 14px; color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: background-color 120ms var(--ease); }
  .menu-row:hover { color: var(--ink); }
  .menu-row:active { background: var(--paper-2); }
  .menu-row:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: 0; }
  .menu-row > .nav-icon { color: var(--muted); }
  .menu-row-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-count { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: rgb(224 164 106 / 28%); color: #5a3a10; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
  .menu-sheet .menu-chevron { width: 16px; height: 16px; color: var(--line-strong); }
  .menu-row[aria-current] { background: var(--oxblood); color: #fff; font-weight: 600; }
  .menu-row[aria-current] > .nav-icon, .menu-row[aria-current] .menu-chevron { color: #fff; }
  .menu-row[aria-current] .menu-count { background: rgb(255 255 255 / 20%); color: #fff; }
  /* Settings' tabs as chips under its row */
  .menu-chips { display: flex; gap: 6px; margin: 0; padding: 0 12px 8px 46px; list-style: none; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .menu-chips::-webkit-scrollbar { display: none; }
  .menu-chips li { display: flex; flex: none; }
  .menu-chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
  .menu-chips a:hover { color: var(--ink); border-color: var(--muted); }
  .menu-chips a[aria-current] { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }

  /* The member and Sign out */
  .menu-sheet-foot { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: var(--paper-2); }
  .menu-me { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; min-height: 44px; color: var(--ink); text-decoration: none; }
  .menu-me:hover { color: var(--ink); }
  .menu-avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--charcoal); color: var(--on-dark); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; object-fit: cover; }
  .menu-me[aria-current] .menu-avatar { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--oxblood); }
  .menu-who { min-width: 0; line-height: 1.25; }
  .menu-who b { display: block; overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .menu-who > span { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .menu-signout { flex: none; margin: 0; }
  .menu-signout button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 13px/1.2 var(--font-body); cursor: pointer; }
  .menu-signout button:hover { border-color: var(--muted); }
  .menu-signout .nav-icon { width: 16px; height: 16px; }
}
@media (min-width: 900px) {
  .tabbar, .menu-scrim, .menu-sheet { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-sheet, .menu-scrim, .tabbar-item, .tabbar-icon { transition: none; }
}

/* Phone menu and Home, Task 3 (16 October 2026): the Menu search's result rows, as the mockup:
   icon, the name in 600, the unit (or the occupant, or "Vacant") at the row's end. */
@media (max-width: 899.98px) {
  .menu-results a:hover { color: var(--ink); }
  .menu-results a:active { background: var(--paper-2); }
  .menu-results a:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: 0; }
  .menu-results a > .nav-icon { flex: none; color: var(--muted); }
  .menu-results b { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .menu-results-where { flex: none; color: var(--muted); font-size: 12px; }
  .menu-results-meta { flex: none; max-width: 45%; margin-left: auto; overflow: hidden; color: var(--muted); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
}

/* Phone menu and Home, Task 5 (16 October 2026): Home remodelled around what needs attention
   (H1-H6; the mockup docs/superpowers/specs/2026-10-16-phone-menu-and-home-mockup.html). On a
   phone one column: the header on the paper (the lockup 118 px, the member on the right), the
   date line, the hero "Collected this period" (26 px figure, a meter in the logo's star gradient),
   "Needs your attention", the landlord panel and the building's six figures, 16 px panels with
   --shadow-panel. From 900 px two columns under --content-max: hero and landlord left, attention
   and building right, the figures one step larger. Oxblood is the only action colour. */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 2px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.home-head .brand-banner-logo { flex: none; width: 118px; }
.home-head .brand-banner-who { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.3; text-align: right; overflow-wrap: anywhere; }
.home-head .brand-banner-who span { color: var(--muted); font-size: 12px; font-weight: 500; }
.home-date { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.home-grid > section { min-width: 0; margin: 0; }
.home-label { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; line-height: 1.3; text-transform: uppercase; }
.home-act { display: inline-flex; flex: none; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px; color: var(--oxblood); font-size: 13px; font-weight: 600; text-decoration: none; }
.home-act:hover { color: var(--oxblood-deep); text-decoration: underline; }
.home-chev { flex: none; }

/* The hero */
.home-hero { padding: 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-panel); }
.home-hero-fig { display: block; margin: 0 0 12px; color: var(--ink); font-size: 26px; font-weight: 650; line-height: 1; letter-spacing: -0.03em; text-decoration: none; }
a.home-hero-fig { display: flex; align-items: center; width: fit-content; min-height: 44px; margin: -9px 0 3px; }
a.home-hero-fig:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.home-meter { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.home-meter span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand-star), var(--oxblood)); }
.home-hero-notes { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.home-hero-notes p { margin: 0; }
.home-hero-notes b { color: var(--ink); font-weight: 650; }
.home-hero-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; min-height: 44px; margin: 10px 0 0; padding-top: 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.home-hero-foot p { margin: 0; padding: 6px 0; }
.home-hero-foot .home-act { margin-right: -8px; }

/* The panels */
.home-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-panel); overflow: hidden; }
.home-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 4px 8px 0 16px; }
.home-panel-head h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: 0; }
.home-panel-head .home-act { margin: 0; }
.home-total { min-width: 24px; height: 24px; margin-right: 8px; padding: 0 8px; border-radius: 12px; background: var(--oxblood); color: #fff; font-size: 12px; font-weight: 700; line-height: 24px; text-align: center; }
.home-panel .empty { padding: 0 16px 14px; }

/* Needs your attention: one row per kind; past four kinds three show and the rest fold (R6) */
.home-att { margin: 4px 0 0; padding: 0; list-style: none; }
.home-att li { border-top: 1px solid var(--line); }
.home-att li[hidden] { display: none; }
.home-att a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px 8px 16px; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.home-att a:hover { color: var(--ink); background: var(--paper); }
.home-att a:active { background: var(--paper-2); }
.home-att a:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: 0; }
.home-att a > .nav-icon { display: block; flex: none; width: 20px; height: 20px; color: var(--muted); }
.home-att-text { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.home-att-text b { display: block; font-size: 14px; font-weight: 600; }
.home-att-text span { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.home-att-count { flex: none; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; background: rgb(224 164 106 / 28%); color: #5a3a10; font-size: 12px; font-weight: 700; line-height: 24px; text-align: center; }
.home-att a > .home-chev { color: var(--line-strong); }
.home-att-more button { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 48px; padding: 0 12px 0 48px; border: 0; background: var(--paper-2); color: var(--oxblood); font: 600 13px/1.3 var(--font-body); text-align: left; cursor: pointer; }
.home-att-more button:hover { background: var(--line); }
.home-att-more button:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: 0; }
.home-att-more-words span { color: var(--muted); font-weight: 500; }
.home-att-more .home-chev { margin-left: auto; transform: rotate(90deg); transition: transform 160ms var(--ease); }
.home-att-more button[aria-expanded="true"] .home-chev { transform: rotate(-90deg); }

/* The landlord (approvers) */
.home-landlord-cells { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 4px 16px 10px; }
.home-landlord-cells > div { min-width: 0; }
.home-landlord-cells > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.home-landlord-cells .home-label { font-size: 11px; }
.home-panel-fig { margin: 0; color: var(--ink); font-size: 18px; font-weight: 650; line-height: 1.2; letter-spacing: -0.02em; }
.home-note { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.home-landlord-foot, .home-building-foot { margin: 0; padding: 10px 16px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* The building: six plain figures (H1) */
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; margin: 0; padding: 4px 16px 16px; }
.home-stats div { min-width: 0; }
.home-stats dt { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.home-stats dd { margin: 0; color: var(--ink); font-size: 18px; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.home-stats dd i { color: var(--muted); font-size: 13px; font-style: normal; font-weight: 500; letter-spacing: 0; }
.home-stats dd.home-stat-money { font-size: 16px; }

@media (min-width: 900px) {
  .home-head { margin-top: 0; }
  .home-head .brand-banner-logo { width: 150px; }
  .home-head .brand-banner-who { font-size: 14px; }
  .home-date { margin-bottom: 20px; font-size: 14px; }
  .home-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "hero att" "landlord att" "landlord building";
    gap: 16px 20px;
  }
  #home-collected { grid-area: hero; }
  #home-attention { grid-area: att; }
  #home-landlord { grid-area: landlord; }
  #home-building { grid-area: building; }
  /* No landlord panel (members who approve nothing): the building goes under the hero. */
  .home-grid-solo { grid-template-areas: "hero att" "building att"; }
  .home-hero { padding: 22px 22px 8px; }
  .home-hero-fig { font-size: 30px; }
  .home-hero-notes, .home-hero-foot { font-size: 13px; }
  .home-panel-head h2 { font-size: 15px; }
  .home-panel-fig { font-size: 20px; }
  .home-stats dd { font-size: 20px; }
  .home-stats dd.home-stat-money { font-size: 18px; }
}

/* The floor grid on the Units page, above the list (R8) */
.units-grid { margin-bottom: var(--space-5); }

/* Tenants list on a phone (the owner, 17 October 2026): two lines per row. The unit pill and the
   phone share `.person-where` on the second line, the rent at its right; no third line. A tenant
   with two units or none wraps the phone under the pill rather than cutting it short. The desktop
   list keeps its six columns: the span is `display: contents` there, so its two children still
   take their own grid areas. Supersedes the phone areas of `.person` above. */
.person-where { display: contents; }
@media (max-width: 899.98px) {
  .person { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "avatar name status" "avatar where rent"; column-gap: 8px; }
  .person-where { grid-area: where; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
  .person-units { flex: none; }
  .person-phone { font-size: 0.8125rem; }
}

/* Payments list on a phone (the owner, 17 October 2026): two lines per row, the receipt number and
   the method · reference on the second line with the date at its right; no third line. A long
   reference is cut with an ellipsis (the row's title and the receipt page carry it whole).
   Supersedes the phone areas of `.paylist-row` above; the desktop columns are unchanged. */
@media (max-width: 899.98px) {
  .paylist-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "who who amount" "number meta date"; column-gap: 8px; }
  .paylist-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Desktop Home graphs (the owner, 17 October 2026, G1-G6; the mockup
   docs/superpowers/specs/2026-10-17-desktop-home-graphs-mockup.html): "Collected, six periods" in
   the grid beside the building, and the band "Over time" beneath it with "Net to the landlord,
   twelve months" (two thirds) and "Arrears by age" (one third). Nothing new below 900 px. One hue:
   oxblood bars on a paper-2 track, the open month a tint with a 1 px oxblood edge, brand-star on
   hover; text in ink or muted, never in the bar colour. Bars 22 px wide (18 px for the age rows)
   with 4 px rounded ends and square bases; hairline gridlines in --line; axis text 11 px muted.
   The age ramp is the graph's own, on .home-aging (tokens.css is not touched). */
@media (max-width: 899.98px) {
  #home-paid, .home-band { display: none; }
}
.home-aging { --hg-age-1: #e9c4ba; --hg-age-2: #cf8d7c; --hg-age-3: #a9472f; --hg-age-4: #6f1a0f; }
.home-tip { position: fixed; top: 0; left: 0; z-index: 60; max-width: 280px; padding: 6px 10px; border-radius: 8px; background: var(--ink); box-shadow: var(--shadow-panel); color: #fff; font-size: 12px; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity 120ms var(--ease); }
.home-tip.is-on { opacity: 1; }
@media (min-width: 900px) {
  .home-grid-paid { grid-template-areas: "hero att" "landlord att" "paid building"; }
  /* No landlord panel: the paid graph sits under the hero, beside the building. */
  .home-grid-solo.home-grid-paid { grid-template-areas: "hero att" "paid building"; }
  #home-paid { grid-area: paid; align-self: stretch; }
  .hg-head-note { margin: 0 8px 0 0; text-align: right; }

  .home-band { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px 20px; align-items: start; margin-top: 36px; }
  .home-band-title { grid-column: 1 / -1; margin: 0 0 -4px; color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: 0.1em; line-height: 1.3; text-transform: uppercase; }

  .hg-chart { padding: 2px 26px 8px 50px; }
  .hg-chart-net { padding: 6px 30px 10px 60px; }
  .hg-svg, .hg-plot, .hg-slot { display: block; overflow: visible; }
  .hg-grid line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
  .hg-axis { fill: var(--muted); font: 11px var(--font-body); font-variant-numeric: tabular-nums; }
  .hg-track { fill: var(--paper-2); }
  .hg-bar { fill: var(--oxblood); }
  .hg-bar-prov { fill: var(--oxblood-tint); }
  .hg-bar-prov .hg-edge { fill: var(--oxblood); }
  .hg-label { fill: var(--ink); font: 600 11.5px var(--font-body); font-variant-numeric: tabular-nums; }
  .hg-note { fill: var(--muted); font: 11px var(--font-body); }
  .hg-hit { fill: transparent; }
  .hg-col { outline: none; }
  .hg-col:hover .hg-bar, .hg-col:focus-visible .hg-bar, .hg-col:hover .hg-bar-prov, .hg-col:focus-visible .hg-bar-prov { fill: var(--brand-star); }
  .hg-col:focus-visible .hg-hit { stroke: var(--oxblood); stroke-width: 2; }

  .hg-age { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; padding: 6px 16px 14px; font-size: 13px; }
  .hg-age-key { color: var(--muted); font-size: 12px; }
  .hg-age-track { display: block; height: 18px; border-radius: 0 4px 4px 0; background: var(--paper-2); overflow: hidden; }
  .hg-age-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; }
  .hg-age-1 { background: var(--hg-age-1); }
  .hg-age-2 { background: var(--hg-age-2); }
  .hg-age-3 { background: var(--hg-age-3); }
  .hg-age-4 { background: var(--hg-age-4); }
  .hg-age-value { color: var(--ink); font-weight: 600; }
  .hg-age-value small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
}

/* Arrears by age without the net graph (a member who approves nothing): it stays one third wide on
   the right, where it sits beside the net for an approver (G1). A modifier class set by the
   template, not :has(). */
@media (min-width: 900px) {
  .home-band-nonet #home-aging { grid-column: 2; }
}

/* EstateOS, built by Nomad Labs (the owner, 18 October 2026, E1-E5 and Option C; the samples
   docs/superpowers/specs/2026-10-18-estateos-branding-samples.html). The sign-in frame shows the
   stacked logo at 200 px (its own NOMAD LABS line is the credit). Home's header: the horizontal
   lockup, a 1 px rule 44 px tall in --line-strong, the building (18 px, 650) with the date and the
   period beneath it (muted 14 px), the member on the right. Below 900 px the phone's shape: the
   lockup at 118 px and the member on one row, the building and the date as one muted line under
   them, no rule. Option C: from 900 px Home's type one scale larger; from 1400 px Home alone is
   1400 px wide (the body class .home-wide; every other page keeps --content-max). The Menu sheet's
   footer ends with the credit line, the colour mark at 16 px. Supersedes .brand-banner-logo,
   .brand-banner-who and the date-line rules for Home above. */
.bare .bare-logo { width: 200px; }

.home-head-logo img { display: block; width: 100%; height: auto; }
.home-head-place { min-width: 0; }
.home-head-place p { margin: 0; }
.home-head-building { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.home-head .home-date { margin: 0; color: var(--muted); }
.home-head-who { margin: 0; color: var(--ink); font-weight: 600; line-height: 1.3; text-align: right; overflow-wrap: anywhere; }
.home-head-who span { color: var(--muted); font-size: 12px; font-weight: 500; }
@media (max-width: 899.98px) {
  .home-head { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo who" "place place"; align-items: center; gap: 2px 12px; margin-bottom: 14px; }
  .home-head-logo { grid-area: logo; width: 118px; }
  .home-head-rule { display: none; }
  .home-head-who { grid-area: who; justify-self: end; font-size: 13px; }
  .home-head-place { grid-area: place; font-size: 13px; line-height: 1.45; }
  .home-head-place p { display: inline; }
  .home-head-building::after { content: " · " / ""; color: var(--muted); font-weight: 400; }
}
@media (min-width: 900px) {
  .home-head { display: flex; align-items: center; gap: 20px; margin: 0 0 24px; }
  .home-head-logo { flex: none; width: 190px; }
  .home-head-rule { display: block; flex: none; width: 1px; height: 44px; background: var(--line-strong); }
  .home-head-building { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
  .home-head .home-date { margin-top: 3px; font-size: 14px; }
  .home-head-who { flex: none; max-width: 40%; margin-left: auto; font-size: 14px; }

  .home-hero-fig { font-size: 38px; }
  .home-panel-fig { font-size: 24px; }
  .home-stats dd { font-size: 24px; }
  .home-stats dd.home-stat-money { font-size: 21px; }
  .home-panel-head h2 { font-size: 17px; }
  .home-att-text b { font-size: 15px; }
  .home-hero-notes, .home-hero-foot, .home-panel .empty { font-size: 15px; }
  .home-label, .home-landlord-cells .home-label, .home-stats dt { font-size: 12px; }
}
@media (min-width: 1400px) {
  .home-wide .main { max-width: 1400px; }
}

.menu-sheet-foot { flex-wrap: wrap; }
.menu-credit { display: flex; flex: 1 1 100%; align-items: center; justify-content: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.menu-credit img { display: block; flex: none; width: 16px; height: 16px; }
.menu-credit b { color: var(--ink); font-weight: 600; }
.home-date-period { white-space: nowrap; }

/* Home at full width (the owner, 18 October 2026): .main is border-box with 48 px (--space-7) of
   padding each side from 900 px, so its cap is 1400 px of content plus both paddings, giving the
   panels the mockup's 1400 px; the grid gaps are the mockup's 18 px rows and 24 px columns. */
@media (min-width: 1400px) {
  .home-wide .main { max-width: calc(1400px + 2 * var(--space-7)); }
  .home-wide .home-grid { gap: 18px 24px; }
  .home-wide .home-band { gap: 18px 24px; }
}

/* Final review (18 October 2026): the phone's date line is the old one-line form (R6) and the
   separator carries a plain fallback before the alt-text form. */
@media (max-width: 899.98px) {
  .home-head-building::after { content: " · "; content: " · " / ""; }
  .home-head-place .home-head-building, .home-head-place .home-date { display: none; }
}
@media (min-width: 900px) {
  .home-head-place .home-head-short { display: none; }
}

/* The brand on the sidebar (the owner, 19 October 2026, SB1-SB4; superseding the 7 October rule
   "no logo at the sidebar's top"). From 900 px the collapse control keeps its place and the
   reversed EstateOS lockup sits on its own row under it, 168 px wide, left-aligned with the links'
   icons (16 px row padding + 8 px = the list's 12 px + the link's 12 px), 10 px under the control
   (the row gap 8 px + 2 px) and 14 px above the rule; in the rail (68 px) the
   lockup gives way to the reversed mark at 30 px, centred above the expand control. One of the two
   is displayed at a time. Home's header then drops its lockup and rule and the building is the
   title (SB2). Below 900 px nothing changes (SB4): the sidebar is hidden and the phone header
   keeps its 118 px lockup. */
@media (min-width: 900px) {
  .nav-top { flex-wrap: wrap; }
  .nav-brand-row { display: block; flex: 0 0 100%; padding: 2px 0 4px 8px; }
  .nav-lockup { display: block; width: 168px; height: auto; }
  .nav-rail-mark { display: none; }
  :root[data-nav-rail] .nav-top { gap: var(--space-2); }
  :root[data-nav-rail] .nav-brand-row { display: none; }
  :root[data-nav-rail] .nav-rail-mark { display: block; order: -1; width: 30px; height: 30px; }

  .home-head-logo, .home-head-rule { display: none; }
  .home-head-building { font-size: 24px; font-weight: 650; line-height: 1.25; }
}

/* New Tenant: "This tenant is already in place" (the sitting-tenant plan, S1). The switch sits
   between the unit tiles and the date as a .check (44 px target); its words stack beside the box.
   The form's mode class hides the move-in-only words, lines and total, or the in-place ones. */
.ob-switch { cursor: pointer; }
.ob-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ob-in-place [data-move-in-only] { display: none; }
.ob:not(.ob-in-place) [data-in-place-only] { display: none; }

/* Change Lease Date joins the lease card's header row, first of the buttons (the owner, 19 October 2026):
   Change Lease Date, Renew or change rent, Give notice. The status flag sits in `.lease-flag`, centred in
   the space between the unit and the first button from 900 px, and at the right of the title row on a
   phone, the buttons stacked full width beneath in the same order. */
.lease-flag { grid-area: badge; display: flex; justify-content: flex-end; min-width: 0; }
.lease-flag .badge { margin-top: 4px; }
.lease-date { grid-area: auto; grid-column: 1 / -1; width: 100%; }
@media (min-width: 900px) {
  .lease-head { grid-template-columns: auto minmax(0, 1fr); grid-auto-columns: auto; grid-auto-flow: column; }
  .lease-flag { grid-area: auto; justify-content: center; }
  .lease-flag .badge { margin-top: 0; }
  .lease-date { grid-area: auto; grid-column: auto; width: auto; }
}

/* A lease date change awaiting approval, or decided within 30 days, under the in-place line on the lease
   card (the owner, 19 October 2026, rulings A5-A7): a full-width cell of the terms grid, its words in
   body weight, Approve and Decline (or Withdraw) beneath, stacked full width on a phone. With no buttons
   in the card's head the status flag sits at the right from 900 px (Task 1 carry-over). */
.lease-terms .lease-change { grid-column: 1 / -1; }
.lease-terms .lease-change dd { font-weight: 400; }
.lease-change-words { margin: 0; }
.lease-change-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-top: var(--space-2); }
.lease-change-actions form { margin: 0; }
.lease-change-actions .btn { width: 100%; }
@media (min-width: 900px) {
  .lease-flag:last-child { justify-content: flex-end; }
  .lease-change-actions { display: flex; flex-wrap: wrap; }
  .lease-change-actions .btn { width: auto; }
}

/* My Work Items (the owner, 19 October 2026, W1, W7; the mockup of 19 October): on Home for a
   member with an approve right, one row per item awaiting their decision: the kind's tag (DATE,
   EXP, SET, STM, in words, never by colour alone), the title with who and when beneath, the
   amount and a chevron, 56 px rows like Needs your attention. From 900 px it is the right
   column's first panel, above Needs your attention; on a phone it sits directly below Needs your
   attention (the hero and the attention panel are ordered first). The work-item screen: the
   crumb, the facts, a before and after table for a lease date change with what does not change,
   then Approve (oxblood), Reject… (the danger outline) and Back to Home, 44 px each, stacked full
   width on a phone; Reject… opens the required comment. */
.home-work-list { margin: 4px 0 0; padding: 0; list-style: none; }
.home-work-list li { border-top: 1px solid var(--line); }
.home-work-list a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px 8px 16px; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.home-work-list a:hover { color: var(--ink); background: var(--paper); }
.home-work-list a:active { background: var(--paper-2); }
.home-work-list a:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; border-radius: 0; }
.home-work-list a > .home-chev { color: var(--line-strong); }
.home-work-tag { display: inline-block; flex: none; min-width: 40px; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); color: var(--muted); font: 700 10px/1.4 var(--font-body); letter-spacing: 0.08em; text-align: center; vertical-align: middle; }
.home-work-amount { flex: none; color: var(--ink); font-size: 13px; font-weight: 650; }
@media (max-width: 899.98px) {
  #home-collected { order: -2; }
  #home-attention { order: -1; }
}
@media (min-width: 900px) {
  #home-work { grid-area: work; }
  .home-grid:not(.home-grid-solo) { grid-template-areas: "hero work" "landlord att" "landlord building"; }
  .home-grid-paid:not(.home-grid-solo) { grid-template-areas: "hero work" "landlord att" "paid building"; }
  .home-work-amount { font-size: 14px; }
}

.work-crumb { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.work-crumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--oxblood); font-weight: 600; }
.work-head h1 { overflow-wrap: anywhere; }
.work-facts .work-fact-words { font: 600 1rem/1.35 var(--font-body); letter-spacing: 0; overflow-wrap: anywhere; }
.work-change { margin-bottom: var(--space-5); padding: var(--space-4); }
.work-change h2 { margin: 0 0 var(--space-3); font-size: 1rem; }
.work-table th[scope="row"] { background: none; color: var(--ink); font-size: var(--text-sm); white-space: normal; }
.work-table td { white-space: nowrap; }
.work-changed td:last-child { font-weight: 650; }
.work-note { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper-2); }
.work-note h3 { margin: 0 0 4px; font-size: var(--text-sm); font-weight: 650; }
.work-note p { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.work-links { margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.work-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.work-decide > .muted, .work-reject .muted { margin: 0 0 var(--space-3); }
.work-reject { padding: var(--space-4); }
.work-required { margin-left: 4px; color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.work-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
.work-actions form { margin: 0; }
.work-actions .btn { width: 100%; }
@media (min-width: 900px) {
  .work-actions { display: flex; flex-wrap: wrap; align-items: center; }
  .work-actions .btn { width: auto; }
  .work-change { padding: var(--space-5); }
  .work-reject { padding: var(--space-5); }
}

/* Change requests awaiting approval where the change would sit (ruling K8, 20 October 2026): the
   notice in the notice strip's place, the move-out and the termination notice inside the on-notice
   strip and on the move-out page; the line wraps, its buttons are the card's 44 px small ones. */
.change-line { margin: 0; overflow-wrap: anywhere; font-weight: 400; }
.lease-moveout .change-line + .change-line { margin-top: var(--space-2); }
.mo-record .change-line { margin-top: var(--space-3); }
.mo-approval-note { margin: var(--space-2) 0 0; }

/* Next approvals (rulings K7, K11, 20 October 2026): My Work Items' "Show all (N)" sits under
   rows without an icon, so it starts where their tags start; the work-item screen's letter
   preview and its reason panel. */
.home-work .home-att-more button { padding: 0 12px 0 16px; }
.work-letter, .work-asked { margin-bottom: var(--space-5); padding: var(--space-4); }
.work-letter h2 { margin: 0 0 var(--space-3); font-size: 1rem; }
.work-asked .work-note { margin-top: 0; }
.work-asked .work-note p + p { margin-top: 6px; }
@media (min-width: 900px) {
  .work-letter, .work-asked { padding: var(--space-5); }
}

/* Buildings (Phase 2, ruling C5, 21 October 2026; mockup tab 3): one row per building. Phone: the
   name and the state, then the agent and the units; a pending row adds who added it and its
   Confirm / Turn down. From 900 px one line per row (the list-density rule): name · agent and
   since · units · state, with a pending row's second line under it. */
.bl-cols { display: none; }
.bl-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); overflow: hidden; }
.bl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name state" "agent units" "added added" "actions actions";
  align-items: center;
  gap: 2px var(--space-3);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
}
.bl-row:not(.bl-row-pending) { grid-template-areas: "name state" "agent units"; }
.bl-row + .bl-row { border-top: 1px solid var(--line); }
.bl-name { grid-area: name; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.bl-name a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; color: var(--ink); text-decoration: none; }
.bl-name a:hover { text-decoration: underline; }
.bl-agent { grid-area: agent; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-sm); }
.bl-own, .bl-since { color: var(--muted); }
.bl-units { grid-area: units; justify-self: end; white-space: nowrap; color: var(--muted); font-size: var(--text-sm); }
.bl-state { grid-area: state; justify-self: end; white-space: nowrap; }
.bl-added { grid-area: added; min-width: 0; color: var(--muted); font-size: var(--text-sm); }
.bl-actions { grid-area: actions; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); margin-top: var(--space-2); }
.bl-actions form { margin: 0; }
.bl-actions .btn { width: 100%; }
.bl-note { margin-top: var(--space-4); }
@media (min-width: 900px) {
  .bl-cols, .bl-row { --bl-cols: minmax(0, 1.2fr) minmax(0, 1.6fr) 96px 240px; }
  .bl-cols {
    display: grid;
    grid-template-columns: var(--bl-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .bl-cols .num { text-align: right; }
  .bl-row {
    grid-template-columns: var(--bl-cols);
    grid-template-areas: "name agent units state" "added added actions actions";
    column-gap: var(--space-4);
    padding: var(--space-2) var(--space-5);
  }
  .bl-state { justify-self: start; }
  .bl-actions { display: flex; justify-content: flex-start; margin: 0; }
  .bl-actions .btn { width: auto; }
  .bl-row:not(.bl-row-pending) { grid-template-areas: "name agent units state"; }
}

/* Agents and the agent handover (Phase 2, ruling C1 and C2, 21 October 2026; mockup tabs 5 and
   6). The Agents list: phone, the name and the staff count, then the lead, then the buildings;
   from 900 px one line per row (the list-density rule): name · lead · buildings · staff. An
   agent's page: the details and the lead's sign-in side by side from 900 px, then its buildings.
   Change the agent: the handover warning and who managed the building. On Buildings, an
   approver's rows carry Change agent, and a scheduled change shows under the agent. */
.al-cols { display: none; }
.al-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); overflow: hidden; }
.al-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name staff" "lead lead" "buildings buildings" "state state";
  align-items: center;
  gap: 2px var(--space-3);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
}
.al-row + .al-row { border-top: 1px solid var(--line); }
.al-name { grid-area: name; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.al-name a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; color: var(--ink); text-decoration: none; }
.al-name a:hover { text-decoration: underline; }
.al-lead, .al-buildings { min-width: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
.al-lead { grid-area: lead; }
.al-buildings { grid-area: buildings; }
.al-muted, .al-next { color: var(--muted); }
.al-next { display: block; }
.al-staff { grid-area: staff; justify-self: end; white-space: nowrap; color: var(--muted); font-size: var(--text-sm); }
.al-state { grid-area: state; }
.al-row-retired .al-name a { color: var(--muted); }
@media (min-width: 900px) {
  .al-cols, .al-row { --al-cols: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr) 80px; }
  .al-cols {
    display: grid;
    grid-template-columns: var(--al-cols);
    column-gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0 var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .al-cols .num { text-align: right; }
  .al-row {
    grid-template-columns: var(--al-cols);
    grid-template-areas: "name lead buildings staff" "state state state state";
    column-gap: var(--space-4);
    padding: var(--space-2) var(--space-5);
  }
  .al-row:not(.al-row-retired) { grid-template-areas: "name lead buildings staff"; }
}

.ad-layout { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); }
.ad-card, .ad-buildings, .ad-retire { padding: var(--space-4); }
.ad-card h2, .ad-buildings h2, .ad-retire h2 { margin: 0 0 var(--space-3); font-size: 1rem; }
.ad-wrap { overflow-wrap: anywhere; }
.ad-lead { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 2px; }
.ad-lead-name { font-weight: 650; }
.ad-card form, .ad-retire form { margin: var(--space-3) 0 0; }
.ad-list { margin: 0; padding: 0; list-style: none; }
.ad-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name change" "when change";
  align-items: center;
  gap: 2px var(--space-3);
  min-height: 44px;
  padding: var(--space-2) 0;
}
.ad-row + .ad-row { border-top: 1px solid var(--line); }
.ad-row-name { grid-area: name; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.ad-row-when { grid-area: when; min-width: 0; color: var(--muted); font-size: var(--text-sm); }
.ad-row-next { display: block; }
.ad-row-change { grid-area: change; min-height: 44px; }
.ad-retire { margin-top: var(--space-4); }
@media (min-width: 900px) {
  .ad-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .ad-card, .ad-buildings, .ad-retire { padding: var(--space-5); }
  .ad-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; grid-template-areas: "name when change"; }
}

.ba-scheduled, .ba-history { padding: var(--space-4); margin-bottom: var(--space-4); }
.ba-scheduled h2, .ba-history h2 { margin: 0 0 var(--space-3); font-size: 1rem; }
.ba-scheduled form { margin: var(--space-3) 0 0; }
.ba-warning { border-color: var(--warn); border-left-width: 4px; background: var(--warn-tint); color: var(--ink); }
.ba-timeline { margin: 0; padding: 0; list-style: none; }
.ba-timeline li { display: grid; gap: 2px; padding: var(--space-2) 0; }
.ba-timeline li + li { border-top: 1px solid var(--line); }
.ba-when { font-weight: 600; }
.ba-who { color: var(--muted); }
@media (min-width: 900px) {
  .ba-scheduled, .ba-history { padding: var(--space-5); }
  .ba-timeline li { grid-template-columns: 240px minmax(0, 1fr); column-gap: var(--space-4); }
}

.bl-next { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bl-change { grid-area: change; justify-self: start; min-height: 44px; }
.bl-can .bl-row:not(.bl-row-pending) { grid-template-areas: "name state" "agent units" "change change"; }
.bl-can .bl-row-pending { grid-template-areas: "name state" "agent units" "added added" "actions actions" "change change"; }
@media (min-width: 900px) {
  .bl-can.bl-cols, .bl-can .bl-row { --bl-cols: minmax(0, 1.2fr) minmax(0, 1.6fr) 96px 220px 132px; }
  .bl-can .bl-row:not(.bl-row-pending) { grid-template-areas: "name agent units state change"; }
  .bl-can .bl-row-pending { grid-template-areas: "name agent units state change" "added added actions actions actions"; }
  .bl-change { justify-self: end; }
}

/* Phase 2 review fixes (R1 and R2, 21 October 2026). R1, the Buildings list: no value is clipped.
   The name, the agent and a scheduled change wrap instead of ending in an ellipsis; "since
   <Month YYYY>" is its own line inside the agent cell; on a phone a pending row's badge drops to
   its own line under the name, so the name keeps the row's width. R2, Change the agent: a gap
   between Schedule / Cancel and the "Who managed" card. */
.bl-name, .bl-agent, .bl-next { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.bl-since-line { display: block; }
@media (max-width: 899px) {
  .bl-row-pending { grid-template-areas: "name name" "state state" "agent units" "added added" "actions actions"; }
  .bl-can .bl-row-pending { grid-template-areas: "name name" "state state" "agent units" "added added" "actions actions" "change change"; }
  .bl-row-pending .bl-state { justify-self: start; }
}
.ba-form + .ba-history { margin-top: var(--space-5); }

/* ======================================================================
   The building switcher (the portfolio model, Phase 4, rulings G4 and G5; the mockup the owner
   approved on 21 October 2026). Drawn only for a member who sees more than one building, from one
   piece of markup (templates/partials/_switcher_rows.html) in two skins: charcoal in the sidebar,
   between the EstateOS lockup and Home, and paper at the top of the phone Menu sheet above the
   search. A 44 px head (an oxblood square with a short building code, the name, and the area and
   managing agent beneath) opens one 44 px row per building, each a form of its own; the building
   you are in carries a tick and a word as well as its tint. "All buildings" is the last row,
   under a hairline, and only for a member who sees every building.
   ====================================================================== */
.switch-menu { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 5px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.switch-menu > li { display: block; }
.switch-menu form { margin: 0; }
.switch-row { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.switch-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.switch-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-tick { flex: none; font-weight: 700; }
.switch-all { margin-top: 3px; padding-top: 3px; }

/* The sidebar's skin, on charcoal; below 900 px the sidebar itself is hidden. */
@media (min-width: 900px) {
  .nav-switch { flex: none; margin: 6px var(--space-3) 0; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius); background: rgb(255 255 255 / 6%); }
  .nav-switch-head { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 10px; border-radius: var(--radius); color: #fff; font-size: 0.84375rem; list-style: none; cursor: pointer; }
  .nav-switch-head::-webkit-details-marker { display: none; }
  .nav-switch-head:hover { background: rgb(255 255 255 / 6%); }
  .nav-switch-head:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
  .nav-switch-mark { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border: 1px solid var(--oxblood-line); border-radius: var(--radius-sm); background: var(--oxblood); color: #fff; font-size: 0.625rem; font-weight: 700; }
  .nav-switch-txt { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
  .nav-switch-txt b { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .nav-switch-txt small { display: block; overflow: hidden; color: var(--on-dark-muted); font-size: 0.6875rem; text-overflow: ellipsis; white-space: nowrap; }
  .nav-switch-chevron { flex: none; color: rgb(255 255 255 / 55%); }
  .nav-switch[open] .nav-switch-chevron { transform: rotate(-90deg); }
  /* The base `.nav ul` (the phone tab bar's row) is more specific than `.switch-menu`: the
     sidebar's list needs its own height, padding and rows back. */
  .nav .nav-switch .switch-menu { height: auto; max-height: calc(100vh - 240px); max-height: calc(100dvh - 240px); padding: 5px; border-top: 1px solid rgb(255 255 255 / 14%); }
  .nav .nav-switch .switch-menu > li { flex: none; }
  .nav-switch .switch-row { color: var(--on-dark); font-size: 0.8125rem; }
  .nav-switch .switch-row:hover { background: rgb(255 255 255 / 8%); color: #fff; }
  .nav-switch .switch-row:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
  .nav-switch .switch-dot { background: rgb(255 255 255 / 35%); }
  .nav-switch .is-here .switch-row { background: rgb(255 255 255 / 12%); color: #fff; }
  .nav-switch .is-here .switch-dot { background: #fff; }
  .nav-switch .switch-all { border-top: 1px solid rgb(255 255 255 / 12%); }
  /* The 68 px icon rail: the square alone, and the list steps out beside it. */
  :root[data-nav-rail] .nav-switch { position: relative; margin: 6px var(--space-2) 0; }
  :root[data-nav-rail] .nav-switch-head { justify-content: center; padding: 6px 0; }
  :root[data-nav-rail] .nav-switch-chevron { display: none; }
  :root[data-nav-rail] .nav-switch-txt { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  :root[data-nav-rail] .nav-switch .switch-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 25; width: 212px; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius); background: var(--charcoal-2); box-shadow: 0 10px 28px rgb(0 0 0 / 35%); }
}

/* The Menu sheet's skin, on paper: the same control, always open, above the search. */
@media (max-width: 899.98px) {
  .menu-switch { margin: 8px 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
  .menu-switch-head { display: flex; align-items: center; gap: 9px; min-height: 44px; margin: 0; padding: 8px 11px; border-bottom: 1px solid var(--line); }
  .menu-switch-mark { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--oxblood); color: #fff; font-size: 10px; font-weight: 700; }
  .menu-switch-txt { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
  .menu-switch-txt b { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .menu-switch-txt small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .menu-switch .switch-menu { max-height: calc(100vh - 300px); max-height: calc(100dvh - 300px); }
  .menu-switch .switch-row { color: var(--ink); font-size: 14px; -webkit-tap-highlight-color: transparent; }
  .menu-switch .switch-row:active { background: var(--paper-2); }
  .menu-switch .switch-row:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
  .menu-switch .switch-dot { background: var(--line-strong); }
  .menu-switch .is-here .switch-row { background: var(--oxblood-tint); color: var(--oxblood-deep); font-weight: 600; }
  .menu-switch .is-here .switch-dot { background: var(--oxblood); }
  .menu-switch .is-here .switch-tick { color: var(--oxblood); }
  .menu-switch .switch-all { border-top: 1px solid var(--line); }
}

/* ======================================================================
   The portfolio Home (the portfolio model, Phase 4, ruling G6; the Home of the mockup the owner
   approved). What a member standing in every building they see gets instead of one building's
   screen, in one column at any width: a full-width oxblood hero ("Collected this period, across
   the portfolio", the figure large, one line of the share invoiced and the days left), "The
   portfolio" as four tiles, "Buildings" as a table whose name cell posts to switch_building, and
   then My Work Items and Needs your attention, which span every building either way. No graph
   belongs here. A pending building's row is flagged in words and its figures are em-dashes.
   Below 900 px the table stacks: the head is dropped and each cell writes its own label from
   data-label, so nothing scrolls sideways at 390 px. Every target is 44 px.
   ====================================================================== */
.portfolio-hero { margin: 0 0 14px; border-color: var(--oxblood-deep); background: var(--oxblood); color: #fff; box-shadow: none; }
.portfolio-hero .home-label { color: rgb(255 255 255 / 72%); }
.portfolio-hero .home-hero-fig { margin-bottom: 8px; color: #fff; }
.portfolio-hero a.home-hero-fig:hover { text-decoration: underline; }
.portfolio-hero a.home-hero-fig:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.portfolio-hero-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: 44px; margin: 0; padding: 4px 0; color: rgb(255 255 255 / 80%); font-size: 13px; line-height: 1.4; }
.portfolio-hero-line b { color: #fff; font-weight: 650; }

.portfolio-panel, .portfolio-buildings { margin: 0 0 14px; }
.portfolio-panel .home-panel-head .home-note { margin: 0 8px 0 0; }
.portfolio-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; padding: 8px 16px 16px; }
.portfolio-tiles > div { min-width: 0; }

/* The Buildings table. From 900 px a plain table; the wrapper only guards a very long name. */
.portfolio-tablewrap { overflow-x: auto; }
.portfolio-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.portfolio-table th, .portfolio-table td { padding: 10px 16px; text-align: left; vertical-align: middle; }
.portfolio-table thead th { padding-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.portfolio-table tbody tr + tr th, .portfolio-table tbody tr + tr td { border-top: 1px solid var(--line); }
.portfolio-table tbody th { font-weight: 600; }
.portfolio-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.portfolio-table thead .num { text-align: right; }
.portfolio-table form { margin: 0; }
.portfolio-open { display: inline-flex; align-items: center; min-height: 44px; margin: 0 -8px; padding: 0 8px; border: 0; background: none; color: var(--oxblood); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.portfolio-open:hover { color: var(--oxblood-deep); text-decoration: underline; }
.portfolio-open:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.portfolio-own { color: var(--muted); }
.portfolio-row-pending th, .portfolio-row-pending td { background: var(--paper-2); }
.portfolio-row-pending .portfolio-name { font-weight: 600; }
.portfolio-row-pending .badge { margin-left: 6px; }
.portfolio-foot { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }

/* My Work Items beside Needs your attention from 900 px, one above the other below it. */
.portfolio-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }

@media (min-width: 900px) {
  .portfolio-hero { padding: 22px 24px 10px; }
  .portfolio-hero .home-hero-fig { font-size: 38px; }
  .portfolio-hero-line { font-size: 15px; }
  .portfolio-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 10px 20px 20px; }
  .portfolio-tiles .home-panel-fig { font-size: 24px; }
  .portfolio-tiles .home-label { font-size: 12px; }
  .portfolio-table { font-size: 15px; }
  .portfolio-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

/* The phone: the table stacks into one card per building, each cell labelled in words. */
@media (max-width: 899.98px) {
  .portfolio-table thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .portfolio-table tbody tr { display: block; padding: 6px 0; }
  .portfolio-table tbody tr + tr { border-top: 1px solid var(--line); }
  .portfolio-table tbody tr + tr th, .portfolio-table tbody tr + tr td { border-top: 0; }
  .portfolio-table tbody th, .portfolio-table tbody td { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 16px; }
  .portfolio-table tbody th { flex-wrap: wrap; padding-top: 6px; }
  .portfolio-table tbody td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
  .portfolio-table tbody td { text-align: right; }
  .portfolio-table .num { text-align: right; }
}

/* Home, one scope: a work item names its building, under the detail line, for a member who sees
   several. Words, not colour; it sits inside the row's existing 44 px link. */
.home-work .home-att-text .home-work-building { color: var(--ink); font-weight: 600; }

/* The switcher's mark holds a building code of two to six characters (Phase 5, ruling I1), and on the
   collapsed 68px rail it is the only thing shown, so it must never clip and must stay legible. It keeps its
   26px square for the short codes and grows into a pill for the long ones rather than shrinking the type:
   six characters measure about 40px, which the rail still holds. */
.nav-switch-mark { width: auto; min-width: 26px; max-width: 48px; padding: 0 4px; letter-spacing: -0.01em; }

/* Tenant records to complete (the owner, 24 October 2026, ruling T5). Under the Tenants list's
   "Needs data" chip a row's phone and rent cells become the missing words and the Complete link,
   in columns wide enough to read; from 900 px the row stays one line (list density, 15 October
   2026) because the words take a 2fr column and ellipsise with a title past it. On the other views
   a short "Needs data" pill in the status cell carries the words in its title. The Complete link
   sits above the name link's full-row cover (.person-name::after), else it could not be clicked. */
.person-missing { color: var(--ink); }
.person-complete { position: relative; z-index: 1; }
@media (min-width: 900px) {
  #tenant-results[data-view="incomplete"] { --people-cols: minmax(0, 1.2fr) 100px minmax(0, 2.8fr) 110px 120px; }
  #tenant-results[data-view="incomplete"] .person-missing { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-sm); }
}

/* Building tabs (the owner, 24 October 2026, ruling T10). On a phone the status chips are a four-cell
   segmented grid, which cuts building names short; the building tabs are one row instead, each tab as
   wide as its name, scrolling sideways inside the row (never the page). From 900 px they wrap as the
   other chip rows do. */
@media (max-width: 899px) {
  .building-tabs { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .building-tabs::-webkit-scrollbar { display: none; }
  .building-tabs .chip { flex: 0 0 auto; min-height: 44px; padding: 0 var(--space-4); white-space: nowrap; }
}

/* ======================================================================
   Folding rows on Units and Tenants (the owner, 24 October 2026, ruling T12): All buildings
   draws a collapsible row per building, a collapsible row per floor inside it; folding works at
   every width, so the desktop rules above that held floors open and hid their controls are
   overridden here (append-only: those rules are left as they were).
   ====================================================================== */
.unit-building {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.unit-building + .unit-building { margin-top: var(--space-3); }
.building-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "badge title chevron" ". counts counts";
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-height: 64px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.building-heading::-webkit-details-marker { display: none; }
.building-heading:hover { background: #fcfaf7; }
.building-heading:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm); }
.building-badge {
  grid-area: badge;
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 28px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--oxblood);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.building-badge-empty { background: none; border: 1px dashed var(--line-strong); color: var(--muted); }
.building-title { grid-area: title; display: flex; flex-direction: column; min-width: 0; }
.building-heading-name { color: var(--ink); font-weight: 700; font-size: var(--text-base); line-height: 1.3; overflow-wrap: anywhere; }
.building-sub { color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.building-sub:empty { display: none; }
.building-counts { grid-area: counts; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.building-chevron { grid-area: chevron; flex: none; color: var(--muted); transition: transform 180ms var(--ease); }
.unit-building[open] > .building-heading .building-chevron { transform: rotate(180deg); }
.unit-building[open] > .building-heading { border-bottom: 1px solid var(--line); }
/* Floors inside a building: indented rows, the rows' own card dropped so only the building is a card. */
.building-body .floor-heading { padding-left: var(--space-5); }
.building-body .unit-rows, .building-body .people { border: 0; border-radius: 0; box-shadow: none; }
.building-body .unit-floor:last-child { border-bottom: 0; }
.unit-groups .building-body .unit-floor:first-of-type { border-top: 0; }
.unit-floor[open] > .people { margin-bottom: var(--space-4); }
.building-body > .people { margin-bottom: var(--space-2); }
#tenant-groups .unit-building + .unit-building { margin-top: var(--space-3); }

@media (min-width: 900px) {
  .building-heading {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "badge title counts chevron";
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
  }
  .building-counts { font-size: var(--text-sm); }
  /* Floors fold at every width: the controls and borders the desktop rules removed come back. */
  .floor-tools { display: flex; }
  .floor-chevron { display: block; }
  .unit-floor, .unit-property > .unit-floor:first-of-type, .unit-groups > .unit-property:first-of-type .unit-floor:first-of-type { border: 0; border-bottom: 1px solid var(--line); }
  .unit-floor + .unit-floor { margin-top: 0; }
  .unit-groups .building-body .unit-floor:last-child { border-bottom: 0; }
  .floor-heading {
    min-height: 52px;
    padding: var(--space-2) var(--space-5);
    cursor: pointer;
    pointer-events: auto;
  }
  .floor-heading:hover { background: #fcfaf7; }
  .building-body .floor-heading { padding-left: calc(var(--space-5) + var(--space-4)); }
  .floor-title { align-items: center; }
  .floor-name-text { color: var(--ink); font-size: var(--text-base); font-weight: 700; letter-spacing: 0; text-transform: none; }
  .floor-summary { font-size: var(--text-sm); }
  .unit-floor[open] > .unit-rows, .unit-floor[open] > .people { margin-bottom: var(--space-3); }
}

/* Letterhead tiles (the owner, 26 October 2026, T14): Settings › Property shows the logo and the
   business stamp as two compact tiles (thumbnail on a checkerboard, title, one status line, actions)
   under a small "Letterhead" heading. Replace and Add reuse the drop zone form (.dz-form, dropzone.js);
   the thumbnail is its drop target. Remove asks once inline (<details class="brand-remove">). */
.brand-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.brand-note { color: var(--muted); font-size: var(--text-sm); }
.brand-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-3); }
.brand-tile { display: grid; grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; gap: 0 var(--space-3); min-height: 112px; padding: var(--space-3); background: #fff; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.brand-tile .brand-form { display: contents; margin: 0; }
.brand-thumb { grid-column: 1; grid-row: 1; position: relative; display: grid; place-items: center; width: 112px; height: 76px; min-height: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.brand-tile .dz.brand-thumb { min-height: 0; padding: 0; gap: 0; }
.brand-tile .dz.brand-thumb:hover, .brand-tile .dz.brand-thumb:focus-within { border-color: var(--oxblood); }
.brand-tile .dz.brand-thumb.is-over { border-style: solid; background-color: var(--oxblood-tint); }
.brand-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.brand-slot { background: var(--paper); background-image: none; border: 1.5px dashed var(--line-strong); }
.brand-slot .dz-icon { color: var(--oxblood); }
.brand-tile .dz-status { grid-column: 1 / -1; grid-row: 2; margin-top: var(--space-2); }
.brand-tile .dz-add { grid-column: 1 / -1; grid-row: 3; margin-top: var(--space-2); justify-self: start; }
.brand-body { grid-column: 2; grid-row: 1; min-width: 0; display: grid; align-content: start; gap: var(--space-1); }
.brand-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.brand-title { margin: 0; font-size: var(--text-base); font-weight: 650; }
.brand-line { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.brand-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); }
.brand-act, .brand-remove > summary, .brand-yes, .brand-keep, .brand-preview { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-1); font: inherit; font-size: var(--text-sm); font-weight: 600; background: none; border: 0; cursor: pointer; text-decoration: none; }
.brand-act, .brand-preview, .brand-yes { color: var(--oxblood); }
.brand-act:hover, .brand-preview:hover { text-decoration: underline; text-underline-offset: 3px; }
.brand-act:focus-within, .brand-act:focus-visible, .brand-preview:focus-visible, .brand-remove > summary:focus-visible, .brand-yes:focus-visible, .brand-keep:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius); }
.brand-remove > summary { list-style: none; color: var(--muted); }
.brand-remove > summary::-webkit-details-marker { display: none; }
.brand-remove > summary:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.brand-remove[data-js][open] > summary { display: none; }
.brand-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); margin: 0; }
.brand-ask { font-size: var(--text-sm); font-weight: 600; }
.brand-yes { color: var(--danger); }
.brand-keep { color: var(--muted); }
.brand-keep[hidden] { display: none; }
.brand-drop { color: var(--muted); font-size: var(--text-sm); }
.brand-tile .st-stamp-use-form { margin: 0; gap: 0 var(--space-2); flex-wrap: nowrap; }
.brand-switch { gap: var(--space-2); min-height: 44px; align-items: center; }
.brand-switch > span > strong { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand-switch > span > small { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand-switch input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 40px; height: 24px; min-height: 0; margin: 0; border-radius: 12px; background: var(--line-strong); cursor: pointer; transition: background-color 120ms var(--ease); }
.brand-switch input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 120ms var(--ease); }
.brand-switch input[type="checkbox"]:checked { background: var(--oxblood); }
.brand-switch input[type="checkbox"]:checked::after { transform: translateX(16px); }
.brand-switch input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ring); }
.brand-tile .st-stamp-saved { font-size: var(--text-sm); }
@media (max-width: 899.98px) {
  .brand-grid { grid-template-columns: minmax(0, 1fr); }
  .brand-tile { grid-template-columns: 96px minmax(0, 1fr); }
  .brand-thumb { width: 96px; height: 66px; }
  .brand-actions a, .brand-act { min-height: 44px; }
}
/* Letterhead tiles, after the render check (T14): each tile is as tall as its own content, and the
   stamp's switch sits beside its status line, which wraps under it on a narrow tile. */
.brand-grid { align-items: start; }
.brand-tile .st-stamp-use-form { flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); }
.brand-tile .st-stamp-saved { display: block; flex: 1 1 12rem; min-height: 0; margin: 0; }

/* Leases ending on Home (the owner, 27 October 2026, T15, T16): red = 30 days or fewer (past term
   included), amber = 31-60, green = 61-90. Each band's words sit in a darker shade of its colour
   (4.5:1 on the panel's white); the bar and dots are the colour, the words and counts carry the
   meaning. Oxblood stays the only action colour (links, See all). Below 900 px: three compact
   cards, a 4 px coloured top border each, and no bar, no list. */
:root {
  --end-red: #b42318; --end-red-text: #8a1c12;
  --end-amber: #c77700; --end-amber-text: #8a5300;
  --end-green: #2f7a45; --end-green-text: #24603a;
}
.home-ending .home-note { margin: 0; white-space: nowrap; }
.ending-bar { display: none; }
.ending-bands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px 12px 12px; }
.ending-band { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line); border-top: 4px solid var(--ending-c); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
a.ending-band:hover { background: var(--paper); }
a.ending-band:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.ending-band b { color: var(--ink); font-size: 24px; font-weight: 650; line-height: 1.1; }
.ending-band span { color: var(--ending-t); font-size: 12px; font-weight: 600; line-height: 1.25; }
.ending-dot { display: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ending-c); }
.ending-red { --ending-c: var(--end-red); --ending-t: var(--end-red-text); }
.ending-amber { --ending-c: var(--end-amber); --ending-t: var(--end-amber-text); }
.ending-green { --ending-c: var(--end-green); --ending-t: var(--end-green-text); }
.ending-list, .ending-empty { display: none; }
.ending-scroll { overflow-x: auto; padding: 0 0 8px; }
.ending-table { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 14px; }
.ending-table th, .ending-table td { padding: 6px 12px; text-align: left; vertical-align: middle; }
.ending-table thead th { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ending-table tbody tr + tr th, .ending-table tbody tr + tr td { border-top: 1px solid var(--line); }
.ending-table tbody th, .ending-table tfoot th { font-weight: 600; }
.ending-table tfoot th, .ending-table tfoot td { border-top: 2px solid var(--line-strong); font-weight: 650; }
.ending-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ending-cell { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; color: var(--oxblood); font-weight: 600; text-decoration: none; }
.ending-cell:hover { text-decoration: underline; }
.home-att-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border: 1px solid var(--end-red); border-radius: 999px; color: var(--end-red-text); font-size: 11px; font-weight: 700; line-height: 1.4; vertical-align: 1px; }
.home-att .home-att-text b .home-att-tag { display: inline-block; overflow: visible; white-space: nowrap; text-overflow: clip; font-size: 11px; color: var(--end-red-text); }
@media (min-width: 900px) {
  .home-ending { grid-area: ending; }
  .home-grid.home-grid-ending:not(.home-grid-solo) { grid-template-areas: "hero work" "landlord att" "landlord building" "ending ending"; }
  .home-grid.home-grid-ending.home-grid-paid:not(.home-grid-solo) { grid-template-areas: "hero work" "landlord att" "paid building" "ending ending"; }
  .home-grid.home-grid-ending.home-grid-solo { grid-template-areas: "hero att" "building att" "ending ending"; }
  .home-grid.home-grid-ending.home-grid-solo.home-grid-paid { grid-template-areas: "hero att" "paid building" "ending ending"; }
  .home-ending .home-panel-head { padding: 6px 16px 0; }
  .ending-bar { display: flex; height: 10px; margin: 6px 16px 4px; gap: 2px; border-radius: 5px; overflow: hidden; background: var(--paper-2); }
  .ending-seg { flex-basis: 0; background: var(--ending-c); }
  .ending-seg.ending-none { flex-grow: 1; background: var(--paper-2); }
  .ending-bands { gap: 10px; padding: 10px 16px 6px; }
  .ending-band { flex-direction: row; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border-top-width: 1px; }
  .ending-band b { font-size: 26px; }
  .ending-band span { font-size: 13px; }
  .ending-dot { display: block; flex: none; }
  .ending-list { display: block; margin: 0; padding: 0; list-style: none; }
  .ending-row { border-top: 1px solid var(--line); }
  .ending-row a { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; color: var(--ink); text-decoration: none; }
  .ending-row a:hover { background: var(--paper); }
  .ending-row a:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -3px; }
  .ending-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ending-date { color: var(--muted); font-size: 13px; }
  .ending-chip { padding: 2px 9px; border: 1px solid var(--ending-c); border-radius: 999px; color: var(--ending-t); font-size: 12px; font-weight: 650; white-space: nowrap; }
  .ending-all { margin: 0 8px 4px auto; display: flex; width: max-content; }
  .ending-empty { display: block; margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
}
.ending-chip-red { --ending-c: var(--end-red); --ending-t: var(--end-red-text); }
/* Phone: the three cards sit just above "Needs your attention" (which is order -1 there). */
@media (max-width: 899.98px) {
  #home-ending { order: -1; }
}

/* Agreement signature ticks (the owner, 27 October 2026, ruling T18). Under an agreement's row: who
   has signed, each Yes / No / Not checked in words, and a folding form that sets them (no
   JavaScript). The block spans the whole row; the form's selects stack on a phone and sit in a
   row from 600 px. */
.doc-sign { grid-column: 1 / -1; min-width: 0; }
.doc-signed { margin: 0; font-size: var(--text-sm); display: flex; flex-wrap: wrap; gap: 2px 0.4em; align-items: baseline; }
.doc-signed-lead { color: var(--muted); }
.doc-signed-item { white-space: nowrap; }
.doc-sign-edit { margin-top: var(--space-2); }
.doc-sign-edit > summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; }
.doc-sign-edit > summary::-webkit-details-marker { display: none; }
.doc-sign-form { display: grid; gap: var(--space-3); margin-top: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.doc-sign-fields { display: grid; gap: var(--space-3); }
.doc-sign-form .btn { justify-self: start; }
@media (min-width: 600px) {
  .doc-sign-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Tenants list, "Documents" chip (T17): the missing words take the same columns as "Needs data". */
#tenant-results[data-view="documents"] .person-missing { color: var(--ink); }
@media (min-width: 900px) {
  #tenant-results[data-view="documents"] { --people-cols: minmax(0, 1.2fr) 100px minmax(0, 2.8fr) 110px 120px; }
  #tenant-results[data-view="documents"] .person-missing { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-sm); }
}
/* Five status chips (Tenants gained "Documents", T17): the phone's segmented bar takes five equal parts. */
.chips:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* The lease card's decision at the end of the term (T19) and a lease holding over (T20): a red
   note with the "30 days" tag in words, three choices; colour is never alone. */
.term-end { display: grid; gap: var(--space-2); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--end-red); border-left-width: 4px; border-radius: var(--radius); background: var(--paper-2); }
.term-end-line, .term-end-detail { margin: 0; }
.term-end-head { color: var(--end-red-text); font-weight: 700; }
.term-end-tag { display: inline-block; margin-right: 6px; padding: 1px 7px; border: 1px solid var(--end-red); border-radius: 999px; color: var(--end-red-text); font-size: 11px; font-weight: 700; line-height: 1.4; vertical-align: 1px; }
.term-end-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.term-end-actions form { margin: 0; }
.term-end-actions .btn { min-height: 44px; }
.term-monthly { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-4); color: var(--muted); }
.term-monthly-form { margin: 0; }
@media (max-width: 640px) {
  .term-end-actions .btn, .term-end-actions form { flex: 1 1 100%; }
  .term-end-actions form .btn { width: 100%; }
}

/* The renewal offer's four fields (T22): two to a row from a tablet up; hidden unless the offer is
   the letter chosen (the grid would otherwise override the `hidden` attribute). */
.lt-offer-fields[hidden] { display: none; }
@media (min-width: 640px) {
  .lt-offer-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Hub tab strip (the owner, 27 October 2026, T23): the tab strip at the top of each page in a hub
   (templates/partials/_hub_tabs.html). It reuses .tabs / .profile-tabs: 44 px tabs, scrolling
   sideways inside its own box so the page never does. */
.hub-tabs { margin-top: calc(var(--space-2) * -1); }
.hub-tabs a { gap: var(--space-2); }
.hub-tabs .tab-count { flex: none; }

/* The sidebar's nine hub items and three groups fit a 1280x800 laptop with no scrolling (the owner,
   27 October 2026, T23): in a window up to 820 px tall the gaps between groups and under each header
   close up and the brand row tightens by a few pixels (every target stays 44 px). */
@media (min-width: 900px) and (max-height: 820px) {
  .nav-top { padding-top: 8px; padding-bottom: 8px; }
  .nav .nav-list { padding-top: 2px; }
  .nav-group { margin-top: 0; }
  .nav .nav-group-body > ul { padding-top: 2px; }
}

/* With the building switcher drawn (a member who sees more than one building), the collapse arrow
   shares the lockup's row in a 1280x800 window so the nine items still fit without scrolling (the
   owner, 27 October 2026, T23). The rail keeps its own stacked layout. */
@media (min-width: 900px) and (max-height: 820px) {
  :root:not([data-nav-rail]) .nav-top { flex-wrap: nowrap; align-items: center; }
  :root:not([data-nav-rail]) .nav-top .nav-brand-row { flex: 1 1 auto; min-width: 0; padding: 2px 0 2px 8px; }
  :root:not([data-nav-rail]) .nav-top .nav-rail-toggle { order: 2; }
  .nav-switch { margin-top: 4px; }
  .nav-switch-head { padding-top: 2px; padding-bottom: 2px; }
}

/* Administration's flat row of eight tabs (the owner, 27 October 2026, T24): tighter from 900 px so the eight fit a 1280 px laptop without scrolling; below that the strip scrolls inside its own box. */
@media (min-width: 900px) {
  .profile-tabs.hub-tabs { gap: 0; }
  .profile-tabs.hub-tabs a, .profile-tabs.hub-tabs a:first-child { padding: 0 var(--space-2, 8px); }
}
.al-agreement-title { margin: var(--space-6, 32px) 0 var(--space-1, 4px); }

/* ---------- Tenant portal frame (the owner, 27 October 2026, T29) ----------
   The header in the building's name, the phone bottom bar (Home, Lease, Money, Letters), the top
   tabs from 900 px, and the credit line. The staff sidebar, tab bar and Menu sheet are never drawn
   for a tenant. Every target is at least 44 px. */
.portal-body { background: var(--paper); }
.portal { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.portal-head { display: flex; align-items: center; gap: var(--space-3); padding: max(var(--space-2), env(safe-area-inset-top)) var(--space-4) var(--space-2); background: var(--charcoal); color: #fff; border-bottom: 3px solid var(--oxblood); }
.portal-brand { display: inline-flex; align-items: center; flex: 1 1 auto; min-width: 0; min-height: 44px; color: #fff; font: 700 1.125rem/1.2 var(--font-display); letter-spacing: var(--tracking-brand); text-decoration: none; overflow-wrap: anywhere; }
.portal-brand:hover, .portal-brand:focus-visible { color: #fff; text-decoration: none; }
.portal-tabs { display: none; }
.portal-signout { margin: 0; }
.portal-signout .btn { background: transparent; color: #fff; border-color: rgb(255 255 255 / 28%); }
.portal-signout .btn:hover { background: var(--charcoal-2); color: #fff; border-color: rgb(255 255 255 / 50%); }
.portal-main { flex: 1 1 auto; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-5) max(var(--space-4), env(safe-area-inset-right)) var(--space-6) max(var(--space-4), env(safe-area-inset-left)); }
.portal-foot { display: flex; align-items: center; justify-content: center; gap: 8px; padding: var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.portal-foot img { display: block; width: 16px; height: 16px; }
.portal-bar { position: fixed; inset: auto 0 0 0; z-index: 20; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--charcoal); border-top: 1px solid rgb(255 255 255 / 8%); }
.portal-bar ul { display: flex; height: 64px; margin: 0; padding: 0 4px; list-style: none; }
.portal-bar li { display: flex; flex: 1 1 0; min-width: 0; }
.portal-bar-item { display: grid; grid-template-rows: 30px auto; justify-items: center; align-content: center; row-gap: 2px; width: 100%; min-width: 44px; min-height: 44px; color: var(--on-dark-muted); font: 600 11px/1.2 var(--font-body); letter-spacing: 0.01em; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.portal-bar-item:hover { color: #fff; text-decoration: none; }
.portal-bar-item:focus-visible { outline: 2px solid #fff; outline-offset: -4px; border-radius: 10px; }
.portal-bar-icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 15px; }
.portal-bar .nav-icon { display: block; width: 22px; height: 22px; color: currentColor; }
.portal-bar-item[aria-current] { color: #fff; font-weight: 700; }
.portal-bar-item[aria-current] .portal-bar-icon { background: linear-gradient(160deg, var(--brand-star), var(--oxblood)); }
.portal-bar-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) {
  .portal { padding-bottom: 0; }
  .portal-bar { display: none; }
  .portal-head { gap: var(--space-5); padding: var(--space-2) var(--space-6); }
  .portal-brand { flex: 0 1 auto; }
  .portal-tabs { display: flex; flex: 1 1 auto; gap: 4px; min-width: 0; overflow-x: auto; }
  .portal-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); color: var(--on-dark); font-weight: 600; white-space: nowrap; text-decoration: none; }
  .portal-tab:hover { background: var(--charcoal-2); color: #fff; text-decoration: none; }
  .portal-tab[aria-current="page"] { background: var(--oxblood); color: #fff; }
  .portal-main { padding: var(--space-7) var(--space-6); }
}

/* The tenant card's Tenant portal line (27 October 2026): the status in words, the actions beside it. */
.profile-portal {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-size: var(--text-sm);
}
.profile-portal-line { margin: 0; flex: 1 1 14rem; }
.profile-portal-label { font-weight: 600; margin-right: var(--space-2); }
.profile-portal-off { background: var(--paper-2); color: var(--muted); }
.profile-portal-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.profile-portal-actions form { margin: 0; }
.profile-portal-revoke summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.profile-portal-revoke summary::-webkit-details-marker { display: none; }
.profile-portal-revoke[open] { flex-basis: 100%; }
.profile-portal-revoke form { margin-top: var(--space-3); max-width: 60ch; }
.profile-portal-revoke form p { margin: 0 0 var(--space-3); }

/* ---------- Tenant portal pages (the owner, 27 October 2026, T29) ----------
   Home, My lease, Money and Letters and documents: cards on the paper, figures in the display face,
   status always in words. 44 px targets, nothing wider than 390 px; from 900 px two columns. */
.portal-hello { margin: 0 0 var(--space-4); }
.portal-hello h1 { margin: 0; }
.portal-sub { margin: var(--space-1) 0 0; color: var(--muted); }
.portal-main h1 { margin: 0 0 var(--space-4); overflow-wrap: anywhere; }
.portal-section-h { margin: var(--space-5) 0 var(--space-3); font-size: var(--text-lg); }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.portal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); padding: var(--space-4); min-width: 0; margin: 0 0 var(--space-4); }
.portal-grid .portal-card { margin: 0; }
.portal-card h2 { margin: 0 0 var(--space-3); font-size: var(--text-base); font-weight: 650; color: var(--muted); letter-spacing: 0.01em; }
.portal-due { border-top: 3px solid var(--oxblood); }
.portal-figure { margin: 0 0 var(--space-3); font: 700 2rem/1.15 var(--font-display); color: var(--ink); overflow-wrap: anywhere; }
.portal-figure-calm { font-size: var(--text-xl); }
.portal-figure-small { font-size: var(--text-lg); line-height: 1.35; }
.portal-note { color: var(--muted); font-size: var(--text-sm); }
p.portal-note { margin: 0 0 var(--space-3); }
.portal-parts, .portal-list { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.portal-parts li, .portal-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); min-height: 44px; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); min-width: 0; }
.portal-parts li:last-child, .portal-list li:last-child { border-bottom: 0; }
.portal-parts li > span:first-child, .portal-list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.portal-list-end { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.portal-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 650; color: var(--oxblood); text-decoration: none; }
.portal-link:hover { text-decoration: underline; }
.portal-pay { margin: 0 0 var(--space-3); white-space: pre-line; overflow-wrap: anywhere; }
.portal-account { margin: 0; padding: var(--space-3); background: var(--paper-2); border-radius: var(--radius-sm); }
.portal-account strong { font-size: var(--text-lg); }
.portal-facts { margin: 0 0 var(--space-3); }
.portal-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.portal-facts > div:last-child { border-bottom: 0; }
.portal-facts dt { color: var(--muted); }
.portal-facts dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.portal-total dt, .portal-total dd { color: var(--ink); font-weight: 700; }
.portal-item-title { margin: 0 0 var(--space-1); font-weight: 650; overflow-wrap: anywhere; }
.portal-status { margin: 0 0 var(--space-3); }
.portal-callout { margin: 0; padding: var(--space-3); background: var(--warn-tint); color: var(--ink); border-radius: var(--radius-sm); border-left: 4px solid var(--warn); }
.portal-fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin: 0 0 var(--space-3); }
.portal-fold > summary { display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: var(--space-3) var(--space-4); cursor: pointer; font-weight: 650; list-style: none; position: relative; padding-right: 44px; }
.portal-fold > summary::-webkit-details-marker { display: none; }
.portal-fold > summary::after { content: ""; position: absolute; right: var(--space-4); top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 150ms var(--ease); }
.portal-fold[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.portal-fold > .portal-lease { padding: 0 var(--space-4) var(--space-2); }
.portal-fold .portal-card { box-shadow: none; }
.portal-desk { display: none; }
.portal-subtabs, .portal-periods { display: flex; gap: 4px; margin: 0 0 var(--space-4); border-bottom: 1px solid var(--line); overflow-x: auto; }
.portal-subtabs a { display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0 14px; color: var(--muted); font-weight: 650; text-decoration: none; white-space: nowrap; }
.portal-subtabs a[aria-current="page"] { color: var(--oxblood); box-shadow: inset 0 -3px 0 var(--oxblood); }
.portal-periods { border-bottom: 0; flex-wrap: wrap; gap: var(--space-2); overflow: visible; }
.portal-periods a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; }
.portal-periods a[aria-current="true"] { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }
.portal-download { margin-top: var(--space-2); }
.portal-table { display: block; width: 100%; margin: 0 0 var(--space-4); border: 0; }
.portal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.portal-table tbody { display: grid; gap: var(--space-3); }
.portal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.portal-row td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
.portal-row .portal-cell-main { grid-column: 1; font-weight: 650; }
.portal-row .portal-cell-end { grid-column: 2; grid-row: 1; justify-self: end; }
.portal-row td[data-label="Invoice"], .portal-row td[data-label="Receipt"] { grid-column: 1; color: var(--muted); font-size: var(--text-sm); }
.portal-row td[data-label="Amount"] { grid-column: 1; font-weight: 650; }
.portal-row td[data-label="Status"] { grid-column: 1 / -1; }
.portal-ledger .portal-row { grid-template-columns: minmax(0, 1fr) auto; }
.portal-ledger .portal-row td[data-label="Date"] { grid-column: 1; color: var(--muted); font-size: var(--text-sm); }
.portal-ledger .portal-row td[data-label="Charged"], .portal-ledger .portal-row td[data-label="Paid"], .portal-ledger .portal-row td[data-label="Balance"] { grid-column: 1 / -1; display: flex; justify-content: space-between; }
.portal-ledger .portal-row td[data-label="Charged"]:empty, .portal-ledger .portal-row td[data-label="Paid"]:empty { display: none; }
.portal-ledger .portal-row td[data-label]:not(:empty)::before { content: attr(data-label); color: var(--muted); font-weight: 400; }
.portal-ledger .portal-row td[data-label="Date"]::before { content: none; }
.portal-ledger .portal-row td.portal-cell-main { grid-column: 1 / -1; grid-row: auto; }
.portal-carried { background: var(--paper-2); box-shadow: none; }
@media (min-width: 900px) {
  .portal-subtab-phone, .portal-subtabs-phone { display: none; }
  .portal-desk { display: block; }
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); align-items: start; }
  .portal-card { padding: var(--space-5); }
  .portal-figure { font-size: 2.5rem; }
  .portal-table { display: table; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-panel); }
  .portal-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; display: table-header-group; }
  .portal-table tbody { display: table-row-group; }
  .portal-table th { padding: var(--space-3) var(--space-4); text-align: left; background: var(--paper-2); color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
  .portal-table th.num { text-align: right; }
  .portal-row { display: table-row; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .portal-row td { display: table-cell; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); vertical-align: middle; }
  .portal-row td.num { text-align: right; }
  .portal-ledger .portal-row td[data-label]:not(:empty)::before { content: none; }
  .portal-ledger .portal-row td[data-label="Charged"], .portal-ledger .portal-row td[data-label="Paid"], .portal-ledger .portal-row td[data-label="Balance"] { display: table-cell; }
  .portal-ledger .portal-row td[data-label="Charged"]:empty, .portal-ledger .portal-row td[data-label="Paid"]:empty { display: table-cell; }
  .portal-carried td { background: var(--paper-2); }
}
/* Home's two columns from 900 px; on a phone the columns dissolve and the cards keep one order. */
.portal-grid { display: flex; flex-direction: column; }
.portal-col { display: contents; }
.portal-o1 { order: 1; } .portal-o2 { order: 2; } .portal-o3 { order: 3; } .portal-o4 { order: 4; }
@media (min-width: 900px) {
  .portal-grid { flex-direction: row; align-items: flex-start; gap: var(--space-5); }
  .portal-col { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; gap: var(--space-5); }
  .portal-o1, .portal-o2, .portal-o3, .portal-o4 { order: 0; }
}
.portal-long { display: none; }
@media (min-width: 900px) { .portal-long { display: inline; } }
.portal-ledger .portal-row td[data-label="Date"]:not(:empty)::before { content: none; }

/* The tenant email switch (the owner, 3 November 2026, D1-D3): the card on the building's page
   (state in words, the control for buildings.approve beside them, the footer line under a rule),
   the confirm step, the Buildings list's "Tenant emails" column (a fifth column from 900 px; its
   own line on a phone) and the Bulk invoicing line. Status is in the words OFF / ON, never the
   colour alone; every control is a .btn (44 px). */
.te-row { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: flex-start; justify-content: space-between; }
.te-words { flex: 1 1 320px; min-width: 0; }
.te-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.te-note { margin: var(--space-2) 0 0; line-height: 1.5; }
.te-action { flex: 0 0 auto; margin: 0; }
.te-foot { margin: var(--space-3) 0 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.te-confirm .rcpt-confirm-q { font-weight: 400; font-size: var(--text-base); }
.te-held { margin: 0 0 var(--space-4); }
.te-no-email { margin: 0 0 var(--space-4); }
.te-line a { font-weight: 600; }
.bl-emails { grid-area: emails; justify-self: start; white-space: nowrap; }
.bl-row:not(.bl-row-pending) { grid-template-areas: "name state" "agent units" "emails emails"; }
.bl-row-pending { grid-template-areas: "name name" "state state" "agent units" "emails emails" "added added" "actions actions"; }
.bl-can .bl-row:not(.bl-row-pending) { grid-template-areas: "name state" "agent units" "emails emails" "change change"; }
.bl-can .bl-row-pending { grid-template-areas: "name name" "state state" "agent units" "emails emails" "added added" "actions actions" "change change"; }
@media (min-width: 900px) {
  .bl-cols, .bl-row { --bl-cols: minmax(0, 1.2fr) minmax(0, 1.6fr) 96px 200px 120px; }
  .bl-can.bl-cols, .bl-can .bl-row { --bl-cols: minmax(0, 1.2fr) minmax(0, 1.6fr) 96px 180px 120px 132px; }
  .bl-row:not(.bl-row-pending) { grid-template-areas: "name agent units state emails"; }
  .bl-row-pending { grid-template-areas: "name agent units state emails" "added added actions actions actions"; }
  .bl-can .bl-row:not(.bl-row-pending) { grid-template-areas: "name agent units state emails change"; }
  .bl-can .bl-row-pending { grid-template-areas: "name agent units state emails change" "added added actions actions actions actions"; }
}
/* Buildings list on a phone (3 November 2026): the column header is hidden below 900 px, so the
   tenant emails badge carries its own words, "Tenant emails off" / "Tenant emails on"; from 900 px
   the header names the column and the badge reads Off / On. */
.bl-emails-short { display: none; }
@media (min-width: 900px) { .bl-emails-word { display: none; } .bl-emails-short { display: inline; } }

/* Held receipts handed over by hand (the owner, 3 November 2026, Part B of the tenant email switch):
   the receipt page's Held state and its two forms, and Bulk Receipts' "Held while tenant emails are
   off" table below the to-do (the table scrolls inside its wrap on a phone; the page never does). */
.rcpt-email-held { align-items: center; }
.rcpt-email-held .rcpt-email-detail { margin-top: 0; }
.rcpt-email .rcpt-handover { margin-top: var(--space-2); }
.rcpt-email-foot { margin: var(--space-3) 0 0 !important; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.au-held { margin-top: var(--space-5); }
.au-held-head { margin-bottom: var(--space-3); }
.au-held-head h2 { margin: 0 0 var(--space-1); font-size: var(--text-lg); letter-spacing: -0.01em; }
.au-held-head p { margin: 0; }
.au-held-table th.num, .au-held-table td.num { text-align: right; }
.au-held-table td { vertical-align: middle; white-space: nowrap; }
.au-held-table form { margin: 0; }
.au-held-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.au-held-done { color: var(--ok); font-weight: 650; }

/* Browser-check fixes to Part B (3 November 2026). The held receipts are the to-do's list pattern,
   not a table (the table widened the page to 593 px at 390 px; the .au-held-table rules above are
   unused now): on a phone a row folds to the unit and tenant with the amount, then the receipt
   number, then the PDF and Mark handed over; from 900 px one line, receipt · unit and tenant ·
   amount · handed over, under a column header. On the receipt page the held note wraps beside the
   badge instead of ending in an ellipsis. */
.au-held-grid { margin: 0; }
.au-held-cols { display: none; }
.au-held-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who amount" "ref ref" "act act"; gap: var(--space-1) var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.au-held-row:last-child { border-bottom: 0; }
.au-held-row .au-who { grid-area: who; }
.au-held-row .au-amount { grid-area: amount; }
.au-held-ref { grid-area: ref; min-width: 0; font-size: var(--text-sm); color: var(--muted); }
.au-held-ref a { display: inline-block; min-height: 24px; }
.au-held-act { grid-area: act; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; margin-top: var(--space-1); }
.au-held-act form { margin: 0; }
.au-held-act .au-held-done { white-space: normal; overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .au-held-cols, .au-held-row { --au-held-cols: 150px minmax(0, 1.4fr) 136px minmax(0, 1.6fr); }
  .au-held-cols { display: grid; grid-template-columns: var(--au-held-cols); column-gap: var(--space-4); margin-bottom: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
  .au-held-cols .num { text-align: right; }
  .au-held-row { grid-template-columns: var(--au-held-cols); grid-template-areas: "ref who amount act"; column-gap: var(--space-4); padding: var(--space-2) 0; }
  .au-held-row .au-amount { text-align: right; }
  .au-held-ref { font-size: var(--text-base); color: var(--ink); }
  .au-held-act { margin-top: 0; }
}
.rcpt-email-held { flex-wrap: wrap; }
.rcpt-email-held .rcpt-email-detail { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: normal; }
.rcpt-email-held > span { contain: none; }
/* The statement page's draft note (the owner, 3 November 2026): under the header, before approval. */
.sd-draft-note { margin: 0 0 var(--space-5); padding: 14px 16px; background: var(--warn-tint); border: 1px solid #ecd5ad; border-radius: var(--radius-lg); line-height: 1.5; }

/* Payments › Bulk payments (the owner, 3 November 2026; mockups Main, Check, Result and Phone of
   the same day). Three screens on one address: the sheet (a row per current tenant), the check
   before saving and the Recorded page. On a phone each row is a card: unit and tenant with what
   is owed, amount and code side by side, "Owed in full", and the row's own date and paid-by behind
   "More" (the for-every-row bar covers the usual case); from 900 px the rows align as one sheet
   under a column header, tabular figures, with the running total and the button in a bar that
   sticks to the bottom. Status on the check is in words and an icon (Ready / Check / Fix), never
   the colour alone; every control is 44 px or more. */
.bp-head .bp-help { flex: 1 1 320px; max-width: 460px; line-height: 1.5; }
.bp-period .num { white-space: nowrap; }
.bp { display: flex; flex-direction: column; gap: var(--space-4); }
.bp-all { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-3); }
.bp-all .field label { margin-bottom: 4px; }
.bp-all .field input, .bp-all .field select { min-height: 44px; padding: 8px 12px; }
.bp-all-note { grid-column: 1 / -1; margin: 0; font-size: var(--text-sm); }
.bp-sheet { padding: var(--space-2) var(--space-3); }
.bp-cols { display: none; }
.bp-opt { font-weight: 400; color: var(--muted); }
.bp-rows { list-style: none; margin: 0; padding: 0; }
.bp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "who who" "owes owes" "amount code" "more more"; gap: var(--space-2) var(--space-3); align-items: center; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.bp-row:last-child { border-bottom: 0; }
.bp-who { grid-area: who; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.bp-who .unit-pill { flex: none; }
.bp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bp-owes { grid-area: owes; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.bp-owed .num { font-weight: 600; }
.bp-nothing { color: var(--ok); font-weight: 650; }
.bp-fill { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; padding: 0; border: 0; background: none; color: var(--oxblood); font: inherit; font-size: var(--text-sm); font-weight: 650; cursor: pointer; border-radius: var(--radius-sm); }
.bp-fill:hover { color: var(--oxblood-deep); text-decoration: underline; }
.bp-fill:focus-visible { outline: none; box-shadow: var(--ring); }
.bp-amount { grid-area: amount; }
.bp-code { grid-area: code; }
.bp-row .field { min-width: 0; }
.bp-row .field input, .bp-row .field select { min-height: 44px; padding: 8px 10px; }
.bp-row .field .money-input input { padding-left: 46px; }
.bp-row .money-prefix { left: 10px; }
.bp-label { display: block; margin-bottom: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.bp-more { grid-area: more; }
.bp-more-toggle { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; padding: 0; border: 0; background: none; color: var(--oxblood); font: inherit; font-size: var(--text-sm); font-weight: 650; cursor: pointer; border-radius: var(--radius-sm); }
.bp-more-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.bp-more-toggle::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(1px) rotate(225deg); transition: transform 120ms var(--ease); }
.bp-more.is-folded .bp-more-toggle::after { transform: translateY(-2px) rotate(45deg); }
.bp-more-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); }
.bp-more-toggle:not([hidden]) + .bp-more-body { margin-top: var(--space-2); }
.bp-more.is-folded .bp-more-body { display: none; }
.bp-foot { position: sticky; bottom: var(--tabbar-height); z-index: 2; display: flex; flex-direction: column; gap: var(--space-2); margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgb(26 26 26 / 25%); }
.bp-foot-words { margin: 0; font-size: var(--text-base); }
.bp-foot .btn { width: 100%; min-height: 48px; }
.bp-foot-check, .bp-foot-done { flex-direction: column-reverse; }
.bp-foot-done { position: static; margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }
.bp-back { margin: 0; }
.bp-back .btn { width: 100%; }
.bp-nothing-ready { margin: 0; text-align: center; }
/* The check and Recorded rows. */
.bp-note { padding: 14px 16px; background: var(--warn-tint); border: 1px solid #ecd5ad; border-radius: var(--radius-lg); line-height: 1.5; }
.bp-check-row, .bp-done-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who amount" "how how" "status status"; align-items: start; }
.bp-check-amount { grid-area: amount; font-weight: 600; text-align: right; }
.bp-check-how { grid-area: how; font-size: var(--text-sm); color: var(--muted); overflow-wrap: anywhere; }
.bp-status-cell { grid-area: status; min-width: 0; }
.bp-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.bp-status svg { flex: none; }
.bp-status-ready { color: var(--ok); }
.bp-status-check { color: var(--warn); }
.bp-status-fix { color: var(--danger); }
.bp-words { margin: 2px 0 0; font-size: var(--text-sm); color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.bp-leave { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; margin-top: 2px; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.bp-leave input { width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); }
.bp-done-row { grid-template-areas: "who amount" "receipt receipt" "email email"; }
.bp-receipt { grid-area: receipt; min-width: 0; }
.bp-receipt a { display: inline-block; min-height: 24px; font-weight: 600; }
.bp-receipt .bp-words { display: block; }
.bp-email { grid-area: email; font-size: var(--text-sm); color: var(--muted); overflow-wrap: anywhere; }
.bp-email .badge { margin-right: 4px; vertical-align: middle; }
.bp-warn { color: var(--warn); font-weight: 650; }
@media (min-width: 900px) {
  .bp-all { grid-template-columns: 200px 200px minmax(0, 1fr); align-items: end; padding: var(--space-4); }
  .bp-all-note { grid-column: auto; padding-bottom: 12px; }
  .bp-sheet { padding: var(--space-2) var(--space-4) var(--space-3); }
  .bp-cols, .bp-row { --bp-cols: minmax(170px, 1.2fr) 120px 140px 150px 132px minmax(130px, 1fr); }
  .bp-cols { display: grid; grid-template-columns: var(--bp-cols); column-gap: 10px; padding: var(--space-3) 0 var(--space-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
  .bp-cols .num { text-align: right; }
  .bp-cols .bp-opt { text-transform: none; letter-spacing: 0; font-size: 0.6875rem; }
  .bp-row { grid-template-columns: var(--bp-cols); grid-template-areas: "who owes amount date method code"; column-gap: 10px; padding: var(--space-2) 0; align-items: center; }
  .bp-row:hover { background: var(--paper); }
  .bp-owes { flex-direction: column; align-items: flex-end; justify-content: center; gap: 0; text-align: right; font-size: var(--text-base); }
  .bp-owes-word { display: none; }
  .bp-fill { margin: 0; min-height: 32px; font-size: 0.8125rem; }
  .bp-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bp-more, .bp-more-body { display: contents; }
  .bp-more-toggle { display: none; }
  .bp-date { grid-area: date; }
  .bp-method { grid-area: method; }
  .bp-row .field input, .bp-row .field select { font-size: 0.9375rem; }
  .bp-foot { bottom: 0; flex-direction: row; align-items: center; justify-content: space-between; margin: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }
  .bp-foot .btn { width: auto; min-height: 44px; }
  .bp-foot-check, .bp-foot-done { flex-direction: row; justify-content: flex-start; }
  .bp-foot-check .btn-primary { margin-left: auto; }
  .bp-foot-done { padding: 0; border: 0; }
  .bp-nothing-ready { margin-left: auto; text-align: right; }
  .bp-check-cols, .bp-check-row { --bp-cols: minmax(0, 1.3fr) 120px minmax(0, 1.3fr) minmax(0, 1.8fr); }
  .bp-check-row { grid-template-areas: "who amount how status"; align-items: start; padding: var(--space-3) 0; }
  .bp-check-row .bp-who, .bp-check-row .bp-check-amount, .bp-check-row .bp-check-how { padding-top: 2px; }
  .bp-check-how { font-size: var(--text-base); color: var(--ink); }
  .bp-done-cols, .bp-done-row { --bp-cols: minmax(0, 1.3fr) 120px minmax(0, 1.2fr) minmax(0, 1.7fr); }
  .bp-done-row { grid-template-areas: "who amount receipt email"; align-items: start; padding: var(--space-3) 0; }
  .bp-email { font-size: var(--text-base); color: var(--ink); }
  .bp-done-no .bp-email { color: var(--muted); }
}
/* Final review of Bulk payments (3 November 2026): the Recorded page's buttons stand off the
   panel by the app's section spacing, as the check page's footer bar does. */
.bp-foot-done { margin-top: var(--space-5); }
@media (min-width: 900px) { .bp-foot-done { margin-top: var(--space-5); } }

/* Payments list: the receipt number has its own column (the owner, 3 November 2026). A
   building-coded number (`N1809-RCT-000033`, up to a six-character code) needs about 160 px at
   the base size, so from 900 px the first column is 180 px and the number never wraps or runs
   into the tenant; the tenant and the method · code share the room left, the method ellipsised
   (its title and the receipt carry it whole); the heading strip names all five columns, "Paid by ·
   code" over the third. The phone layout above is unchanged. */
@media (min-width: 900px) {
  .paylist-cols, .paylist-row { --paylist-cols: 180px minmax(0, 1.3fr) minmax(0, 1fr) 84px 130px; }
  .paylist-cols span:nth-child(2) { grid-column: auto; }
  .paylist-number { white-space: nowrap; }
}

/* Bulk payments: amounts pre-filled and a Paid tick per row (the owner, 3 November 2026, D5).
   The tick is the first column from 900 px and the top-right of each card below; an unticked row
   that owes is dimmed AND reads "Not paid" (words, never the colour alone); a ticked row below
   what is owed reads "Part payment"; the footer counts paid, the total and not paid. "Owed in
   full" is gone: the amount is already full. The check page names the unticked tenants in one
   "Left out" line. */
.bp-paid { grid-area: paid; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; margin: 0; font-size: var(--text-sm); font-weight: 650; color: var(--ink); cursor: pointer; user-select: none; }
.bp-paid input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); cursor: pointer; }
.bp-paid input:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }
.bp-owes-note { display: block; min-height: 1.2em; font-size: var(--text-xs); font-weight: 650; letter-spacing: 0.02em; color: var(--muted); }
.bp-owes-note.is-part { color: var(--warn); }
.bp-row.is-off .bp-who, .bp-row.is-off .bp-owes { color: var(--muted); }
.bp-row.is-off .bp-name { font-weight: 500; }
.bp-row.is-off .unit-pill { opacity: 0.6; }
.bp-row.is-off .field input, .bp-row.is-off .field select, .bp-row.is-off .money-prefix { background: var(--paper); color: var(--muted); }
.bp-row.is-off .field input:focus, .bp-row.is-off .field select:focus { background: var(--surface); color: var(--ink); }
.bp-foot-unpaid { color: var(--muted); }
.bp-left-out { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.55; }
.bp-left-out strong { color: var(--ink); }

@media (max-width: 899.98px) {
  .bp-entry .bp-row { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "who who who paid" "owes owes owes owes" "amount amount code code" "more more more more"; }
  .bp-paid { justify-self: end; margin: -10px 0; }
  .bp-owes-note:empty { display: none; }
}
@media (min-width: 900px) {
  .bp-entry .bp-cols, .bp-entry .bp-row { --bp-cols: 48px minmax(160px, 1.5fr) 112px 128px 132px 112px minmax(110px, 1fr); }
  .bp-entry .bp-row { grid-template-areas: "paid who owes amount date method code"; }
  .bp-paid { justify-self: start; justify-content: center; min-width: 44px; min-height: 44px; margin: -6px 0; }
  .bp-paid-word { display: none; }
  .bp-owes-note { text-align: right; }
}

/* Review of the pre-filled sheet (3 November 2026): from 900 px the word "Paid" beside each tick
   is for screen readers only (the sr-only pattern, not display: none, so the checkbox still reads
   "Paid, F301 <tenant>"); the Unit and tenant column takes more room (narrower Paid, Owes and
   Amount tracks) and a long name wraps to a second line instead of being cut. */
@media (min-width: 900px) {
  .bp-paid-word { display: block; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bp-entry .bp-cols, .bp-entry .bp-row { --bp-cols: 44px minmax(190px, 1.8fr) 104px 124px 128px 112px minmax(100px, 1fr); }
  .bp-entry .bp-name { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; }
}
@media (min-width: 900px) { .bp-entry .bp-nothing { white-space: nowrap; font-size: var(--text-sm); } }

/* ======================================================================
   Phone cleanup (the owner, 4 November 2026, from the approved mockups; rulings in
   docs/decisions/2026-11-04-phone-cleanup-rulings.md). Screen only: every listed row is ONE
   line, 44 px tall, with a long name cut by an ellipsis and money never cut.
   ====================================================================== */

/* The statement's header: Print · Draft PDF · Draft Excel (approved: Print · PDF · Excel) as
   three equal buttons on one row below 700 px; their natural width from there. */
.sd-actions { flex-wrap: nowrap; width: 100%; }
.sd-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
@media (min-width: 700px) {
  .sd-actions { width: auto; }
  .sd-actions .btn { flex: none; padding: 0 var(--space-5); }
}

/* "Received, by unit · rent for <month set>": the heading carries the month set and the
   footnotes name the exceptions, by the PDF's rule (`printout.received_table`). */
.sd-table h2.sd-h2-sub { justify-content: flex-start; gap: 6px; }
.sd-sub { color: var(--muted); font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; }
.sd-mark { margin-left: 1px; color: var(--oxblood); font-size: var(--text-xs); font-weight: 700; line-height: 1; vertical-align: top; }
.sd-foot { margin: var(--space-2) 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.45; }
.sd-foot b { color: var(--oxblood); font-weight: 700; }

/* One line per row: unit pill · name · total (the tenant tables), item · amount (expenses and
   advances). The name and the item ellipsise; the total never does. */
.sd-one .sd-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who total"; gap: 0 var(--space-3); align-items: center; min-height: 44px; padding: 6px 0; }
.sd-one .sd-who { flex-wrap: nowrap; gap: 10px; }
.sd-one .sd-who .unit-pill { flex: none; }
.sd-one .sd-name, .sd-one .sd-item { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sd-one .sd-item { color: var(--ink); }
.sd-one .sd-row-sum .sd-name, .sd-one .sd-row-sum .sd-item { font-weight: 700; }
.sd-one .sd-row.is-reversal .sd-item { color: var(--muted); }
.sd-received .sd-cols, .sd-received .sd-cell { display: none; }
.sd-received .sd-cell.is-zero { color: var(--muted); }
.sd-more { display: grid; gap: var(--space-5); min-width: 0; }

/* From 900 px the money columns the PDF shows, measured: 88 px a figure column and 104 px
   for Total at least, a column growing to its widest amount (a 7-figure rent), the rest to the
   name. */
@media (min-width: 900px) {
  .sd-received .sd-cols, .sd-received .sd-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--sd-figs, 3), minmax(88px, max-content)) minmax(104px, max-content); grid-template-areas: none; gap: 0 var(--space-3); align-items: center; }
  .sd-received .sd-row > .sd-who, .sd-received .sd-row > .sd-cell, .sd-received .sd-row > .sd-total { grid-area: auto; }
  .sd-received .sd-row > .sd-cell { display: block; text-align: right; font-size: var(--text-sm); }
  .sd-received .sd-row-sum > .sd-cell { font-weight: 700; color: var(--ink); }
}

/* From 1100 px the "Received, by unit" panel spans the page below the main and side columns
   (a 36-character name fits beside six columns); the phone order is the markup's. */
@media (min-width: 1100px) {
  .sd-layout-wide { grid-template-columns: minmax(0, 1fr) 320px; }
  .sd-layout-wide > .sd-main { grid-column: 1; grid-row: 1; }
  .sd-layout-wide > .sd-side { grid-column: 2; grid-row: 1; }
  .sd-layout-wide > .sd-received { grid-column: 1 / -1; grid-row: 2; }
  .sd-layout-wide > .sd-more { grid-column: 1; grid-row: 3; }
}

/* The Statements list: the chooser on one row, its labels inside the fields; each month one
   line, month · status · net, the status in words (the colour only repeats it); the dates and
   the statement number show from 700 px. The list sits flush in its panel. */
.sm-chooser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); }
.sm-chooser select { min-width: 0; }
.sm-chooser .btn { padding: 0 var(--space-4); }
.sm-chooser-more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sm-head { margin-bottom: var(--space-2); }
.sm-months { border: 0; border-radius: 0; border-top: 1px solid var(--line); }
.sm-month { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name state net"; gap: 0 10px; align-items: center; min-height: 44px; padding: 0; border-bottom: 1px solid var(--line); }
.sm-month + .sm-month { border-top: 0; }
.sm-month-name { display: block; min-width: 0; min-height: 44px; line-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-month-dates, .sm-number { display: none; }
.sm-state { grid-area: state; color: var(--muted); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.sm-state.is-closed { color: var(--ok); }
.sm-state.is-submitted { color: var(--warn); }
.sm-state.is-late { color: var(--danger); }
.sm-month-net { font-size: 0.9375rem; }
@media (min-width: 700px) {
  .sm-month { grid-template-columns: 150px minmax(0, 1fr) auto auto auto; grid-template-areas: "name dates state number net"; gap: 0 var(--space-3); }
  .sm-month-dates { display: block; }
  .sm-number { display: block; grid-area: number; }
  .sm-number:empty { display: none; }
}

/* Reports: the rent roll's phone cards one line, unit · tenant (or the empty unit's state) ·
   rent, the status word only when it is not Occupied; "Open a statement" rows one line, month ·
   View · PDF · Excel, the statement number from 700 px. */
@media (max-width: 699.98px) {
  .rp-card { grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 10px; align-items: center; min-height: 44px; padding: 6px 0; }
  .rp-card.has-state { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .rp-card .unit-pill { grid-area: auto; }  /* the pill's global `grid-area: pill` would place it off the row */
  .rp-card .rp-card-tenant { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .rp-card .rp-card-tenant.is-vacant { color: var(--muted); font-weight: 500; }
  .rp-card .rp-state { margin-left: -4px; color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
  .rp-card > .num { font-weight: 600; white-space: nowrap; }
  .rp-number { display: none; }
}
.rp-links li { flex-wrap: nowrap; min-height: 52px; padding: var(--space-1) 0; }
.rp-links .rp-month { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.rp-links .rp-number { font-weight: 500; }
.rp-links .rp-actions { flex: none; flex-wrap: nowrap; }
.rp-links .rp-actions .btn { padding: 0 12px; }
@media (min-width: 700px) {
  .rp-links .rp-actions .btn { padding: 0 var(--space-4); }
}

/* Expenses list: one line per expense, item · a word when it is not approved (Awaiting,
   Rejected, Withdrawn, Reversed, Reversal; the colour only repeats it) · amount. A decision
   (Approve, Reject, Withdraw) takes a line of its own under the row; Reverse sits inline; the
   receipt is a 44 px paperclip link by the item. From 900 px the four columns as before. */
.xp-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "what state amount" "actions actions actions"; gap: 0 var(--space-3); align-items: center; min-height: 44px; padding: 6px var(--space-4); }
.xp-what { display: flex; align-items: center; gap: 2px; min-width: 0; }
.xp-item { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.xp-receipt { display: inline-grid; flex: none; place-items: center; width: 44px; height: 44px; margin: -6px -8px -6px 0; border-radius: var(--radius-sm); color: var(--muted); }
.xp-receipt:hover, .xp-receipt:focus-visible { color: var(--oxblood); }
.xp-receipt svg { width: 18px; height: 18px; }
.xp-state { gap: var(--space-3); white-space: nowrap; }
.xp-word { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.xp-word.is-pending { color: var(--warn); }
.xp-word.is-rejected { color: var(--danger); }
.xp-reverse { min-height: 44px; margin: -6px 0; }
.xp-actions { margin-top: var(--space-1); }
@media (min-width: 900px) {
  .xp-row { grid-template-columns: minmax(0, 1fr) 150px 140px auto; grid-template-areas: "what state amount actions"; }
  .xp-actions { margin-top: 0; }
}

/* Payments list on a phone, one line (the owner, 4 November 2026): unit · tenant · date ·
   amount, the tenant opening the payment (the hit area is the whole row); the number and the
   method · code stay on the payment page (the row's title carries the code whole); a reversal,
   a reversed payment and an opening balance say so in a word. Supersedes the two-line phone row
   of 17 October 2026; the desktop columns are unchanged. */
.paylist-who { color: inherit; text-decoration: none; }
.paylist-who::after { content: ""; position: absolute; inset: 0; }
.paylist-who:focus-visible { outline: none; }
.paylist-who:focus-visible::after { outline: 2px solid var(--oxblood); outline-offset: -3px; }
.paylist-number::after { content: none; }
.paylist-word { grid-area: word; color: var(--muted); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
@media (max-width: 899.98px) {
  .paylist-row { grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "who word date amount"; column-gap: 10px; align-items: center; min-height: 44px; padding: 6px var(--space-4); }
  .paylist-meta, .paylist-number { display: none; }
  .paylist-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 900px) {
  .paylist-word { display: none; }
}

/* The code review of the phone cleanup (4 November 2026, PC21 to PC27). PC21: the by-unit
   tables are ONE grid per panel (`.sd-grid`, its tracks whole from the view, PC22), the header
   and every row subgrids of it, so a 7-figure amount widens the column for the header, each row
   and Total alike and the right edges line up. PC24: a rejection note takes a line of its own
   under the expense. PC25: an imported month keeps its word in "Open a statement" on a phone.
   PC26: the move-out's phone row says "refunded" after the figure. */
.sd-word { color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.sd-one .sd-who .sd-mark { flex: none; margin-left: -7px; }  /* PC27: after the link, hugging the name */
.rp-links .rp-word { font-size: var(--text-sm); font-weight: 500; }
.xp-row { grid-template-areas: "what state amount" "note note note" "actions actions actions"; }
.xp-note { grid-area: note; min-width: 0; margin-top: 2px; line-height: 1.4; }
@media (min-width: 900px) {
  .sd-received .sd-grid { display: grid; grid-template-columns: var(--sd-tracks); gap: 0 var(--space-3); align-items: center; }
  .sd-received .sd-rows { display: contents; }
  .sd-received .sd-cols, .sd-received .sd-row { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; }
  .sd-word { display: none; }
  .xp-row { grid-template-areas: "what state amount actions" "note note note note"; }
}

/* ======================================================================
   Summary statement and Detailed statement (the owner, 4 November 2026; rulings in
   docs/decisions/2026-11-04-summary-detailed-statement-rulings.md, SD7). Print and the PDF
   (the statement's header, the "Open a statement" rows) open a choice of two:
   `templates/statements/_layout_menu.html`, a `<details>` whose summary is a quiet button with
   a chevron. From 700 px a small menu beneath it, right-aligned, 332 px, two 56 px rows with an
   oxblood-tinted icon; below 700 px the same markup is a bottom sheet with the Menu sheet's
   grammar (scrim, handle, title, 44 px close, 60 px rows, a safe-area foot). Excel stays one
   button. Oxblood is the only action colour; the open button takes the paper-2 tint.
   ====================================================================== */
.lmenu { position: relative; display: inline-flex; }
.lmenu > summary { list-style: none; }
.lmenu > summary::-webkit-details-marker { display: none; }
.btn-menu { gap: 6px; padding-right: 16px; }
.btn-menu .chev { flex: none; color: var(--muted); transition: transform 160ms var(--ease); }
.lmenu[open] > .btn-menu { background: var(--paper-2); border-color: #b9ae9f; }
.lmenu[open] > .btn-menu .chev { transform: rotate(180deg); color: var(--ink); }
.lmenu-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 25; width: 332px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); }
.lmenu-head, .lmenu-foot, .lmenu-chev { display: none; }
.lmenu-items { margin: 0; padding: 0; list-style: none; }
.lmenu-items > li { display: block; }
.lmenu-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px 8px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; transition: background-color 120ms var(--ease); }
.lmenu-item:hover { background: var(--paper-2); color: var(--ink); }
.lmenu-item:focus-visible { outline: none; background: var(--paper-2); box-shadow: 0 0 0 3px rgb(111 26 15 / 22%); }
.lmenu-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--oxblood-tint); color: var(--oxblood); }
.lmenu-icon svg { width: 20px; height: 20px; }
.lmenu-text { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
.lmenu-name { font-size: 15px; font-weight: 650; line-height: 1.25; }
.lmenu-sub { font-size: 13px; color: var(--muted); line-height: 1.3; }
/* The statement's header: the menu button takes its third of the row below 700 px. */
.sd-actions > .lmenu { flex: 1 1 0; min-width: 0; }
.sd-actions > .lmenu > .btn { width: 100%; }
.sd-actions > .lmenu > .btn-menu { padding: 0 6px 0 8px; }
/* The "Open a statement" rows: the menu's button is as short as its neighbours. */
.rp-links .rp-actions .btn-menu { padding: 0 6px 0 10px; gap: 3px; }
@media (min-width: 700px) {
  .sd-actions > .lmenu { flex: none; }
  .sd-actions > .lmenu > .btn-menu { padding: 0 16px 0 var(--space-5); }
  .rp-links .rp-actions .btn-menu { padding: 0 12px 0 var(--space-4); gap: 6px; }
}
@media (max-width: 699.98px) {
  .lmenu[open]::before { content: ""; position: fixed; inset: 0; z-index: 30; background: rgb(26 26 26 / 55%); animation: lmenu-fade 200ms var(--ease); }
  .lmenu-menu { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 31; width: auto; max-height: 86vh; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 calc(22px + env(safe-area-inset-bottom)); background: var(--paper); border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px -16px rgb(26 26 26 / 45%); animation: lmenu-up 220ms var(--ease); }
  .lmenu-head { display: block; padding: 8px max(8px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .lmenu-handle { width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 2px; background: var(--line-strong); }
  .lmenu-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; }
  .lmenu-title { margin: 0; font: 650 20px/1.3 var(--font-display); letter-spacing: -0.015em; color: var(--ink); }
  .lmenu-title small { display: block; color: var(--muted); font: 500 12px/1.5 var(--font-body); letter-spacing: 0; }
  .lmenu-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .lmenu-close:active { background: var(--paper-2); }
  .lmenu-close:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
  .lmenu-items { margin: 8px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .lmenu-items > li + li { border-top: 1px solid var(--line); }
  .lmenu-item { min-height: 60px; padding: 8px 12px; border-radius: 0; }
  .lmenu-item:focus-visible { box-shadow: none; outline: 2px solid var(--oxblood); outline-offset: -3px; }
  .lmenu-chev { display: block; flex: none; width: 16px; height: 16px; color: var(--line-strong); }
  .lmenu-foot { display: block; margin: 12px 18px 0; color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
  /* Without the script the button is the only way to close the sheet: it stays above the scrim. */
  html:not(.lmenu-js) .lmenu[open] > summary { position: relative; z-index: 32; }
}
@keyframes lmenu-up { from { transform: translateY(102%); } }
@keyframes lmenu-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .btn-menu .chev { transition: none; }
  .lmenu[open]::before, .lmenu-menu { animation: none; }
}

/* Ending a month early (4 November 2026): the quiet control, the confirm page and the "Ended early" notes. */
.sd-early { margin: var(--space-3) 0 0; }
.sd-early .btn { width: 100%; min-height: 44px; }
.ee-note { margin: 2px 0 0; }
/* The list's "ended early" marker sits inside the dates cell, which the owner's phone cleanup
   already hides below 700 px, so the one-line row is untouched. Who ended it and when are on the
   statement page; the list only flags that the span is short. */
.sm-early { color: var(--muted); font-weight: 500; white-space: nowrap; }
.ee-confirm { max-width: 640px; }
.ee-points { margin: 0 0 var(--space-4); padding-left: var(--space-5); display: grid; gap: var(--space-2); line-height: 1.5; overflow-wrap: anywhere; }
.ee-final { margin: 0; font-size: var(--text-base); }
.ee-confirm .ob-actions .btn { min-height: 44px; }

/* Correcting an issued invoice with a credit note (the owner, 5 November 2026): the line picker
   and the confirm page. Screen only; the credit note's own PDF has the letterhead's styles. */
.cn-pick, .cn-confirm { max-width: 640px; }
.cn-sub { margin: 0 0 var(--space-4); color: var(--muted); line-height: 1.5; }
.cn-fieldset { margin: 0 0 var(--space-4); padding: 0; border: 0; }
.cn-fieldset ul { margin: var(--space-2) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.cn-fieldset li { display: flex; align-items: center; min-height: 44px; }
.cn-fieldset label { display: flex; align-items: center; gap: 10px; min-height: 44px; line-height: 1.4; overflow-wrap: anywhere; }
.cn-fieldset input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.cn-field { display: grid; gap: 6px; margin: 0 0 var(--space-4); }
.cn-field textarea { width: 100%; min-height: 64px; }
.cn-hint { color: var(--muted); font-size: var(--text-sm); line-height: 1.4; }
.cn-points { margin: 0 0 var(--space-4); padding-left: var(--space-5); display: grid; gap: var(--space-2); line-height: 1.5; overflow-wrap: anywhere; }
.cn-lines { margin: var(--space-2) 0 0; padding-left: var(--space-4); display: grid; gap: 4px; }
.cn-final { margin: 0 0 var(--space-4); font-size: var(--text-base); }
.cn-confirm .ob-actions .btn { min-height: 44px; }

/* A lease's credit on the statement tab, with the action that spends it (5 November 2026). */
.st-credit-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-credit-held { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.st-credit-form { margin: 0; }
.st-credit-form .btn { min-height: 44px; }

/* The sign-in code as six boxes (the owner, 13 November 2026, from the approved mockup): six
   equal columns with one small, even gap, drawn under ONE real field (static/js/otp.js), so an
   autofilled or pasted code lands whole. Without the script the boxes stay hidden and the field
   is the plain one it always was. */
.otp-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.otp-field { position: relative; }
.otp:not(.otp-ready) .otp-boxes { display: none; }
.otp-box {
  display: grid; place-items: center; aspect-ratio: 5 / 6; min-height: 52px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); font-size: clamp(1.375rem, 6.5vw, 1.75rem); font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1;
  transition: border-color 120ms, box-shadow 120ms, background-color 120ms;
}
.otp-box.is-filled { border-color: var(--ink); }
.otp.has-focus .otp-box.is-active { border-color: var(--oxblood); box-shadow: var(--ring); }
.otp.has-focus .otp-box.is-active:empty::before {
  content: ""; width: 2px; height: 1.1em; background: var(--oxblood); animation: otp-caret 1.1s steps(1) infinite;
}
.otp.is-error .otp-box { border-color: var(--danger); background: var(--danger-tint); }
@keyframes otp-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .otp.has-focus .otp-box.is-active:empty::before { animation: none; }
  .otp-box { transition: none; }
}
/* The real field, lying over the boxes: transparent, at 16px so a phone does not zoom in. */
.otp.otp-ready .otp-field input,
.otp.otp-ready .otp-field input:focus {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  color: transparent; caret-color: transparent; font-size: 16px; cursor: text;
}
.otp.otp-ready .otp-field input::selection { background: transparent; }


/* Staff pay (the owner, 17 November 2026): the Staff screens reuse the expense list rows (.xp-*),
   the statement's section tables (.sd-*) and the facts grid; only what none of them has is here.
   Every row is ONE line on a phone: the name takes what the state and the amount leave and is
   cut with an ellipsis (its full words are the title), and the role, month and number that sit
   beside it from 600 px are dropped below that. */
.staff-tabs { margin-bottom: var(--space-3); }
.sp-row { grid-template-areas: "what state amount"; }
.sp-row .xp-what { display: flex; }
.sp-row .xp-meta { display: none; }
.sp-row.is-left .xp-item { color: var(--muted); }
@media (min-width: 600px) {
  .sp-row .xp-meta { display: flex; min-width: 0; }
  .sp-row .xp-what { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); align-items: baseline; column-gap: var(--space-3); }
}
@media (min-width: 900px) {
  .sp-row { grid-template-areas: "what state amount"; grid-template-columns: minmax(0, 1fr) 130px 150px; }
}
/* The status strip of a loan: Requested, Approved, Disbursed, Settled (or Returned, Withdrawn). */
.sp-strip { display: flex; gap: 0; margin: var(--space-3) 0; padding: 0; list-style: none; }
.sp-step { flex: 1 1 0; min-width: 0; padding: var(--space-2) var(--space-1); border-bottom: 3px solid var(--line); color: var(--muted); font-size: var(--text-sm); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-step.is-done { border-bottom-color: var(--ink); color: var(--ink); }
.sp-step.is-current { border-bottom-color: var(--oxblood); color: var(--ink); font-weight: 700; }
/* A payslip line: label and its Automatic mark, the amount, and Remove for a one-off. */
.sp-line { align-items: center; }
.sp-line .sd-who { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.sp-line .sd-item { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-line .mark { flex: none; }
.sp-line form { margin: 0; }
/* An inline form inside a panel (Add a line, Mark as disbursed): fields stack on a phone and sit
   in one row from 900 px. */
.sp-inline { display: grid; gap: var(--space-3); }
.sp-inline .field { margin: 0; }
@media (min-width: 900px) {
  .sp-inline { grid-template-columns: auto minmax(0, 1fr) 180px auto; align-items: end; }
}
.sp-schedule { margin-top: var(--space-4); }
.sp-panel { margin-bottom: var(--space-4); }

/* Staff pay, the visual pass (17 November 2026): the screens match the approved mockups in the
   app's own tokens. No second strip: the four lists draw Administration's strip (Staff current)
   and the records and forms an eyebrow crumb (`.rcpt-eyebrow`, as the Rental Tax forms). A
   panel has its own padding; a record is one main column with a 360 px side column from
   1100 px (`.sp-layout`: `.sp-side` above `.sp-main` on a phone, `.sp-side2` below it); the
   header's buttons share ONE row on a phone (`.sp-actions`, the long words from 700 px). */
.sp-panel { padding: var(--space-4); margin-bottom: var(--space-4); }
.sp-panel > h2 { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.sp-panel > h2 .sd-sub { flex: 1 1 100%; }
.sp-hero .rcpt-figure { margin: var(--space-1) 0; }
.sp-hero > .muted { margin: 0; font-size: var(--text-sm); }
.sp-h1-num { margin-left: 2px; color: var(--muted); font-size: var(--text-lg); font-weight: 500; }
.sp-h1-word { vertical-align: middle; margin-left: 4px; }
.sp-words { font: 600 1rem/1.35 var(--font-body); letter-spacing: 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-facts .facts-figure.num { white-space: nowrap; }
.sp-reason { margin: calc(var(--space-5) * -1) 0 var(--space-5); font-size: var(--text-sm); }
.sp-note { margin: 0 0 var(--space-4); font-size: var(--text-sm); }
.sp-block { width: 100%; }
.sp-stack { display: grid; gap: var(--space-3); }
.sp-stack .field { margin: 0; }
.sp-group + .sp-group { margin-top: var(--space-5); }
.sp-none { margin: 0; font-size: var(--text-sm); }
.sp-typed { color: var(--muted); font-weight: 500; font-size: var(--text-sm); }
.sp-foot-action { margin: var(--space-2) 0 0; }
.sp-row .xp-word.is-ok { color: var(--ok); }
/* The header's buttons: one row on a phone, each taking an equal share (as `.sd-actions`). */
.sp-actions { flex-wrap: nowrap; width: 100%; }
.sp-actions form { display: contents; }
.sp-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; gap: 0; font-size: var(--text-sm); }
.sp-wide { display: none; white-space: pre; }
.sp-narrow { display: inline; }
@media (min-width: 700px) {
  .sp-actions { width: auto; }
  .sp-actions .btn { flex: none; padding: 0 var(--space-5); font-size: 0.9375rem; }
  .sp-wide { display: inline; }
  .sp-narrow { display: none; }
}
/* The sums under a payslip's net figure: label left, figure right. */
.sp-sums { margin: var(--space-3) 0 0; }
.sp-sums > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 6px 0; font-size: var(--text-sm); border-top: 1px solid var(--line); }
.sp-sums dt { margin: 0; color: var(--muted); }
.sp-sums dd { margin: 0; min-width: 0; font-weight: 600; text-align: right; }
.sp-issue { margin-top: var(--space-4); }
.sp-hero .hint { margin-top: var(--space-3); line-height: 1.45; }
/* The register: name · role · salary on a phone (a member who left reads Left in the role's
   place); since, pay to and the state word from 900 px. */
.sp-reg .xp-meta { display: flex; }
.sp-reg .sp-left-word, .sp-reg .sp-more { display: none; }
.sp-reg.is-left .sp-role { display: none; }
.sp-reg.is-left .sp-left-word { display: inline; }
.sp-reg .xp-state, .sp-reg .sp-since, .sp-reg .sp-payto { display: none; }
.sp-reg { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "what amount"; }
.sp-meta-on .xp-meta { display: flex; }
.sp-meta-on .sp-more { display: none; }
/* Below the 900 px list-density block a meta cell may wrap; on these rows it never does. */
.sp-row .xp-meta-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-more { display: none; }
@media (max-width: 599.98px) {
  .sp-reg .xp-what, .sp-meta-on .xp-what { column-gap: var(--space-2); }
  .sp-reg .xp-item, .sp-meta-on .xp-item { flex: 0 1 auto; }
  .sp-reg .xp-meta, .sp-meta-on .xp-meta { flex: none; max-width: 50%; min-width: 0; }
}
@media (min-width: 600px) {
  .sp-more, .sp-reg .sp-more, .sp-meta-on .sp-more { display: inline; }
}
@media (min-width: 900px) {
  .sp-reg { grid-template-columns: minmax(0, 1fr) 100px minmax(0, 190px) 64px 120px; grid-template-areas: "what since payto state amount"; }
  .sp-reg .xp-state { display: flex; grid-area: state; }
  .sp-reg .sp-since { display: block; grid-area: since; color: var(--muted); font-size: var(--text-sm); }
  .sp-reg .sp-payto { display: block; grid-area: payto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: var(--text-sm); }
  .sp-reg.is-left .sp-role { display: inline; }
  .sp-reg.is-left .sp-left-word { display: none; }
}
/* A payslip line: the label, then from 900 px its source and the Automatic mark (both muted;
   the label's title carries them below that), the amount, and Remove (or End) for a line a
   person may take off. */
.sd-one .sp-line { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "who total act"; }
.sd-one .sp-line.is-auto { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who total"; }
.sp-line form { grid-area: act; margin: 0; }
.sp-line .sp-remove { margin: -6px 0; padding: 0 var(--space-3); }
.sp-src, .sp-auto { display: none; }
.sd-one .sd-who .xp-word { flex: none; }
.sd-row.is-here .sd-item { font-weight: 700; }
@media (min-width: 900px) {
  .sp-src { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: var(--text-sm); }
  .sp-auto { display: inline-flex; flex: none; align-items: center; min-height: 20px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
  .sp-line .sd-item { flex: 0 1 auto; }
}
/* Add a line: the kind on its own row, then label · amount · Add from 700 px. */
@media (min-width: 700px) {
  .sp-inline { grid-template-columns: minmax(0, 1fr) 160px auto; align-items: end; }
  .sp-inline > .choice-set { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .sp-inline { grid-template-columns: minmax(0, 1fr) 160px auto; }
}
/* The request form: the fields, the schedule preview beside them from 1100 px (the summary
   line at every width, the rows from 900 px), the buttons under the fields. */
.sp-form { max-width: 1220px; }
.sp-sum-line { margin: 0 0 var(--space-2); color: var(--muted); font-size: var(--text-sm); font-weight: 600; white-space: normal; line-height: 1.45; }
.sp-schedule[hidden] { display: none; }
@media (max-width: 899.98px) {
  .sp-preview-rows { display: none; }
}
@media (min-width: 1100px) {
  .sp-form { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "main side" "actions side"; align-items: start; column-gap: var(--space-5); }
  .sp-form-main { grid-area: main; }
  .sp-form-side { grid-area: side; margin-bottom: 0; }
  .sp-form-actions { grid-area: actions; }
}
/* A record: one main column and a 360 px side column from 1100 px; the side above the main on a
   phone and the second side block (a list) below it. */
@media (min-width: 1100px) {
  .sp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "main side" "main side2"; align-items: start; column-gap: var(--space-5); }
  .sp-main { grid-area: main; min-width: 0; }
  .sp-side { grid-area: side; min-width: 0; }
  .sp-side2 { grid-area: side2; min-width: 0; }
}
/* The status strip of a loan, as the mockup: a dot and a line per step, the step reached in
   oxblood, each step done with its day (the days from 600 px). */
.sp-strip { display: flex; align-items: center; gap: 0; margin: 0 0 var(--space-5); padding: 0; list-style: none; }
.sp-step { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0; border-bottom: 0; color: var(--muted); font-size: var(--text-xs); font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; }
.sp-step::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.sp-step::after { content: ""; flex: 1 1 8px; min-width: 6px; height: 2px; margin: 0 6px; background: var(--line); }
.sp-step:last-child { flex: 0 0 auto; }
.sp-step:last-child::after { display: none; }
.sp-step-words { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sp-step.is-done { border-bottom: 0; color: var(--ink); }
.sp-step.is-done::before { background: var(--oxblood); border-color: var(--oxblood); }
.sp-step.is-done::after { background: var(--oxblood); }
.sp-step.is-current { flex-shrink: 0; border-bottom: 0; color: var(--oxblood); font-weight: 700; }
.sp-step.is-current::before { border-color: var(--oxblood); box-shadow: 0 0 0 3px var(--oxblood-tint); }
.sp-step small { display: none; font-size: inherit; font-weight: 500; color: var(--muted); }
@media (min-width: 600px) {
  .sp-step { gap: 8px; font-size: var(--text-sm); }
  .sp-step::after { margin: 0 8px; }
  .sp-step small { display: inline; }
}
.sp-facts .facts-cell.sp-span { grid-column: 1 / -1; }
@media (min-width: 700px) {
  .sp-facts-4 .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sp-facts .facts-cell.sp-span { grid-column: auto; }
}
/* The status strip at 390 px: the four words show whole, the connecting lines give way instead. */
.sp-step-words { flex: none; }
@media (max-width: 699px) {
  .sp-step::after { margin: 0 4px; }
}

/* Administration's settings sub-nav (the owner, 17 November 2026, Option A): from 900 px a 220 px
   grouped list beside each page (`.adm`, base.html; templates/partials/_admin_nav.html); below it the
   list is not drawn and the page carries the "‹ Administration" crumb back to the landing page. */
.adm-crumb { margin: 0 0 var(--space-2); }
.adm-crumb a { position: relative; color: var(--oxblood); text-decoration: none; }
/* A 44 px target around the one-line eyebrow, without making the line itself tall. */
.adm-crumb a::after { content: ""; position: absolute; inset: -16px -12px; }
.adm-nav { display: none; }
@media (min-width: 900px) {
  .adm { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
  .adm-crumb { display: none; }
  .adm-nav { display: block; position: sticky; top: var(--space-5); }
  .adm-group { margin: 0 0 var(--space-1) var(--space-3); color: var(--muted); font: 700 0.71875rem/1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
  .adm-list { margin: 0 0 var(--space-4); padding: 0; list-style: none; }
  .adm-row { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border-left: 3px solid transparent; border-radius: 0 6px 6px 0; color: var(--ink); font-size: 0.9375rem; font-weight: 500; text-decoration: none; }
  .adm-row:hover { background: var(--paper-2); color: var(--ink); }
  .adm-row:focus-visible { outline: 2px solid var(--oxblood); outline-offset: -2px; }
  .adm-row[aria-current="page"] { border-left-color: var(--oxblood); background: var(--oxblood-tint); color: var(--oxblood); font-weight: 650; }
  .adm-page { min-width: 0; }
}
/* The landing page's rows: name and hint in one cell, the hint kept on a phone (a list of nine
   bare names says too little) as a second line under the name. */
.adm-text { display: flex; flex: 1 1 auto; align-items: center; gap: var(--space-3); min-width: 0; }
@media (max-width: 599.98px) {
  .adm-text { flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--space-1) 0; }
  .adm-home .rh-hint { display: block; white-space: normal; }
}

/* The visual pass (17 November 2026): the mockup's measures. The landing page's rows stack the
   name over its one-line hint at every width (a hint beside the name broke the long names into
   three lines) in 56 px rows; in the sub-nav the groups are parted by a hairline and the first
   group label sits level with the page's h1 (4 px, the h1's half-leading and cap gap). */
.adm-home .rh-row { min-height: 56px; }
.adm-home .adm-text { flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--space-1) 0; line-height: 1.3; }
.adm-home .rh-name { flex: none; max-width: 100%; }
.adm-home .rh-hint { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) {
  .adm-nav { padding-top: 4px; }
  .adm-group { margin-left: 0; padding-left: var(--space-3); }
  .adm-list { margin-bottom: 0; }
  .adm-list + .adm-group { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }
}
/* The phone crumb as the mockup's back-link: a left chevron and the hub's name in one oxblood
   44 px link (no uppercase eyebrow), tucked 8 px up and 4 px out so its text sits on the margin. */
.adm-crumb { margin: -8px 0 0 -4px; }
.adm-crumb a::after { content: none; }
.adm-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px; color: var(--oxblood); font: 600 var(--text-sm)/1.2 var(--font-body); text-decoration: none; }
.adm-back svg { flex: none; }
.adm-back:hover { color: var(--oxblood-deep); text-decoration: underline; text-underline-offset: 3px; }
/* Beside the sub-nav the Team list's who column is narrower: the name sits over the email on two
   lines (one beside the other, the name was cut to "Lan…" while the email kept its width). */
@media (min-width: 900px) {
  .adm-page .member-who { grid-template-columns: minmax(0, 1fr); }
}

/* The review fix (17 November 2026): the two-column shell is for 1100 px and up. From 900 px the
   sidebar (~248 px) and the page's 48 px padding left ~300 px for the page beside the 220 px
   sub-nav, so from 900 to 1099 px the page gets the phone treatment again: no sub-nav column, the
   "‹ Administration" crumb shown (AN10). */
@media (min-width: 900px) and (max-width: 1099.98px) {
  .adm { display: block; }
  .adm-crumb { display: block; }
  .adm-nav { display: none; }
}

/* Staff profile: the Loans and advances tab (the owner, 18 November 2026). */
.sp-loans { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.sp-loans-title { margin: 0; font-size: var(--text-lg); }
.sp-loan { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.sp-loan-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sp-loan-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin: 0; }
.sp-loan-figures dt { font-size: var(--text-sm); color: var(--muted, inherit); }
.sp-loan-figures dd { margin: 0; font-weight: 600; white-space: nowrap; }
.sp-loan-words, .sp-loan-link { margin: 0; font-size: var(--text-sm); }
.sp-loan-empty { margin: 0; }
.sp-settled-title { margin: 0 0 var(--space-2); font-size: var(--text-base); }
@media (min-width: 900px) {
  .sp-loan-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.sp-loan-sub .sp-src { white-space: normal; }
.sp-loan-name { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.sp-loan-name .sd-item, .sp-loan-name .sp-src { white-space: nowrap; }
.sp-loan-figures .sp-count { display: block; font-weight: 400; font-size: var(--text-sm); }

/* The Loans tab's visual pass (18 November 2026, boards L1 and L2): a card is a title row (the
   name, the number, the status word; View schedule at the right from 900 px), the dates on one
   line, the figures as label/value pairs two across on a phone and four across from 900 px (the
   phone folds the share into Instalments and drops "KES", so every pair stays on one line), a †
   note when the last instalment takes the rounding, and a thin oxblood bar at the foot. The
   settled list is an eyebrow heading over muted rows. */
.sp-loans { gap: var(--space-4); }
.sp-loan { gap: var(--space-2); padding: var(--space-4); }
.sp-loan-head { align-items: baseline; }
.sp-loan-title { display: flex; flex-wrap: nowrap; align-items: baseline; gap: var(--space-2); margin: 0; min-width: 0; font-size: var(--text-base); font-weight: 700; letter-spacing: -0.01em; }
.sp-loan-title a { color: var(--ink); text-decoration: none; }
.sp-loan-title a:hover { color: var(--oxblood); text-decoration: underline; }
.sp-loan-no { color: var(--muted); font-size: var(--text-sm); font-weight: 500; }
.sp-loan-title .xp-word { flex: none; }
.sp-loan-sched { display: none; flex: none; }
.sp-loan-when { margin: 0; color: var(--muted); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-loan-reason, .sp-loan-desk, .sp-loan-cur { display: none; }
.sp-loan-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin-top: var(--space-1); }
.sp-loan-cell { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); min-width: 0; font-size: 0.8438rem; }
.sp-loan-figures dt { margin: 0; color: var(--muted); font-size: inherit; }
.sp-loan-figures dd { margin: 0; font-weight: 650; font-size: inherit; white-space: normal; }
.sp-loan-note { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.sp-loan-bar { height: 6px; margin-top: var(--space-2); }
.sp-loan-bar > span { background: var(--oxblood); }
.sp-loan-empty { margin: 0; padding: var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.sp-settled-title { margin: 0 0 var(--space-1); color: var(--muted); font: 600 0.6875rem/1.3 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
.sp-settled .sd-item, .sp-settled .sd-total { color: var(--muted); }
.sp-settled .sd-total { font-weight: 600; }
.sp-loan-ref { flex: none; color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
@media (min-width: 900px) {
  .sp-loan { padding: var(--space-4) var(--space-5); }
  .sp-loan-title { font-size: var(--text-lg); }
  .sp-loan-no { font-size: 0.9375rem; }
  .sp-loan-sched, .sp-loan-reason, .sp-loan-cur, .sp-loan-desk { display: inline; }
  .sp-loan-cell.sp-loan-desk { display: block; }
  .sp-loan-phone { display: none; }
  .sp-loan-figures { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin-top: var(--space-2); }
  .sp-loan-cell { display: block; font-size: var(--text-base); }
  .sp-loan-figures dt { margin-bottom: 2px; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
}
/* The title's name never wraps (the number, the least telling part, is the one cut short), the
   number is a size down on a phone, and the phone-only Schedule cell stays off the desktop. */
.sp-loan-title a { flex: none; white-space: nowrap; }
.sp-loan-no { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.8125rem; }
@media (min-width: 900px) {
  .sp-loan-no { font-size: 0.9375rem; }
  .sp-loan-cell.sp-loan-phone { display: none; }
}

/* The payslip screens' Loans and advances panel (board L4): each loan is two rows, the name and
   number with this payslip's deduction, then a quieter "Paid … of … · N left | <remaining> left"
   line tucked under it with no rule between. */
.sd-one .sp-slip-loan { padding-bottom: 0; min-height: 38px; }
.sd-one .sp-slip-loan-sub { border-top: 0; min-height: 0; padding: 0 0 10px; }
.sp-slip-loan-sub .sd-total { font-weight: 600; }
.sp-slip-word { color: var(--muted); font-weight: 500; }
/* On a phone the share lives in the Instalments pair (board L2): the Per instalment cell is the
   desktop's alone. */
@media (max-width: 899.98px) {
  .sp-loan-cell.sp-loan-desk { display: none; }
}

/* Pay structure (19 November 2026, ruling PS1-PS14): positions, their component templates, a
   person's pay table and the New staff preview. One row grammar, `.ps-row`: on a phone the name
   and the figure share the first line and the rest follows in ONE quieter line (the `.ps-c`
   cells joined by " · ", cut with an ellipsis, never wrapped); from 900 px the cells become
   columns under a header row. Everything here is `.ps-*`. */
.ps-panel, .ps-preview { container: ps / inline-size; }
.ps-panel { padding: 0; overflow: hidden; }
.ps-panel > h2:not(.sr-only) { margin: 0; }
.ps-head-bar { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-2); }
.ps-head-bar h2 { margin: 0; font-size: var(--text-lg); }
.ps-head-bar .muted { font-size: var(--text-sm); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ps-rows { margin: 0; padding: 0; list-style: none; }
.ps-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "sub sub" "acts acts"; column-gap: var(--space-3); row-gap: 2px; align-items: baseline; min-height: 56px; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.ps-rows > .ps-row:first-child, .ps-head + .ps-row { border-top: 0; }
.ps-head { display: none; }
.ps-row.is-left .ps-name, .ps-row.is-left .ps-val { color: var(--muted); }
.ps-name { grid-area: name; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; color: var(--ink); text-decoration: none; }
a.ps-name:hover, .ps-name a:hover { color: var(--oxblood); text-decoration: underline; }
.ps-name a { color: inherit; text-decoration: none; }
.ps-val { grid-area: val; justify-self: end; white-space: nowrap; font-weight: 700; text-align: right; }
.ps-sub { grid-area: sub; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: var(--text-sm); }
.ps-c { display: inline; }
.ps-c + .ps-c::before { content: " · "; }
.ps-c.is-warn { color: var(--warn); font-weight: 600; }
.ps-acts { grid-area: acts; display: flex; flex-wrap: nowrap; gap: var(--space-2); padding-top: var(--space-2); }
.ps-acts form { margin: 0; display: contents; }
.ps-acts .btn { flex: 0 1 auto; min-width: 0; }
.ps-a-name { grid-area: name; } .ps-a-val { grid-area: val; } .ps-a-staff { grid-area: staff; } .ps-a-tpl { grid-area: tpl; }
.ps-a-type { grid-area: type; } .ps-a-rule { grid-area: rule; } .ps-a-dflt { grid-area: dflt; } .ps-a-more { grid-area: more; }
.ps-a-from { grid-area: from; } .ps-a-to { grid-area: to; } .ps-a-diff { grid-area: diff; }
.ps-note { margin: var(--space-3) 0 0; }
.ps-lede { margin: 0; }
.ps-word { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.ps-word.is-ok { color: var(--ok); }
.ps-word.is-warn { color: var(--warn); }
.ps-person { margin-left: var(--space-1); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ps-sum { margin: var(--space-4) var(--space-4) var(--space-1); font-variant-numeric: tabular-nums; }
.ps-sum .ps-netline { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--muted); }
.ps-sum .ps-dot { display: none; }
.ps-net { margin: 0 var(--space-4) var(--space-1); color: var(--muted); font-size: var(--text-sm); }
.ps-diffline { margin: var(--space-1) var(--space-4) var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.ps-buttons { display: flex; flex-wrap: nowrap; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); }
.ps-buttons .btn, .ps-buttons form { flex: 1 1 0; min-width: 0; margin: 0; }
.ps-buttons form .btn { width: 100%; }
.ps-buttons .btn { padding: 0 var(--space-2); font-size: var(--text-sm); white-space: nowrap; }
.ps-cols { display: grid; gap: var(--space-5); align-items: start; }
.ps-cols > * { min-width: 0; }
.ps-stack { display: grid; gap: var(--space-5); min-width: 0; }
.ps-sheet { border-color: var(--oxblood); box-shadow: 0 0 0 1px var(--oxblood-line) inset, var(--shadow-panel); padding: var(--space-4); }
.ps-sheet > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-weight: 650; }
.ps-sheet > summary::-webkit-details-marker { display: none; }
.ps-sheet[open] > summary { margin-bottom: var(--space-3); }
.ps-pick { margin: 0 0 var(--space-4); padding: 0; border: 0; display: grid; gap: var(--space-2); }
.ps-pick legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.ps-pick label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; min-width: 0; }
.ps-pick label > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ps-pick small { font-weight: 400; color: var(--muted); font-size: var(--text-sm); margin-left: var(--space-1); }
.ps-pick input { width: 20px; height: 20px; accent-color: var(--oxblood); margin: 0; flex: none; }
.ps-prev { margin: 0 0 var(--space-4); padding: var(--space-3); list-style: none; display: grid; gap: 6px; background: var(--paper-2); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.ps-prev li { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ps-prev .muted { color: var(--muted); }
.ps-kicker { margin: 0 0 6px; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ps-preview { margin: 0 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.ps-preview .ps-kicker { margin: 0; padding: var(--space-3) var(--space-4) 0; text-transform: none; letter-spacing: 0; font-size: var(--text-sm); color: var(--ink); font-weight: 650; }
.ps-preview .ps-row { background: transparent; }
.ps-preview .ps-row.is-sum { font-weight: 700; }
.ps-preview .hint { padding: 0 var(--space-4) var(--space-3); margin: 0; }
.ps-dl { margin: 0; padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-2); }
.ps-dl div { display: flex; justify-content: space-between; gap: var(--space-3); }
.ps-dl dt { color: var(--muted); }
.ps-dl dd { margin: 0; font-weight: 600; }
.ps-facts > .hint { padding: 0 var(--space-4); }
.ps-facts .ob-actions { padding: var(--space-3) var(--space-4) var(--space-4); }
.ps-end { margin: var(--space-4) 0 0; }
@media (max-width: 899.98px) {
  .ps-lede { display: none; }
}
@container ps (min-width: 600px) {
  .ps-head, .ps-row { display: grid; align-items: center; column-gap: var(--space-4); grid-template-columns: var(--ps-cols); grid-template-areas: var(--ps-areas); min-height: 56px; }
  .ps-head { padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--paper-2); }
  .ps-head > * { min-width: 0; }
  .ps-head .ps-a-val, .ps-head .ps-a-from, .ps-head .ps-a-to { text-align: right; }
  .ps-sub { display: contents; }
  .ps-c + .ps-c::before { content: none; }
  .ps-c { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-size: var(--text-base); }
  .ps-c.num { text-align: right; }
  .ps-val { justify-self: stretch; }
  .ps-pos { --ps-cols: minmax(6.5rem, 0.6fr) 4.5rem minmax(0, 3fr) 5.5rem; --ps-areas: "name staff tpl val"; column-gap: var(--space-3); }
  .ps-pos .ps-row, .ps-pos .ps-head { column-gap: var(--space-3); }
  .ps-pos .ps-c.ps-a-tpl { font-size: var(--text-sm); }
  .ps-cat { --ps-cols: minmax(9rem, 1.3fr) 6rem 6.5rem minmax(0, 1.2fr) 5rem; --ps-areas: "name type rule dflt val"; }
  .ps-tbl { --ps-cols: minmax(8rem, 1.1fr) minmax(0, 1.5fr) 6.5rem 5.5rem 5.5rem; --ps-areas: "name rule val from to" "acts acts acts acts acts"; }
  .ps-tbl .ps-acts { justify-self: start; padding-top: 0; }
  .ps-tbl .ps-row { row-gap: var(--space-2); }
  .ps-who { --ps-cols: minmax(10rem, 1fr) 8rem minmax(0, 2fr); --ps-areas: "name val diff"; }
  .ps-prv { --ps-cols: minmax(0, 1.2fr) minmax(0, 1fr) 8rem; --ps-areas: "name rule val"; }
}
.ps-wide { display: none; }
.ps-narrow { display: inline; }
.ps-c.ps-a-to::before { content: " – "; }
@container ps (min-width: 600px) {
  .ps-sum .ps-netline { display: inline; margin: 0; font-size: inherit; color: inherit; }
  .ps-sum .ps-dot { display: inline; }
  .ps-c.ps-a-to::before { content: none; }
  .ps-wide { display: inline; }
  .ps-narrow { display: none; }
}

/* Pay structure review fixes (19 November 2026): the seeded preview's title sits clear of the
   table under it, and the Positions row title needs no cut-off of its own. */
.ps-preview .ps-kicker { padding-bottom: var(--space-3); }

/* Editable components (19 November 2026): the rule-change step and the "Make this the base" fold. */
.ps-step-title { margin: var(--space-4) 0 var(--space-3); font-size: var(--text-lg); }
.ps-rule-preview { margin: var(--space-4) 0; color: var(--ink); font-weight: 600; }
.ps-base { margin: var(--space-4) 0; max-width: 34rem; }
.ps-base summary { cursor: pointer; list-style: none; }
.ps-base summary::-webkit-details-marker { display: none; }
.ps-base form { margin-top: var(--space-3); }

/* Administration as a sidebar flyout (the owner, 25 November 2026, AF1-AF12; templates/partials/nav.html,
   static/js/nav-flyout.js). The Administration row is a button that looks like its neighbours' links;
   the panel is a charcoal sheet beside the sidebar (the sidebar's tokens), fixed, placed and clamped
   by the script, above the page, with a tail at the button. From 900 px only: below it the phone
   Menu sheet serves and neither is drawn. The old `.adm-*` shell rules above stay, unused. */
.nav-fly { display: none; }
@media (min-width: 900px) {
  .nav .nav-list .nav-fly-toggle { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); width: 100%; height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--on-dark); font: 500 0.9375rem/1.2 var(--font-body); text-align: left; text-decoration: none; cursor: pointer; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
  .nav .nav-list .nav-fly-toggle:hover, .nav .nav-list .nav-fly-toggle[aria-expanded="true"] { background: var(--charcoal-2); color: #fff; }
  .nav .nav-list .nav-fly-toggle[aria-current="page"] { background: var(--oxblood); color: #fff; font-weight: 600; }
  .nav .nav-list .nav-fly-toggle:hover .nav-icon, .nav .nav-list .nav-fly-toggle[aria-current="page"] .nav-icon, .nav .nav-list .nav-fly-toggle[aria-expanded="true"] .nav-icon { color: #fff; }
  .nav-fly-chev { flex: none; margin-left: auto; color: var(--on-dark-muted); }
  :root[data-nav-rail] .nav .nav-list .nav-fly-toggle { justify-content: center; width: 44px; padding: 0; }
  :root[data-nav-rail] .nav-fly-chev { display: none; }

  .nav-fly { display: block; position: fixed; z-index: 40; top: 0; left: 0; box-sizing: border-box; width: 272px; max-height: calc(100vh - 16px); padding: 8px; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius); background: var(--charcoal-2); color: var(--on-dark); box-shadow: 0 10px 28px rgb(0 0 0 / 35%); opacity: 0; visibility: hidden; transform: translateX(-4px); transition: opacity 140ms var(--ease), transform 140ms var(--ease), visibility 0s linear 140ms; }
  .nav-fly.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity 140ms var(--ease), transform 140ms var(--ease), visibility 0s; }
  .nav-fly-tail { position: absolute; left: -7px; top: 20px; width: 12px; height: 12px; border-left: 1px solid rgb(255 255 255 / 18%); border-bottom: 1px solid rgb(255 255 255 / 18%); background: var(--charcoal-2); transform: rotate(45deg); }
  /* A short window: the panel scrolls within itself (which would clip the tail, so it goes). */
  @media (max-height: 640px) { .nav-fly { overflow-y: auto; overscroll-behavior: contain; } .nav-fly-tail { display: none; } }
  .nav-fly-all, .nav-fly-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--on-dark); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
  .nav-fly-all { margin-bottom: 4px; padding-bottom: 0; border-bottom: 1px solid rgb(255 255 255 / 9%); border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: #fff; font-weight: 650; }
  .nav-fly-all::after { content: "\203A"; margin-left: auto; color: var(--on-dark-muted); font-size: 1.125rem; }
  .nav-fly-all:hover, .nav-fly-row:hover { background: rgb(255 255 255 / 8%); color: #fff; }
  .nav-fly-all:focus-visible, .nav-fly-row:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
  .nav-fly-all[aria-current="page"] { background: var(--oxblood); }
  .nav-fly-row[aria-current="page"] { background: var(--oxblood); color: #fff; font-weight: 600; }
  .nav-fly-row svg { flex: none; color: var(--on-dark-muted); }
  .nav-fly-row:hover svg, .nav-fly-row[aria-current="page"] svg { color: #fff; }
  .nav-fly-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-fly-count { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgb(224 164 106 / 18%); color: #e0a46a; font-size: 0.75rem; font-weight: 700; }
  .nav-fly-group { margin: 10px 0 2px 10px; color: var(--on-dark-muted); font: 700 0.6875rem/1 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; }
  .nav-fly-list { display: block; height: auto; margin: 0; padding: 0; list-style: none; }
}
@media (pointer: coarse) and (min-width: 900px) {
  .nav-fly-all, .nav-fly-row { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-fly, .nav-fly.is-open { transition: none; transform: none; }
}
/* Pages use the full width: the "‹ Administration" back-link is for the phone and tablet only (AF9). */
@media (min-width: 900px) {
  .adm-crumb { display: none; }
}

/* Home's paid graph as a line graph (the owner, 25 November 2026, HL1-HL10; the mockups LG1 and LG2):
   "Received vs expected, six periods" replaces the paid bars of 17 October 2026 (G2). Two series, two
   tones from the app's status tokens: Received --ok green, a heavier line with filled dots; Expected
   --danger red, a lighter line with hollow dots, so they differ by weight and fill as well as hue.
   The open month's last segment is dashed and its dots outlined; a month with nothing invoiced
   shows a hollow muted marker on the baseline. Text (legend, axis, label) is ink or muted, never in a
   series colour. Hairline gridlines, the axis and the tooltip stay as the bars had them. */
@media (min-width: 900px) {
  .hg-legend-row { display: flex; justify-content: flex-end; min-height: 20px; }
  .hg-legend { display: flex; gap: 14px; margin: 0; padding: 0; list-style: none; color: var(--ink); font-size: 12px; font-weight: 600; }
  .hg-legend li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
  .hg-legend svg { display: block; overflow: visible; }
  .hg-chart-line { padding-left: 62px; }  /* room for a 7-character axis figure ("600,000") */
  .hg-lines { display: block; overflow: visible; }
  .hg-line, .hg-line-expected, .hg-line-received { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
  .hg-line-expected { stroke: var(--danger); stroke-width: 1.5; }
  .hg-line-received { stroke: var(--ok); stroke-width: 2; }
  .hg-line.is-open { stroke-dasharray: 4 3; }
  .hg-dot { stroke-width: 1.75; }
  .hg-dot-received { fill: var(--ok); stroke: var(--ok); }
  .hg-dot-expected { fill: var(--surface); stroke: var(--danger); }
  .hg-dot-received.is-open { fill: var(--surface); }
  .hg-dot-expected.is-open { stroke-dasharray: 2 1.6; }
  .hg-zero { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
  .hg-col:hover .hg-dot, .hg-col:focus-visible .hg-dot { stroke-width: 2.5; }
}

/* Expenses › Record recurring (the owner, 25 November 2026; mockups RE1-RE5). One grid on one
   address: a row per recurring item, the standard filled in; the check and the Recorded page one
   line per row, the outcome in words at the right. On a phone each row is one line (tick, item,
   amount) with a second line holding the status word and "More" (paid to, date and receipt);
   from 900 px the rows align under a column header. Every control is 44 px or more. */
.xb-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.xb-head-actions .btn { min-height: 44px; }
.xb { display: flex; flex-direction: column; gap: var(--space-4); }
.xb-all { display: grid; gap: var(--space-2); padding: var(--space-3); }
.xb-all .field { margin: 0; }
.xb-all .field label { margin-bottom: 4px; }
.xb-all .field input { min-height: 44px; padding: 8px 12px; width: 100%; }
.xb-all-note { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.xb-sheet { padding: var(--space-1) var(--space-3); }
.xb-cols { display: none; }
.xb-rows { list-style: none; margin: 0; padding: 0; }
.xb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 124px; grid-template-areas: "tick item amount" "more more more"; column-gap: var(--space-2); align-items: center; padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }
.xb-row:last-child { border-bottom: 0; }
.xb-tick { grid-area: tick; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.xb-tick input { width: 22px; height: 22px; margin: 0; accent-color: var(--oxblood); cursor: pointer; }
.xb-tick input:disabled { cursor: not-allowed; }
.xb-item { grid-area: item; display: grid; gap: 1px; min-width: 0; }
.xb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.xb-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-xs); }
.xb-row .field { margin: 0; min-width: 0; }
.xb-row .field input { min-height: 44px; padding: 8px 10px; font-size: 0.875rem; }
.xb-row .money-input input { padding-left: 38px; text-align: right; font-weight: 600; }
.xb-row .money-prefix { left: 8px; font-size: 0.6875rem; }
.xb-amount { grid-area: amount; }
.xb-fixed { grid-area: amount; padding-right: 10px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.xb-label { display: block; margin-bottom: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.xb-more { grid-area: more; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-2); min-width: 0; padding-left: 52px; }
.xb-more-toggle { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; padding: 0; border: 0; background: none; color: var(--oxblood); font: inherit; font-size: var(--text-sm); font-weight: 650; cursor: pointer; border-radius: var(--radius-sm); }
.xb-more-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.xb-more-toggle::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(1px) rotate(225deg); transition: transform 120ms var(--ease); }
.xb-more.is-folded .xb-more-toggle::after { transform: translateY(-2px) rotate(45deg); }
.xb-more-body { flex-basis: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 132px 44px; gap: var(--space-2); padding: var(--space-1) 0 var(--space-2); }
.xb-more.is-folded .xb-more-body { display: none; }
.xb-status { flex: 1 1 auto; min-width: 0; text-align: right; color: var(--muted); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xb-status.is-warn { color: var(--warn); }
.xb-status-wide { grid-area: more; padding-left: 52px; text-align: left; padding-bottom: var(--space-1); }
.xb-row.is-off .xb-name { color: var(--muted); font-weight: 500; }
.xb-row.is-off .xb-tick input { accent-color: var(--line-strong); }
.xb-receipt { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.xb-attach { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; }
.xb-attach svg { width: 18px; height: 18px; }
.xb-attach.is-attached { color: var(--oxblood); border-color: var(--oxblood); }
.xb-attach:focus-within, .xb-receipt input:focus-visible + .xb-attach { box-shadow: var(--ring); }
.xb-foot { position: sticky; bottom: var(--tabbar-height); z-index: 2; display: flex; flex-direction: column; gap: var(--space-2); margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgb(26 26 26 / 25%); }
.xb-foot-words { margin: 0; text-align: center; }
.xb-foot .btn { width: 100%; min-height: 48px; }
.xb-foot-check, .xb-foot-done { position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.xb-foot-done { margin-top: var(--space-5); }
.xb-back { display: contents; }
.xb-note { padding: var(--space-3) var(--space-4); background: var(--warn-tint); border-radius: var(--radius-lg); }
.xb-checked { padding: 0 var(--space-3); }
.xb-check-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.xb-check-row:last-child { border-bottom: 0; }
.xb-line { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.xb-line b, .xb-line .num { color: var(--ink); font-weight: 600; }
.xb-why { color: var(--danger); }
.xb-word { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.xb-word a { color: inherit; }
.xb-word.is-ok { color: var(--ok); }
.xb-word.is-warn { color: var(--warn); }
.xb-word.is-no { color: var(--danger); }
.xb-left-out { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.xb-left-out strong { color: var(--ink); }
.sd-check-link { display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 -10px; font-size: var(--text-sm); font-weight: 650; }
@media (min-width: 900px) {
  .xb-all { grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: var(--space-3); }
  .xb-all .field input { width: 190px; }
  .xb-all-note { margin-bottom: 12px; }
  .xb-sheet { padding: var(--space-1) var(--space-4) var(--space-2); }
  .xb-cols, .xb-row { --xb-cols: 44px minmax(0, 1.5fr) 124px 150px 140px 52px minmax(0, 1fr); }
  .xb-cols { display: grid; grid-template-columns: var(--xb-cols); column-gap: 10px; padding: var(--space-3) 0 var(--space-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
  .xb-cols span:nth-child(3) { text-align: right; }
  .xb-row { grid-template-columns: var(--xb-cols); grid-template-areas: "tick item amount payee date receipt status"; column-gap: 10px; min-height: 56px; padding: 6px 0; }
  .xb-row:hover { background: var(--paper); }
  .xb-row .field input { font-size: 0.9375rem; }
  .xb-row .money-input input { padding-left: 42px; }
  .xb-more, .xb-more-body { display: contents; }
  .xb-more-toggle { display: none; }
  .xb-payee { grid-area: payee; }
  .xb-date { grid-area: date; }
  .xb-receipt { grid-area: receipt; flex-direction: row; justify-content: center; align-items: center; }
  .xb-status { grid-area: status; text-align: left; font-size: 0.8125rem; }
  .xb-status-wide { grid-area: payee / payee / payee / -1; padding: 0; }
  .xb-row.is-recorded .xb-status-wide, .xb-row.is-salary .xb-status-wide { grid-column: 4 / -1; grid-row: 1; }
  .xb-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .xb-foot { bottom: 0; flex-direction: row; align-items: center; justify-content: space-between; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); }
  .xb-foot-words { text-align: left; }
  .xb-foot .btn { width: auto; min-height: 44px; }
  .xb-foot-check, .xb-foot-done { justify-content: flex-start; }
  .xb-foot-check .btn-primary { margin-left: auto; }
  .xb-nothing-ready { margin-left: auto; text-align: right; }
  .xb-checked { padding: 0 var(--space-4); }
  .xb-check-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); min-height: 52px; font-size: var(--text-base); }
  .xb-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.xb-amount .xb-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.xb-row { grid-template-columns: 44px minmax(0, 1fr) 112px; }
@media (min-width: 900px) { .xb-row { grid-template-columns: var(--xb-cols); } }
/* Recurring grid heading: below 700 px the month sits in a sub-line, with no stray leading dot. */
@media (max-width: 699px) {
  .xb-head .xb-sep { display: none; }
  .xb-head .xb-month { display: block; margin-top: 2px; font-size: var(--text-sm); font-weight: 500; color: var(--muted); }
}

/* ======================================================================
   Units page: the stacking plan (the owner's U1, 27 November 2026, rulings UN1-UN9 in
   docs/decisions/2026-11-27-units-page-rulings.md). Append-only: the old row and tile-grid rules
   above are left as they were and no longer match anything on this page. The figure strip is
   `.un-fig*`, the plan `.sp-*`, the unit page's blocks `.ud-*`.
   ====================================================================== */
.un-figs { display: flex; margin: 0 0 var(--space-5); padding: 0; list-style: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.un-fig { flex: 1 1 0; min-width: 0; padding: var(--space-4) var(--space-5) var(--space-4) 0; }
.un-fig + .un-fig { padding-left: var(--space-5); border-left: 1px solid var(--line); }
.un-fig.is-hero { flex: 1.4 1 0; }
.un-fig-label { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; }
.un-fig-figure { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.un-fig.is-hero .un-fig-figure { font-size: 2.25rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.025em; }
.un-fig-kes { font-size: 0.6em; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.un-fig-note { margin: 4px 0 0; color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.un-fig-note.is-danger { color: var(--danger); font-weight: 600; }
.un-fig-note.is-warn { color: var(--warn); font-weight: 600; }

.sp { display: block; }
.sp-floors { display: grid; gap: var(--space-5); }
.unit-groups.sp-floors .unit-property + .unit-property { margin-top: 0; }
#unit-groups .unit-floor { border: 0; margin: 0; }
#unit-groups .building-body { padding: var(--space-4) var(--space-4) var(--space-5); }
#unit-groups .unit-property { display: grid; gap: var(--space-5); }
.sp-floor-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; margin: 0 0 var(--space-2); padding: 0 0 6px; border-bottom: 1px solid var(--line); list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sp-floor-head::-webkit-details-marker { display: none; }
.sp-floor-title { display: flex; flex: 1 1 auto; align-items: baseline; flex-wrap: wrap; gap: 2px var(--space-3); min-width: 0; }
.unit-floor .floor-name-text { color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; }
.unit-floor .floor-summary { margin-left: auto; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.sp-floor-rent { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.sp-chevron { flex: none; color: var(--muted); transition: transform 180ms var(--ease); }
.unit-floor[open] > .sp-floor-head .sp-chevron { transform: rotate(180deg); }
.sp-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.sp-tiles.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-tiles.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.sp-tiles .unit-row { display: flex; align-items: stretch; gap: 0; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; transition: none; }
.sp-tiles .unit-row:hover, .sp-tiles .unit-row:focus-within { background: none; }
.sp-tiles .unit-row + .unit-row { border-top: 0; }
.sp-tile { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 108px; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-panel); color: var(--ink); overflow: hidden; }
.sp-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.sp-tile.is-notice::before { background: var(--warn); }
.sp-tile.is-vacant::before { background: var(--line-strong); }
.sp-tile.is-leased::before { background: var(--muted); }
.sp-tile.is-vacant { background: var(--paper); border-style: dashed; box-shadow: none; }
.sp-tile.is-selected { border-color: var(--oxblood); border-style: solid; box-shadow: inset 0 0 0 1px var(--oxblood), var(--shadow-panel); }
.sp-tile:focus-within { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.sp-tile:hover { border-color: var(--line-strong); }
.sp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.sp-ident { min-width: 0; }
/* The number is the tile's one link; its box is stretched over the tile so the whole tile opens it. */
.sp-num { display: block; color: var(--ink); font-size: 1.375rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; text-decoration: none; }
.sp-num::after { content: ""; position: absolute; inset: 0; }
.sp-num:focus-visible { outline: 0; }
.sp-type { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.sp-state { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sp-marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sp-mark { display: inline-block; max-width: 100%; padding: 1px 7px; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; line-height: 1.35; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.sp-mark.is-danger { background: var(--danger-tint); color: var(--danger); }
.sp-mark.is-warn { background: var(--warn-tint); color: var(--warn); }
.sp-mark.is-quiet { background: var(--paper-2); color: var(--muted); }
.sp-who { margin-top: auto; padding-top: 10px; font-size: 0.875rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.sp-tile.is-vacant .sp-who { color: var(--muted); font-weight: 500; }
.sp-who .unit-row-action { position: relative; z-index: 1; display: flex; align-items: center; min-height: 44px; padding: 0; margin: 2px 0 0; font-size: 0.8125rem; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; color: var(--oxblood); font-weight: 650; text-decoration: none; }
.sp-who .unit-row-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.sp-rent { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-tiles.cols-5 .sp-tile { padding: 10px 8px 10px 14px; }
.sp-tiles.cols-5 .sp-num { font-size: 1.25rem; }

.sp-drawer { margin-top: var(--space-5); padding: var(--space-4) var(--space-5) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.sp-drawer:focus { outline: 0; }
.sp-drawer:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.sp-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sp-drawer-num { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.sp-drawer-meta { margin: 4px 0 var(--space-2); color: var(--muted); font-size: 0.875rem; }
.sp-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.sp-close:hover { background: var(--paper-2); color: var(--ink); }
.sp-drawer-facts { margin: 0; }
.sp-drawer-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.875rem; }
.sp-drawer-facts > div:last-child { border-bottom: 0; }
.sp-drawer-facts dt { color: var(--muted); }
.sp-drawer-facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sp-drawer-facts dd.is-danger { color: var(--danger); }
.sp-drawer-facts dd.is-warn { color: var(--warn); }
.sp-drawer-actions { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.sp-drawer-hint { margin: 0; color: var(--muted); font-size: 0.8125rem; text-align: center; }
.sp-drawer:not(.is-open) .sp-drawer-hint { padding: var(--space-4) 0; }
.sp-drawer.is-open > .sp-drawer-hint { margin-top: 10px; }
.sp-scrim { position: fixed; inset: 0; z-index: 40; background: rgb(26 26 26 / 32%); }
.sp-scrim[hidden] { display: none; }

/* Phone, tablet and a laptop below 1280 px: the drawer is a bottom sheet that exists only while a
   unit is chosen (UN5, amended by ruling C: beside the plan a 5-unit floor is under 110 px a tile
   from 1100 to 1279, so the side column starts at 1280). */
@media (max-width: 1279px) {
  .sp-drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; display: none; max-height: 85dvh; margin: 0; padding: var(--space-2) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom)); border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px -16px rgb(26 26 26 / 45%); overflow-y: auto; overscroll-behavior: contain; }
  .sp-drawer.is-open { display: block; }
  .sp-drawer.is-open::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: var(--line-strong); }
  .sp-drawer-head { margin-bottom: 10px; padding-bottom: 10px; }
  .sp-drawer-facts > div { padding: 8px 0; }
  .sp-drawer-actions { grid-template-columns: 1fr 1fr; margin-top: 14px; }
  .sp-drawer-actions .btn { min-height: 48px; }
  body.sp-sheet-open { overflow: hidden; }
}
@media (min-width: 1280px) {
  .sp { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 28px; align-items: start; }
  .sp-drawer { position: sticky; top: var(--space-5); margin-top: 0; }
  .sp-scrim { display: none; }
}
@media (max-width: 699px) {
  .un-figs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 var(--space-3); padding: var(--space-3) 0 14px; }
  .un-fig, .un-fig + .un-fig { padding: 0; border-left: 0; }
  .un-fig:nth-child(1), .un-fig:nth-child(2) { grid-column: span 3; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .un-fig:nth-child(2) { padding-left: var(--space-3); border-left: 1px solid var(--line); }
  .un-fig:nth-child(n+3) { grid-column: span 2; }
  .un-fig:nth-child(n+4) { padding-left: var(--space-3); border-left: 1px solid var(--line); }
  .un-fig-figure { font-size: 1.0625rem; }
  .un-fig:nth-child(2) .un-fig-figure { font-size: 1.25rem; }
  .un-fig.is-hero .un-fig-figure { font-size: 2rem; }
  .un-fig-label { margin-bottom: 3px; font-size: 10.5px; }
  .un-fig-note { font-size: 0.75rem; }
  .un-fig-more { display: none; }
  .sp-floors { gap: 18px; }
  .sp-tiles, .sp-tiles.cols-3, .sp-tiles.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sp-tile, .sp-tiles.cols-5 .sp-tile { min-height: 96px; padding: 10px 10px 10px 16px; }
  .sp-num, .sp-tiles.cols-5 .sp-num { font-size: 1.25rem; }
  .unit-floor .floor-summary { font-size: 0.78rem; text-align: right; }
  .sp-floor-rent { display: none; }
}

/* The unit page in the same language (U1d, UN10-UN13): hero, the floor strip, facts, this month's
   charges, deposit held, meter, documents, lease history. */
.ud-hero { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin: 0 0 var(--space-5); padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ud-ident { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.ud-mark { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--paper-2); color: var(--oxblood); }
.ud-id { min-width: 0; }
.ud-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ud-title h1 { margin: 0; font-size: 2.25rem; line-height: 1; letter-spacing: -0.03em; }
.ud-meta { margin: 6px 0 0; color: var(--muted); font-size: 0.9375rem; }
.ud-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ud-strip { margin: 0 0 var(--space-5); }
.ud-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-2); }
.ud-strip-head h2 { margin: 0; font-size: 1rem; font-weight: 650; }
.ud-strip-head h2 small { color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.ud-strip-head .link { min-height: 44px; display: inline-flex; align-items: center; }
.ud-strip-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ud-strip-tiles li { display: flex; min-width: 0; }
.ud-strip-tiles .sp-tile { min-height: 84px; padding: 10px 12px 10px 16px; text-decoration: none; }
.ud-strip-tiles .sp-num { font-size: 1.125rem; }
.ud-strip-tiles .sp-who { font-size: 0.8125rem; }
.ud-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5) 28px; align-items: start; }
.ud-col { display: grid; gap: var(--space-5); min-width: 0; }
.ud-section h2 { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-2); font-size: 1rem; font-weight: 650; letter-spacing: -0.005em; }
.ud-section h2 .link { margin-left: auto; font-size: 0.84rem; font-weight: 600; }
.ud-section h2 small { margin-right: auto; margin-left: 8px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.ud-list { margin: 0; }
.ud-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.ud-list dt { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.ud-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ud-list dd small { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 500; }
.ud-list .is-sum { border-top: 1.5px solid var(--ink); }
.ud-list .is-sum dt { color: var(--ink); font-weight: 650; }
.ud-list .is-sum dd { font-weight: 700; }
.ud-list dd.is-ok { color: var(--ok); }
.ud-list dd.is-danger { color: var(--danger); }
.ud-line.is-paid dd small { color: var(--ok); }
.ud-line.is-unpaid dd small, .ud-line.is-part dd small { color: var(--warn); font-weight: 600; }
.ud-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-5); margin: 0; }
.ud-facts > div { min-width: 0; padding: var(--space-3) 0 14px; border-top: 1px solid var(--line); }
.ud-facts dt { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; }
.ud-facts dd { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ud-facts dd small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; }
.ud-facts dd small.is-warn { color: var(--warn); font-weight: 600; }
.ud-facts dd small.is-danger { color: var(--danger); font-weight: 600; }
.ud-facts dd a { color: var(--ink); text-decoration: none; }
.ud-facts dd a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ud-history { margin: 0; padding: 0; list-style: none; }
.ud-history > li { min-height: 0; grid-template-areas: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.ud-history .ud-when { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.ud-history .ud-who { min-width: 0; }
.ud-history .tenancy-name { display: block; font-weight: 600; }
.ud-history .ud-status { justify-self: end; }
.ud-history small { display: block; color: var(--muted); font-size: 0.78rem; }
.ud-docs { margin: 0; padding: 0; list-style: none; }
.ud-docs li { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: 4px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.ud-docs svg { flex: none; color: var(--muted); }
.ud-docs .ud-doc { flex: 1 1 auto; min-width: 0; }
.ud-docs .ud-doc small { display: block; color: var(--muted); font-size: 0.78rem; }
.ud-docs .link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2); white-space: nowrap; }
.ud-meter { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: 0 0 var(--space-3); }
.ud-meter > div { padding: var(--space-3) 0 0; border-top: 1px solid var(--line); }
.ud-meter dt { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.ud-meter dd { margin: 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ud-meter dd small { display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.ud-panel { padding: var(--space-4) var(--space-5) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.ud-panel h2 { margin-bottom: 6px; }
.ud-dep-hero { margin: 4px 0 var(--space-2); font-size: 1.875rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ud-dep-words { margin: 0 0 var(--space-2); color: var(--muted); font-size: 0.84rem; }
@media (min-width: 700px) {
  .ud-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ud-history > li { grid-template-columns: 196px minmax(0, 1fr) auto; gap: var(--space-4); }
  .ud-history .ud-when { grid-column: auto; font-size: 0.9rem; white-space: nowrap; }
}
@media (min-width: 1100px) {
  .ud-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 699px) {
  .ud-title h1 { font-size: 1.875rem; }
  .ud-actions { width: 100%; }
  .ud-actions .btn { flex: 1 1 0; }
  .ud-strip-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Units drawer x 1.33 (the owner, 27 November 2026, ruling UN18, mockups D1 and D3): 312 px becomes
   416 px beside the plan from 1280 px, the type goes one step up inside it at every width, and the
   phone sheet is at most 70 % of the screen with its head and buttons pinned and the facts scrolling.
   Modifiers on the existing classes; nothing above is renamed. */
.sp-big .sp-drawer-num { font-size: 1.875rem; }
.sp-big .sp-drawer-meta { margin: 4px 0 10px; font-size: 0.9375rem; }
.sp-big .sp-drawer-facts > div { align-items: center; min-height: 48px; padding: 10px 0; gap: var(--space-3); font-size: 0.9375rem; }
.sp-big .sp-drawer-facts dt { flex: none; }
.sp-big .sp-drawer-facts dd { min-width: 0; }
.sp-big .sp-drawer-actions .btn { min-height: 48px; }
.sp-big .sp-drawer-hint { font-size: 0.875rem; }
@media (max-width: 1279px) {
  .sp-drawer.sp-big.is-open { display: flex; flex-direction: column; max-height: 70dvh; overflow: hidden; padding-bottom: 0; }
  .sp-drawer.sp-big.is-open::before { flex: none; }
  .sp-big .sp-drawer-head { flex: none; margin-bottom: 0; padding-bottom: 12px; }
  .sp-big .sp-drawer-facts { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .sp-big .sp-drawer-facts > div { padding: 10px 0; }
  .sp-big .sp-drawer-actions { flex: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); background: var(--surface); }
  .sp-drawer.sp-big.is-open > .sp-drawer-hint { flex: none; margin: 0; padding: 8px 0 calc(var(--space-4) + env(safe-area-inset-bottom)); }
}
@media (min-width: 1280px) {
  .sp { grid-template-columns: minmax(0, 1fr) 416px; gap: var(--space-5); }
  .sp-drawer.sp-big { padding: var(--space-5); }
  .sp-big .sp-drawer-head { margin-bottom: 8px; padding-bottom: 16px; }
  .sp-big .sp-close { margin: -10px -10px 0 0; }
  .sp-big .sp-drawer-actions { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
  .sp-big .sp-drawer-hint { margin-top: 12px; }
  /* The plan beside the wider drawer: tiles of at least 112 px (the column is 494 px at 1280) wrap (a five-unit floor 4 + 1, a four-unit floor one row). */
  .sp-tiles, .sp-tiles.cols-3, .sp-tiles.cols-5 { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
  .sp-tiles .sp-tile, .sp-tiles.cols-5 .sp-tile { padding: 12px 10px 12px 16px; }
  .sp-tiles .sp-num, .sp-tiles.cols-5 .sp-num { font-size: 1.3125rem; }
  .sp-tiles .sp-top { flex-direction: column; gap: 4px; }
  .sp-tiles .sp-marks { justify-content: flex-start; }
  .sp-floor-head { flex-wrap: wrap; gap: 2px 12px; }
}

/* Units as rows (the owner, 28 November 2026, rulings UN19-UN21, mockups R1, N2, R2): every floor is a
   list of full-width rows, in the All view and the filtered views alike, and the unit page's floor strip
   is the same row (`_unit_row.html`). The `.sp-tile*` and `.sp-tiles` rules above stay but nothing uses
   them; this block adds, it renames nothing. */
.sp-rows { display: grid; margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-panel); overflow: hidden; }
.sp-rows .unit-row { display: flex; align-items: stretch; gap: 0; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; transition: none; }
.sp-rows .unit-row:hover, .sp-rows .unit-row:focus-within { background: none; }
.sp-rows .unit-row + .unit-row { border-top: 1px solid var(--line); }
.sp-row { position: relative; flex: 1 1 auto; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto 16px; grid-template-areas: "num who marks rent chev" "num type type type chev"; align-items: center; gap: 0 16px; min-width: 0; min-height: 56px; padding: 8px 14px 8px 20px; color: var(--ink); }
.sp-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.sp-row.is-notice::before { background: var(--warn); }
.sp-row.is-vacant::before { background: var(--line-strong); }
.sp-row.is-leased::before { background: var(--muted); }
.sp-row.is-selected { background: var(--paper); box-shadow: inset 0 0 0 2px var(--oxblood); }
.sp-row:hover { background: var(--paper); }
.sp-row:focus-within { outline: 2px solid var(--oxblood); outline-offset: -2px; }
.sp-row-num { grid-area: num; align-self: center; color: var(--ink); font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.sp-row-num::after { content: ""; position: absolute; inset: 0; }
.sp-row-num:focus-visible { outline: 0; }
.sp-row-who { grid-area: who; display: block; min-width: 0; font-size: 0.9063rem; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row-who.is-vacant { display: flex; align-items: center; overflow: visible; color: var(--muted); font-weight: 500; }
.sp-row-who .unit-row-action { position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0 -12px 6px; padding: 0 2px; color: var(--oxblood); font-weight: 650; text-decoration: none; }
.sp-row-who .unit-row-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.sp-row-type { grid-area: type; display: block; min-width: 0; margin-top: 1px; color: var(--muted); font-size: 0.78rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row-marks { grid-area: marks; display: flex; gap: 4px; }
.sp-row-marks .sp-mark { white-space: nowrap; }
.sp-row-rent { grid-area: rent; min-width: 92px; font-size: 0.9063rem; font-weight: 600; text-align: right; }
.sp-row.is-vacant .sp-row-rent, .sp-row.is-leased .sp-row-rent { color: var(--muted); font-weight: 500; }
.sp-row-chev { grid-area: chev; width: 16px; height: 16px; color: var(--muted); }
.ud-strip-rows .sp-row { min-height: 52px; }
@media (max-width: 699px) {
  .sp-row { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "num who rent" "num type type" "num marks marks"; gap: 0 12px; min-height: 60px; padding: 10px 12px 10px 16px; }
  .sp-row-chev { display: none; }
  .sp-row-num { font-size: 1rem; }
  .sp-row-rent { min-width: 0; font-size: 0.875rem; }
  .sp-row-marks { justify-content: flex-start; margin-top: 6px; }
}
.sp-big .sp-drawer-facts dd { white-space: normal; overflow-wrap: anywhere; text-align: right; }

/* The drawer as a slide-over (the owner, 28 November 2026, ruling UN22; mockup D2's panel over R2's rows):
   from 1280 px the rows run the full width and the 416 px drawer slides in from the right edge over a
   scrim, existing only while a unit is chosen, as the bottom sheet below 1280 px does. This block comes
   after the side-column rules above and overrides them; nothing is renamed. */
@media (min-width: 1280px) {
  .sp { display: block; }
  .sp-drawer, .sp-drawer.sp-big { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; display: none; width: 416px; max-width: 100%; margin: 0; padding: var(--space-5); border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; box-shadow: -18px 0 44px -18px rgb(26 26 26 / 50%); overflow-y: auto; overscroll-behavior: contain; }
  .sp-drawer.is-open { display: block; }
  .sp-scrim { display: block; background: rgb(26 26 26 / 22%); }
  .sp-scrim[hidden] { display: none; }
  body.sp-sheet-open { overflow: hidden; }
}

/* Units, round 4 (the owner, 28 November 2026, UN23 amended, UN24): floors fold again from the
   title line, and a chosen unit's whole page block opens under the last floor. */
.sp-floor-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-3); color: var(--muted); font-size: 0.8125rem; }
.sp-floor-tools .floor-toggle-all { min-height: 44px; }
.unit-floor > summary.sp-floor-fold { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; margin: 0 0 10px; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.unit-floor > summary.sp-floor-fold::-webkit-details-marker { display: none; }
.sp-floor-fold h2 { flex: 1 1 auto; min-width: 0; }
.sp-floor-fold .sp-chevron { flex: none; color: var(--muted); transition: transform 0.15s ease; }
.unit-floor:not([open]) > .sp-floor-fold { margin-bottom: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.unit-floor:not([open]) > .sp-floor-fold .sp-chevron { transform: rotate(-90deg); }
.sp-block { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); scroll-margin-top: var(--space-5); }
.sp-block[hidden] { display: none; }
.sp-block:focus { outline: 0; }
.sp-block:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 4px; }
.sp-block-head { align-items: center; margin-bottom: 18px; }
.sp-block-head h2 { display: block; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -0.015em; }
.sp-block-head h2 small { margin: 0 0 0 8px; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.sp-block-head .link { min-height: 44px; display: inline-flex; align-items: center; }
.sp-block-head .sp-close { margin: -10px -10px -10px 0; }
.ud-section.ud-panel .ud-facts > div { border-top: 1px solid var(--line); }
.ud-section.ud-panel .ud-list > div:first-child, .ud-section.ud-panel .ud-history li:first-child { border-top: 0; }
@media (max-width: 699px) {
  .sp-block { margin-top: 20px; padding-top: 18px; }
  .sp-block-head { flex-wrap: wrap; gap: 8px 12px; }
  .sp-block-head h2 { font-size: 1.25rem; }
  .sp-block-head h2 small { display: block; margin: 2px 0 0; font-size: 0.78rem; }
}
.unit-floor > summary.sp-floor-fold { flex-wrap: nowrap; }
/* The folded floor's chevron turns about its centre, not its corner (UN25 round, 28 November 2026). */
.unit-floor > .sp-floor-fold .sp-chevron { transform-origin: 50% 50%; transform-box: fill-box; }

/* The lease card's "Upload lease agreement" button and its sheet (the owner, 30 November 2026,
   T17f): the button sits in the head's action row with Renew and Give notice, full width under
   them on a phone, auto-placed as they are; the sheet (hidden until the button opens it) sits
   under the facts, above the rent history: one line, the file field and Upload. */
.lease-upload { grid-area: auto; grid-column: 1 / -1; width: 100%; gap: var(--space-2); }
.lease-upload svg { color: var(--oxblood); }
.lease-upload.is-open { background: var(--oxblood-tint); border-color: var(--oxblood); color: var(--oxblood); }
@media (min-width: 900px) {
  .lease-upload { grid-area: auto; grid-column: auto; width: auto; }
}
.lease-upload-sheet { margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4); border: 1px solid var(--oxblood-line); border-radius: var(--radius); background: var(--oxblood-tint); }
.lease-upload-sheet[hidden] { display: none; }
.lease-upload-lead { margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.lease-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.lease-upload-file { flex: 1 1 220px; display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.lease-upload-file input { width: 100%; font-size: var(--text-sm); }

/* ======================================================================
   Tenants page in the Units row framework (the owner, 1 December 2026, rulings TN1-TN9 in
   docs/decisions/2026-12-01-tenants-page-rulings.md; mockups T1, T2, T3). Append-only: the figure
   strip, the floors (`.unit-floor > .sp-floor-fold`), the rows (`.sp-row`) and the block
   (`.sp-block`, `.ud-*`) are the Units page's own rules above. This adds only what Tenants needs;
   the old `.people` / `.person` rules stay and no longer match the list, `.people-cols` is gone.
   ====================================================================== */
/* The search left and the status chips right on one line; stacked on a phone, the chips wrapping. */
.tn-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0 0 var(--space-5); }
.tn-tools .search { flex: 0 1 340px; min-width: 220px; margin: 0; }
.tn-tools .search-input { min-height: 44px; border-radius: 999px; box-shadow: none; font-size: 0.9063rem; }
.tn-tools .chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; padding: 0; border: 0; background: none; }
.tn-tools .chip { flex-direction: row; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-2) 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--text-sm); }
.tn-tools .chip:hover { border-color: #b9ae9f; }
.tn-tools .chip-count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: var(--text-xs); line-height: 1; }
.tn-tools .chip[aria-current="page"], .tn-tools .chip[aria-current="page"]:hover { border-color: var(--oxblood); background: var(--oxblood); color: #fff; }
.tn-tools .chip[aria-current="page"] .chip-count { background: rgb(255 255 255 / 18%); }
@media (max-width: 899.98px) {
  .tn-tools { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .tn-tools .search { flex: none; min-width: 0; }
  .tn-tools .chips { justify-content: flex-start; }
}
/* The floors and buildings of the list stack as the plan's do (the Units page's #unit-groups rules). */
#tenant-groups .unit-floor { border: 0; margin: 0; }
#tenant-groups .unit-building + .unit-building { margin-top: 0; }
#tenant-groups .building-body { padding: var(--space-4) var(--space-4) var(--space-5); }
/* A row of the list: the Units row (`.sp-row`) with the unit pills in the number column, the name
   as the stretched link, the phone on the second line, the marks and the rent. */
.sp-rows .person { display: flex; align-items: stretch; gap: 0; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; transition: none; }
.sp-rows .person:hover, .sp-rows .person:focus-within { background: none; }
.sp-rows .person + .person { border-top: 1px solid var(--line); }
.sp-row.is-former::before { background: var(--line-strong); }
.sp-row .person-units { grid-area: num; display: flex; flex-direction: column; align-items: flex-start; align-self: center; gap: 4px; min-width: 0; }
.sp-row .person-units .unit-pill { min-width: 48px; height: 24px; background: var(--surface); }
.sp-row .person-none { color: var(--muted); font-size: 1.0625rem; font-weight: 500; }
.sp-row-who .person-name { color: var(--ink); text-decoration: none; }
.sp-row.is-former .person-name { color: var(--muted); }
.sp-row-who .person-name::after { content: ""; position: absolute; inset: 0; }
.sp-row-who .person-name:focus-visible { outline: 0; }
.sp-row .person-phone { grid-area: type; display: block; min-width: 0; margin-top: 1px; color: var(--muted); font-size: 0.78rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row .person-phone.person-missing { color: var(--warn); font-weight: 600; font-size: 0.78rem; }
.sp-row .sp-row-rent .person-complete { position: relative; z-index: 1; }
.sp-row.is-former .sp-row-rent { color: var(--muted); font-weight: 500; }
@media (max-width: 699px) {
  .sp-row .person-units { align-self: start; margin-top: 2px; }
  .sp-row .sp-row-rent .btn-small { padding: 0 10px; }
}
/* The tenant block's head and record (TN7). */
.sp-block-head .profile-status { flex: none; }
.sp-block-head .btn-small { flex: none; }
.ud-section .profile-contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.ud-section .profile-action-detail { display: inline; }
.tn-record { margin: 0; }
.tn-record > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.875rem; }
.tn-record > div:first-child { border-top: 0; }
.tn-record dt { color: var(--muted); }
.tn-record dd { margin: 0; overflow-wrap: anywhere; }
.ud-facts dd.is-ok { color: var(--ok); }
.ud-facts dd.is-danger { color: var(--danger); }
.ud-panel .profile-notes { margin: 0; font-size: 0.9rem; line-height: 1.5; }
@media (max-width: 699px) {
  .ud-section .profile-action { flex: 1 1 0; justify-content: center; padding: 0 8px; }
  .ud-section .profile-action-detail { display: none; }
  .sp-block-head .profile-status { margin-left: 0; }
}

/* The gap line under a name on the Needs data and Documents views (1 December 2026, TN5a): the warn
   tone and weight of mockup T3, above the older per-view ink rules, so a gap is not read as a phone. */
#tenant-results .sp-row .person-phone.person-missing { color: var(--warn); font-weight: 600; }
