:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e4e7ec;
  --primary: #1f5eff; --primary-dark: #1546c4; --danger: #d92d20; --ok: #079455; --warn: #b54708;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { display: grid; place-items: center; min-height: 60vh; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* layout */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0c4a6e 0%, #0a3a57 55%, #082f47 100%); color: #c9d8e4;
  padding: 1.25rem .85rem; display: flex; flex-direction: column; gap: .15rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 4px solid #f59e0b;
}
.side-brand { display: flex; align-items: center; gap: .65rem; padding: .1rem .5rem 1.25rem; }
.side-title { color: #fff; font-weight: 700; font-size: 1.02rem; }
.side-sub { font-size: .75rem; color: #9fb6c8; }
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar a { color: #c9d8e4; padding: .55rem .7rem; border-radius: 8px; display: flex; align-items: center; gap: .65rem; position: relative; }
.sidebar a .icon { width: 1.15rem; height: 1.15rem; flex: none; opacity: .85; }
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.sidebar a.active::before { content: ''; position: absolute; left: -.85rem; top: .45rem; bottom: .45rem; width: 4px; border-radius: 0 4px 4px 0; background: #f59e0b; }
.sidebar a.active .icon { opacity: 1; color: #fbbf24; }
.side-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f9db3; padding: 1.1rem .7rem .3rem; }
.sidebar .spacer { flex: 1; }
.side-user { display: flex; align-items: center; gap: .6rem; padding: .75rem .55rem; margin-top: .5rem; border-top: 1px solid rgba(255,255,255,.12); }
.side-user-text { min-width: 0; }
.side-user-name { color: #fff; font-weight: 600; font-size: .88rem; }
.side-user-email { font-size: .75rem; color: #9fb6c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #f59e0b; color: #0c4a6e; font-weight: 700; font-size: .8rem; }
.avatar.sm { width: 1.8rem; height: 1.8rem; font-size: .7rem; }
.icon { width: 1.1rem; height: 1.1rem; flex: none; }
button .icon, .btn .icon { width: 1rem; height: 1rem; }
.main { padding: 1.75rem 2.25rem; max-width: 1320px; width: 100%; min-width: 0; }
.main > div > .topbar:first-child h1, .main h1 { font-size: 1.6rem; letter-spacing: -.01em; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.topbar h1 { margin: 0; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.two { grid-template-columns: 1fr 1fr; }
/* Laptops / tablets: the sidebar becomes a narrow icon bar so tables get the room (labels show on hover). */
@media (min-width: 801px) and (max-width: 1150px) {
  .shell { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar { padding: 1rem .5rem; align-items: center; }
  .sidebar a { justify-content: center; padding: .6rem; }
  .sidebar a span, .side-brand > div, .side-user-text, .side-section { display: none; }
  .side-brand { padding: 0 0 1rem; justify-content: center; }
  .side-user { justify-content: center; padding: .6rem 0; }
  .sidebar a.active::before { left: -.5rem; }
  .main { padding: 1.25rem 1rem; }
  th, td { padding: .55rem .55rem; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; position: static; height: auto; border-right: 0; border-bottom: 4px solid #f59e0b; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-brand { width: 100%; padding-bottom: .5rem; }
  .side-section, .side-user { display: none; }
  .sidebar a.active::before { display: none; }
  .sidebar .spacer { display: none; }
  .main { padding: 1rem; }
  .two { grid-template-columns: 1fr; }
}

.card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 1.15rem 1.3rem; }
.stat { border-top: 3px solid transparent; }
a.card.stat:hover { border-top-color: #f59e0b; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: .25rem; }
.mb { margin-bottom: 1rem; }

/* tables */
.table-wrap { overflow: hidden; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
/* Long lists: the table scrolls inside the window, so its header and side-scrollbar stay in view. */
.paged .table-scroll { max-height: calc(100vh - 13rem); min-height: 16rem; overflow: auto; }
.paged th { z-index: 2; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fafb; }
td.actions { white-space: nowrap; text-align: right; }
tfoot td { font-weight: 700; background: #fafbfc; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* forms */
button, .btn {
  font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); padding: .5rem .9rem;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
button:hover, .btn:hover { background: #f2f4f7; text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--primary-dark); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--primary); padding: .2rem .4rem; }
button.link.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: inherit; width: 100%; padding: .5rem .65rem; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d7fe; border-color: var(--primary); }
input[type=checkbox] { width: auto; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: .85rem; }
.field .help { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.filters input, .filters select { width: auto; min-width: 180px; }

/* badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #f2f4f7; color: #344054; }
.badge.current, .badge.posted { background: #dcfae6; color: var(--ok); }
.badge.past { background: #f2f4f7; color: var(--muted); }
.badge.future, .badge.calculated { background: #e0eaff; color: var(--primary-dark); }
.badge.draft { background: #fef0c7; color: var(--warn); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: 92vh; overflow: auto; padding: 1.5rem; }
.modal.wide { width: min(1000px, 100%); }
.modal .footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.modal { position: relative; }
.modal-x { position: absolute; top: .6rem; right: .6rem; width: 2.2rem; height: 2.2rem; padding: 0; justify-content: center;
  border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--muted); border-radius: 50%; }
.modal-x:hover { background: #f2f4f7; color: var(--text); }
.modal > h2:first-of-type { padding-right: 2.2rem; }
body.modal-open { overflow: hidden; }
.error { background: #fef3f2; color: var(--danger); padding: .6rem .8rem; border-radius: 8px; margin-bottom: .8rem; }
.notice { background: #eff4ff; color: #1d2939; padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }

.toast { position: fixed; bottom: 1.25rem; right: 1.25rem; background: #101828; color: #fff; padding: .75rem 1rem; border-radius: 8px; z-index: 60; max-width: 420px; }
.toast.err { background: var(--danger); }

/* sign-in page */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 5fr) 6fr; background: #fff; }
.login-brand {
  background: linear-gradient(160deg, #0c4a6e 0%, #0a3a57 60%, #082f47 100%); color: #e6eef5;
  display: flex; flex-direction: column; justify-content: space-between; padding: 2.5rem 3rem;
  border-right: 6px solid #f59e0b; position: relative; overflow: hidden;
}
.login-brand::after {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  right: -160px; bottom: -160px; background: rgba(255,255,255,.05);
}
.login-logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; color: #fff; }
.logo-mark { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: #f59e0b; color: #0c4a6e; }
.logo-mark svg { width: 1.25rem; height: 1.25rem; }
.login-pitch { max-width: 30rem; position: relative; z-index: 1; }
.login-pitch h1 { color: #fff; font-size: 2rem; line-height: 1.2; margin: 0 0 .9rem; }
.login-pitch p { margin: 0 0 1.75rem; line-height: 1.55; color: #c9d8e4; }
.login-pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.login-pitch li { display: flex; align-items: center; gap: .8rem; }
.pt-icon { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 8px; background: rgba(255,255,255,.1); color: #fbbf24; }
.pt-icon svg { width: 1.15rem; height: 1.15rem; }
.login-foot { font-size: .85rem; color: #9fb6c8; position: relative; z-index: 1; }

.login-main { display: grid; place-items: center; padding: 2.5rem 1.5rem; background: var(--bg); }
.login-box { width: min(400px, 100%); background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(16,24,40,.08), 0 1px 3px rgba(16,24,40,.08); padding: 2.25rem 2rem; }
.login-box h2 { font-size: 1.45rem; margin: 1.25rem 0 .3rem; }
.login-box > .muted { margin: 0 0 1.25rem; }
.login-box .field { margin-bottom: 1rem; }
.login-box input { padding: .65rem .75rem; }
button.block { width: 100%; justify-content: center; padding: .7rem 1rem; font-weight: 600; margin-top: .25rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #f2f4f7; border-radius: 10px; padding: 4px; gap: 4px; }
.segmented button { border: 0; background: none; border-radius: 7px; padding: .5rem; justify-content: center; color: var(--muted); font-weight: 600; }
.segmented button:hover { background: rgba(255,255,255,.6); }
.segmented button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 4.2rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--primary); font-size: .82rem; font-weight: 600; padding: .3rem .5rem; }
.pw-toggle:hover { background: #eff4ff; }
.login-cta { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); text-align: center; color: var(--muted); }
.login-cta .link { font-weight: 600; padding: 0 .2rem; }
.login-note { font-size: .82rem; color: var(--muted); margin: 1rem 0 0; line-height: 1.45; text-align: center; }
.login-box .back { padding: 0; font-size: .9rem; }
.steps-list { margin: 0 0 1.25rem; padding-left: 1.2rem; color: var(--text); font-size: .92rem; line-height: 1.6; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 1.5rem; border-right: 0; border-bottom: 5px solid #f59e0b; }
  .login-pitch { margin-top: 1rem; }
  .login-pitch h1 { font-size: 1.35rem; margin-bottom: .4rem; }
  .login-pitch p, .login-pitch ul { display: none; }
  .login-foot { margin-top: .5rem; }
  .login-main { padding: 1.5rem 1rem 2.5rem; place-items: start center; }
  .login-box { padding: 1.75rem 1.25rem; }
}
.tabs { display: flex; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a, .tabs button { border: 0; background: none; padding: .55rem .8rem; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
details summary { cursor: pointer; color: var(--primary); }
.weights { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: none; box-shadow: 0 2px 6px rgba(16,24,40,.15); }
.sidebar .who { padding: .5rem .7rem; }
.m0 { margin: 0; }
.main.centered { margin: 0 auto; }
.field[hidden] { display: none; }
.form-heading { margin: .75rem 0 .25rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .95rem; }
.mt { margin-top: 1.5rem; }
.grow { flex: 1; min-width: 220px; }
.badge.danger { background: #fee4e2; color: var(--danger); }
.badge.finalized { background: #dcfae6; color: var(--ok); }
table.lines { width: 100%; border: 1px solid var(--line); border-radius: 8px; }
table.lines input { width: 140px; text-align: right; }
table.lines td { vertical-align: middle; }
ol.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
ol.steps li { display: flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
ol.steps li span { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: #f2f4f7; font-size: .75rem; font-weight: 700; }
ol.steps li.done { color: var(--ok); border-color: #abefc6; }
ol.steps li.done span { background: var(--ok); color: #fff; }
ol.steps li.current { color: var(--primary-dark); border-color: var(--primary); font-weight: 600; }
ol.steps li.current span { background: var(--primary); color: #fff; }
.progress { height: 10px; background: #eef0f3; border-radius: 999px; overflow: hidden; margin: 1rem 0 .5rem; }
.progress .bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.log { max-height: 220px; overflow: auto; margin-top: .5rem; }
.log .error { margin: .25rem 0; padding: .35rem .6rem; }
button.primary.danger-fill { background: var(--danger); border-color: var(--danger); }
button.primary.danger-fill:hover { background: #b42318; }
.mt-sm { margin-top: .5rem; }
.modal ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
.warn { color: var(--warn); }
details.hint { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; }
details.hint summary { font-weight: 600; }
table.col-guide { font-size: .82rem; margin-top: .25rem; background: #fff; }
table.col-guide th, table.col-guide td { padding: .4rem .55rem; }
table.col-guide td:first-child { min-width: 170px; }
table.col-guide code { white-space: nowrap; font-size: .8rem; }
.col-check { margin-bottom: 1rem; padding: .8rem 1rem; }
.col-check ul { list-style: none; padding: 0; margin: .5rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .2rem .8rem; font-size: .85rem; }
.ok { color: var(--ok); }
th.sel, td.sel { width: 2rem; padding-right: 0; }
tr.selected td { background: #eff4ff; }
.selbar { display: flex; align-items: center; gap: .75rem; background: #eff4ff; border: 1px solid #c7d7fe; border-radius: 8px; padding: .5rem .8rem; margin-bottom: .75rem; }
.selbar[hidden] { display: none; }

/* log in as a resident: picker */
.picker { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.picker-row { display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .6rem .8rem; background: #fff; text-align: left; white-space: normal; }
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: #f5f8ff; }

/* resident portal */
.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.preview-bar { display: flex; align-items: center; gap: .7rem; padding: .6rem 1.25rem; background: #fef3c7; color: #78350f; border-bottom: 1px solid #f59e0b; font-size: .9rem; flex-wrap: wrap; }
.preview-bar span { flex: 1; min-width: 200px; }
.preview-bar button { background: #78350f; color: #fff; border-color: #78350f; }
.preview-bar button:hover { background: #92400e; }
.portal-head { background: linear-gradient(120deg, #0c4a6e, #082f47); color: #fff; border-bottom: 4px solid #f59e0b; }
.portal-head-inner { max-width: 1120px; margin: 0 auto; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.portal-brand, .portal-user { display: flex; align-items: center; gap: .75rem; }
.portal-prop { font-weight: 700; font-size: 1.1rem; }
.portal-sub { font-size: .78rem; color: #9fb6c8; font-weight: 400; }
.portal-user-name { font-weight: 600; font-size: .9rem; }
button.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
button.ghost:hover { background: rgba(255,255,255,.1); }
.portal-main { max-width: 1120px; width: 100%; margin: 0 auto; padding: 1.75rem 1.5rem 2.5rem; flex: 1; }
.portal-hello { font-size: 1.6rem; margin: 0 0 1rem; }
.due { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; background: #0c4a6e; color: #fff;
  border-radius: 14px; padding: 1.5rem 1.75rem; margin-bottom: 1.75rem; box-shadow: 0 8px 24px rgba(12,74,110,.25); position: relative; overflow: hidden; }
.due::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.06); }
.due-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #fbbf24; font-weight: 700; }
.due-amount { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: .2rem 0; }
.due-meta { color: #c9d8e4; font-size: .92rem; }
.due-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; position: relative; z-index: 1; }
.due-note { font-size: .8rem; color: #9fb6c8; }
.btn.light { background: #fff; color: #0c4a6e; border-color: #fff; font-weight: 600; }
.btn.light:hover { background: #f1f5f9; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.stmt { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: .9rem; border-left: 4px solid #0c4a6e; }
.stmt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.stmt-title { font-weight: 700; }
.stmt-total { font-size: 1.35rem; font-weight: 800; color: #0c4a6e; white-space: nowrap; }
.stmt-lines { list-style: none; padding: 0; margin: .75rem 0; border-top: 1px solid var(--line); }
.stmt-lines li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid #f0f2f5; font-size: .92rem; font-variant-numeric: tabular-nums; }
.stmt-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.stmt-foot details { flex: 1; }
.how { margin-top: .5rem; display: grid; gap: .45rem; color: #344054; line-height: 1.5; }
.side-card { margin-bottom: 1rem; }
.side-card h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; font-size: 1rem; }
.side-card h3 .icon { color: #0c4a6e; }
.side-card dl.kv { font-size: .9rem; margin-bottom: .75rem; }
.side-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.help-card { background: #fffbeb; border: 1px solid #fde68a; box-shadow: none; }
.portal-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.25rem; border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 860px) {
  .portal-grid { grid-template-columns: 1fr; }
  .due-actions { align-items: flex-start; }
  .portal-user-name .portal-sub { display: none; }
}
.due .due-amount.none { font-size: 1.6rem; }
.due-disclaimer { flex-basis: 100%; margin: .25rem 0 0; padding-top: .9rem; border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; color: #c9d8e4; position: relative; z-index: 1; }
.statement-preview ul { margin: .5rem 0; padding-left: 1.2rem; } .statement-preview li { margin: .2rem 0; }
.btn.pay { background: #f59e0b; border-color: #f59e0b; color: #0c4a6e; font-weight: 700; }
.btn.pay:hover { background: #fbbf24; text-decoration: none; }
a.btn.block { width: 100%; justify-content: center; }
.pay-card { border-top: 3px solid #f59e0b; }
.pay-card h3 .icon { color: #f59e0b; }
.bulk-edit { display: grid; gap: .5rem; margin: .5rem 0 1rem; } .bulk-opt { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: .25rem 0 0; } .bulk-edit [data-for] { padding-left: 1.6rem; }
.inline-edit { display: inline-flex; align-items: center; gap: .3rem; justify-content: flex-end; }
.inline-num { width: 4.2rem; text-align: right; padding: .3rem .45rem; border-color: #e4e7ec; background: #fff; font-variant-numeric: tabular-nums; }
tr:hover .inline-num { border-color: #b8c0cc; }
.inline-num:disabled { opacity: .6; }
.inline-ok { width: 1rem; color: var(--ok); font-weight: 700; }
.inline-ok.saving::after { content: '…'; color: var(--muted); }
/* split rule (RUBS template) form */
.rubs-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1rem; }
@media (max-width: 900px) { .rubs-grid { grid-template-columns: 1fr; } }
.flat-card { box-shadow: none; border: 1px solid var(--line); }
.flat-card h3 { margin: 0 0 .75rem; font-size: 1rem; }
.suffix { position: relative; }
.suffix input { padding-right: 1.8rem; text-align: right; }
.suffix span { position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.radio-row { display: flex; align-items: center; gap: .55rem; font-weight: 400; padding: .45rem .6rem; border-radius: 8px; margin: 0; }
.radio-row:hover { background: #f5f7fa; }
.radio-row input { width: auto; }
.factors { margin: .5rem 0 0 .6rem; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: .6rem; }
.factor-row { display: grid; grid-template-columns: 9rem 6rem 1fr; align-items: center; gap: .6rem; }
.factor-row .scope label { display: inline-flex; align-items: center; gap: .25rem; font-weight: 400; margin: 0 0 0 .5rem; }
.factor-row .scope input { width: auto; }
.small-input input { padding: .35rem .5rem; padding-right: 1.6rem; }
.switch { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; margin: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { width: 2.1rem; height: 1.2rem; border-radius: 999px; background: #c5ccd6; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ''; position: absolute; top: .15rem; left: .15rem; width: .9rem; height: .9rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(.9rem); }
.switch input:focus-visible + span { outline: 2px solid #c7d7fe; }
.factor-total { font-weight: 700; font-size: .9rem; }
.factor-total.ok { color: var(--ok); }
.factor-total.bad { color: var(--danger); }
.mr-auto { margin-right: auto; }
.test-form .field { margin-bottom: 0; }
.test-form { align-items: flex-end; margin-bottom: 1rem; }
.test-cards { grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
@media (max-width: 800px) { .test-cards { grid-template-columns: 1fr 1fr; } .factor-row { grid-template-columns: 1fr 6rem; } .factor-row .scope { grid-column: 1 / -1; } }
.weighting { display: flex; align-items: center; gap: .4rem; font-weight: 400; margin: 0 0 .2rem; flex-wrap: wrap; } .weighting select { width: auto; padding: .3rem .5rem; }
td.portal-col, th.portal-col { min-width: 11.5rem; }
.portal-cell .small { line-height: 1.35; }
/* Row buttons may wrap onto a second line instead of running off the edge. */
td.actions { white-space: nowrap; text-align: right; }
td.actions .link { padding: .15rem .35rem; }

/* tenant list cells */
td.contact { overflow-wrap: anywhere; min-width: 9rem; max-width: 15rem; }
td.dates { white-space: nowrap; }

/* row "More" menu (the panel is placed with JS, position: fixed, so the table can't clip it) */
details.row-menu { display: inline-block; }
details.row-menu > summary { list-style: none; cursor: pointer; color: var(--primary); padding: .15rem .4rem; border-radius: 6px; display: inline-block; user-select: none; }
details.row-menu > summary::-webkit-details-marker { display: none; }
details.row-menu > summary:hover, details.row-menu[open] > summary { background: #eef2ff; }
.menu-panel { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16,24,40,.18); padding: .3rem; min-width: 11rem; display: flex; flex-direction: column; }
.menu-panel button.link { width: 100%; text-align: left; justify-content: flex-start; padding: .45rem .65rem; border-radius: 6px; }
.menu-panel button.link:hover { background: #f2f4f7; }

/* pager */
tr.off-page { display: none !important; }
.pager { display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap; padding: .6rem .9rem; border-top: 1px solid var(--line); background: #fafbfc; font-size: .85rem; color: var(--muted); }
.pager-info b { color: var(--text); }
.pager-size { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400; font-size: .85rem; }
.pager-size select { width: auto; padding: .25rem .4rem; }
.pager-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.pager .pg { padding: .3rem .6rem; min-width: 2.1rem; justify-content: center; font-size: .85rem; }
.pager .pg.current { background: var(--primary); border-color: var(--primary); color: #fff; opacity: 1; cursor: default; }
.pg-gap { padding: 0 .2rem; }

/* responsive tables: drop less important columns on smaller screens, then switch to cards on phones */
@media (max-width: 1280px) { .hide-lg { display: none; } }
@media (max-width: 960px) {
  .paged .table-scroll { max-height: none; overflow: visible; }
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tfoot, table.responsive tr { display: block; width: 100%; }
  table.responsive tr { position: relative; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  table.responsive td { display: block; position: relative; border: 0; padding: .3rem .9rem .3rem 8rem; min-height: 1.9rem; text-align: left; max-width: none; white-space: normal; }
  /* The label floats in the left padding, so a two-line label makes its row taller instead of overlapping the next one. */
  table.responsive td::before { content: attr(data-label); float: left; width: 6.6rem; margin: .12rem 0 0 -7.1rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); line-height: 1.3; }
  table.responsive td:not(.actions):not(.sel)::after { content: ''; display: table; clear: both; }
  table.responsive td.hide-lg { display: block; }
  table.responsive td.sel { position: absolute; right: .4rem; top: .55rem; display: block; width: auto; }
  table.responsive td.sel::before, table.responsive td.actions::before, table.responsive tfoot td::before { content: none; }
  table.responsive td.actions { display: block; text-align: left; padding: .45rem .9rem .2rem; }
  table.responsive tr:has(td.sel) td:nth-child(2) { padding-right: 2.5rem; }
  table.responsive tfoot td { display: inline-block; }
  table.responsive .inline-edit { justify-content: flex-start; }
  .pager-nav { margin-left: 0; }
}

/* settings → system & storage */
.sys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.sys-grid .card h2 { margin-bottom: .6rem; }
.sys-wide { grid-column: 1 / -1; }
.sys-big { font-size: 1.6rem; font-weight: 700; margin-bottom: .5rem; }
.sys-big .muted { font-size: 1rem; font-weight: 400; }
.meter { height: .6rem; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, #0c4a6e, #1f5eff); border-radius: 999px; }
table.plain td { padding: .35rem .2rem; }
table.plain tr:hover { background: none; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: .2rem; }
@media (max-width: 960px) { .sys-grid { grid-template-columns: 1fr; } }
dl.kv dd { overflow-wrap: anywhere; }

/* settings → security */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); }
.checklist .chk { flex: none; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; font-size: .75rem; font-weight: 700; background: #dcfae6; color: var(--ok); }
.checklist li.off .chk { background: #fef0c7; color: var(--warn); }
.sec-form label.check { margin-bottom: 1rem; }
.sec-form label.check .help { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.tabs.m0 { margin: 0; border: 0; }
/* ALTCHA widget on the sign-in forms */
.altcha-wrap { margin: .25rem 0 1rem; }
.altcha-wrap altcha-widget { display: block; --altcha-max-width: 100%; }

/* owner discount on a billing batch */
.discount-box { border: 1px dashed #c7d7fe; background: #f8faff; border-radius: 10px; padding: .85rem 1rem; margin: .75rem 0 .25rem; }
.discount-head { margin-bottom: .6rem; }
.discount-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.discount-grid .full { grid-column: 1 / -1; }
.discount-box [data-discount-preview] { margin: .1rem 0 .4rem; }
.discount-box [data-discount-preview]:empty { display: none; }
.discount-text { color: var(--ok); display: block; }
.discount-stat .value { color: var(--ok); }

/* phones: pop-up windows become full-screen sheets with the buttons always visible */
@media (max-width: 600px) {
  .modal-bg { padding: 0; place-items: stretch; }
  .modal, .modal.wide {
    width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0;
    padding: 1rem 1rem 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .modal-x { top: .5rem; right: .5rem; }
  /* labels the hidden table header used to give */
  table.lines td.amt::before { content: 'Amount on bill'; display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: .3rem; }
  table.lines td.inc { display: flex; align-items: center; gap: .5rem; }
  table.lines td.inc::after { content: 'Include in this batch'; font-size: .9rem; }
  table.lines td.inc input[type=checkbox] { margin-top: 0; }
  .modal > h2:first-of-type { padding-right: 2.4rem; margin-top: .2rem; }
  /* Cancel / Save stay at the bottom of the screen, above Safari's toolbar */
  .modal .footer { position: sticky; bottom: 0; z-index: 2; margin: 1rem -1rem 0; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(16,24,40,.06); }
  .modal .footer button { flex: 1; justify-content: center; min-height: 2.9rem; }
  /* 16px text stops iPhone Safari from zooming in when a field is tapped */
  input, select, textarea { font-size: 16px; }
  .field { margin-bottom: .75rem; }
  .discount-grid { grid-template-columns: 1fr; }
  table.lines, table.lines tbody, table.lines tfoot, table.lines tr { display: block; width: 100%; }
  table.lines thead { display: none; }
  table.lines tr { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
  table.lines td { display: block; border: 0; padding: .15rem 0; text-align: left; }
  table.lines td.num { text-align: left; }
  table.lines input[type=number] { width: 100%; text-align: left; margin-top: .3rem; }
  table.lines tfoot tr { display: flex; justify-content: space-between; }
  table.lines input[type=checkbox] { width: auto; margin-top: .3rem; }
}
.stmt-lines li.stmt-total-row { border-bottom: 0; padding: .25rem 0; }
.stmt-lines li.stmt-total-row.first, .stmt-lines li.stmt-total-row.grand { border-top: 1px solid var(--line); }
.stmt-lines li.stmt-total-row.grand { font-weight: 700; padding-top: .45rem; }
.stmt-lines li.discount-text { display: flex; color: var(--ok); }

/* date fields: keep iOS Safari's date input inside its box */
input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; min-height: 2.65rem; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }

/* forgot password */
button.link.inline { padding: 0; font-size: inherit; }
.notice.ok-notice { background: #ecfdf3; border-color: #abefc6; color: #05603a; }

/* checks before finalizing */
.checks-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.checks-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
ul.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
ul.checks li { display: flex; gap: .6rem; align-items: flex-start; }
ul.checks .chk { flex: none; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; font-size: .75rem; font-weight: 700; background: #dcfae6; color: var(--ok); }
ul.checks li.warn .chk { background: #fef0c7; color: var(--warn); }
.check-items { margin-top: .2rem; color: var(--text); }
.notice.warn-notice { background: #fffaeb; border-color: #fedf89; color: #93370d; }

/* bill history chart */
.chart-card { margin-bottom: 1rem; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .25rem; }
.legend { list-style: none; display: flex; gap: 1rem; flex-wrap: wrap; margin: 0; padding: 0; font-size: .85rem; color: var(--text); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
svg.bill-chart { width: 100%; height: auto; display: block; margin-top: .5rem; }
svg.bill-chart .grid { stroke: #eceef2; stroke-width: 1; }
svg.bill-chart .baseline { stroke: #c4c9d2; stroke-width: 1; }
svg.bill-chart .axis-label { font-size: 11px; fill: var(--muted); font-family: inherit; }
svg.bill-chart .chart-hit .hit { fill: transparent; }
svg.bill-chart .chart-hit:hover .hit, svg.bill-chart .chart-hit:focus .hit { fill: #f2f4f7; }
svg.bill-chart .chart-hit:focus { outline: none; }
