:root {
  color-scheme: light dark; /* native controls follow the phone on neutral pages */
  --bg: #f6f7f9; --card: #fff; --text: #16181d; --muted: #5f6672;
  --line: #e2e5ea; --control: #858b96; --accent: #0b6e4f; --accent-text: #fff; --accent-weak: #e7f3ee;
  --danger: #b42318; --danger-text: #fff; --warn: #9a3c06; --warn-bg: #fff4e5; --warn-line: #f5d0a0;
  /* spacing, radius and size: the Rentday design system's tokens */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --radius-xs: 2px; --radius-sm: 8px; --radius-md: 10px; --radius-lg: 12px; --radius-pill: 999px;
  --tap-min: 44px; --control-h: 50px; --button-h: 52px; --row-h: 60px; --page-max: 560px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1a1d23; --text: #e8eaee; --muted: #9aa1ad;
    --line: #2a2f37; --control: #6b7280; --accent: #3bb98c; --accent-text: #0b1210; --accent-weak: #14322a;
    --danger: #f97066; --danger-text: #1f0d0b; --warn: #f2a65a; --warn-bg: #2e2112; --warn-line: #6b4a22;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}
/* Links are the accent colour and never underlined; rows and buttons set their own colour. */
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Form controls use the page font, not the browser's. */
button, input, select, textarea { font: inherit; color: inherit; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
header.top strong { font-size: 17px; }
header.top a { color: var(--text); text-decoration: none; }
header.top .brand { margin-right: auto; }
header.top .nav { color: var(--muted); margin-right: 8px; }
.field { margin-bottom: 14px; }
h2 { font-size: 17px; margin: 24px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
select { width: 100%; min-height: 50px; font-size: 18px; padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--control); background: var(--card); color: var(--text); }
.ok { color: var(--accent); margin: 8px 0 0; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=tel], input[type=text], input[type=number], input[type=search], input[type=date], input[type=month],
input[type=password], input[type=email], input:not([type]), textarea {
  width: 100%; min-height: 50px; font-size: 18px; padding: 12px; border-radius: var(--radius-md); appearance: none;
  border: 1px solid var(--control); background: var(--card); color: var(--text);
}
button, .btn {
  display: inline-block; width: 100%; margin-top: 12px; padding: 13px; font-size: 17px; font-weight: 600;
  border: 0; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-text); cursor: pointer;
}
button.link { width: auto; background: none; color: var(--muted); padding: 6px; margin: 0; font-weight: 500; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); margin: 8px 0 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 18px; }
.line { display: flex; justify-content: space-between; padding: 6px 0; }
.line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 18px; }
a.btn { text-align: center; text-decoration: none; margin: 4px 0 12px; }
.qr { text-align: center; }
.qr img { background: #fff; padding: 8px; border-radius: var(--radius-sm); image-rendering: pixelated; }
button.dev { background: var(--danger); color: var(--danger-text); }

/* ---- pay flow (v2) ---- */
.amounts { font-variant-numeric: tabular-nums; }
.pay-head { margin-bottom: 12px; }
.pay-head .to { font-size: 14px; color: var(--muted); }
.pay-head h1 { margin: 2px 0 4px; font-size: 24px; }
.pay-head .upi-name { font-size: 14px; color: var(--muted); }
.pay-head .upi-name b { color: var(--text); }
.line .detail { display: block; font-size: 14px; color: var(--muted); }
.line .detail.warn { color: var(--warn); }
.line > span:first-child { padding-right: 12px; }
.note-warn { background: var(--warn-bg); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-top: 10px; }
a.btn, .btn { display: flex; align-items: center; justify-content: center; min-height: 52px; }
.btn-secondary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px;
  margin: 8px 0; padding: 0 12px; font-size: 16px; font-weight: 600; border: 1px solid var(--control); border-radius: var(--radius-lg);
  background: var(--card); color: var(--text); text-decoration: none; cursor: pointer; }
.center { text-align: center; }
.small { font-size: 14px; }
.link-row { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 16px; }
.qr-title { font-weight: 600; margin: 0 0 8px; }
.status-card { text-align: center; padding: 28px 16px; }
.status-card h2 { border: 0; padding: 0; margin: 10px 0 8px; font-size: 24px; }
.status-card.warn { border-color: var(--warn-line); text-align: left; }
.status-card.warn h2 { margin-top: 6px; }
.hero { font-size: 28px; font-weight: 700; margin: 10px 0 4px; }
.spinner { width: 52px; height: 52px; margin: 0 auto; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--accent);
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.tick { width: 56px; height: 56px; margin: 0 auto; color: var(--accent); }
.applist { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.applist a { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 16px; border: 1px solid var(--control);
  border-radius: var(--radius-lg); background: var(--card); color: var(--text); font-size: 17px; font-weight: 600; text-decoration: none; }
.kv { display: flex; justify-content: space-between; padding: 4px 0; }
.kv span:first-child { color: var(--muted); }
.desktop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; align-items: start; }
main.wide { max-width: 860px; }
@media (max-width: 700px) { .desktop-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- owner app shell ---- */
body.app { padding-bottom: env(safe-area-inset-bottom); }
body.with-tabs main { padding-bottom: 80px; }
.app-bar { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px; }
.app-bar { display: flex; align-items: center; gap: 4px; }
.app-bar h1 { margin: 0; font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bar a.back { flex: none; width: 44px; height: 44px; margin: -10px 0 -10px -12px; justify-content: center; font-size: 28px; line-height: 1; color: var(--text); }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--muted); text-decoration: none; }
nav.tabs a.active { color: var(--accent); font-weight: 700; }
a.back { display: inline-flex; align-items: center; }
.checklist { list-style: none; padding: 0; }
.checklist .check { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.checklist .check:last-child { border-bottom: 0; }
.checklist .mark { flex: none; width: 28px; height: 28px; border: 2px solid var(--control); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 700; color: var(--accent-text); }
.checklist .done .mark { background: var(--accent); border-color: var(--accent); }
.checklist .what { flex-grow: 1; display: flex; flex-direction: column; }
.btn-small { flex: none; min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: var(--radius-md);
  background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; }
.menu { padding: 0; }
.menu a { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 8px 16px;
  border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.menu a:last-child { border-bottom: 0; }
.menu a > span:first-child { display: flex; flex-direction: column; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2.first { border: 0; padding: 0; margin: 4px 0 4px; font-size: 22px; }

/* ---- buildings ---- */
form.stack { display: flex; flex-direction: column; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid3 input { font-size: 16px; padding: 10px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 14px; font-weight: 400; }
.check-row input { width: 22px; height: 22px; margin: 0; }
.exp-row { align-items: flex-start; padding: 12px 0; margin: 0; border-bottom: 1px solid var(--line); }
.exp-row:last-child { border-bottom: 0; }
.exp-row input { flex: none; margin-top: 1px; }
.exp-row .col { gap: 2px; }
fieldset.choices { border: 0; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.choices legend { font-weight: 600; padding: 0 0 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--control); border-radius: var(--radius-md); font-weight: 400; margin: 0; }
.choice.on { border: 2px solid var(--accent); background: var(--accent-weak); }
.choice input { margin: 3px 0 0; width: 20px; height: 20px; flex: none; }
.choice > span { display: flex; flex-direction: column; }
.floor { padding: 0; }
.floor-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.floor-head .what { flex-grow: 1; display: flex; flex-direction: column; }
.floor-head form { margin: 0; }
button.square { width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid var(--control); border-radius: var(--radius-md);
  background: var(--card); color: var(--text); font-size: 20px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.tile { min-height: 60px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--text);
  text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 14px; }
.tile b { font-size: 16px; }
.tile.sel { border: 3px solid var(--accent); background: var(--card); }
.tag { font-size: 12px; font-weight: 600; color: var(--accent); }
.editor { margin: 0 12px 12px; padding: 12px; border-radius: var(--radius-md); background: var(--accent-weak); display: flex; flex-direction: column; gap: 8px; }
.editor .field { margin-bottom: 0; }
.fill-form { display: flex; flex-direction: column; border: 2px solid var(--accent); }
.fill-form .bed { font-size: 18px; }
.seg3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--control);
  border-radius: var(--radius-md); font-weight: 400; margin: 0; background: var(--card); }
.seg.on { border: 2px solid var(--accent); background: var(--accent-weak); font-weight: 600; }
.seg input { margin: 0; }
.bed-list .line { min-height: 40px; align-items: center; border-bottom: 1px solid var(--line); }
.bed-list .line:last-child { border-bottom: 0; }

/* ---- home ---- */
.stats-card .big { font-size: 20px; }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; font-size: 14px; }
.stat3 a { display: flex; flex-direction: column; gap: 2px; min-height: 44px; color: var(--text); text-decoration: none; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-xs); margin-right: 6px; }
.sw.ok { background: var(--accent); } .sw.late { background: var(--warn); } .sw.soon { background: var(--control); }
.warn { color: var(--warn); } .strong { font-weight: 600; }
.banner { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 8px 14px; margin-bottom: 12px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-lg); color: var(--text); text-decoration: none; }
.banner > span:first-child { min-width: 0; }
.banner > span:last-child { flex: none; padding-left: 12px; color: var(--warn); font-weight: 600; white-space: nowrap; }
.segs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--line); border-radius: var(--radius-md); padding: 3px; margin-bottom: 12px; font-size: 15px; }
.segs a { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.segs a.on { background: var(--card); font-weight: 600; }
.rows { padding: 0; }
.row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { flex-grow: 1; min-width: 0; color: var(--text); text-decoration: none; }
.row-main .line { padding: 2px 0; }
.row-main .line > span:first-child, .row-main .line > b:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .line > :last-child { flex: none; white-space: nowrap; }
.icon-btn { flex: none; width: 44px; height: 44px; border: 1px solid var(--control); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: var(--text); }

/* ---- tenant page ---- */
.nowrap { white-space: nowrap; }
.inline-act { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0 0 12px; font-weight: 600; text-decoration: none; }
.actions { margin-bottom: 8px; }
.actions .btn, .actions .btn-secondary { margin: 0; }
.card-title { border: 0; padding: 0; margin: 0 0 8px; font-size: 17px; }

/* ---- payments ---- */
.col { display: flex; flex-direction: column; }
.monthbar { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.square-link { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; text-decoration: none; }
.dayhead { display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; margin: 12px 2px 6px; text-transform: uppercase; }
a.row { display: block; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pick-list a { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 8px 14px; border: 1px solid var(--control);
  border-radius: var(--radius-lg); background: var(--card); color: var(--text); text-decoration: none; }
.toast { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 4px 4px 4px 16px; margin-bottom: 12px;
  border-radius: var(--radius-lg); background: var(--text); color: var(--bg); }
button.link-btn { width: auto; margin: 0; min-height: 44px; padding: 0 14px; background: none; color: var(--accent); font-weight: 700; }

/* ---- tenants list ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 8px; padding: 0 16px 4px; }
.chip { flex: none; min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: var(--radius-pill);
  border: 1px solid var(--control); background: var(--card); color: var(--text); text-decoration: none; font-size: 15px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.ok-text { color: var(--accent); font-weight: 600; }
.warn-text { color: var(--warn); }
button.danger { background: var(--danger); color: var(--danger-text); } /* 6.6:1 light, 6.7:1 dark */
.link-danger { color: var(--danger); }
form.inline-form { display: contents; }
button.icon-btn { background: var(--card); cursor: pointer; padding: 0; }
form.actions { display: block; margin: 0 0 12px; }
form.actions button { width: 100%; }
.month-switch { display: flex; gap: 12px; align-items: center; font-size: 15px; }
.month-switch a { color: var(--text); text-decoration: none; padding: 4px 6px; }

/* ---- tidy-up (17 Nov review) ---- */
.subtitle { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.actions-row { display: flex; gap: 8px; margin-bottom: 12px; }
.actions-row > :first-child { flex-grow: 1; }
.actions-row form { flex-grow: 1; margin: 0; }
.actions-row .btn-secondary { margin: 0; min-height: 52px; }
.actions-row .icon-btn { width: 52px; height: 52px; }
details.more-actions { margin-bottom: 12px; }
details.more-actions summary { display: flex; align-items: center; justify-content: center; min-height: 44px; color: var(--muted);
  font-weight: 600; cursor: pointer; list-style: none; }
details.more-actions summary::-webkit-details-marker { display: none; }
details.more-actions[open] summary { color: var(--text); }
.menu .danger-text { color: var(--danger); }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  border: 0; padding: 0; margin: 20px 2px 8px; }
.section-title:first-child { margin-top: 4px; }
.card > .field:last-child, .card > .hint:last-child { margin-bottom: 0; }
.hint { color: var(--muted); font-size: 14px; margin: -6px 0 14px; }
.bill-parts { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; white-space: normal; }
.row-link { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 0 2px 8px; }
.hint.center { margin: 10px 0 0; }
.field > .hint { margin: 6px 0 0; }
/* Icon buttons: no inherited form-button margin, so a <button> and a link line up. */
button.icon-btn { margin: 0; }
.icon-btn.labeled { width: 56px; height: 52px; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 600; line-height: 1; }
/* A form button that looks like a .menu row. */
.menu button.menu-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 60px; margin: 0;
  padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; color: var(--text);
  font-size: 16px; font-weight: 400; text-align: left; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
/* ---- receipt ---- */
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.receipt-amount { font-size: 28px; font-weight: 700; margin: 8px 0; }
@media print {
  .app-bar, nav.tabs, .no-print, .note-warn { display: none !important; }
  body, .card { background: #fff; color: #000; }
  .receipt { border: 1px solid #000; }
}

/* ---- tenants from a sheet ---- */
.sheet-help { margin: 0; padding-left: 20px; }
.sheet-help li { margin: 4px 0; }
.sheet-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sheet-row:last-child { border-bottom: 0; }
.sheet-row .error { margin: 2px 0 0; }
input[type=file] {
  width: 100%; min-height: 64px; padding: 8px; font-size: 15px; color: var(--muted); cursor: pointer;
  border: 1px dashed var(--control); border-radius: var(--radius-md); background: var(--card);
}
input[type=file]::file-selector-button {
  min-height: 46px; margin-right: 12px; padding: 0 16px; font: inherit; font-size: 16px; font-weight: 600;
  border: 1px solid var(--control); border-radius: var(--radius-md); background: var(--bg); color: var(--text); cursor: pointer;
}
input[type=file]:hover::file-selector-button { border-color: var(--accent); color: var(--accent); }
.sheet-sum { margin: 4px 0 0; }
.sheet-group { padding: 0 16px; }
.sheet-group > summary { display: flex; justify-content: space-between; align-items: center; min-height: 52px;
  font-weight: 600; cursor: pointer; list-style: none; }
.sheet-group > summary::-webkit-details-marker { display: none; }
.sheet-group > summary > span:first-child::before { content: "›"; display: inline-block; width: 16px; transition: transform .15s; }
.sheet-group[open] > summary > span:first-child::before { transform: rotate(90deg); }
.sheet-group[open] { padding-bottom: 8px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sheet-grid span { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ===== NEW: scale components (buildings with 1,000+ beds) ===== */
/* Search: one field, server-side, results update as you type. */
.search { position: relative; margin-bottom: var(--space-3); }
.search input[type=search] { border-radius: var(--radius-pill); padding-left: 44px; min-height: var(--control-h); font-size: 17px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-meta { display: flex; justify-content: space-between; align-items: center; min-height: 28px; margin: -4px 4px 8px; font-size: 14px; color: var(--muted); }

/* Pager: where you are in a long list, and the next page. */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: var(--space-3) 0; }
.pager .where { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager .where b { color: var(--text); }
.pager a, .pager span.off { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap-min); min-height: var(--tap-min);
  padding: 0 14px; border: 1px solid var(--control); border-radius: var(--radius-md); background: var(--card); color: var(--text); font-weight: 600; }
.pager span.off { color: var(--muted); border-color: var(--line); }

/* Floor jump: a sticky strip of floors with how full each is. */
.floor-jump { position: sticky; top: 0; z-index: 1; display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-2) var(--space-4);
  margin: 0 calc(-1 * var(--space-4)) var(--space-3); background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.floor-jump a { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 56px; min-height: var(--tap-min);
  padding: 4px 10px; border: 1px solid var(--control); border-radius: var(--radius-md); background: var(--card); color: var(--text); font-size: 14px; line-height: 1.2; }
.floor-jump a b { font-size: 16px; }
.floor-jump a small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.floor-jump a.on { border: 2px solid var(--accent); background: var(--accent-weak); }

/* Bed map: every room of a floor as a cell, one pip per bed. */
.bedmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.bedmap a { display: flex; flex-direction: column; gap: 4px; min-height: 56px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bedmap .pips { display: flex; flex-wrap: wrap; gap: 3px; }
.pip { width: 12px; height: 12px; border-radius: var(--radius-xs); background: var(--accent); }
.pip.vacant { background: transparent; border: 1.5px dashed var(--control); }
.pip.owes { background: var(--warn); }
.bedmap a.full { background: var(--accent-weak); border-color: var(--accent-weak); }
.bedmap a.has-owes { border-color: var(--warn-line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: var(--space-2) 2px; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Import summary: what a sheet will do, in counts, before anything is saved. */
.import-sum .count { font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.import-sum .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.import-sum .fact { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); font-size: 14px; color: var(--muted); }
.import-sum .fact b { display: block; color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }
.import-sum .fact.warn b { color: var(--warn); }
.problems { padding: 0; }
.problems a, .problems div { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); min-height: var(--tap-min);
  padding: 8px var(--space-4); border-bottom: 1px solid var(--line); color: var(--text); }
.problems > :last-child { border-bottom: 0; }
.problems .n { flex: none; min-width: 32px; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--warn-bg); color: var(--warn); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.problems details { border-bottom: 1px solid var(--line); }
.problems details:last-child { border-bottom: 0; }
.problems summary { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); min-height: var(--tap-min);
  padding: 8px var(--space-4); cursor: pointer; list-style: none; font-weight: 600; }
.problems summary::-webkit-details-marker { display: none; }
.problem-row { margin: 0; padding: 6px var(--space-4); border-top: 1px solid var(--line); }
.problem-row .error { display: block; margin: 2px 0 0; }

/* ===== Loading and failure states (static/app.js) ===== */
/* Top bar: any page change, submit, search or preview in flight. */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity .15s; }
.progress::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--accent);
  animation: progress-run 1s ease-in-out infinite; }
.progress.on { opacity: 1; }
@keyframes progress-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
/* The button that was pressed: spinner before its label, can't be pressed again. */
.is-loading { cursor: progress; }
button.is-loading, button.is-loading:disabled { opacity: 1; }
.is-loading::before { content: ""; flex: none; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px;
  border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
/* A link that was tapped (a row, a chip, a tab): dims until the page arrives. */
.is-pending { opacity: .55; transition: opacity .1s; cursor: progress; }
/* The area a preview or live search is refreshing. */
[aria-busy="true"]:not(button):not(a) { opacity: .55; transition: opacity .15s; }
/* Search: the glyph turns into a spinner while results load. */
.search.is-searching svg { visibility: hidden; }
.search.is-searching::before { content: ""; position: absolute; left: 16px; top: 50%; width: 16px; height: 16px; margin-top: -8px; z-index: 1;
  border-radius: 50%; border: 2px solid var(--muted); border-right-color: transparent; animation: spin .7s linear infinite; }
/* Lost connection or a server error. Tap to dismiss. */
.net-toast { position: fixed; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right));
  bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 20; max-width: 528px; margin: 0 auto; padding: 14px 16px;
  border-radius: var(--radius-lg); background: var(--text); color: var(--bg); font-size: 15px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .progress::before { animation: none; width: 100%; opacity: .6; }
  .is-loading::before, .search.is-searching::before { animation-duration: 2s; }
}

/* Late fee on caught-up rent only matters when there is a late fee. */
form:has(#late_fee_mode option[value="none"]:checked) .caught-up { display: none; }

/* A message to forward, shown as it will read. */
.share-msg { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--accent-weak); border-radius: var(--radius-sm); white-space: pre-wrap; }

/* ===== Themes (owner's choice in Settings → Look) =====
   Same layout for all; only colour, type and corners change. The owner app
   sets data-theme and data-mode (light | dark | auto) on <html>; pages
   without them (tenant pay page, login) keep the neutral palette above.
   Every text colour passes 4.5:1 on its backgrounds, controls 3:1. */
@font-face { font-family: "Source Sans 3"; src: url(/static/fonts/source-sans-3-var.woff2) format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/static/fonts/barlow-condensed-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/static/fonts/barlow-condensed-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/static/fonts/ibm-plex-sans-var.woff2) format("woff2"); font-weight: 100 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/static/fonts/ibm-plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/static/fonts/ibm-plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/static/fonts/ibm-plex-mono-600.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url(/static/fonts/bricolage-grotesque-var.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Hind"; src: url(/static/fonts/hind-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hind"; src: url(/static/fonts/hind-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Hind"; src: url(/static/fonts/hind-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Hind"; src: url(/static/fonts/hind-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
html[data-mode="light"] { color-scheme: light; }
html[data-mode="dark"] { color-scheme: dark; }

html[data-theme="register"] {
  --bg: #f7f7f2; --card: #ffffff; --text: #1d2b4f; --muted: #5b6478; --line: #dbe4f0; --control: #7d88a3; --accent: #2346a0; --accent-text: #ffffff; --accent-weak: #e8eefa; --danger: #8f1d16; --danger-text: #ffffff; --warn: #8a3b00; --warn-bg: #fdecdf; --warn-line: #f0c4a1;
  --font: 'Source Sans 3', system-ui, sans-serif; --font-display: 'Barlow Condensed', 'Source Sans 3', sans-serif; --display-weight: 700;
  --display-case: uppercase; --display-track: 0.01em; --font-num: 'IBM Plex Mono', ui-monospace, monospace;
  --radius-xs: 2px; --radius-sm: 3px; --radius-md: 4px; --radius-lg: 6px; --radius-pill: 3px;
}
html[data-theme="register"][data-mode="dark"] { --bg: #0e1424; --card: #172036; --text: #e6eaf5; --muted: #a6afc5; --line: #2a3653; --control: #6b7899; --accent: #9db8ff; --accent-text: #0e1424; --accent-weak: #1f2c52; --danger: #ff8a80; --danger-text: #2a0a08; --warn: #f3ad6a; --warn-bg: #2e2112; --warn-line: #6b4a22; }
@media (prefers-color-scheme: dark) {
  html[data-theme="register"]:not([data-mode="light"]) { --bg: #0e1424; --card: #172036; --text: #e6eaf5; --muted: #a6afc5; --line: #2a3653; --control: #6b7899; --accent: #9db8ff; --accent-text: #0e1424; --accent-weak: #1f2c52; --danger: #ff8a80; --danger-text: #2a0a08; --warn: #f3ad6a; --warn-bg: #2e2112; --warn-line: #6b4a22; }
}
html[data-theme="control"] {
  --bg: #f3f4f1; --card: #ffffff; --text: #191c1a; --muted: #5d635f; --line: #dfe2dd; --control: #858c86; --accent: #1f7a4d; --accent-text: #ffffff; --accent-weak: #eaf5ef; --danger: #a3221b; --danger-text: #ffffff; --warn: #8a4d00; --warn-bg: #fbf1e2; --warn-line: #efd3a6;
  --font: 'IBM Plex Sans', system-ui, sans-serif; --font-display: 'IBM Plex Sans', system-ui, sans-serif; --display-weight: 600;
  --display-case: none; --display-track: -0.01em; --font-num: 'IBM Plex Mono', ui-monospace, monospace;
  --radius-xs: 4px; --radius-sm: 5px; --radius-md: 6px; --radius-lg: 8px; --radius-pill: 999px;
}
html[data-theme="control"][data-mode="dark"] { --bg: #101311; --card: #191d1a; --text: #e4e7e3; --muted: #9ea6a0; --line: #2b312d; --control: #68716a; --accent: #5fd39a; --accent-text: #0b1510; --accent-weak: #16301f; --danger: #f97066; --danger-text: #1f0d0b; --warn: #f2a65a; --warn-bg: #2b2113; --warn-line: #665029; }
@media (prefers-color-scheme: dark) {
  html[data-theme="control"]:not([data-mode="light"]) { --bg: #101311; --card: #191d1a; --text: #e4e7e3; --muted: #9ea6a0; --line: #2b312d; --control: #68716a; --accent: #5fd39a; --accent-text: #0b1510; --accent-weak: #16301f; --danger: #f97066; --danger-text: #1f0d0b; --warn: #f2a65a; --warn-bg: #2b2113; --warn-line: #665029; }
}
html[data-theme="marigold"] {
  --bg: #f2f6f5; --card: #ffffff; --text: #0f2e2c; --muted: #4a6461; --line: #d3dfdc; --control: #738b88; --accent: #0d6b63; --accent-text: #ffffff; --accent-weak: #e3f1ee; --danger: #8a2a05; --danger-text: #ffffff; --warn: #7d4500; --warn-bg: #fdf0d5; --warn-line: #f1d49a;
  --font: 'Hind', system-ui, sans-serif; --font-display: 'Bricolage Grotesque', 'Hind', sans-serif; --display-weight: 800;
  --display-case: none; --display-track: -0.02em; --font-num: 'Hind', system-ui, sans-serif;
  --radius-xs: 8px; --radius-sm: 12px; --radius-md: 16px; --radius-lg: 22px; --radius-pill: 999px;
}
html[data-theme="marigold"][data-mode="dark"] { --bg: #0b1d1c; --card: #122d2b; --text: #e3efed; --muted: #a3bdb9; --line: #23443f; --control: #5b7f7a; --accent: #5ed3c3; --accent-text: #062421; --accent-weak: #153f3a; --danger: #ff9a7a; --danger-text: #2a0a02; --warn: #f5c26b; --warn-bg: #2c2611; --warn-line: #6a5620; }
@media (prefers-color-scheme: dark) {
  html[data-theme="marigold"]:not([data-mode="light"]) { --bg: #0b1d1c; --card: #122d2b; --text: #e3efed; --muted: #a3bdb9; --line: #23443f; --control: #5b7f7a; --accent: #5ed3c3; --accent-text: #062421; --accent-weak: #153f3a; --danger: #ff9a7a; --danger-text: #2a0a02; --warn: #f5c26b; --warn-bg: #2c2611; --warn-line: #6a5620; }
}
/* Theme type: headings and big figures in the display face, amounts in the number face. */
h1, .app-bar h1, .card-title, h2.first, .status-card h2, .hero, .receipt-amount, .import-sum .count, .big {
  font-family: var(--font-display, inherit); font-weight: var(--display-weight, 700);
  text-transform: var(--display-case, none); letter-spacing: var(--display-track, normal); }
.amounts .line > :last-child:not(:first-child), .pager .where, .stat3 b { font-family: var(--font-num, inherit); }
/* Theme picker swatches (Settings → Look): each theme's own dark and accent. */
.swatch { display: block; height: 40px; border-radius: var(--radius-sm); position: relative; box-shadow: inset 0 0 0 1px var(--control); }
.swatch::after { content: ""; position: absolute; left: 8px; bottom: 8px; width: 22px; height: 8px; border-radius: 4px; }
.swatch.register { background: #1d2b4f; } .swatch.register::after { background: #9db8ff; }
.swatch.control { background: #191c1a; } .swatch.control::after { background: #5fd39a; }
.swatch.marigold { background: #0f2e2c; } .swatch.marigold::after { background: #f5b301; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.themes .choice { flex-direction: column; gap: 8px; }
.themes .choice > span:nth-child(2) { flex-direction: row; align-items: center; gap: 6px; }
.themes .choice input { margin: 0; }
.themes .swatch { align-self: stretch; }
/* A picked choice shows at once, before saving. */
.choice:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-weak); }

/* ===== Today: the one screen ===== */
body.today { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.today-main { max-width: var(--page-max); margin: 0 auto; padding: 14px 16px 16px; }
.today-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.today-owner { font-family: var(--font-display, inherit); font-weight: var(--display-weight, 700); text-transform: var(--display-case, none);
  letter-spacing: var(--display-track, normal); font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-top .icon-btn { background: var(--card); }
.today-search { display: flex; align-items: center; gap: 10px; min-height: var(--control-h); padding: 0 16px; margin-bottom: 12px;
  border: 1px solid var(--control); border-radius: var(--radius-pill); background: var(--card); color: var(--muted); }
.today-search svg { width: 18px; height: 18px; flex: none; }
.today-hero { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 12px; border-radius: var(--radius-lg);
  background: var(--text); color: var(--bg); }
.today-hero .big { font-size: 28px; line-height: 1.15; }
.today-hero-label { font-size: 14px; opacity: .85; }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 8; }
.ring-track { stroke: color-mix(in srgb, var(--bg) 25%, transparent); }
.ring-done { stroke: var(--accent-weak); stroke-linecap: round; }
.today-rows { padding: 0; }
.today-rows a { display: flex; align-items: center; gap: 12px; min-height: var(--row-h); padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.today-rows a:last-child { border-bottom: 0; }
.grow { flex-grow: 1; min-width: 0; }
.today-count { flex: none; font-variant-numeric: tabular-nums; font-family: var(--font-num, inherit); font-weight: 600; }
.chev { flex: none; color: var(--muted); }
.today-icon { flex: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14px; background: var(--bg); color: var(--text); }
.today-icon.late { background: var(--warn-bg); color: var(--danger); }
.today-icon.due { background: var(--warn-bg); color: var(--warn); }
.today-icon.paid, .today-icon.ahead { background: var(--accent-weak); color: var(--accent); }
.today-icon.empty { background: transparent; border: 1.5px dashed var(--control); color: var(--muted); }
.today-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; gap: 10px; justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.today-actions > * { flex: 1; max-width: 264px; margin: 0; }
.today-actions .btn-secondary { min-height: 52px; }

/* The sheet: one at a time over Today; its steps replace each other. */
.scrim { position: fixed; inset: 0; z-index: 4; background: rgba(10, 12, 16, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
body:has(#sheet:not(:empty)) .scrim { opacity: 1; pointer-events: auto; }
body:has(#sheet:not(:empty)) { overflow: hidden; }
#sheet:empty { display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; max-width: var(--page-max); height: 90vh; height: 90dvh; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -12px 40px rgba(10, 12, 16, .25); overflow: hidden; }
.step { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: step-in .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes step-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.step-grab { width: 40px; height: 5px; margin: 8px auto 2px; border-radius: 3px; background: var(--control); flex: none; }
.step-bar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 8px; flex: none; }
.step-back { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 8px; font-weight: 600; }
.step-close { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--line); color: var(--text); font-size: 15px; }
.step-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.step-title { margin: 0 0 4px; font-size: 24px; }
.step-body > .subtitle { margin-bottom: 12px; }
.step-body .floor-jump { margin-left: -16px; margin-right: -16px; }

/* List rows in a step. */
.list-row { display: flex; align-items: center; gap: 12px; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--accent-weak); color: var(--accent); }
.avatar.empty { background: transparent; border: 1.5px dashed var(--control); color: var(--muted); }
.list-right { flex: none; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.list-right b { font-family: var(--font-num, inherit); }
.pill { display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted); }
.pill.late { background: var(--warn-bg); color: var(--danger); }
.pill.due { background: var(--warn-bg); color: var(--warn); }
.pill.paid { background: var(--accent-weak); color: var(--accent); }

/* Loading a step: a skeleton of the list it will be. */
.skel { display: block; height: 14px; border-radius: var(--radius-xs); background: var(--line); animation: skel 1.2s ease-in-out infinite alternate; }
.skel-title { width: 45%; height: 24px; margin: 4px 0 18px; }
.skel-row { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.skel-dot { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.w70 { width: 70%; } .w55 { width: 55%; } .w62 { width: 62%; } .w48 { width: 48%; } .w66 { width: 66%; } .w58 { width: 58%; }
@keyframes skel { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .step, .skel { animation: none; } .scrim { transition: none; } }
/* Lists in a step: as many filter tabs as there are, on one line. */
.step .segs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.step .segs a { flex: 1 0 auto; padding: 0 10px; white-space: nowrap; }
a.list-row, a.list-row.row { display: flex; }
/* In dark mode the month card is a lifted surface, not an inverted block. */
html[data-mode="dark"] .today-hero { background: var(--accent-weak); color: var(--text); }
html[data-mode="dark"] .ring-done { stroke: var(--accent); }
@media (prefers-color-scheme: dark) {
  html[data-theme]:not([data-mode="light"]) .today-hero { background: var(--accent-weak); color: var(--text); }
  html[data-theme]:not([data-mode="light"]) .ring-done { stroke: var(--accent); }
}
/* Bulk remind: rows become checkboxes; the bar counts the ticks (no script). */
.pick { cursor: pointer; }
.pick input { width: 22px; height: 22px; margin: 0; flex: none; }
#list-results { counter-reset: picked; }
#list-results input[name=t]:checked { counter-increment: picked; }
.bulk-bar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0; background: var(--bg); }
.bulk-bar button { margin: 0; flex: 1; min-height: 52px; }
.bulk-picked::before { content: "Remind " counter(picked) " "; } .bulk-picked { font-size: 0; } .bulk-picked::before, .bulk-picked::after { font-size: 17px; } .bulk-picked::after { content: "on WhatsApp"; }
#list-results:not(:has(input[name=t]:checked)) .bulk-picked { opacity: .5; pointer-events: none; }
/* Setup inside Today. */
.setup-steps { list-style: none; margin: 0 0 12px; }
.setup-steps li > a, .setup-steps li > div { display: flex; align-items: center; gap: 12px; min-height: var(--row-h); padding: 8px 14px;
  border-bottom: 1px solid var(--line); color: var(--text); }
.setup-steps li:last-child > * { border-bottom: 0; }
.setup-steps .off { color: var(--muted); }
.setup-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; border: 2px solid var(--control); color: var(--muted); }
.setup-mark.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.setup-mark.next { border-color: var(--accent); color: var(--accent); }
/* Focus moves to a step's title for screen readers; it is not a control. */
.step-title:focus { outline: none; }
/* Building switch: Today's title, and the list it opens. */
.today-switch { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap-min); padding: 0 14px; min-width: 0;
  border: 1px solid var(--control); border-radius: var(--radius-pill); background: var(--card); color: var(--text); font-weight: 600; }
.today-switch > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-list form { margin: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--row-h); margin: 0; padding: 8px 14px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; color: var(--text); font-weight: 400; text-align: left; }
.switch-list form:last-child .switch-row { border-bottom: 0; }
.switch-row.on { background: var(--accent-weak); }
.switch-tick { color: var(--accent); font-weight: 700; }
/* Toast: what just happened, with Undo; it fades after ten seconds. */
.toast-bar { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6; max-width: 528px;
  margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 6px 6px 6px 16px; border-radius: var(--radius-lg); background: var(--text); color: var(--bg);
  font-size: 15px; box-shadow: 0 10px 30px rgba(10, 12, 16, .3); animation: toast-out .4s ease 10s forwards; }
.toast-bar form { margin: 0; flex: none; }
.toast-undo { width: auto; margin: 0; min-height: 40px; padding: 0 14px; background: transparent; color: var(--bg); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; }
.toast-bar:focus-within { animation-play-state: paused; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .toast-bar { animation-duration: 0s; } }
/* Toast: what just happened, with Undo; it fades after ten seconds. */
.toast-bar { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6; max-width: 528px;
  margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 6px 6px 6px 16px; border-radius: var(--radius-lg); background: var(--text); color: var(--bg);
  font-size: 15px; box-shadow: 0 10px 30px rgba(10, 12, 16, .3); animation: toast-out .4s ease 10s forwards; }
.toast-bar form { margin: 0; flex: none; }
.toast-undo { width: auto; margin: 0; min-height: 40px; padding: 0 14px; background: transparent; color: var(--bg); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; }
.toast-bar:focus-within { animation-play-state: paused; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .toast-bar { animation-duration: 0s; } }
/* Record payment, as drawn: the amount large, quick amounts, then how. */
.pay-amount { display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 8px 0 4px;
  font-family: var(--font-display, inherit); font-weight: var(--display-weight, 700); font-size: 40px; }
.pay-amount input { width: 7ch; min-height: 0; padding: 0; border: 0; border-bottom: 2px solid var(--line); border-radius: 0;
  background: transparent; font: inherit; text-align: center; font-variant-numeric: tabular-nums; }
.pay-amount input:focus { outline: none; border-bottom-color: var(--accent); }
.pay-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }
.pay-chips .chip { width: auto; margin: 0; min-height: 40px; font-weight: 600; cursor: pointer; }
.pay-chips .chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.pay-date { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 4px 14px;
  border-radius: var(--radius-md); background: var(--bg); }
.step-body .pay-date { background: var(--card); }
.pay-date label { margin: 0; color: var(--muted); font-weight: 400; }
.pay-date input { width: auto; min-height: 44px; border: 0; background: transparent; }
.pay-after { margin: 0 0 8px; }
/* Person step, as drawn: balance, three actions, a ledger by month. */
.balance-card { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; margin-bottom: 12px; border-radius: var(--radius-lg);
  background: var(--accent-weak); color: var(--text); }
.balance-card.late { background: var(--warn-bg); color: var(--danger); }
.balance-card.due { background: var(--warn-bg); color: var(--warn); }
.balance-card .big { font-size: 26px; }
.balance-side { align-items: flex-end; text-align: right; }
.owed-lines { padding: 8px 14px; }
.person-actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.person-actions > *, .person-actions form > button { margin: 0; min-height: 52px; }
.person-actions form { margin: 0; display: flex; }
.person-actions form > button { flex: 1; }
.ledger { margin-bottom: 16px; }
.ledger-month { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 14px 2px 4px; font-size: 14px; }
.ledger-items { list-style: none; margin: 0; padding: 0 0 0 4px; border-left: 2px solid var(--line); }
.ledger-items li { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 7px 0 7px 14px; font-size: 15px; }
.dot { position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--control); }
.dot.paid { background: var(--accent); } .dot.late { background: var(--danger); } .dot.due { background: var(--warn); }
.dot.ahead { background: var(--text); } .dot.off { background: var(--line); border: 1.5px solid var(--control); }
.move-out-btn { color: var(--danger); margin-bottom: 12px; }
/* Search: an overlay at the top of Today, as drawn. */
.sheet:has(.palette) { top: calc(12px + env(safe-area-inset-top)); bottom: auto; left: 12px; right: 12px; height: auto; max-height: 78vh;
  border-radius: var(--radius-lg); }
@media (min-width: 584px) { .sheet:has(.palette) { left: 0; right: 0; } }
.palette { overflow: hidden; }
.palette-bar { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.palette-bar svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.palette-bar input { flex: 1; min-height: 44px; padding: 0; border: 0; background: transparent; font-size: 17px; }
.palette-bar input:focus { outline: none; }
.palette-cancel { flex: none; min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--radius-sm);
  background: var(--line); color: var(--text); font-size: 14px; }
.palette-results { overflow-y: auto; padding: 0 14px; }
.palette-results .list-row { border-bottom: 1px solid var(--line); padding: 8px 0; }
.palette-note { margin: 10px 0 14px; font-size: 14px; color: var(--muted); }
/* Today rows as drawn: total on the right, a small bar, one line of note. */
html[data-theme="register"] { --ring: #9db8ff; --ring-track: #34446d; }
html[data-theme="control"] { --ring: #5fd39a; --ring-track: #2e322f; }
html[data-theme="marigold"] { --ring: #f5b301; --ring-track: #23514d; }
html[data-theme] .ring-done { stroke: var(--ring); }
html[data-theme] .ring-track { stroke: var(--ring-track); }
.today-row-body { gap: 4px; }
.today-line { display: flex; justify-content: space-between; gap: 8px; }
.today-sum { flex: none; font-family: var(--font-num, inherit); font-weight: 600; font-variant-numeric: tabular-nums; }
.today-sum.late { color: var(--danger); } .today-sum.due { color: var(--warn); } .today-sum.paid { color: var(--accent); }
.minibar { display: block; width: 100%; height: 6px; }
.bar { fill: var(--control); }
.bar.late { fill: var(--danger); } .bar.late-mid { fill: var(--warn); } .bar.late-soft { fill: var(--warn-line); }
.bar.due { fill: var(--warn); } .bar.paid { fill: var(--accent); }
.bar.filled { fill: var(--line); } .bar.vacant { fill: var(--text); }
.bar.day0 { fill: var(--line); } .bar.day1 { fill: var(--control); } .bar.day2 { fill: var(--muted); } .bar.day3 { fill: var(--text); }
.today-icon.move, .pill.move { background: var(--move-bg); color: var(--text); }
.today-icon.week { background: var(--bg); color: var(--muted); }
.btn.btn-dark { background: var(--text); color: var(--bg); }
.switch-item { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.switch-item:last-child { border-bottom: 0; }
.switch-item form { flex: 1; }
.switch-item .switch-row { border-bottom: 0; }
.switch-details { flex: none; display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 14px; font-size: 14px; font-weight: 600; }
/* Sheet heights by step, as drawn. */
.sheet:has(.step.size-pay) { height: 64vh; height: 64dvh; }
.sheet:has(.step.size-person) { height: 86vh; height: 86dvh; }
/* Lists: floor headers stay at the top while scrolling; floors on a rail
   at the right; the pager (or the bulk bar) stays at the sheet's foot. */
.group-head { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 2px 6px; background: var(--bg); }
.list-body.with-rail { display: flex; gap: 8px; align-items: flex-start; }
.list-main { flex: 1; min-width: 0; }
.floor-rail { position: sticky; top: 8px; flex: none; width: 34px; display: flex; flex-direction: column; gap: 2px; padding: 4px 2px;
  border-radius: var(--radius-md); background: var(--card); border: 1px solid var(--line); max-height: 70vh; overflow-y: auto; scrollbar-width: none; }
.floor-rail a { display: flex; align-items: center; justify-content: center; min-height: 30px; border-radius: var(--radius-sm);
  font-family: var(--font-num, inherit); font-size: 13px; font-weight: 600; color: var(--muted); }
.floor-rail a.on { background: var(--text); color: var(--bg); }
.step-foot { position: sticky; bottom: 0; z-index: 2; margin: 8px -16px 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); }
.step-foot .pager { margin: 0; }
.step-foot .bulk-bar { position: static; padding: 0; }
.step-body:has(.step-foot) { padding-bottom: 0; }
.menu .menu-off { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 8px 16px; color: var(--muted); }
.menu .menu-off > span:first-child { display: flex; flex-direction: column; }
/* Leaving card, as drawn. */
.leaving-card { background: var(--move-bg); border-color: transparent; box-shadow: inset 3px 0 0 var(--control); }
.leaving-card > b { display: block; margin-bottom: 4px; font-size: 17px; }
.menu .menu-btn > span:first-child { display: flex; flex-direction: column; }
/* A step loading: the skeleton over the step being left, which stays in the
   page (hidden) so Back can restore it. */
#sheet.is-loading-step > :not([data-skeleton]) { display: none; }
/* A segment shows what is checked now, not what the server last drew. */
.seg:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-weak); font-weight: 600; }
.seg.on:not(:has(input:checked)) { border: 1px solid var(--control); background: var(--card); font-weight: 400; }
.pay-form .seg input { position: absolute; opacity: 0; pointer-events: none; }
.pay-form .seg { position: relative; }
.pay-form .seg:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Record payment: the save button stays in view at the sheet's foot. */
.pay-form .pay-save { position: sticky; bottom: 0; z-index: 2; margin: 8px -16px 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); }
.pay-form .pay-save button { margin: 0; }
.step-body:has(.pay-save) { padding-bottom: 0; }
/* Person actions: one height. */
.person-actions > *, .person-actions form > button { min-height: 52px; height: 52px; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.add-account > summary { cursor: pointer; list-style: none; display: flex; align-items: center; min-height: var(--tap-min); margin: 0; }
.add-account > summary::-webkit-details-marker { display: none; }
.add-account > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
/* Add tenant: the bed picker inside the form */
.bed-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.bed-field > legend { padding: 0; margin-bottom: 6px; }
.bed-pick { padding: 0; }
.bed-pick > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap-min); padding: 10px 14px; cursor: pointer; }
.bed-pick > summary::-webkit-details-marker { display: none; }
.bed-pick > summary .link { color: var(--accent-ink, var(--accent)); font-weight: 600; }
.bed-pick[open] > summary { border-bottom: 1px solid var(--line); }
.bed-pick .search { margin: 10px 14px 0; }
.bed-choices { max-height: 46vh; overflow-y: auto; padding: 4px 0 8px; }
.bed-choices > p.muted, .bed-choices > .search-meta { padding: 8px 14px; margin: 0; }
.bed-floor { position: sticky; top: 0; background: var(--card); margin: 0; padding: 10px 14px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bed-choice { display: flex; align-items: center; gap: 12px; min-height: var(--tap-min); padding: 6px 14px; cursor: pointer; }
.bed-choice:has(input:checked) { background: var(--accent-weak); }
.bed-choice input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* Someone moving: a neutral tint in every theme, never the paid colour. */
:root, html[data-theme] { --move-bg: color-mix(in srgb, var(--text) 8%, var(--card)); }

/* Review m2, m16, n7: every tap target at least 44px; disclosures look
   tappable; search dims Today. */
.step-close { width: var(--tap-min); height: var(--tap-min); }
.chip, .pay-chips .chip { min-height: var(--tap-min); }
.floor-rail a { min-height: var(--tap-min); }
.palette-cancel { min-height: var(--tap-min); }
input[type="month"], input[type="date"] { min-height: var(--control-h); }
details.more-actions summary { justify-content: space-between; padding: 0 14px; min-height: var(--tap-min);
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); color: var(--text); }
details.more-actions summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
details.more-actions[open] summary::after { transform: rotate(180deg); }
body:has(.sheet .palette) .scrim { opacity: 1; pointer-events: auto; background: rgba(10, 12, 16, .28); }
[hidden] { display: none !important; }
/* Today rows: an empty row is quiet; every bar has its track. */
.bar.track { fill: var(--line); }
.today-rows a.zero .today-sum { color: var(--muted); font-weight: 500; }
.today-rows a.zero .today-icon { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.today-icon svg { display: block; }
.ledger-amt { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.ledger-amt.paid { color: var(--accent); } .ledger-amt.late { color: var(--danger); } .ledger-amt.off { color: var(--muted); font-weight: 500; }
.btn-secondary.is-off { opacity: .6; cursor: default; pointer-events: none; display: inline-flex; align-items: center; justify-content: center; }
/* Fieldsets are groups, not boxes; segment radios show as the segment. */
fieldset.field, fieldset.choices { border: 0; padding: 0; margin: 0 0 var(--space-3, 12px); min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.seg3 .seg input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg3 .seg { position: relative; cursor: pointer; }
.seg3 .seg:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.unreachable p { margin: 4px 0 10px; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions-row .btn-secondary { min-height: var(--tap-min); }
/* Error, offline and sign-in pages: one centred card. */
.status-page { margin-top: 12vh; padding: 24px 20px; }
.status-page h1 { font-size: 22px; margin: 0 0 8px; }
.status-page .ref { font-family: var(--font-num, ui-monospace, monospace); letter-spacing: .08em; }
.status-page .actions-row { margin-top: 16px; }
/* Sign in */
.login { max-width: 400px; margin: 8vh auto 0; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 20px; }
.login-mark { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; }
.login h1 { margin: 0 0 4px; font-size: 26px; }
.login > .muted { margin: 0 0 20px; }
.login .note-warn { margin-bottom: 12px; }
.phone-field, .password-field { display: flex; align-items: stretch; border: 1px solid var(--control); border-radius: var(--radius-md);
  background: var(--card); overflow: hidden; }
.phone-field:focus-within, .password-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.phone-field > span { display: flex; align-items: center; padding: 0 4px 0 14px; color: var(--muted); font-weight: 600; }
.phone-field input, .password-field input { flex: 1; min-width: 0; border: 0 !important; outline: none !important; background: transparent; }
.show-pw { width: auto; min-height: var(--control-h); margin: 0; padding: 0 14px; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
.status-page h2 { border: 0; padding: 0; margin: 0 0 8px; font-size: 20px; }

/* Scrollbars: thin and in the theme's colours everywhere (no grey system
   bars with arrows in a dark theme); the sheet keeps its gutter so content
   doesn't jump as a list grows or shrinks; side-scrolling strips (chips,
   segments, the floor jump) scroll without a bar. */
:root { --scroll-thumb: color-mix(in srgb, var(--text) 28%, transparent); --scroll-thumb-hover: color-mix(in srgb, var(--text) 45%, transparent); }
html, .step-body, .palette-results, .bed-choices, .floor-rail { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.step-body { scrollbar-gutter: stable; }
.chips, .segs, .step .segs, .floor-jump, .floor-rail { scrollbar-width: none; }
/* Safari and older Chrome read these instead. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.chips::-webkit-scrollbar, .segs::-webkit-scrollbar, .floor-jump::-webkit-scrollbar, .floor-rail::-webkit-scrollbar { display: none; }
/* While a sheet is open the page behind it stays still. */
html:has(#sheet:not(:empty)) { overflow: hidden; }
/* Where scrollbars take room (mouse devices), the gutter stands in for the
   right padding, so the list sits centred. Phones overlay their bars. */
@media (pointer: fine) { .step-body { padding-right: 6px; } }

/* Icons are SVG (views/icons.templ), centred by box, not by a font's
   glyph metrics. */
.icon { display: block; flex: none; }
.step-close, .back, .square, .setup-mark, .switch-tick { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.step-back, a.back { display: inline-flex; align-items: center; gap: 2px; }
.step-back .icon { margin-left: -6px; }
.chev, .caret { display: inline-flex; align-items: center; color: var(--muted); }
/* Arrows drawn in CSS: the same chevron as a mask, in the text colour. */
:root { --icon-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E"); }
details.more-actions summary::after, .add-account > summary::after { content: ""; width: 18px; height: 18px; flex: none; margin-left: auto;
  background: var(--muted); -webkit-mask: var(--icon-caret) center / contain no-repeat; mask: var(--icon-caret) center / contain no-repeat; }
.sheet-group > summary > span:first-child::before { content: ""; width: 16px; height: 16px; vertical-align: -3px;
  background: currentColor; -webkit-mask: var(--icon-chevron) center / contain no-repeat; mask: var(--icon-chevron) center / contain no-repeat; }

/* Room names (views/names.templ) */
.room-names { border: 0; padding: 0; margin: 0 0 var(--space-3); min-width: 0; }
.room-names > legend { font-weight: 700; font-size: 17px; padding: 0; margin-bottom: 2px; }
.name-cards { display: grid; gap: 8px; margin: 8px 0 4px; }
.name-card input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.name-card { position: relative; }
.name-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.name-sample { font-family: var(--font-num, ui-monospace, monospace); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.name-preview { margin: 12px 0; }
.name-details[open] ~ * {}
.room-names:has(.name-details[open]) .name-preview { position: sticky; top: 0; z-index: 2; box-shadow: 0 6px 16px -12px rgba(0,0,0,.4); }
.name-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 3px 0; }
.name-row > :last-child { text-align: right; overflow-wrap: anywhere; }
.name-status { margin: 8px 0 0; }
.name-details > summary { list-style: none; display: flex; align-items: center; min-height: var(--tap-min); cursor: pointer; }
.name-details > summary::-webkit-details-marker { display: none; }
.name-details > summary::after { content: ""; width: 18px; height: 18px; flex: none; margin-left: auto;
  background: var(--muted); -webkit-mask: var(--icon-caret) center / contain no-repeat; mask: var(--icon-caret) center / contain no-repeat; }
.name-details[open] > summary::after { transform: rotate(180deg); }
.name-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.name-chip { position: relative; cursor: pointer; }
.name-chip input, .name-seg input { position: absolute; opacity: 0; pointer-events: none; }
.name-chip.on, .name-chip:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-weak); font-weight: 600; }
.name-chip:has(input:focus-visible), .name-seg:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.name-chip.off, .name-seg.off { opacity: .45; cursor: not-allowed; }
.name-seg { flex-direction: column; text-align: center; padding: 6px 4px; }
.room-names p.label { margin: 0 0 4px; font-weight: 600; }
/* Chosen chips: readable in every theme (the generic .chip.on is a dark fill). */
.name-chip.on, .name-chip:has(input:checked) { color: var(--text); }
button.text-link { width: auto; margin: 0; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600;
  min-height: var(--tap-min); text-align: left; justify-content: flex-start; }
.name-card .name-sample { word-break: keep-all; }
.name-row > :first-child { flex: none; white-space: nowrap; }
.name-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; }
.name-list > .name-sample, .name-chip .name-sample, .name-seg .name-sample { white-space: nowrap; }
/* Check new names: old → new, then who lives there */
.rename-rows { padding: 0 0 6px; }
.rename-row { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1.2fr) 84px; align-items: center; gap: 6px;
  min-height: var(--tap-min); padding: 6px 14px; border-top: 1px solid var(--line); }
.rename-row > :nth-child(2) { color: var(--muted); text-align: center; }
.rename-row > :last-child { text-align: right; white-space: nowrap; }
.rename-row .name-sample { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rename-row.conflict { background: var(--warn-bg); box-shadow: inset 3px 0 0 var(--danger); }
.plain-list { margin: 6px 0 0; padding-left: 18px; }
.plain-list li { margin: 2px 0; }
.banner.danger { display: block; background: var(--warn-bg); border: 1px solid var(--danger); color: var(--text); border-radius: var(--radius-md); padding: 10px 14px; }
/* Room names, from the design review */
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.name-seg .name-sample { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prefix-field.quiet { display: none; }
.room-names:has(.name-details[open]) .prefix-field.quiet { display: block; }
.name-preview > .name-intro { margin-top: 0; }
.name-preview .hint { margin: 10px 0 0; }
.name-preview.long .name-row { flex-direction: column; align-items: stretch; gap: 0; }
.name-preview.long .name-list { justify-content: flex-start; }
.room-names:has(.name-details[open]) .name-preview { max-height: 38vh; overflow-y: auto; }
.room-names:has(.name-details[open]) .name-preview > .name-intro,
.room-names:has(.name-details[open]) .name-preview > .hint { display: none; }
.now-tag { color: var(--accent); font-weight: 600; }
.rename-row { grid-template-columns: auto 20px minmax(0, 1fr) 84px !important; }
.rename-check .card.amounts p:last-child { margin-bottom: 0; }
.name-seg { min-width: 0; } .name-seg > .col { min-width: 0; max-width: 100%; align-items: center; }
/* Add building: Room names folds to one row until "Change" is tapped. */
.names-fold > summary { list-style: none; cursor: pointer; }
.names-fold > summary::-webkit-details-marker { display: none; }
.names-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--row-h);
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.names-row .col { min-width: 0; }
.names-row .name-sample { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.names-row .link { color: var(--accent); font-weight: 600; flex: none; }
.names-fold .names-done, .names-fold[open] .names-change { display: none; }
.names-fold[open] .names-done { display: inline; }
.names-fold[open] > .names-row { margin-bottom: 8px; }

/* Test mode: a bar on every page, so a test is never mistaken for real. */
.test-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn-line); font-size: 14px; }
.test-bar form { margin: 0; }
.test-bar-btn { min-height: 36px; width: auto; padding: 0 12px; font-size: 14px; background: transparent; color: var(--warn);
  border: 1px solid var(--warn-line); border-radius: var(--radius-pill); }
@media print { .test-bar { display: none !important; } }

input.mono-input { font-family: var(--font-num); font-size: 14px; padding: 12px 10px; }
.mono-input + .hint { margin-top: 8px; }

/* Get the app: space between a button and the hint under it. */
button + .hint, [data-push] + .hint, .hint.spaced { margin-top: 12px; }
