:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #e9ecf0;
  --border: #c3c9d2;
  --text: #0a0e17;
  --muted: #39424f;
  --brand: #1646c8;
  --brand-ink: #ffffff;
  --brand-soft: #dde7ff;
  --sidebar: #0b111d;
  --sidebar-text: #eef1f5;
  --sidebar-active: #243149;
  --rail-btn: #1a2436;
  --rail-border: #3a4862;
  --brand-rail: #1f5eff;
  --ok: #075a31;
  --ok-soft: #d6f0e0;
  --warn: #6e3f00;
  --warn-soft: #ffeac2;
  --bad: #961a10;
  --bad-soft: #fbdcd8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}

/* Dark: chosen with the dashboard switch, or following the computer when nothing is chosen. */
:root[data-theme="dark"] {
  --bg: #07090d;
  --surface: #11151d;
  --surface-2: #1a212d;
  --border: #3b4659;
  --text: #f7f8fa;
  --muted: #c9d0db;
  --brand: #8fb0ff;
  --brand-ink: #0b1020;
  --brand-soft: #1b2a4d;
  --sidebar: #05070a;
  --sidebar-text: #e3e8ef;
  --sidebar-active: #1a2233;
  --rail-btn: #121a28;
  --rail-border: #33415a;
  --brand-rail: #1f5eff;
  --ok: #6ee7a0;
  --ok-soft: #12301f;
  --warn: #fcd34d;
  --warn-soft: #3a2c0c;
  --bad: #fca5a5;
  --bad-soft: #3b1515;
  --shadow: none;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07090d;
    --surface: #11151d;
    --surface-2: #1a212d;
    --border: #3b4659;
    --text: #f7f8fa;
    --muted: #c9d0db;
    --brand: #8fb0ff;
    --brand-ink: #0b1020;
    --brand-soft: #1b2a4d;
    --sidebar: #05070a;
    --sidebar-text: #e3e8ef;
    --sidebar-active: #1a2233;
    --rail-btn: #121a28;
    --rail-border: #33415a;
    --brand-rail: #1f5eff;
    --ok: #6ee7a0;
    --ok-soft: #12301f;
    --warn: #fcd34d;
    --warn-soft: #3a2c0c;
    --bad: #fca5a5;
    --bad-soft: #3b1515;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
::placeholder { color: var(--muted); opacity: .85; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 116px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--sidebar) 116px, transparent 116px); }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  padding: 12px 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rail-border) transparent;
  border-right: 1px solid var(--rail-border);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rail-border); border-radius: 3px; }
.rail { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
nav.rail { flex: 1; }
.rail-sep { height: 2px; border-radius: 2px; background: var(--rail-border); margin: 4px 0; }
/* Each menu button is its own clearly outlined box, with its name under the icon. */
.rail-btn {
  width: 100%; min-height: 62px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 10px; border: 1px solid var(--rail-border); background: var(--rail-btn); color: var(--sidebar-text);
  cursor: pointer; font: inherit; padding: 8px 4px; text-decoration: none; text-align: center;
  transition: background-color .12s, color .12s, border-color .12s;
}
.rail-btn .icon, .rail-btn .logo, .rail-btn .avatar-initials { flex: none; }
.rail-label { font-size: .7rem; font-weight: 600; line-height: 1.15; overflow-wrap: normal; word-break: normal; hyphens: none; }
.rail-btn .icon { width: 24px; height: 24px; stroke-width: 2; }
.rail-btn:hover, .rail-btn:focus-visible { background: var(--sidebar-active); border-color: #6b7a96; color: #fff; text-decoration: none; }
.rail-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rail-btn.active { background: var(--brand-rail); border-color: #fff; color: #fff; box-shadow: 0 0 0 1px #fff; }
/* Council reconciliation and the rent run stand out in red. */
.rail-btn.rail-red { color: #ff6b6b; border-color: #c43b3b; background: #3a1418; }
.rail-btn.rail-red:hover, .rail-btn.rail-red:focus-visible { color: #fff; border-color: #ff6b6b; background: #5a1c22; }
.rail-btn.rail-red.active { background: #d92d2d; border-color: #fff; color: #fff; }
.brand-btn { margin-bottom: 4px; }
.brand-btn .logo { width: 30px; height: 30px; }
.brand-btn.active .logo { box-shadow: none; }
.avatar-initials { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--sidebar); font-size: .78rem; font-weight: 800; }

.link-btn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; text-decoration: underline; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 28px 32px 60px; width: 100%; min-width: 0; }
/* The bar along the top of every page: who's signed in, My account and Sign out. Always visible. */
.topbar { position: sticky; top: 0; z-index: 15; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; color: var(--sidebar-text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sidebar) 88%, #1f5eff 12%), var(--sidebar));
  box-shadow: 0 1px 0 var(--rail-border), 0 6px 18px -10px rgba(4, 10, 30, .55); }
/* A thin brand-coloured line along the bottom, fading out at each end. */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--brand-rail) 25%, #7c5cff 60%, transparent); opacity: .7; }
.topbar-agency { display: flex; align-items: center; gap: 12px; min-width: 0; font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; }
.agency-mark { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; font-weight: 800; font-size: .95rem;
  background: linear-gradient(135deg, var(--brand-rail), #7c5cff); box-shadow: 0 2px 8px rgba(31, 94, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.agency-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar-actions form { margin: 0; }
.topbar-actions .theme-toggle { margin-right: 6px; }
.topbar-sep { width: 1px; height: 28px; margin: 0 6px; background: var(--rail-border); }
.topbar-btn { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px 0 9px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--sidebar-text); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; }
.topbar-btn:hover, .topbar-btn:focus-visible { background: var(--rail-btn); border-color: var(--rail-border); color: #fff; text-decoration: none; }
.topbar-btn.active { background: var(--brand-rail); border-color: transparent; color: #fff; box-shadow: 0 2px 10px rgba(31, 94, 255, .35); }
.topbar-signout:hover, .topbar-signout:focus-visible { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
.topbar-btn .icon { width: 19px; height: 19px; margin-left: 3px; opacity: .9; }
.topbar-btn .avatar-initials { width: 30px; height: 30px; background: linear-gradient(135deg, #fff, #dbe4ff); box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 3.5px var(--brand-rail); }
.topbar-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-sub { font-weight: 400; font-size: .74rem; opacity: .7; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .topbar-btn { transition: none; } }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); padding: 0 8px 4px; }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 1.4rem; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-weight: 800; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumb { font-size: .85rem; display: inline-block; margin-bottom: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.count { font-size: .8rem; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 99px; margin-left: 4px; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 .card { margin-bottom: 0; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); box-shadow: var(--shadow); }
a.tile:hover { border-color: var(--brand); text-decoration: none; }
.tile .label { font-size: .8rem; color: var(--muted); }
.tile .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .value.sm { font-size: 1.1rem; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.tile.alert { border-color: var(--bad); background: var(--bad-soft); }
.tile.alert .value { color: var(--bad); }
.tile.warn { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); font-weight: 600; }
tr.sub td { color: var(--muted); font-style: italic; }
tr.total td { font-weight: 700; border-top: 2px solid var(--text); }

.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); text-transform: capitalize; white-space: nowrap; }
.badge.s-active, .badge.s-let, .badge.s-managed, .badge.s-completed { background: var(--ok-soft); color: var(--ok); }
.badge.s-vacant, .badge.s-open, .badge.s-pending, .badge.warn, .badge.p-high, .badge.s-high { background: var(--warn-soft); color: var(--warn); }
.badge.s-suspended, .badge.bad, .badge.p-emergency, .badge.s-emergency, .badge.s-ended { background: var(--bad-soft); color: var(--bad); }
.badge.plain { text-transform: none; }
.badge.s-admin, .badge.s-in-progress { background: var(--brand-soft); color: var(--brand); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 4px; }

/* ---------- forms ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[type="radio"] { width: auto; }
label { font-size: .88rem; font-weight: 600; display: block; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label input { margin-top: 4px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field label { margin-bottom: 4px; }
.field.wide, .wide { grid-column: 1 / -1; }
.req { color: var(--bad); }
.help { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.field-err { font-size: .82rem; color: var(--bad); margin-top: 3px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.segmented { display: flex; gap: 16px; margin-bottom: 14px; }
.segmented label { display: flex; gap: 6px; align-items: center; font-weight: 500; }
[hidden] { display: none !important; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.inline-form > div { flex: 1 1 260px; }
.inline-form h2 { margin-bottom: 2px; }
.inline-form p { margin: 0; }
.inline-form label input, .inline-form label select { margin-top: 4px; font-weight: 400; }
.inline-form input, .inline-form select { width: auto; }
.search input { min-width: 240px; }
.search-bar { display: flex; gap: 8px; margin: 0 0 16px; }
.search-bar input { flex: 1; min-width: 0; font-size: 1rem; padding: 10px 14px; }
.search-count { margin: -8px 0 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin: 0 0 0 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.small { padding: 5px 10px; font-size: .82rem; }

.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: .92rem; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.err { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- detail pages ---------- */
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 24px; margin: 0; }
.details dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.details .wide { grid-column: 1 / -1; }
.row-start { grid-column-start: 1; }
.with-photo { display: flex; gap: 24px; align-items: flex-start; }
.with-photo > .details { flex: 1; min-width: 0; }
.council-photo { flex: none; width: 180px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.council-photo img, .photo-empty { width: 180px; height: 180px; border-radius: var(--radius); border: 1px solid var(--border); object-fit: contain; background: var(--surface-2); }
.photo-empty { display: flex; align-items: center; justify-content: center; font-size: 3.4rem; font-weight: 700; color: var(--muted); }
.council-photo form { margin: 0; }
.photo-upload label.btn { cursor: pointer; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 2px 6px; }
.btn.link:hover { color: var(--bad); }
a.with-thumb, h1.with-thumb { display: inline-flex; align-items: center; gap: 14px; }
h1.with-thumb { display: flex; }
.code-chip { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-size: .95rem; font-weight: 700; vertical-align: middle; letter-spacing: .02em; }
img.title-thumb { width: 80px; height: 80px; border-radius: 8px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
img.thumb { width: 52px; height: 52px; border-radius: 6px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.callout { display: flex; justify-content: space-between; align-items: center; background: var(--ok-soft); color: var(--ok); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.callout strong { font-size: 1.2rem; }
.callout.alert { background: var(--bad-soft); color: var(--bad); }
.danger-zone { border-color: var(--bad); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.summary div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.summary span { font-size: .8rem; color: var(--muted); }
/* One box split into three, under the properties list. */
.rent-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.rent-totals div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; text-align: center; }
.rent-totals div + div { border-left: 1px solid var(--border); }
.rent-totals span { font-size: .8rem; color: var(--muted); }
.rent-totals strong { font-size: 1.25rem; }
.rent-totals small { font-size: .72rem; color: var(--muted); }
.rent-totals .rt-good { background: var(--ok-soft, rgba(16, 150, 90, .1)); }
.rent-totals .rt-good strong { color: var(--ok, #0a7a4a); }
.rent-totals .rt-bad { background: var(--bad-soft); }
.rent-totals .rt-bad strong { color: var(--bad); }
@media (max-width: 560px) { .rent-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rent-totals div:nth-child(2n+1) { border-left: 0; } .rent-totals div:last-child:nth-child(odd) { grid-column: 1 / -1; } .rent-totals div:nth-child(n+3) { border-top: 1px solid var(--border); } .rent-totals strong { font-size: 1rem; } .rent-totals span { font-size: .72rem; } .rent-totals div { padding: 10px 6px; } }

/* ---------- admin chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bar-fill { width: 100%; max-width: 44px; background: var(--brand); border-radius: 5px 5px 0 0; height: 2%; }
.bar-val { font-size: .75rem; font-weight: 600; }
.bar-label { font-size: .72rem; color: var(--muted); }

/* ---------- public pages ---------- */
.public { max-width: 1040px; margin: 0 auto; padding: 48px 16px; }
.auth .public { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.narrow { max-width: 420px; width: 100%; }
.center { text-align: center; margin: 60px auto; }
.narrow h1 { margin: 14px 0 16px; }
.hero { padding: 40px 0 30px; max-width: 760px; }
.hero h1 { font-size: 2.4rem; line-height: 1.15; margin: 20px 0 14px; }
.lead { font-size: 1.1rem; color: var(--muted); margin-bottom: 24px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.features .card { margin: 0; }
.features p { margin: 0; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; background: none; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; padding: 8px 12px; overflow-x: auto; overflow-y: hidden; }
  .rail { flex-direction: row; }
  nav.rail { flex: none; }
  .rail-sep { width: 2px; height: 32px; margin: 0 4px; }
  .rail-btn { width: 90px; height: 62px; min-height: 0; padding: 4px 3px; }
  .rail-label { font-size: .62rem; }
  .rail-sep { width: 2px; }
  .brand-btn { margin: 0 4px 0 0; }
  .content { padding: 20px 16px 48px; }
  .topbar { top: 78px; height: 52px; padding: 0 12px; }
  .topbar-sub { display: none; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .search input { min-width: 0; width: 100%; }
  .with-photo { flex-direction: column; }
  .council-photo { flex-direction: row; width: auto; }
  .council-photo img, .photo-empty { width: 80px; height: 80px; }
  .hero h1 { font-size: 1.8rem; }
}

@media print {
  .sidebar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
}

/* ---------- invoices ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .9rem; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
table.clickable tbody tr[data-href] { cursor: pointer; }
.file-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
label.check input { width: auto; margin-top: 4px; }
.spaced { margin-top: 16px; }

/* ---------- monthly statements ---------- */
.statement-doc h3 { margin: 22px 0 8px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 14px; margin-bottom: 18px; }
.doc-head h2 { margin: 2px 0; }
.doc-agency { font-weight: 800; color: var(--brand); letter-spacing: .02em; }
.doc-to { text-align: right; }
.ai-summary { background: var(--brand-soft); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.ai-summary p { margin: 4px 0 0; }
.ai-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.summary.big strong { font-size: 1.2rem; }
.summary .hl { background: var(--ok-soft); color: var(--ok); }
.summary .hl span { color: var(--ok); }
@media print { .ai-summary { background: #f2f4f8; } .doc-agency { color: #000; } }

/* ---------- autosave ---------- */
.save-status { align-self: center; font-size: .85rem; color: var(--muted); }
.save-status.ok { color: var(--ok); }
.save-status.err { color: var(--bad); font-weight: 600; }
.save-status.busy { color: var(--warn); }
.link-btn.inline { color: inherit; padding: 0; margin-left: 6px; }
.steps { margin: 0 0 10px; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- sign-in / create-account pages: everything centred ---------- */
.auth .narrow { text-align: center; }
.auth .narrow .brand { display: flex; justify-content: center; padding: 0; }
.auth .narrow .stack label { text-align: center; }
.auth .narrow input { text-align: center; }
.auth .narrow .notice, .auth .narrow .help, .auth .narrow .field-err { text-align: center; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.co-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.co-name { color: var(--brand); }
.co-sep { color: var(--muted); font-weight: 400; }
.co-date { align-self: center; margin-left: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.login-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 8px; }
.login-summary div { display: flex; flex-direction: column; gap: 2px; }

/* ---------- certificates & insurance panel (property page) ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cert { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; border-top-width: 4px; }
.cert-valid { border-top-color: var(--ok); }
.cert-expiring { border-top-color: var(--warn); }
.cert-expired, .cert-missing { border-top-color: var(--bad); }
.cert-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; }
.cert-head h3 { margin: 0; font-size: .95rem; }
.cert-badge-valid { background: var(--ok-soft); color: var(--ok); }
.cert-badge-expiring { background: var(--warn-soft); color: var(--warn); }
.cert-badge-expired, .cert-badge-missing { background: var(--bad-soft); color: var(--bad); }
.cert-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
.cert-facts div { display: contents; }
.cert-facts dt { color: var(--muted); font-size: .8rem; }
.cert-facts dd { margin: 0; overflow-wrap: anywhere; }
.cert-history { width: 100%; font-size: .85rem; }
.cert-history summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.cert-history table { margin-top: 6px; font-size: .82rem; }
.cert-history th, .cert-history td { padding: 5px 6px; }
.cert-head .badge { text-transform: none; }
.cert-history td { white-space: nowrap; }
.cert-history .table-scroll { overflow-x: auto; }

/* ---------- dashboard notifications ---------- */
.notifications.has-items { border-left: 4px solid var(--bad); }
.alert-count { background: var(--bad); color: #fff; }
.notice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.notice-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.notice-list li:last-child { border-bottom: 0; }
.notice-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.is-expired .notice-dot { background: var(--bad); }
.is-expiring .notice-dot { background: var(--warn); }
.notice-text { flex: 1; min-width: 0; }
.notice-when { display: block; font-size: .85rem; }
.is-expired .notice-when { color: var(--bad); font-weight: 600; }
.is-expiring .notice-when { color: var(--warn); }

/* ---------- activity log (admin) ---------- */
.nowrap { white-space: nowrap; }
.act { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 99px; margin-right: 6px; background: var(--surface-2); color: var(--muted); }
.act-created { background: var(--ok-soft); color: var(--ok); }
.act-updated { background: var(--brand-soft); color: var(--brand); }
.act-deleted { background: var(--bad-soft); color: var(--bad); }
.act-signed-in, .act-signed-out, .act-downloaded { background: var(--warn-soft); color: var(--warn); }
.activity-scroll { max-height: 480px; overflow-y: auto; }
.tabs.compact { margin: 0; border-bottom: 0; }
.person-menu { display: inline-block; text-align: left; }
.person-menu > summary { list-style: none; }
.person-menu > summary::-webkit-details-marker { display: none; }
.person-menu[open] .person-actions { display: flex; }
.person-actions { display: none; flex-direction: column; gap: 8px; padding: 10px 0 0; }
.person-actions input { width: 150px; }
.person-actions .tab-grid input { width: auto; }

/* ---------- security page ---------- */
.qr { margin: 10px 0; }
.qr img { background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); max-width: 100%; height: auto; }
.secret { letter-spacing: .06em; }
.recovery { background: var(--warn-soft); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.recovery h3 { margin-top: 0; }
.code-list { columns: 2; margin: 0; padding-left: 22px; font-size: 1rem; }
.code-list li { margin: 4px 0; }
.jump-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.jump-links a { padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--text); }
.jump-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
section[id] { scroll-margin-top: 16px; }

.idle-warning { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn);
  border: 1px solid var(--warn); box-shadow: 0 6px 24px rgba(0,0,0,.18); font-weight: 600; }
.idle-warning[hidden] { display: none; }

/* Month-end steps on Monthly statements */
.monthend { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.monthend > li { counter-increment: step; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 0 14px 46px; border-top: 1px solid var(--border); position: relative; }
.monthend > li:first-child { border-top: 0; }
.monthend > li::before { content: counter(step); position: absolute; left: 0; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.monthend > li > div:first-child { flex: 1 1 320px; }
.monthend p { margin: 2px 0 0; }
.monthend form { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.step-email { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.step-email input[type=email] { width: 260px; max-width: 100%; }
.warn-text { color: var(--warn); }
.btn.disabled, .btn:disabled { opacity: .5; pointer-events: none; cursor: not-allowed; }
tr.subtotal td { font-weight: 600; background: var(--surface-2); }

.tab-picker { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; text-align: left; }
.tab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.tab-grid label.check { font-weight: 500; }

/* Council reconciliation */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.month-pick { display: flex; align-items: center; gap: 8px; margin: 0; }
.month-label { font-size: 1.25rem; font-weight: 800; min-width: 170px; text-align: center; }
.month-pick input[type=month] { width: auto; }
.rec-table td { vertical-align: middle; }
.rec-table tr.open td { background: var(--brand-soft); }
.notes-col { min-width: 240px; width: 30%; }
.rec-notes { margin: 0; }
.rec-notes .field { margin: 0; }
.rec-notes textarea { width: 100%; min-height: 40px; resize: vertical; font: inherit; }
.rec-notes .save-status { display: block; min-height: 1em; }
.bad-text { color: var(--bad); }
.ok-text { color: var(--ok); }

/* Admin tab access grid */
.access-grid th.tab-col { vertical-align: bottom; text-align: center; padding: 6px 4px; }
.access-grid th.tab-col span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: .72rem; display: inline-block; text-transform: none; letter-spacing: 0; }
.access-grid td.tab-col { text-align: center; padding: 6px 4px; }
.access-grid td.tab-col input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.access-grid tr.company-row td { background: var(--surface-2); padding-top: 12px; }
.access-grid tbody tr[data-access-row]:hover td { background: var(--brand-soft); }

/* Tenant page: council, property and tenancy agreement */
.tenant-box-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.tenant-box-grid > div { border-left: 3px solid var(--border); padding-left: 16px; }
.tenant-box-grid h3 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tenant-box-grid p { margin: 0 0 8px; }
dl.mini { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
dl.mini dt { color: var(--muted); font-weight: 600; }
dl.mini dd { margin: 0; overflow-wrap: anywhere; }
.with-thumb-line { display: flex; align-items: center; gap: 8px; }
.agreement { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.agreement-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.agreement-actions form { margin: 0; }
.agreement-actions label.btn { cursor: pointer; }
@media (max-width: 900px) { .tenant-box-grid { grid-template-columns: 1fr; } }

.money-cell { min-width: 130px; }
.money-cell .field { margin: 0; }
.money-cell input { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.money-cell input::placeholder { color: var(--text); opacity: .55; }
.money-cell .field-err { text-align: left; font-size: .75rem; }
.strong { font-weight: 700; }

/* Councils list: the council name, then three equal columns. */
table.list-councils { table-layout: fixed; }
table.list-councils th:first-child { width: 34%; }
table.list-councils th:nth-child(n+2) { width: 22%; }
table.list-councils td { overflow-wrap: anywhere; vertical-align: middle; }
table.list-councils th:nth-child(n+2), table.list-councils td:nth-child(n+2) { text-align: center; }

/* Rent run landlords table: every column centred. */
table.centered th, table.centered td { text-align: center; }
form.inline { display: inline-flex; margin: 0; }
.step-actions label.btn { cursor: pointer; }
/* Payment instruction form */
.instruction-form h2 { margin-top: 0; }
.instruction-form h2.spaced { margin-top: 22px; }
.form-grid.three { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.payee-table input { width: 100%; min-width: 0; padding: 6px 8px; }
.payee-table input[type=checkbox] { width: 18px; height: 18px; }
.payee-table .w-sort { width: 100px; } .payee-table .w-acc { width: 110px; } .payee-table .w-amt { width: 110px; text-align: right; } .payee-table .w-ref { width: 170px; }

/* Council reconciliation: everything centred, including the boxes. */
.rec-table.centered .money-cell input { text-align: center; }
.rec-table.centered .money-cell .field, .rec-table.centered .rec-notes .field { display: flex; justify-content: center; }
.rec-table.centered .rec-notes textarea { text-align: center; }

.month-pick input.month-big { font-size: 1.35rem; font-weight: 800; padding: 10px 18px; min-width: 240px; text-align: center; border: 2px solid var(--brand); border-radius: 10px; color: var(--text); background: var(--surface); cursor: pointer; }
.month-back { text-align: center; margin: -8px 0 16px; font-size: .9rem; }

/* Invoices: deducted from the landlord? */
.yes-no { display: inline-block; font-weight: 800; font-size: .8rem; padding: 2px 9px; border-radius: 99px; }
.yes-no.yes { background: var(--ok-soft); color: var(--ok); }
.yes-no.no { background: var(--bad-soft); color: var(--bad); }

/* Landlord invoices */
.settle-form { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.settle-form label.check { max-width: 320px; }
.settle-form label.check input { margin-top: 5px; }
.settled { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.settled form { margin: 0; }
.settle-edit { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.settle-edit legend { font-weight: 700; padding: 0 6px; }
.settle-edit .settle-date { max-width: 220px; }
.invoice-doc .doc-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.invoice-doc .doc-to { text-align: right; }
.invoice-doc .doc-to h2 { margin: 0 0 4px; letter-spacing: .12em; }
.bill-to { margin: 0 0 14px; }

.btn.deduct-btn { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Several phone numbers / emails on a council: one per line. */
.cell-text { white-space: pre-line; }
/* Properties, landlords and tenants lists: headings and text centred. */
table.list-properties th, table.list-properties td, table.list-landlords th, table.list-landlords td,
table.list-tenants th, table.list-tenants td { text-align: center; }

table.centered td.row-actions { text-align: center; }

.tile.ok { border-color: var(--ok); background: var(--ok-soft); }
.tile.ok .value { color: var(--ok); }

.page-tabs { margin: 0 0 12px; }

/* Maintenance job photos and files */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.file-tile { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.file-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-type { font-weight: 800; font-size: 1.3rem; color: var(--muted); letter-spacing: .06em; }
.file-tile figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; gap: 10px; align-items: center; }
/* Landlords and tenants lists: every column the same width, so the gaps are equal. */
table.list-landlords, table.list-tenants, table.list-maintenance, table.list-contractors { table-layout: fixed; width: 100%; }
table.list-landlords td, table.list-tenants td, table.list-maintenance td, table.list-contractors td { overflow-wrap: anywhere; }
table.list-maintenance th, table.list-maintenance td, table.list-contractors th, table.list-contractors td { text-align: center; }

/* Tables with every column the same width. */
table.equal { table-layout: fixed; width: 100%; }
table.equal td { overflow-wrap: anywhere; }

/* Every table on every page: headings and the text under them centred. */
.content table th, .content table td, .content table td.num, .content table th.num { text-align: center; }
.content table td .field-err { text-align: left; }

.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }
.form-subhead { margin: 10px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

details.fold > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: '▾'; margin-left: auto; font-size: 1.1rem; color: var(--muted); transition: transform .15s; }
details.fold:not([open]) > summary::after { transform: rotate(-90deg); }
details.fold[open] > summary { margin-bottom: 12px; }
.w-hours { width: 7em; }

/* ---------- welcome animation after signing in ---------- */
@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .auth .auth-card { animation: none; }
}

.monthend > li > .sender-now, .monthend > li > .sender-settings { flex: 1 0 100%; }
.monthend > li > .sender-now { margin-top: -8px; }
.sender-settings { margin-top: 4px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sender-settings.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.sender-settings .field input { width: 100%; }
.sender-settings .form-actions { grid-column: 1 / -1; }
@media (max-width: 760px) { .sender-settings.form-grid { grid-template-columns: 1fr; } }

.sheet-preview .sheet-title { font-weight: 700; margin: 0 0 12px; letter-spacing: .02em; }
table.cfp { max-width: 720px; }
table.cfp td, table.cfp th { text-align: left; }
table.cfp .num { text-align: right; }
.report-actions .step-email { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.report-actions .step-email input[type=email] { min-width: 260px; }
.rec-table.centered .date-cell .field { display: flex; justify-content: center; }
.rec-table .date-cell input { width: auto; }
.rec-table .money-cell input { width: 96px; }
.rec-table .date-cell input { width: 138px; padding-left: 6px; padding-right: 4px; }
.rec-table .notes-col { min-width: 170px; width: auto; }
.rec-table th, .rec-table td { padding-left: 6px; padding-right: 6px; }
.invoice-actions { display: grid; gap: 12px; }
.invoice-actions .inline-form, .invoice-actions .step-email { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.invoice-actions .step-email input[type=email] { min-width: 260px; }
.price-trio { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.price-trio > .field { margin: 0; }
.profit-out { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px dashed var(--border); border-radius: 8px; font-weight: 700; font-size: 1.05rem; background: var(--surface-2); }
@media (max-width: 760px) { .price-trio { grid-template-columns: 1fr; } }
/* Invoice file, supplier and who added it on one line */
.top-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.top-trio > .field { margin: 0; }
.top-trio input[type="file"] { width: 100%; min-width: 0; }
@media (max-width: 760px) { .top-trio { grid-template-columns: 1fr; } }
.is-upcoming .notice-dot { background: var(--border); }
.is-upcoming .notice-when { color: var(--muted); }
table.council-db th { background: #ffff00; color: #000; border: 2px solid #000; font-size: .72rem; white-space: normal; min-width: 90px; }
.end-tenancy { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.end-tenancy input[type=date] { width: 140px; padding: 4px 6px; }
table.council-db td { white-space: nowrap; font-size: .85rem; }
.db-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-start; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .form-grid.three { grid-template-columns: 1fr; } }
#add-entry details.fold > summary { margin-bottom: 0; }
#add-entry details.fold[open] > summary { margin-bottom: 12px; }
.step5 .step-no { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); font-size: .9rem; margin-right: 8px; }
.step5-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Landlord invoice on screen, laid out like the agency's Word invoice. */
.lodge-sheet { background: #fff; color: #000; overflow-x: auto; }
.lodge-page { width: 612px; min-height: 700px; margin: 0 auto; padding: 36px 0 24px 90px; box-sizing: content-box; font-family: Arial, Helvetica, sans-serif; }
.lodge-page > * { width: 432px; }
.lodge-name { font-size: 29px; color: #0000ff; line-height: 1.1; }
.lodge-sub { font-size: 18px; font-weight: 700; color: #999; padding-left: 12px; }
.lodge-addr { font-size: 13px; color: #808080; }
.lodge-contact { font-size: 13px; color: #999; margin-bottom: 26px; }
.lodge-contact a { color: #0563c1; text-decoration: underline; }
.lodge-box { border: 1px solid #000; margin-bottom: 14px; box-sizing: border-box; }
.lodge-row { display: grid; grid-template-columns: 144px 1fr; padding: 8px 0 8px 36px; font-size: 14px; min-height: 36px; }
.lodge-row strong { font-size: 15px; }
.lodge-row sup { font-size: 9px; }
.lodge-prop { min-height: 75px; }
.lodge-prop strong { font-size: 14px; }
.lodge-main { height: 499px; position: relative; margin-bottom: 0; font-family: 'Times New Roman', Times, serif; font-size: 16px; }
.lodge-invoice { font-family: Arial, Helvetica, sans-serif; font-weight: 700; text-decoration: underline; text-align: center; margin-top: 38px; font-size: 16px; }
.lodge-main ul { margin: 36px 0 0; padding-left: 48px; }
.lodge-main li { margin-bottom: 6px; }
.lodge-note { position: absolute; left: 36px; bottom: 8px; color: #f00; font-weight: 700; }
.lodge-total { display: flex; justify-content: space-between; padding: 12px 29px 26px 10px; font-size: 16px; border-top: 0; }
@media print { .lodge-sheet { border: 0; box-shadow: none; padding: 0; } .lodge-page { padding-top: 0; } }
.centered-tiles .tile { text-align: center; align-items: center; }
.static-value { padding: 9px 0; }

table.council-db.editable td { padding: 4px 3px; }
table.council-db .cell-input { width: 100%; min-width: 110px; padding: 5px 6px; font-size: .85rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
table.council-db .cell-input:hover { border-color: var(--border); }
table.council-db .cell-input:focus { border-color: var(--brand); background: var(--surface); outline: none; }
table.council-db .cell-date { min-width: 135px; }
table.council-db .cell-money { min-width: 80px; text-align: right; }
table.council-db tr.new-row td { background: var(--surface-2); }
table.council-db tr.new-row .cell-input { border-color: var(--border); background: var(--surface); }
.tile-month { display: inline; }
.tile-month select { font-size: .8rem; padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
/* Line up every cell in a row with its buttons. */
.table-wrap td { vertical-align: middle; }
.table-wrap td .btn.small { margin: -2px 0; }
.rec-actions { display: flex; gap: 8px; justify-content: flex-end; margin: -6px 0 12px; }
.metro-docs { margin: 4px 0 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.metro-docs h3 { margin: 0 0 8px; }
.btn.blank-form { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.presets-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px; }
.presets-bar select { min-width: 220px; }
.preset-save { display: flex; gap: 8px; margin-top: 10px; }
.preset-save input { flex: 1; max-width: 360px; }
.presets-bar { flex-wrap: nowrap; }
.presets-bar label { margin: 0; white-space: nowrap; }
.presets-bar select { width: auto; flex: 0 1 320px; }

/* Dark mode switch (dashboard) */

/* Small totals in the top right of a page header */
.page-head.with-head-tiles { align-items: flex-start; flex-wrap: nowrap; }
.page-head.with-head-tiles .head-text { flex: 1 1 auto; min-width: 0; }
.head-tiles { display: flex; gap: 10px; flex: 0 0 auto; }
@media (max-width: 760px) {
  .page-head.with-head-tiles { flex-wrap: wrap; }
  .head-tiles { flex-wrap: wrap; }
}
.mini-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; display: flex; flex-direction: column; min-width: 150px; box-shadow: var(--shadow); }
.mini-tile .label { font-size: .75rem; color: var(--muted); }
.mini-tile .value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Rent run step 5: shown in capitals, as they're written on Metro's form */
.step5-grid input:not([type="date"]) { text-transform: uppercase; }
.step5-grid input::placeholder { text-transform: none; }

/* Step 5: Metro's bulk payment file, and its preview (looks like the spreadsheet) */
.bulk-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 8px 0 4px; }
.bulk-sheet { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.bulk-sheet .table-wrap { flex: 1 1 560px; }
table.metro-bulk { border-collapse: collapse; font-family: Calibri, Carlito, Arial, sans-serif; font-size: .92rem; background: #fff; color: #000; width: auto; }
table.metro-bulk th { background: #0000ff; color: #fff; font-weight: 700; height: 73px; vertical-align: bottom; text-align: left; padding: 2px 6px; border: 1px solid #000; white-space: nowrap; }
table.metro-bulk td { border: 1px solid #000; padding: 1px 6px; white-space: nowrap; }
table.metro-bulk th:nth-child(1), table.metro-bulk td:nth-child(1) { min-width: 90px; }
table.metro-bulk th:nth-child(2), table.metro-bulk td:nth-child(2) { min-width: 200px; }
table.metro-bulk th:nth-child(3), table.metro-bulk td:nth-child(3) { min-width: 170px; }
table.metro-bulk th:nth-child(4), table.metro-bulk td:nth-child(4) { min-width: 170px; }
table.metro-bulk th:nth-child(5), table.metro-bulk td:nth-child(5) { min-width: 110px; }
table.metro-bulk td.c { text-align: center; }
table.metro-bulk td.money { text-align: right; }
table.metro-bulk td.money span { float: left; }
table.metro-bulk tr.total td { border: 0; }
table.metro-bulk tr.total td.money { border: 1px solid #000; font-weight: 700; }
table.metro-bulk .cut { color: #c00; }
.bulk-help { flex: 0 1 220px; background: linear-gradient(#fbe4d5, #bdd7ee); color: #000; border: 1px solid #7f9fbf; border-radius: 4px; padding: 10px 12px; font-size: .8rem; }
.bulk-help p { margin: 0 0 10px; }
.bulk-help .ver { font-weight: 700; }
ul.tight { margin: 6px 0 0; padding-left: 20px; }

/* A sub-step (e.g. 3.1) in the rent run list: its own label, not counted */
.monthend > li.sub { counter-increment: none; }
.monthend > li.sub::before { content: attr(data-step); width: auto; min-width: 30px; padding: 0 6px; border-radius: 15px; }
.bulk-help .bulk-btn { display: inline-block; font-weight: 700; background: #e1e1e1; border: 1px solid #adadad; padding: 6px 10px; margin-bottom: 12px; }

/* Step 4 preview: the Bank Transfer sheet as it looks in Excel */
table.transfer-sheet { border-collapse: collapse; font-family: 'Aptos Narrow', Aptos, Calibri, Carlito, Arial, sans-serif; font-size: .92rem; background: #fff; color: #000; width: auto; }
table.transfer-sheet td, table.transfer-sheet th { border: 1px solid #000; padding: 1px 6px; white-space: nowrap; }
table.transfer-sheet tr.title td, table.transfer-sheet tr.gap td { border: 0; }
table.transfer-sheet tr.title td[colspan="3"] { text-align: center; font-weight: 700; }
table.transfer-sheet tr.gap td { height: 14px; }
table.transfer-sheet tr.head th { border: 2px solid #000; border-left-width: 1px; text-align: center; font-weight: 700; }
table.transfer-sheet th:nth-child(1) { min-width: 250px; } table.transfer-sheet th:nth-child(2) { min-width: 60px; }
table.transfer-sheet th:nth-child(3) { min-width: 260px; } table.transfer-sheet th:nth-child(4) { min-width: 110px; }
table.transfer-sheet th:nth-child(5) { min-width: 120px; } table.transfer-sheet th:nth-child(6) { min-width: 140px; }
table.transfer-sheet th:nth-child(7) { min-width: 170px; }
table.transfer-sheet .note-col { border: 0; min-width: 120px; }
table.transfer-sheet .c { text-align: center; }
table.transfer-sheet .money { text-align: right; }
table.transfer-sheet .money span { float: left; }
table.transfer-sheet .strong { font-weight: 700; }
table.transfer-sheet tr.total td { border: 0; }
table.transfer-sheet tr.total td.c, table.transfer-sheet tr.total td.money { border: 1px solid #000; border-bottom-width: 2px; }
table.transfer-sheet .yellow-note { background: #ff0; font-weight: 700; padding: 0 2px; }
/* Both spreadsheet previews: text as typed and left-aligned, like Excel */
table.metro-bulk th, table.metro-bulk td, table.transfer-sheet th, table.transfer-sheet td { text-transform: none; letter-spacing: normal; text-align: left; font-size: .9rem; color: #000; }
table.metro-bulk td.c, table.transfer-sheet td.c, table.transfer-sheet tr.head th, table.transfer-sheet tr.title td[colspan="3"] { text-align: center; }
table.metro-bulk th { color: #fff; }
table.metro-bulk td.money, table.transfer-sheet td.money { text-align: right; }
table.metro-bulk tbody tr:hover td, table.transfer-sheet tbody tr:hover td { background: inherit; }
table.transfer-sheet .note-col { min-width: 240px; }
table.transfer-sheet th:nth-child(1) { min-width: 200px; } table.transfer-sheet th:nth-child(3) { min-width: 220px; }
table.transfer-sheet th:nth-child(7) { min-width: 130px; } table.transfer-sheet .note-col { min-width: 110px; }
.monthend > li.sub::before { font-size: .8rem; padding: 0 4px; }
.monthend > li.sub { padding-left: 52px; }

/* Bank details changed and not yet checked */
.bank-alert ul { margin: 6px 0; }
.bank-alert .small { margin: 6px 0; }
.bank-flag { color: #c00; font-weight: 700; }

/* Dashboard: the animated GhostFibers background (React Bits), behind everything right of the sidebar */
.shell { position: relative; z-index: 0; }
/* Light mode: the glowing fibers flipped to blue ink on a light background. */
.dashboard-bg { position: fixed; top: 0; right: 0; bottom: 0; left: 116px; z-index: -1; pointer-events: none; opacity: 1; filter: invert(1) hue-rotate(180deg); }
:root[data-theme="dark"] .dashboard-bg { opacity: .9; filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dashboard-bg { opacity: .9; filter: none; } }
@media (max-width: 900px) { .dashboard-bg { left: 0; } }
@media print { .dashboard-bg { display: none; } }

/* ---------- phones: nothing wider than the screen ---------- */
.form-actions { flex-wrap: wrap; }
.field { min-width: 0; }
input, select, textarea { max-width: 100%; }
@media (max-width: 900px) {
  /* One column that can shrink below its widest content (plain 1fr can't). */
  .grid-2, .form-grid, .form-grid.three, .price-trio, .top-trio, .sender-settings.form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > *, .price-trio > *, .top-trio > * { min-width: 0; }
  select { width: 100%; min-width: 0; text-overflow: ellipsis; }
  input[type="file"] { width: 100%; min-width: 0; }
  .page-head { flex-wrap: wrap; }
  .page-head .actions, .actions, .step-actions { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .presets-bar { flex-wrap: wrap; }
  .presets-bar select { flex: 1 1 100%; }
}
@media (max-width: 900px) {
  /* Tables keep their words whole and scroll sideways instead of squashing columns. */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap > table { table-layout: auto; width: max-content; min-width: 100%; }
  .table-wrap > table th, .table-wrap > table td { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
  .table-wrap > table td textarea { min-width: 200px; }
}
@media (max-width: 600px) {
  /* Month switcher: the month on top, Previous and Next side by side below it. */
  .month-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .month-nav .month-pick { grid-column: 1 / -1; order: -1; }
  .month-nav .month-pick input { width: 100%; }
  .month-nav > .btn { justify-content: center; text-align: center; }
}
@media (max-width: 900px) {
  /* iPhones zoom the page into any box with text under 16px; keep them at 16px. */
  input, select, textarea, table.council-db .cell-input { font-size: 16px; }
  /* The menu bar swipes sideways: fade its right edge so it's clear there's more. */
  .sidebar { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
}
.head-actions { margin-top: 12px; }
@media (max-width: 900px) {
  .head-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .mini-tile { min-width: 0; }
}

/* Dashboard: properties overview box */
.po-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.po-tile { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.po-n { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.po-label { font-size: .8rem; color: var(--muted); }
.po-bad .po-n { color: var(--bad); } .po-ok .po-n { color: var(--ok); } .po-warn .po-n { color: var(--warn); } .po-info .po-n { color: var(--brand); }
.po-group { border-top: 1px solid var(--border); padding: 8px 0; }
.po-group summary { cursor: pointer; font-weight: 600; }
.po-list { margin: 6px 0 0; padding-left: 20px; }
.po-list li { margin: 3px 0; }
@media (max-width: 900px) { .po-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* New property: certificates */
.new-certs { border-top: 1px solid var(--border); padding-top: 12px; }
.cert-row { display: grid; grid-template-columns: 180px repeat(3, minmax(0, 1fr)); gap: 10px 16px; align-items: end; margin: 8px 0; }
@media (max-width: 900px) { .cert-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cert-row > strong, .cert-row > .field:last-child { grid-column: 1 / -1; } }
/* Property: tenant call notes, each in its own box */
.call-note-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.call-note-form .wide { grid-column: 1 / -1; }
.call-note { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: var(--surface-2); }
.call-note-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.call-note-head form { margin-left: auto; }
@media (max-width: 900px) { .call-note-form { grid-template-columns: minmax(0, 1fr); } }

/* Certificate files */
.cert-row input[type=file] { font-size: .85rem; max-width: 100%; }
.cert-file-link { display: block; overflow-wrap: anywhere; margin: 2px 0; }
.cert-file-list { list-style: none; padding: 0; margin: 0; }
.cert-file-list li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.cert-file-list li:first-child { border-top: 0; }

/* Install as an app */
.install-steps { margin: 8px 0 12px; padding-left: 20px; }
.install-steps li { margin: 6px 0; }
[data-install][hidden], [data-install-help][hidden], [data-installed][hidden] { display: none; }

/* ---- Welcome after signing in: a glowing rift opens and the screen parts to reveal the app ---- */
.intro { position: fixed; inset: 0; z-index: 1000; overflow: hidden; cursor: pointer; animation: intro-gone 0s linear 2.45s forwards; }
.intro-half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; background: #04051a; will-change: transform; }
.intro-half img { position: absolute; top: 0; width: 100vw; height: 100%; object-fit: cover; }
.intro-l { left: 0; animation: intro-open-l .95s cubic-bezier(.7, 0, .2, 1) 1.4s forwards; }
.intro-r { right: 0; animation: intro-open-r .95s cubic-bezier(.7, 0, .2, 1) 1.4s forwards; }
.intro-l img { left: 0; }
.intro-r img { left: -50vw; }
.intro-seam { position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px; transform: scaleY(0); background: linear-gradient(180deg, transparent, #bfefff 18%, #fff 50%, #bfefff 82%, transparent); box-shadow: 0 0 14px 3px rgba(56, 216, 255, .75), 0 0 60px 14px rgba(122, 92, 255, .5); animation: intro-seam .9s cubic-bezier(.2, .8, .2, 1) .15s forwards, intro-seam-out .45s ease-in 1.45s forwards; }
.intro-center { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.intro-logo { width: 84px; height: 84px; border-radius: 22px; opacity: 0; box-shadow: 0 0 40px rgba(94, 225, 255, .45), 0 0 80px rgba(150, 90, 255, .35); animation: intro-logo 1.35s ease-out .3s forwards; }
.intro.skip { animation: intro-skip .3s ease forwards; }
.intro.skip * { animation: none !important; }
@keyframes intro-seam { to { transform: scaleY(1); } }
@keyframes intro-seam-out { to { opacity: 0; } }
@keyframes intro-logo { 0% { opacity: 0; transform: scale(.9); } 35% { opacity: 1; transform: scale(1); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.06); } }
@keyframes intro-open-l { to { transform: translateX(-101%); } }
@keyframes intro-open-r { to { transform: translateX(101%); } }
@keyframes intro-gone { to { visibility: hidden; pointer-events: none; } }
@keyframes intro-skip { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* Privacy notice and terms */
.legal-page { max-width: 780px; margin: 0 auto; padding: 24px 16px 60px; }
.legal-page h1 { margin: 6px 0 4px; }
.legal-page h2 { margin: 28px 0 8px; font-size: 1.15rem; }
.legal-page p, .legal-page li { line-height: 1.6; }
.legal-page ul { padding-left: 22px; }
.legal-page .legal-back { display: inline-block; margin-bottom: 6px; }

/* ---- Sign-in pages: the card centred over full-screen galaxy artwork ---- */
.auth .public { display: block; max-width: none; padding: 0; min-height: 100vh; }
.auth-split { position: relative; width: 100%; margin: 0; min-height: 100vh; background: #03040f; }
.auth-art { position: fixed; inset: 0; background: linear-gradient(rgba(3, 4, 16, .25), rgba(3, 4, 16, .45)), url(/static/login-art.jpg) 50% center / cover no-repeat; }
.auth-main { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; padding: 28px 36px 24px; }
.auth-brand { justify-self: start; display: inline-flex; align-items: center; gap: 12px; font-size: 1.3rem; font-weight: 800; letter-spacing: .02em; color: #fff; text-decoration: none; }
.auth-brand:hover { text-decoration: none; }
.auth-logo { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 0 22px rgba(94, 225, 255, .4), 0 0 40px rgba(150, 90, 255, .3); }
.auth-content { align-self: center; justify-self: center; width: 100%; max-width: 420px; padding: 24px 0; }
.auth .auth-card { max-width: none; padding: 36px 32px; border-radius: 16px; background: rgba(10, 12, 38, .62); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); border: 1px solid rgba(160, 175, 255, .25); color: #eef0ff; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .85), 0 0 70px -12px rgba(110, 90, 255, .4); animation: auth-rise .45s ease-out both; }
.auth .auth-card .brand { display: none; }
.auth .auth-card h1 { margin: 0 0 6px; color: #fff; font-size: 1.7rem; letter-spacing: -.01em; }
.auth .auth-card .auth-sub { margin: 0 0 22px; }
.auth .auth-card .muted, .auth .auth-card .help, .auth .auth-card small { color: #b9c1ea; }
.auth .auth-card a { color: #8fdcff; }
.auth .auth-card .stack { gap: 14px; }
.auth .auth-card .stack label { color: #e3e7ff; font-weight: 600; font-size: .9rem; }
.auth .auth-card input { height: 46px; margin-top: 6px; border-radius: 10px; font-size: 1rem; background: rgba(6, 8, 30, .6); border: 1px solid rgba(150, 165, 255, .32); color: #fff; transition: border-color .15s, box-shadow .15s; }
.auth .auth-card input::placeholder { color: #8b93c4; }
.auth .auth-card input:focus { border-color: #5ee1ff; box-shadow: 0 0 0 4px rgba(94, 225, 255, .2); outline: none; }
.auth .auth-card input:-webkit-autofill { -webkit-text-fill-color: #fff; box-shadow: 0 0 0 40px #0b0e33 inset; }
.auth .auth-submit { height: 48px; margin-top: 6px; border: 0; border-radius: 10px; background: linear-gradient(135deg, #6a5cff, #2fa8ff); color: #fff; font-size: 1rem; font-weight: 600; box-shadow: 0 10px 30px -8px rgba(90, 120, 255, .8); transition: transform .12s, box-shadow .12s; }
.auth .auth-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -8px rgba(90, 160, 255, .9); }
.auth-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font-size: .8rem; color: #8d95c2; }
.auth-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.auth-footer a { color: #a9b4ee; }
.auth-footer a:hover { color: #fff; }
@media (max-width: 600px) {
  .auth-main { padding: 20px 16px 18px; }
  .auth .auth-card { padding: 28px 20px; }
}
/* Short screens (small phones, phones on their side, short laptop windows): everything on the
   sign-in pages fits on the screen without scrolling. */
@media (max-height: 760px) {
  .auth-main { padding-top: 16px; padding-bottom: 12px; }
  .auth-content { padding: 10px 0; }
  .auth .auth-card { padding: 22px 24px; }
  .auth .auth-card h1 { font-size: 1.45rem; }
  .auth .auth-card .auth-sub { margin-bottom: 12px; }
  .auth .auth-card .stack { gap: 9px; }
  .auth .auth-card input { height: 40px; margin-top: 4px; }
  .auth .auth-submit { height: 42px; margin-top: 4px; }
  .auth .auth-card .pw-eye { height: 40px; width: 40px; }
  .auth-logo { width: 32px; height: 32px; }
  .auth-brand { font-size: 1.1rem; }
}
@media (max-width: 360px) {
  .auth-main { padding-left: 12px; padding-right: 12px; }
  .auth .auth-card { padding: 18px 14px; }
}
@media (max-height: 520px) {
  .auth-main { padding: 8px 16px 6px; grid-template-rows: 1fr auto; }
  .auth-brand { position: absolute; top: 10px; left: 14px; }
  .auth-brand span { display: none; }
  .auth-content { padding: 0; max-width: 460px; }
  .auth .auth-card { padding: 12px 18px; }
  .auth .auth-card h1 { font-size: 1.15rem; margin-bottom: 0; }
  .auth .auth-card .auth-sub { display: none; }
  .auth .auth-card .notice { margin: 6px 0; padding: 6px 10px; font-size: .85rem; }
  .auth .auth-card .stack { gap: 6px; margin-top: 6px; }
  /* Labels beside the boxes rather than above them. */
  .auth .auth-card .stack label { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; column-gap: 10px; text-align: left; }
  .auth .auth-card .stack label > input, .auth .auth-card .stack label > .pw-wrap { margin-top: 0; }
  .auth .auth-card input { height: 36px; margin-top: 0; }
  .auth .auth-card .pw-eye { height: 36px; width: 36px; }
  .auth .auth-submit { height: 38px; margin-top: 2px; }
  .auth .auth-card > .small { margin: 6px 0 0; }
  .auth-footer { font-size: .72rem; gap: 2px 14px; }
}
.logo-img { display: block; object-fit: cover; background: none; }

/* Light / dark switch in the top bar: a sun and a moon, the knob slides to the one in use. */
.theme-toggle { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 999px; }
.theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.theme-toggle-track { position: relative; display: block; width: 64px; height: 32px; border-radius: 999px; background: #8fc4ff; border: 1px solid rgba(255, 255, 255, .35); transition: background-color .25s; }
.theme-toggle[aria-checked="true"] .theme-toggle-track { background: #1d2140; }
.tt-icon { position: absolute; top: 6px; width: 18px; height: 18px; z-index: 2; fill: none; stroke-width: 2; stroke-linecap: round; transition: opacity .25s, color .25s; }
.tt-sun { left: 7px; color: #b45309; stroke: currentColor; }
.tt-sun circle { fill: #fbbf24; }
.tt-moon { right: 7px; color: #c7cdfa; stroke: currentColor; fill: currentColor; opacity: .55; }
.theme-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), background-color .25s; z-index: 1; }
.theme-toggle[aria-checked="true"] .theme-toggle-thumb { transform: translateX(32px); background: #33386b; }
.theme-toggle[aria-checked="true"] .tt-sun { opacity: .45; }
.theme-toggle[aria-checked="true"] .tt-moon { opacity: 1; color: #fef3c7; }
@media (prefers-reduced-motion: reduce) { .theme-toggle-track, .theme-toggle-thumb, .tt-icon { transition: none; } }
@media (max-width: 600px) {
  .topbar-btn .topbar-text { display: none; }
  .topbar-btn { padding: 0 8px; }
  .topbar-sep { display: none; }
  .agency-mark { width: 30px; height: 30px; }
}

/* Sign-in: the eye button, to the right of the password box, shows or hides what's being typed
   (on this screen only). */
.pw-wrap { display: flex; align-items: flex-end; gap: 8px; }
.auth .auth-card .pw-wrap input { flex: 1; min-width: 0; width: auto; }
.pw-eye { flex: none; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid rgba(150, 165, 255, .32); background: rgba(6, 8, 30, .6); color: #b9c1ea; cursor: pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color: #fff; border-color: #5ee1ff; }
.pw-eye:focus-visible { outline: 2px solid #5ee1ff; outline-offset: 1px; }
.pw-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .pw-shut, .pw-eye[aria-pressed="true"] .pw-open { display: none; }
.pw-eye[aria-pressed="true"] .pw-shut { display: block; }

/* Dashboard: the eight figures at a glance in one box (portfolio, then this month's money). */
.kpi-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin-bottom: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 28px -14px rgba(16, 24, 40, .25); }
.kpi { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px 14px 14px; border-left: 1px solid var(--border); color: var(--text); text-decoration: none; transition: background-color .15s; }
.kpi:first-child { border-left: 0; }
.kpi:hover, .kpi:focus-visible { background: var(--surface-2); text-decoration: none; }
.kpi:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.kpi-money-start { border-left: 2px solid var(--border); }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 6px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.kpi-icon .icon { width: 18px; height: 18px; }
.kpi .label { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); line-height: 1.25; }
.kpi .value { font-size: clamp(1.05rem, 1.35vw, 1.5rem); font-weight: 800; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.kpi-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi-ok .value { color: var(--ok); }
.kpi-warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi-warn .value { color: var(--warn); }
.kpi-alert .kpi-icon { background: var(--bad-soft); color: var(--bad); }
.kpi-alert .value { color: var(--bad); }
.kpi-warn::before, .kpi-alert::before, .kpi-ok::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: currentColor; }
.kpi-warn::before { background: var(--warn); }
.kpi-alert::before { background: var(--bad); }
.kpi-ok::before { background: var(--ok); }
@media (max-width: 1199px) {
  .kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi:nth-child(n+5) { border-top: 1px solid var(--border); }
  .kpi:nth-child(4n+1) { border-left: 0; }
  .kpi .value { font-size: 1.35rem; }
}
@media (max-width: 640px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(4n+1) { border-left: 1px solid var(--border); }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi .value { font-size: 1.2rem; }
}

/* Landlord form: Statement type, Overseas landlord and Payment terms as sliding segment controls
   (RubberSegment). The real select stays in the form, hidden, and holds the value. */
.field:has(> .rs-native) { position: relative; }
.rs-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rs-field .rubber-segment { display: grid; width: 100%; }
.rs-empty .rubber-segment__thumb { opacity: 0; }
.rs-empty .rubber-segment__item { opacity: .75; }
@media (max-width: 600px) {
  .rs-field .rubber-segment { --rs-pad: 4px !important; --rs-min: 0px !important; --rs-font: 12px !important; }
}

/* Search box over a hidden dropdown (e.g. a property's Landlord). */
.field:has(> .search-native) { position: relative; }
.search-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.search-box:invalid:not(:placeholder-shown) { border-color: var(--bad); }

/* A property's page: a Rightmove-style listing at the top. */
.listing { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; margin-bottom: 18px; }
.listing-main { min-width: 0; }
.gallery { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 6px; height: 420px; border-radius: var(--radius); overflow: hidden; }
.gallery.single { grid-template-columns: 1fr; }
.gallery-main { position: relative; display: block; min-height: 0; background: var(--surface-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-count { position: absolute; left: 12px; bottom: 12px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .85rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.gallery-side { display: grid; grid-template-rows: 1fr 1fr; gap: 6px; min-height: 0; }
.gallery-side-img { position: relative; padding: 0; border: 0; cursor: pointer; min-height: 0; background: var(--surface-2); }
.gallery-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; font-weight: 800; font-size: 1.05rem; }
.gallery-strip { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumb { flex: 0 0 auto; width: 84px; height: 60px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.active { border-color: var(--brand); }
.gallery-empty { height: 260px; border: 2px dashed var(--border); border-radius: var(--radius); display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); background: var(--surface); }
.gallery-empty p { margin: 0; font-weight: 700; }
.listing-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 16px; }
.listing-price { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.listing-price-sub { font-size: 1.05rem; font-weight: 700; color: var(--muted); margin-top: 4px; }
.listing-address { font-size: 1.15rem; margin: 8px 0 0; }
.key-facts { display: flex; flex-wrap: wrap; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--border); }
.key-facts > div { padding: 0 28px 0 0; margin-right: 28px; border-right: 1px solid var(--border); }
.key-facts > div:last-child { border-right: 0; margin-right: 0; }
.key-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.key-facts dd { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 700; }
.key-facts svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The email box stays where it is and fills the height beside the photos and key facts; its
   message box grows to fill the space, with the PDF button at the bottom. */
.listing-side { margin-bottom: 0; align-self: stretch; display: flex; flex-direction: column; }
.listing-side .stack { flex: 1; grid-template-rows: auto auto 1fr auto; }
.listing-side .stack label.grow { grid-template-rows: auto 1fr; }
.listing-side .stack textarea { height: 100%; min-height: 90px; resize: none; }
.listing-side .listing-pdf { margin-top: auto; }
.listing-side .stack + .listing-pdf { margin-top: 12px; }
.listing-side h2 { margin-top: 0; }
.listing-side .stack { display: grid; gap: 10px; }
.listing-side label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; }
@media (max-width: 1000px) {
  .listing { grid-template-columns: 1fr; }
  .listing-side { position: static; }
  .gallery { height: 300px; }
}
@media (max-width: 600px) {
  .gallery { grid-template-columns: 1fr; height: 240px; }
  .gallery-side { display: none; }
  .key-facts > div { padding-right: 16px; margin-right: 16px; }
}

/* A property's boxes under the certificates: one row of smaller boxes. */
.below-certs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: start; margin-bottom: 18px; }
.below-certs > .card { padding: 12px; margin-bottom: 0; min-width: 0; font-size: .85rem; }
.below-certs .card-head { flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.below-certs h2 { font-size: .95rem; }
.below-certs .btn.small { font-size: .75rem; padding: 4px 8px; }
.below-certs .table-wrap { overflow-x: auto; }
.below-certs th, .below-certs td { padding: 5px 6px; font-size: .78rem; }
.below-certs .call-note-form { grid-template-columns: 1fr; }
@media (min-width: 1100px) { .below-certs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
.gallery-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.listing-pdf { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; margin-top: 12px; }
.listing-pdf svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Editing a property: one row per certificate, each with its own Save. */
.cert-edit-row { grid-template-columns: 200px repeat(3, minmax(0, 1fr)) 170px; padding: 12px 0; border-top: 1px solid var(--border); margin: 0; }
.cert-edit-row .badge { margin-left: 6px; }
.cert-edit-row .field { margin: 0; }
.cert-edit-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) { .cert-edit-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cert-edit-row > div:first-of-type, .cert-edit-actions { grid-column: 1 / -1; } }
/* An inspection's condition. */
.badge.s-Good { background: var(--ok-soft); color: var(--ok); }
.badge.s-Fair { background: var(--warn-soft); color: var(--warn); }
.badge.s-Poor { background: var(--bad-soft); color: var(--bad); }
.rentrun-month { display: flex; align-items: center; gap: 8px; }
.month-bar { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.month-bar .statement-search { display: flex; gap: 6px; margin-left: 12px; }
.month-bar .statement-search input { width: 150px; }
table.stmt-table td.row-actions { white-space: normal; }
table.stmt-table td.row-actions > a, table.stmt-table td.row-actions > span, table.stmt-table .row-actions form { display: inline-block; margin: 2px 1px; vertical-align: middle; }
table.stmt-table td.row-actions > .icon-btn { display: inline-flex; }
@media (min-width: 1200px) { table.stmt-table td.row-actions { white-space: nowrap; } }
.btn.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; padding: 0; line-height: 1; vertical-align: middle; }
.btn.small.icon-btn { width: 34px; height: 30px; padding: 0; }
.btn.icon-btn svg { display: block; flex: none; }
.btn.icon-btn[disabled], .btn.icon-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
td.nowrap-lines span { display: block; white-space: nowrap; }

/* A maintenance job's sheet: two signature boxes, signed on screen. */
.sign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 10px; }
.sign-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.sign-box h3 { margin: 0 0 8px; font-size: 1rem; }
.sign-box form[data-signature] { display: grid; gap: 8px; }
.sign-box label { display: grid; gap: 4px; font-weight: 700; }
.sign-satisfied { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.sign-satisfied legend { padding: 0; margin-bottom: 4px; width: 100%; }
.sign-satisfied label { display: inline-flex; gap: 6px; font-weight: 600; }
.sign-pad { width: 100%; aspect-ratio: 3 / 1; height: auto; background: #fff; border: 1px dashed var(--border); border-radius: 8px; touch-action: none; cursor: crosshair; }
.sign-img { display: block; width: 100%; max-width: 360px; aspect-ratio: 3 / 1; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.sign-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sign-hint.err { color: var(--bad); font-weight: 700; }

/* An inspection's safety tick sheet: a Yes / No / N/A choice per requirement. */
.tick-sheet { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tick-head, .tick-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 64px) 160px; align-items: center; gap: 6px; padding: 6px 10px; }
.tick-sheet.read-only .tick-head, .tick-sheet.read-only .tick-row { grid-template-columns: minmax(0, 1fr) 200px; }
.tick-head { background: #8ea9db; color: #0a0e17; font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tick-head span:not(:first-child) { text-align: center; }
.tick-row { border-top: 1px solid var(--border); }
.tick-row:nth-child(odd) { background: var(--surface-2); }
.tick-label { font-size: .92rem; }
.tick { display: flex; justify-content: center; cursor: pointer; }
.tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick span { display: inline-grid; place-items: center; min-width: 52px; padding: 7px 0; border: 2px solid var(--border); border-radius: 8px; font-weight: 800; font-size: .85rem; color: var(--muted); background: var(--surface); }
.tick input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 1px; }
.tick-yes input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick-no input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.tick-na input:checked + span { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.tick-answer { font-weight: 800; text-align: center; border-radius: 6px; padding: 4px 6px; }
.tick-answer.tick-yes { background: var(--ok-soft); color: var(--ok); }
.tick-answer.tick-no { background: var(--bad-soft); color: var(--bad); }
.tick-answer.tick-na { color: var(--muted); }
#inspection-sheet .sign-grid { margin-top: 16px; }
@media (max-width: 700px) {
  .tick-head { display: none; }
  .tick-row { grid-template-columns: repeat(3, 1fr); }
  .tick-label { grid-column: 1 / -1; font-weight: 700; }
  .tick-sheet.read-only .tick-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tick-sheet.read-only .tick-label { grid-column: auto; }
}

/* Support page. */
/* Support: a dark control-deck panel, the same in light and dark mode. */
.sp-deck { position: relative; overflow: hidden; isolation: isolate; border-radius: 18px; padding: 34px 32px 30px; color: #e7ecff;
  background: radial-gradient(120% 90% at 0% 0%, #1b2a6b 0%, transparent 55%), radial-gradient(90% 80% at 100% 100%, #3b1d6e 0%, transparent 60%), #070b19;
  border: 1px solid rgba(124, 140, 255, .28); box-shadow: 0 24px 60px -30px rgba(31, 94, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .06); }
.sp-grid { position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(124, 140, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(124, 140, 255, .09) 1px, transparent 1px);
  background-size: 34px 34px; -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 20%, #000 20%, transparent 75%); }
.sp-sweep { position: absolute; inset: -40% -10%; z-index: -1; background: linear-gradient(100deg, transparent 40%, rgba(140, 170, 255, .10) 50%, transparent 60%); animation: sp-sweep 9s linear infinite; }
@keyframes sp-sweep { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.sp-orb { position: absolute; z-index: -1; border-radius: 50%; filter: blur(40px); opacity: .55; }
.sp-orb-a { width: 260px; height: 260px; right: -60px; top: -80px; background: #1f5eff; }
.sp-orb-b { width: 220px; height: 220px; left: 30%; bottom: -140px; background: #7c5cff; opacity: .4; }
.sp-head h1 { margin: 10px 0 6px; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.01em;
  background: linear-gradient(90deg, #ffffff, #b9c8ff 55%, #c9a8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sp-head p { margin: 0; max-width: 60ch; color: #aab4d8; }
.sp-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font: 600 .74rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em; text-transform: uppercase; color: #9ff5c8; background: rgba(34, 197, 94, .1); border: 1px solid rgba(74, 222, 128, .3); }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: sp-pulse 2.2s ease-out infinite; }
@keyframes sp-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); } }
.sp-channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 28px 0 4px; }
.sp-channel { position: relative; display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 14px; text-decoration: none; color: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)); border: 1px solid rgba(140, 160, 255, .22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.sp-channel::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0; transition: opacity .2s ease;
  background: linear-gradient(120deg, #1f5eff, #7c5cff, #22d3ee); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.sp-channel:hover, .sp-channel:focus-visible { transform: translateY(-2px); border-color: transparent; box-shadow: 0 14px 34px -16px rgba(31, 94, 255, .8); text-decoration: none; color: inherit; }
.sp-channel:hover::before, .sp-channel:focus-visible::before { opacity: 1; }
.sp-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: radial-gradient(circle at 30% 25%, rgba(124, 92, 255, .55), rgba(31, 94, 255, .25)); box-shadow: 0 0 22px rgba(80, 120, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .2); }
.sp-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sp-text { display: grid; gap: 3px; min-width: 0; }
.sp-label { font: 600 .72rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; color: #8fa2ff; }
.sp-text strong { font-size: 1.15rem; color: #fff; overflow-wrap: anywhere; }
.sp-hint { font-size: .8rem; color: #8e98bd; }
.sp-go { margin-left: auto; font-size: 1.3rem; color: #8fa2ff; transition: transform .2s ease; }
.sp-channel:hover .sp-go { transform: translateX(4px); color: #fff; }
.sp-empty { color: #aab4d8; margin: 24px 0 0; }
.sp-empty a, .sp-alt { color: #b9c8ff; }
.sp-message { margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(140, 160, 255, .16); }
.sp-message h2 { margin: 0 0 14px; font-size: 1.15rem; color: #fff; }
.sp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.sp-form label { display: grid; gap: 6px; font: 600 .74rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; color: #8fa2ff; }
.sp-form .sp-l span { color: #6f7aa3; text-transform: none; letter-spacing: 0; font-weight: 400; }
.sp-form input, .sp-form textarea { width: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 1rem; font-weight: 400; line-height: 1.4; text-transform: none; letter-spacing: 0; color: #fff; padding: 11px 13px; border-radius: 10px;
  background: rgba(3, 6, 16, .6); border: 1px solid rgba(140, 160, 255, .25); transition: border-color .2s ease, box-shadow .2s ease; }
.sp-form textarea { resize: vertical; min-height: 130px; }
.sp-form input::placeholder, .sp-form textarea::placeholder { color: #5f6a92; }
.sp-form input:focus, .sp-form textarea:focus { outline: none; border-color: #7c8cff; box-shadow: 0 0 0 3px rgba(124, 140, 255, .25); }
.sp-wide { grid-column: 1 / -1; }
.sp-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sp-send { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border: 0; border-radius: 999px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: .95rem; line-height: 1; color: #fff;
  background: linear-gradient(120deg, #1f5eff, #7c5cff); box-shadow: 0 10px 26px -10px rgba(31, 94, 255, .9); transition: transform .2s ease, box-shadow .2s ease; }
.sp-send:hover, .sp-send:focus-visible { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(124, 92, 255, .9); }
.sp-alt { font-size: .85rem; }
.sp-note { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.sp-ok { color: #bbf7d0; background: rgba(34, 197, 94, .12); border: 1px solid rgba(74, 222, 128, .35); }
.sp-err { color: #fecaca; background: rgba(239, 68, 68, .12); border: 1px solid rgba(248, 113, 113, .35); }
@media (max-width: 600px) {
  .sp-deck { padding: 24px 18px 20px; border-radius: 14px; }
  .sp-channel { padding: 16px; gap: 12px; }
  .sp-icon { width: 44px; height: 44px; }
  .sp-go { display: none; }
  .sp-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .sp-sweep, .sp-dot, 
/* Adding or editing a property: a compact form, four smaller boxes to a row. */
/* Landlord invoice form: three to a row. */
@media (min-width: 900px) {
  .form-grid.form-landlord-invoice { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-landlord-invoice .span-2 { grid-column: span 2; }
}
/* Adding or editing a contractor: three to a row, Address beside Notes. */
@media (min-width: 900px) {
  .form-grid.form-contractors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-contractors .span-2 { grid-column: span 2; }
}
@media (min-width: 900px) {
  .form-grid.form-properties { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px 14px; }
  .form-properties .span-2 { grid-column: span 2; }
  .form-properties .span-3 { grid-column: span 3; }
  .form-properties .span-4 { grid-column: span 4; }
  .form-properties .field.row-start.span-2 { grid-column: 1 / span 2; }
  .form-properties .field.row-start.span-3 { grid-column: 1 / span 3; }
  .form-properties .field.row-start.span-4 { grid-column: 1 / span 4; }
}
.form-properties .field { margin: 0; }
.form-properties label { font-size: .82rem; margin-bottom: 3px; }
.form-properties input:not([type=radio]):not([type=checkbox]):not([type=file]), .form-properties select { padding: 6px 9px; min-height: 34px; font-size: .9rem; }
.form-properties textarea { padding: 6px 9px; font-size: .9rem; min-height: 60px; }
.form-properties .help { font-size: .72rem; margin-top: 2px; line-height: 1.3; }
.form-properties .new-certs .cert-row { grid-template-columns: 170px repeat(3, minmax(0, 1fr)); gap: 6px 12px; margin: 4px 0; }
.form-properties .form-subhead { margin: 6px 0 2px; }
@media (max-width: 899px) { .form-properties input:not([type=radio]):not([type=checkbox]):not([type=file]), .form-properties select, .form-properties textarea { font-size: 16px; } }
@media (min-width: 900px) {
  .form-properties .new-certs .cert-row input { padding: 5px 9px; min-height: 32px; font-size: .88rem; }
  .form-properties .new-certs .cert-row strong { font-size: .92rem; }
  .form-properties .new-certs .cert-row label { font-size: .78rem; }
  .form-properties .new-certs .cert-row { margin: 2px 0; }
}
/* A value set automatically that can't be changed, e.g. "Added by". */
.locked-value { padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font-weight: 600; min-height: 38px; display: flex; align-items: center; }
.field > .label { display: block; font-weight: 700; margin-bottom: 4px; }
.pay-gaps p { margin: 4px 0; }
.gap-list { display: flex; flex-wrap: wrap; gap: 4px 12px; }
/* The Rift report preview: every cell centred, like the workbook. */
.sheet-preview .sheet-title { text-align: center; }
.sheet-preview table.cfp th, .sheet-preview table.cfp td, .sheet-preview table.cfp .num { text-align: center; }
.sheet-count { text-align: center; }
.sheet-preview { width: 720px; max-width: 100%; }
.sheet-preview table.cfp { width: 100%; }

/* The inspection sheet and job sheet: everything centred. */
#inspection-sheet, #job-sheet { text-align: center; }
#inspection-sheet > .card-head, #job-sheet > .card-head { flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#inspection-sheet > .card-head .actions, #job-sheet > .card-head .actions { justify-content: center; }
.tick-sheet .tick-head span, .tick-sheet .tick-label, .tick-sheet .tick-answer { text-align: center; }
.sign-box { text-align: center; }
.sign-box .sign-img { margin: 0 auto; }
.sign-box form[data-signature] { justify-items: center; }
.sign-box form[data-signature] label { justify-items: center; width: 100%; max-width: 420px; }
.sign-box form[data-signature] label input { text-align: center; }
.sign-box .sign-pad { max-width: 600px; }
.sign-satisfied { justify-content: center; }
.sign-satisfied legend { text-align: center; }
.sign-actions { justify-content: center; }
.new-sign { display: grid; justify-items: center; gap: 8px; text-align: center; }
.new-sign label { display: grid; gap: 4px; justify-items: center; width: 100%; max-width: 420px; font-weight: 700; }
.new-sign label input { text-align: center; }
.new-sign .sign-pad { max-width: 600px; }
.new-signs { margin-top: 6px; }
.new-signs .sign-satisfied label { display: inline-flex; width: auto; }

/* Inspection and job sheet forms, laid out like the printed sheets: a white page in both themes. */
.paper { --paper-ink: #111; --paper-line: #222; background: #fff; color: var(--paper-ink); border: 1px solid #b9bec7; border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12); max-width: 860px; width: 100%; margin: 0 auto 8px; padding: 34px 40px 30px;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; }
.paper a { color: #1646c8; }
.paper .muted { color: #555; }
.paper input:not([type=radio]):not([type=checkbox]), .paper select, .paper textarea { background: #fff; color: #111; border: 1px solid #9aa1ab; border-radius: 4px; min-height: 32px; padding: 4px 8px; font: inherit; font-size: .95rem; }
.paper input:focus, .paper select:focus, .paper textarea:focus { outline: 2px solid #1646c8; outline-offset: 1px; }
.paper .field-err { color: #a3150c; font-size: .8rem; }
.paper-k { font-weight: 700; }

/* Inspection sheet */
.paper-head { margin-bottom: 26px; }
.paper-agency { font-family: Arial, sans-serif; font-weight: 800; font-size: 2rem; color: #3f5273; line-height: 1.1; }
.paper-sub { color: #66708a; font-size: .95rem; }
.paper-lines { display: grid; gap: 10px; margin-bottom: 20px; }
.paper-line { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; }
.paper-line > label { font-weight: 700; font-size: .92rem; }
.paper-line select, .paper-line input { width: 100%; max-width: 460px; }
.paper-pair { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.paper-pair select { width: auto; }
.paper-pair label { font-weight: 700; font-size: .92rem; }
.paper-checks { display: grid; }
.paper-check { display: grid; grid-template-columns: minmax(0, 360px) auto auto; align-items: center; column-gap: 26px; }
.paper-check .paper-cell { border: 1.5px solid var(--paper-line); border-top-width: 0; padding: 7px 6px 3px; font-size: .9rem; min-height: 33px; display: flex; align-items: flex-end; }
.paper-check-head .paper-cell { background: #8ea9db; border-top-width: 1.5px; font-weight: 700; justify-content: center; align-items: center; min-height: 24px; padding: 3px 6px; }
.paper-answers { display: flex; gap: 6px; }
.paper-check-head .paper-answers span { width: 52px; text-align: center; font-weight: 700; font-size: .78rem; color: #333; }
.paper-answers .tick span { min-width: 52px; padding: 4px 0; }
.paper-notes { margin-top: 22px; display: grid; gap: 4px; }
.paper-notes label { font-weight: 700; font-size: .92rem; }
.paper-notes textarea { width: 100%; max-width: 620px; min-height: 140px; border: 1.5px solid var(--paper-line); border-radius: 0; }
.paper-sign { margin-top: 18px; display: grid; gap: 6px; }
.paper-sign-label { font-weight: 700; font-size: .92rem; }
.paper .new-sign { justify-items: start; text-align: left; max-width: 420px; }
.paper .new-sign label { justify-items: start; }
.paper .new-sign label input { text-align: left; }
.paper .sign-pad { background: #fff; border: 1px dashed #9aa1ab; }
.paper .sign-actions { justify-content: flex-start; }

/* Job sheet */
.paper-job { font-family: "Times New Roman", Times, serif; padding: 0 0 26px; border: 1.5px solid var(--paper-line); border-radius: 0; }
.paper-job input:not([type=radio]):not([type=checkbox]), .paper-job select, .paper-job textarea { font-family: inherit; }
.paper-band { background: #dcdcdc; border-bottom: 1.5px solid var(--paper-line); text-align: center; padding: 10px 12px 8px; }
.paper-band-name { font-weight: 700; font-size: 1.6rem; }
.paper-band-line { font-weight: 700; font-size: .78rem; }
.paper-job > *:not(.paper-band) { margin-left: 36px; margin-right: 36px; }
.paper-job-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 64px; }
.paper-contractor { display: grid; gap: 4px; align-content: start; }
.paper-contractor input { max-width: 300px; }
.paper-address { white-space: pre-line; font-size: .95rem; min-height: 1.2em; }
.paper-kv { margin: 0; display: grid; gap: 6px; }
.paper-kv > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; }
.paper-kv dt { font-weight: 700; }
.paper-kv dd { margin: 0; text-align: right; min-height: 1.2em; }
.paper-kv dd input, .paper-kv dd select { max-width: 170px; }
.paper-kv-left dd { text-align: left; }
.paper-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 46px; padding-bottom: 8px; border-bottom: 1.5px solid var(--paper-line); }
.paper-title { font-weight: 700; font-size: 2rem; letter-spacing: .01em; }
.paper-jobno { display: flex; align-items: center; gap: 14px; }
.paper-box { display: inline-grid; place-items: center; min-width: 110px; min-height: 34px; border: 1.5px solid var(--paper-line); font-size: 1.1rem; }
.paper-prop { margin-top: 14px; display: grid; gap: 4px; }
.paper-boxed { border: 1.5px solid var(--paper-line); padding: 4px 6px; }
.paper-prop .paper-boxed select { width: 100%; border: 0; min-height: 26px; padding: 0; }
.paper-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 18px; }
.paper-details .paper-kv-left > div { grid-template-columns: 140px minmax(0, 1fr); }
.paper-section { margin-top: 18px; display: grid; gap: 5px; }
.paper-access { display: block; width: 100%; min-height: 64px; font: inherit; font-size: .95rem; line-height: 1.35; resize: vertical; background: transparent; color: inherit; border-radius: 0; }
.paper-work { display: grid; gap: 6px; padding: 10px 12px; }
.paper-work input, .paper-work textarea { width: 100%; }
.paper-signs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 10px; padding-top: 10px; border-top: 1px dotted #777; }
.paper-signs > p { grid-column: 1 / -1; margin: 0; }
.paper-sat { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .92rem; }
.paper-sign-later { margin: 8px 0 0; }
.paper-office { margin-top: 22px; padding-top: 14px; border-top: 1px dashed #9aa1ab; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; }
.paper-office-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.paper-office .field label, .paper-office .label { font-size: .85rem; }
.paper .locked-value { background: #f2f3f5; color: #111; border-color: #9aa1ab; }
@media (max-width: 760px) {
  .paper { padding: 20px 16px; }
  .paper-job { padding: 0 0 18px; }
  .paper-job > *:not(.paper-band) { margin-left: 14px; margin-right: 14px; }
  .paper-line { grid-template-columns: 1fr; gap: 3px; }
  .paper-check { grid-template-columns: minmax(0, 1fr); row-gap: 4px; margin-bottom: 6px; }
  .paper-check-head .paper-answers { display: none; }
  .paper-job-top, .paper-details, .paper-signs, .paper-office-grid { grid-template-columns: 1fr; }
  .paper-job-top { margin-top: 24px; }
  .paper-kv > div { grid-template-columns: 140px minmax(0, 1fr); }
  .paper-title { font-size: 1.5rem; }
  .paper input:not([type=radio]):not([type=checkbox]), .paper select, .paper textarea { font-size: 16px; }
}
.paper-sat label.check { display: inline-flex; align-items: center; gap: 6px; width: auto; font-weight: 700; }
.paper-signs .new-sign { align-content: start; }
.paper .sign-actions { align-self: start; }
.paper .sign-actions .btn { height: auto; }
.paper-prop-head { display: flex; align-items: baseline; gap: 10px; }
.paper-prop-head label { display: inline; margin: 0; }
@media (max-width: 760px) {
  .paper-title-row { flex-wrap: wrap; }
  .paper-jobno { gap: 8px; }
  .paper-box { min-width: 72px; }
}
.paper-kv dd input { width: 100%; max-width: 200px; text-align: right; }
.paper-kv-left dd input { text-align: left; }
.paper-sat { grid-column: 1 / -1; }
.below-certs .btn.small { white-space: normal; text-align: center; }

/* Landlord statement, laid out like the printed statement of account. */
.statement-paper { padding: 0; overflow: hidden; background: #fff; color: #000; font-family: 'Times New Roman', Times, serif; border: 1px solid #000; border-radius: 0; max-width: 820px; margin-left: auto; margin-right: auto; }
.sp-band { background: #c0c0c0; border-bottom: 1px solid #000; text-align: center; padding: 10px 12px 8px; }
.sp-agency { font-size: 28px; font-weight: 700; line-height: 1.15; }
.sp-sub { font-size: 13px; font-weight: 700; }
.sp-body { padding: 40px 36px 28px; }
.sp-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-size: 16px; padding-left: 12px; }
.sp-details { display: grid; grid-template-columns: auto auto; gap: 2px 40px; margin: 0; font-size: 13px; }
.sp-details dt { font-weight: 700; }
.sp-details dd { margin: 0; text-align: right; }
.sp-title { text-align: center; font-size: 19px; font-weight: 700; line-height: 1.25; margin: 42px 0 8px; color: #000; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.statement-paper .sp-table th, .statement-paper .sp-table td { border: 0; padding: 2px 6px; background: none; color: #000; text-align: left; }
.statement-paper .sp-table th { font-size: 13px; text-align: right; text-transform: none; letter-spacing: 0; width: 15%; }
.sp-table th:first-child { width: auto; }
.statement-paper .sp-table td.num { text-align: right; vertical-align: bottom; }
.sp-re { font-weight: 700; font-size: 16px; padding-top: 4px; }
.sp-head { font-weight: 700; font-size: 19px; padding-left: 18px !important; }
.sp-item { padding-left: 30px !important; }
.sp-item div { padding-left: 4px; }
.sp-total td { border-top: 1px solid #000; font-weight: 700; font-size: 16px; padding-top: 6px; padding-left: 18px; }
.sp-total td:first-child, .sp-total2 td:first-child, .sp-due td:first-child { padding-left: 18px; }
.sp-total td.num, .sp-total2 td.num { font-weight: 400; }
.sp-total td.num strong, .sp-total2 td.num strong { font-weight: 700; }
.sp-total td:first-child { border-top: 0; }
.sp-total2 td { font-weight: 700; font-size: 16px; }
.sp-due td { font-weight: 700; font-size: 16px; padding-top: 18px; }
.sp-due td.num span { display: inline-block; min-width: 100%; border-top: 1px solid #000; border-bottom: 3px double #000; padding: 2px 0; }
.sp-closing { font-weight: 700; font-size: 16px; padding-left: 18px; margin-top: 14px; }
@media (max-width: 640px) { .sp-body { padding: 20px 10px; } .sp-agency { font-size: 20px; } .sp-title { font-size: 15px; } .sp-table { font-size: 13px; } .sp-head { font-size: 15px; } }
/* A statement's transactions on a phone: each one a small block (date and amounts, then the
   property and what it was) instead of a wide table to scroll sideways. */
@media (max-width: 700px) {
  .table-wrap > table.fit-phone, table.fit-phone tbody { display: block; width: 100%; min-width: 0; }
  table.fit-phone thead { display: none; }
  table.fit-phone tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "d m" "p b" "s s"; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.fit-phone td { display: block; border: 0; padding: 0; white-space: normal; text-align: left; }
  table.fit-phone td:nth-child(1) { grid-area: d; font-weight: 600; }
  table.fit-phone td:nth-child(2) { grid-area: p; }
  table.fit-phone td:nth-child(3) { grid-area: s; color: var(--muted); font-size: .85rem; }
  table.fit-phone td:nth-child(4), table.fit-phone td:nth-child(5) { grid-area: m; text-align: right; }
  table.fit-phone td:nth-child(6) { grid-area: b; text-align: right; }
  table.fit-phone td:nth-child(4), table.fit-phone td:nth-child(5), table.fit-phone td:nth-child(6) { white-space: nowrap; }
  table.fit-phone td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .75rem; font-weight: 400; }
  table.fit-phone tr.sub, table.fit-phone tr.total { grid-template-columns: 1fr auto; grid-template-areas: "s b"; }
  table.fit-phone tr.sub td:first-child, table.fit-phone tr.total td:first-child { grid-area: s; color: inherit; font-size: inherit; }
  table.fit-phone tr.sub td:last-child, table.fit-phone tr.total td:last-child { grid-area: b; }
}

/* Landlord statements: the next statement number, top right. */
.stmt-head { flex-wrap: nowrap; align-items: flex-start; }
.stmt-head > div { flex: 1 1 auto; min-width: 0; }
@media (max-width: 700px) { .stmt-head { flex-wrap: wrap; } }
.stmt-no-box { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-width: 190px; }
.stmt-no-box label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.stmt-no-row { display: flex; gap: 6px; }
.stmt-no-row input { width: 100px; }

/* Contractors: export / import, top right. */
.transfer-box { display: inline-flex; gap: 6px; align-items: center; padding: 4px; border: 1px solid var(--border); border-radius: 10px; }
.transfer-box form { margin: 0; }

/* Admin: rename an agency. */
.rename-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rename-form input { flex: 1 1 420px; max-width: 640px; min-width: 0; }

/* Rent run 5.2: an email laid out like a mail program's new message window. */
.mail-compose { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); margin-top: 10px; }
.mail-head { display: flex; flex-direction: column; }
.mail-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--border); margin: 0; }
.mail-row span { padding: 0 12px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.mail-compose .mail-row input { border: 0; border-radius: 0; box-shadow: none; padding: 10px 12px; margin: 0; background: transparent; width: 100%; }
.mail-compose .mail-row input:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.mail-compose .mail-body { display: block; width: 100%; border: 0; border-radius: 0; padding: 12px; min-height: 200px; resize: vertical; margin: 0; background: transparent; }
.mail-compose .mail-body:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.mail-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.mail-attach { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mail-attach svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mail-compose + .muted, #send-email > .muted.small { margin-top: 6px; }

/* Contractor invoice: change the paid date. */
.paid-date-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.paid-date-form label { font-weight: 600; }
.paid-date-form input { width: auto; }
.preset-name { max-width: 420px; margin-bottom: 12px; }
