/* SR-DV — console styles. Wayfinding world in DreamVille blue: a near-black bar, one blue sign band per
   page naming the next job, quiet ink-on-light work areas, colour only where it means something. */
:root {
  --bg: #f3f5f6;
  --bg-subtle: #eaeef0;
  --panel: #ffffff;
  --border: #dbe1e5;
  --border-strong: #aeb9c1;
  --text: #0f1c24;
  --muted: #45535e;
  --faint: #66737e;
  --hover: #e6f6fc;
  --inverse: #0f1c24;
  --inverse-text: #ffffff;
  --focus: rgba(0, 182, 240, .40);
  --shadow: none;
  --radius: 4px;
  --brand: #00b6f0;        /* DreamVille logo blue: sign band and active tab only */
  --brand-ink: #0f1c24;    /* text on the brand blue */
  --brand-deep: #00739c;   /* the same blue, deep enough for links on white */
  --bar: #0f1c24;          /* top bar, both themes */
  --bar-text: #c3ced5;
  --font: "Hind", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Source Sans 3", "Hind", "Segoe UI", system-ui, sans-serif;  /* numbers: Hind has no tabular figures; this one matches its width */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b141a; --bg-subtle: #0f1a21; --panel: #111d24; --border: #1f2d36; --border-strong: #34454f;
  --text: #e6edf1; --muted: #a3b2bc; --faint: #7d8c96; --hover: #12313d;
  --inverse: #e6edf1; --inverse-text: #0b141a; --focus: rgba(0, 182, 240, .45);
  --brand-deep: #5fd2f6; --bar: #060d11;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: currentColor; }
::selection { background: var(--brand); color: var(--brand-ink); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
p { margin: 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Top bar: near-black in both themes; the open tab is a blue panel ── */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px;
  display: flex; align-items: center; gap: 28px; padding: 0 28px;
  background: var(--bar); color: var(--bar-text);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { display: none; }
.brand .site { color: var(--bar-text); font-weight: 500; font-size: 15px; }
.tabs { display: flex; gap: 4px; align-items: center; }
.tabs a { padding: 6px 13px; border-radius: 3px; color: var(--bar-text); font-weight: 500; font-size: 15px; }
.tabs a:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .07); }
.tabs a.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 14px; color: var(--bar-text); font-size: 14px; }
.top-actions a:hover, .top-actions button:hover { color: #fff; }
.top-actions form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.iconbtn {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: var(--bar-text); cursor: pointer;
}
.iconbtn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 3px;
  background: var(--amber-bg); border: 1px solid var(--amber-line); font: 600 12px/1 var(--font);
  color: var(--amber);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* the test copy is marked solid, so it can't be mistaken for the real console */
.tag.tag-copy { background: #f5b301; border-color: #f5b301; color: #0f1c24; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tag.tag-copy::before { display: none; }

/* ── Page ── */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head p { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }

/* ── Panels / cards ── */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }

.nav-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.nav-card {
  display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 148px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, background .15s;
}
.nav-card:hover { border-color: var(--border-strong); background: var(--bg-subtle); text-decoration: none; }
.nav-card .idx { font: 500 11px/1 var(--mono); color: var(--faint); letter-spacing: .06em; }
.nav-card h2 { font-size: 17px; margin-top: 10px; }
.nav-card .desc { color: var(--muted); }
.nav-card .live { margin-top: auto; padding-top: 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.nav-card .arrow { color: var(--faint); transition: transform .15s, color .15s; }
.nav-card:hover .arrow { transform: translateX(3px); color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.kpi { padding: 18px 20px; border-left: 1px solid var(--border); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font: 600 24px/1.2 var(--mono); letter-spacing: -0.03em; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi .hint { color: var(--faint); font-size: 12px; margin-top: 4px; }
.meter { height: 4px; border-radius: 2px; background: var(--border); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--text); }

/* ── Attention list ── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); flex: none; margin-right: 12px; }
.list .item { display: flex; align-items: center; min-width: 0; }
.list .go { color: var(--muted); white-space: nowrap; font-weight: 500; }
.list li:hover .go { color: var(--text); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* ── Buttons & forms ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 3px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:focus-visible, .input:focus, .select:focus { outline: none; box-shadow: 0 0 0 3px var(--focus); border-color: var(--text); }
.btn.primary { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-text); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.input, .select {
  height: 38px; padding: 0 10px; border-radius: 3px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font: 14px var(--font); min-width: 0;
}
.select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input.num { font-family: var(--mono); text-align: right; }
.input.cell { height: 30px; width: 110px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.file { font: 12px var(--font); color: var(--muted); max-width: 100%; }
.file::file-selector-button {
  height: 30px; padding: 0 12px; margin-right: 10px; border-radius: 3px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font: 500 12px var(--font); cursor: pointer;
}
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.segmented { display: inline-flex; box-sizing: border-box; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--bg-subtle); }
.segmented a { display: inline-flex; align-items: center; padding: 0 12px; border-radius: 2px; color: var(--muted); font-weight: 500; font-size: 14px; }
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.segmented .count { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-left: 6px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--text); padding: 10px 16px;
  border-bottom: 2px solid var(--text); white-space: nowrap; background: var(--panel);
}
.t td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--bg-subtle); }
.t td.num, .t th.num { text-align: right; }
.t tr.group td { background: var(--bg-subtle); font-weight: 600; font-size: 12px; padding-top: 8px; padding-bottom: 8px; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.t .check { width: 36px; }
.t tr.missing td:first-child { box-shadow: inset 2px 0 0 var(--text); }
.panel > .table-wrap > .t th:first-child, .panel > .table-wrap > .t td:first-child { padding-left: 20px; }
.panel > .table-wrap > .t th:last-child, .panel > .table-wrap > .t td:last-child { padding-right: 20px; }
.row-link { font-weight: 500; }

/* ── Status pills (monochrome: fill, outline, dash) ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 3px;
  font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border-strong); color: var(--text);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; }
.pill-paid { color: var(--muted); border-color: var(--border); }
.pill-paid::before { background: currentColor; }
.pill-partial::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.pill-overdue { background: var(--inverse); color: var(--inverse-text); border-color: var(--inverse); }
.pill-overdue::before { background: currentColor; }
.pill-draft { border-style: dashed; color: var(--muted); }
.pill-void { color: var(--faint); border-color: var(--border); text-decoration: line-through; }
.pill-sent::before, .pill-ok::before { background: currentColor; }
.pill-failed, .pill-skipped { border-style: dashed; }
.pill-pending { color: var(--muted); }

/* ── Stepper ── */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.step { padding: 14px 18px; border-left: 1px solid var(--border); display: flex; align-items: center; gap: 12px; color: var(--faint); }
.step:first-child { border-left: 0; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); font: 500 12px/1 var(--mono); flex: none; }
.step .t { font-weight: 500; }
.step.done { color: var(--muted); }
.step.done .n { background: var(--bg-subtle); }
.step.now { color: var(--text); background: var(--bg-subtle); }
.step.now .n { background: var(--inverse); color: var(--inverse-text); border-color: var(--inverse); }

/* ── Callouts & messages ── */
.callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.callout h2 { margin-bottom: 2px; }
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: 3px; border: 1px solid var(--border); background: var(--bg-subtle); display: flex; gap: 10px; }
/* a square status marker in the message's own colour, drawn, not a text glyph */
.messages li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 7px; background: var(--faint); }
.messages li.error { border-color: var(--text); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: 3px; margin-bottom: 20px; color: var(--muted); }
.banner b { color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px; background: var(--hover); font: 12px var(--mono); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details.more summary { cursor: pointer; color: var(--muted); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary:hover { color: var(--text); }

/* ── Login ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 100%; max-width: 360px; }
.auth .brand { justify-content: center; margin-bottom: 28px; font-size: 15px; color: var(--text); }
.auth h1 { text-align: center; font-size: 20px; margin-bottom: 6px; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth form { display: grid; gap: 14px; }
.auth .input { height: 40px; width: 100%; }
.auth .btn { height: 40px; width: 100%; }
.auth .err { padding: 10px 12px; border: 1px solid var(--text); border-radius: 3px; font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .nav-cards, .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .grid-2 { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr 1fr; }
  .step:nth-child(3) { border-left: 0; }
  .step:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 0 16px; overflow-x: auto; }
  .brand .name, .top-actions .who { display: none; }
  .tabs a { padding: 0 8px; }
  .page { padding: 24px 16px 64px; }
  .nav-cards, .kpis, .form-grid { grid-template-columns: 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--border); }
  .kpi:first-child { border-top: 0; }
}

/* ── Readings grid ── */
.readings { font-size: 14px; }
.readings thead tr:first-child th { background: var(--panel); border-bottom: 0; padding-top: 14px; padding-bottom: 4px; }
.readings th.grp { text-align: center; color: var(--text); font-weight: 600; font-size: 13px; }
.readings th.grp span { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 12px; margin-left: 4px; }
.readings th { color: var(--muted); }
.readings .sep { border-left: 1px solid var(--border); }
.readings .meter-col { width: 30%; min-width: 180px; }
.readings tbody tr:hover td { background: transparent; }
.readings tr.unit-head td {
  background: var(--bg-subtle); border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border);
  padding-top: 12px; padding-bottom: 12px;
}
.readings tbody:first-of-type tr.unit-head td { border-top: 0; }
.readings tr.unit-head td > * { vertical-align: middle; margin-right: 10px; }
.readings .unit-code { font: 600 16px/1 var(--mono); color: var(--text); letter-spacing: -0.02em; }
.readings .pill-todo { border-color: var(--text); font-weight: 600; }
.readings .meter-name { font-weight: 500; color: var(--text); }
.readings .meter-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.readings td.prev { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.readings td.no-meter { text-align: center; color: var(--faint); font-size: 12px; }
.readings td { padding-top: 10px; padding-bottom: 10px; }
.input.cell {
  height: 34px; width: 108px; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--bg); border-color: var(--border-strong);
}
.input.cell:placeholder-shown { border-style: dashed; border-color: var(--faint); background: transparent; }
.input.cell::placeholder { color: var(--faint); }
.input.cell.auto { color: var(--muted); font-weight: 400; }
.input.cell.bad { border-color: var(--text); border-width: 2px; }

/* ═══════════════ Color ═══════════════
   Ink on light; the brand blue is the sign band and the active tab, its deep shade marks what is waiting
   (unpaid, due). green = paid / up to date, amber = partly paid / missing, red = overdue / failed. */
:root {
  --green: #1d7a46;  --green-bg: #e2f2e8;  --green-line: #9ccfb0;
  --amber: #8f5300;  --amber-bg: #fcf0d9;  --amber-line: #e9be78;
  --red: #c0261c;    --red-bg: #fbe4e2;    --red-line: #eea59f;
  --blue: #00739c;   --blue-bg: #e1f5fc;   --blue-line: #8bd8f2;
  --violet: #5646b0; --violet-bg: #ecebf8; --violet-line: #b9b2e6;
  --cyan: #00739c;   --cyan-bg: #e1f5fc;   --cyan-line: #8bd8f2;
  --tg: #00739c;
}
:root[data-theme="dark"] {
  --green: #5ccf8c;  --green-bg: rgba(92, 207, 140, .13);  --green-line: rgba(92, 207, 140, .38);
  --amber: #f2b85a;  --amber-bg: rgba(242, 184, 90, .13);  --amber-line: rgba(242, 184, 90, .38);
  --red: #ff8a80;    --red-bg: rgba(255, 138, 128, .14);   --red-line: rgba(255, 138, 128, .40);
  --blue: #5fd2f6;   --blue-bg: rgba(0, 182, 240, .14);    --blue-line: rgba(0, 182, 240, .42);
  --violet: #a99cf0; --violet-bg: rgba(169, 156, 240, .14); --violet-line: rgba(169, 156, 240, .40);
  --cyan: #5fd2f6;   --cyan-bg: rgba(0, 182, 240, .14);    --cyan-line: rgba(0, 182, 240, .42);
  --tg: #5fd2f6;
}

/* text accents */
.c-green { color: var(--green) !important; }
.c-amber { color: var(--amber) !important; }
.c-red { color: var(--red) !important; }
.c-blue { color: var(--blue) !important; }

/* status pills: tinted fill + colored text */
.pill { border-color: var(--border-strong); }
.pill-issued, .pill-pending { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-line); }
.pill-partial { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.pill-paid, .pill-sent, .pill-ok { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.pill-overdue, .pill-failed { color: var(--red); background: var(--red-bg); border-color: var(--red-line); font-weight: 600; }
.pill-overdue::before, .pill-failed::before { background: currentColor; }
.pill-skipped, .pill-todo { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.pill-draft { color: var(--muted); background: transparent; border-color: var(--border-strong); }
.pill-void { color: var(--faint); background: transparent; }

/* channel chips */
.chip-email { background: var(--violet-bg); color: var(--violet); }
.chip-telegram { background: color-mix(in srgb, var(--tg) 14%, transparent); color: var(--tg); }

/* tab cards on the overview */
.nav-card .idx {
  width: 28px; height: 28px; border-radius: 3px; display: grid; place-items: center;
  font: 600 13px/1 var(--mono); letter-spacing: 0;
}
.nav-card h2 { margin-top: 12px; }
.nav-card.tone-blue .idx { background: var(--blue-bg); color: var(--blue); }
.nav-card.tone-violet .idx { background: var(--violet-bg); color: var(--violet); }
.nav-card.tone-green .idx { background: var(--green-bg); color: var(--green); }
.nav-card.tone-blue:hover { border-color: var(--blue-line); }
.nav-card.tone-violet:hover { border-color: var(--violet-line); }
.nav-card.tone-green:hover { border-color: var(--green-line); }

/* needs-attention list */
.list li.tone-red .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.list li.tone-amber .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.list li.tone-blue .dot { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.list li.tone-red .go { color: var(--red); }

/* progress */
.meter i { background: var(--green); }
.step.done .n { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.step.now .n { background: var(--blue); color: #fff; border-color: var(--blue); }
.step.now { box-shadow: inset 0 -2px 0 var(--blue); }

/* messages and banners */
.messages li.success { border-color: var(--green-line); background: var(--green-bg); }
.messages li.success::before { color: var(--green); }
.messages li.error { border-color: var(--red-line); background: var(--red-bg); }
.messages li.error::before { color: var(--red); }
.messages li.warning { border-color: var(--amber-line); background: var(--amber-bg); }
.messages li.warning::before { color: var(--amber); }
.tag:not(.tag-copy) { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }
.banner { border-color: var(--amber-line); background: var(--amber-bg); color: var(--text); }
.banner b { color: var(--amber); }

/* readings: electricity = amber, water = cyan */
.readings th.util-e, .readings th.util-w { position: relative; }
.readings th.util-e::before, .readings th.util-w::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px;
}
.readings th.util-e::before { background: var(--amber); }
.readings th.util-w::before { background: var(--cyan); }
.readings th.util-e { box-shadow: inset 0 2px 0 var(--amber); }
.readings th.util-w { box-shadow: inset 0 2px 0 var(--cyan); }
.readings tr.unit-head .pill-paid::before { background: currentColor; }
.input.cell.bad { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.input.cell.auto { color: var(--blue); }

/* brand: SR-DV */
.brand .mark { width: auto; min-width: 26px; padding: 0 5px; font-size: 11px; letter-spacing: .02em; }
.brand .site { color: var(--muted); font-weight: 400; margin-left: 2px; }

/* ── Customer table ── */
.cust-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.t.cust { font-size: 13px; }
.t.cust th { position: sticky; top: 0; z-index: 2; background: var(--panel); white-space: nowrap; }
.t.cust td { padding: 5px 4px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t.cust th { padding: 10px 4px 10px 12px; }
.t.cust .sep { border-left: 1px solid var(--border); }
.t.cust .stick { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: inset -1px 0 0 var(--border); }
.t.cust th.stick { z-index: 3; }
.t.cust tbody tr:hover td { background: transparent; }
.t.cust tbody.house { border-top: 1px solid var(--border-strong); }
.t.cust tr.f-row td { background: var(--bg-subtle); }
.t.cust tr.f-row td.stick { background: var(--bg-subtle); }
.t.cust tbody.inactive .cell-in, .t.cust tbody.inactive .cell-sel { color: var(--faint); }
.t.cust tr.dirty td.stick { box-shadow: inset 3px 0 0 var(--amber), inset -1px 0 0 var(--border); }
.t.cust tr.n-row td.stick { box-shadow: inset 3px 0 0 var(--blue), inset -1px 0 0 var(--border); }
.t.cust tr.has-error td.stick { box-shadow: inset 3px 0 0 var(--red), inset -1px 0 0 var(--border); }
.t.cust tr.err-row td { color: var(--red); background: var(--red-bg); font-size: 12px; padding: 6px 8px; white-space: normal; }
.t.cust .small { font-size: 12px; }
.cell-in, .cell-sel { height: 30px; font-size: 13px; padding: 0 8px; border-color: transparent; background-color: transparent; }
.cell-sel { padding-right: 22px; background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; }
.cell-in:hover, .cell-sel:hover { border-color: var(--border-strong); }
.cell-in:focus, .cell-sel:focus { background-color: var(--bg); }
.cell-in.changed, .cell-sel.changed { background-color: var(--amber-bg); border-color: var(--amber-line); }
.n-row .cell-in, .n-row .cell-sel { border-color: var(--border-strong); border-style: dashed; }
.cell-in.w-code { width: 64px; font-family: var(--mono); font-weight: 600; }
.cell-in.w-block { width: 56px; }
.cell-in.w-name { width: 132px; }
.cell-in.w-email { width: 164px; }
.cell-in.w-phone { width: 104px; font-family: var(--mono); }
.cell-in.w-acct { width: 100px; font-family: var(--mono); }
.floor-name { display: inline-block; padding-left: 10px; font-weight: 500; min-width: 96px; }
.more-link { font-size: 12px; color: var(--blue); margin-left: 2px; }
.new-wrap { display: inline-flex; align-items: center; gap: 2px; }
.rm { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 16px; width: 18px; padding: 0; }
.rm:hover { color: var(--red); }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--border);
}
.page.wide { max-width: 1680px; }

/* ── Monthly invoices ── */
.stepper.steps-3 { grid-template-columns: repeat(3, 1fr); }
.readings .uh { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.readings .uh-l { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.readings .uh-r { font-size: 13px; }
.select.sm-sel { height: 28px; font-size: 12px; padding-left: 8px; }
.nb-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.nb { display: inline-flex; align-items: center; gap: 8px; }
.readings .unit-code.sm { font-size: 13px; }

/* Monthly invoices: one row per house */
.t.fees .unit-code { font: 600 14px/1 var(--mono); color: var(--text); }
.t.fees td { vertical-align: middle; }

/* Customers: delete a house */
.t.cust .del-col { width: 36px; text-align: center; padding-left: 4px; padding-right: 8px; }
.del { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 3px; background: none;
       color: var(--faint); cursor: pointer; }
.del:hover { color: var(--red); background: var(--red-bg); }
.del:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

/* ── Overview: three counts, then the next step ── */
.tally { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.tally-cell { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-left: 1px solid var(--border); color: var(--text); min-width: 0; }
.tally-cell:first-child { border-left: 0; border-radius: var(--radius) 0 0 var(--radius); }
.tally-cell:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.tally-cell:hover { background: var(--bg-subtle); text-decoration: none; }
.tally-cell:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--text); }
.tally-cell .label { color: var(--muted); font-weight: 500; }
.tally-cell .value { font: 600 44px/1 var(--mono); letter-spacing: -0.03em; }
.tally-cell .hint { color: var(--faint); font-size: 12px; }
.tally-cell.is-overdue .value { color: var(--red); }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 14px 20px;
             border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); }

/* ── Invoices ── */
.actionbar, .paybar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-top: 12px; }
.paybar { margin-top: 16px; padding: 14px 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.t tfoot td { padding: 11px 16px; font-weight: 600; border-top: 1px solid var(--border-strong); }
.strong { font-weight: 600; }
.small { font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Standing pills ── */
.pill-due { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-line); }
.pill-void-soft { color: var(--faint); border-color: var(--border); border-style: dashed; }
.cell-in.w-month { width: 136px; font-family: var(--mono); }
.cell-in.w-date { width: 140px; font-family: var(--mono); }
.cell-sel.w-block { width: 70px; }

@media (max-width: 720px) {
  .tally { grid-template-columns: 1fr; }
  .tally-cell { border-left: 0; border-top: 1px solid var(--border); }
  .tally-cell:first-child { border-top: 0; }
}


/* ═══════════════ Sign band ═══════════════
   One per page, full width under the bar: a monumental number, what it means, one action. */
.band { background: var(--brand); color: var(--brand-ink); }
.band-in { max-width: 1200px; margin: 0 auto; padding: 18px 24px; display: flex; align-items: center; gap: 22px; }
.page.wide + .band .band-in, .band.wide .band-in { max-width: none; }
.band-n { font: 700 52px/1 var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; flex: none; }
.band-msg { font-size: 21px; font-weight: 600; line-height: 1.25; }
.band-msg small { display: block; font-size: 15px; font-weight: 500; margin-top: 3px; }
.band-go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px;
  background: var(--brand-ink); color: #fff; font-weight: 600; font-size: 16px; border-radius: 3px; white-space: nowrap;
}
.band-go:hover { text-decoration: none; background: #000; }
.band-go:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.band-go svg { flex: none; }
.band.calm { background: var(--bg-subtle); color: var(--text); border-bottom: 1px solid var(--border); }
.band.calm .band-go { background: var(--panel); color: var(--text); border: 1px solid var(--border-strong); }
.band.alert .band-n { color: var(--brand-ink); }
@media (min-width: 900px) { .band { position: sticky; top: 56px; z-index: 9; } }
@media (max-width: 720px) {
  .band-in { flex-wrap: wrap; gap: 8px 14px; padding: 14px 16px; }
  .band-n { font-size: 40px; }
  .band-msg { font-size: 17px; flex: 1; min-width: 0; }
  .band-go { margin-left: 0; width: 100%; justify-content: center; }
}
.tally-cell.is-ok .value { color: var(--green); }
.tally { margin-top: 4px; }
.tally-cell .value { font-size: 36px; font-weight: 700; }
.topbar .brand .site { color: var(--bar-text); font-weight: 500; }
/* anchors land below the sticky bar and band */
[id] { scroll-margin-top: 72px; }
@media (min-width: 900px) { [id] { scroll-margin-top: 176px; } }

/* phone: one-line bar that scrolls, tables keep readable columns and scroll inside their panel */
.tabs a { white-space: nowrap; }
.banner { flex-wrap: wrap; }
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .tabs { gap: 2px; }
  .tabs a { padding: 6px 9px; font-size: 14px; }
  .top-actions { gap: 10px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap > .t { min-width: 620px; }
  .table-wrap > .t.cust { min-width: 0; }
  .section-head { flex-wrap: wrap; }
}
.messages li.success::before { background: var(--green); }
.messages li.error::before { background: var(--red); }
.messages li.warning::before { background: var(--amber); }
.messages li.info::before { background: var(--blue); }
.rm svg { display: block; }

/* ── Automatic invoices ── */
.sub-h { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
.section-head + .sub-h, .section-head + form > .sub-h { margin-top: 0; }
.auto-off p { margin: 0 0 14px; max-width: 72ch; }
.auto-off + form, .auto-off + .sub-h { margin-top: 20px; }

/* ── Record a payment from the Invoices list ── */
.pay-cell { text-align: right; white-space: nowrap; }
.pay-row td { background: var(--bg-subtle); }
.pay-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px; }
.pay-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pay-form .input[name="amount"] { width: 130px; }
.pay-form .faint { flex-basis: 100%; font-size: 13px; }

/* ── Invoices: the schedule in a line, then the list ── */
.sched { display: grid; gap: 12px; }
.sched-line { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.due-now { display: grid; gap: 8px; }
.due-now .sched-line { border-color: var(--blue-line); background: var(--blue-bg); }
.notices { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.notices .linkbtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--brand-deep); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#bank-form label.btn { cursor: pointer; }
#bank-form label.btn:focus-within { box-shadow: 0 0 0 3px var(--focus); }

/* ── Popup (Customer DB bulk import) ── */
.modal { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--text); box-shadow: 0 12px 32px rgba(15, 28, 36, .22); }
.modal::backdrop { background: rgba(15, 28, 36, .45); }
.modal form { padding: 22px 24px; }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal .steps { margin: 0; padding-left: 20px; display: grid; gap: 16px; }
.modal .steps li { padding-left: 4px; }
.modal .steps .toolbar, .modal .steps .input { margin-top: 8px; }
.modal .steps .input[type=file] { width: 100%; height: auto; padding: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

#auto + #manage { margin-top: 48px; }
.sched .t td.codes { color: var(--text); }

/* ── Resident booking page (phone first) ── */
body.resident { background: var(--bg); }
.r-bar { display: flex; justify-content: space-between; align-items: center; height: 52px; padding: 0 16px; background: var(--bar); color: #fff; font-weight: 600; }
.r-bar .r-house { color: var(--bar-text); font-weight: 500; }
.r-page { max-width: 560px; margin: 0 auto; padding: 20px 16px 64px; }
.r-page h1 { font-size: 30px; margin-bottom: 16px; }
.r-page h2 { font-size: 19px; margin-bottom: 10px; }
.r-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.r-tabs a { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--panel); font-weight: 600; font-size: 14px; }
.r-tabs a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.r-tabs a:hover { text-decoration: none; }
.r-form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.r-day { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; }
.r-day .btn { padding: 0; }
.r-day [aria-disabled] { opacity: .35; }
.r-when { margin: 8px 0 14px; font-weight: 600; }
.r-hint { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.r-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.r-slot { height: 44px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--panel); color: var(--text);
  font: 600 15px var(--mono); cursor: pointer; }
.r-slot:hover:not(:disabled) { border-color: var(--text); }
.r-slot:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.r-slot.on { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-text); }
.r-slot:disabled { color: var(--faint); background: var(--bg-subtle); border-color: var(--border); text-decoration: line-through; cursor: not-allowed; }
.r-pick { min-height: 24px; margin: 10px 0 0; font-weight: 700; font-size: 17px; }
.r-fields { display: grid; gap: 12px; margin-top: 18px; }
.r-fields label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.r-fields .input, .r-fields .select { width: 100%; }
.r-fee { margin: 14px 0; color: var(--muted); }
.r-go { width: 100%; height: 46px; font-size: 16px; }
.r-mine { margin-top: 32px; }
.r-mine ul { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.r-mine li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.r-mine li:first-child { border-top: 0; }
@media (min-width: 480px) { .r-slots { grid-template-columns: repeat(6, 1fr); } }

/* ── Bookings: the day as a timetable ── */
.book-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.book-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.book-form .input[name=name] { width: 150px; }
.book-form .input[name=phone] { width: 130px; }
.link-url { width: min(460px, 100%); font-family: var(--mono); font-size: 13px; }
.book-form label[hidden] { display: none; }
/* full width like Status below; fixed number columns so the amounts line up under each other */
.sched-t th:first-child { width: 22%; }
.sched-t th:last-child { width: 18%; }
.sched-t .houses { margin-top: 4px; }
.sched-t .houses summary { cursor: pointer; width: max-content; color: var(--brand-deep); font-size: 13px; font-weight: 600; }
.sched-t .houses p { margin: 6px 0 0; font-family: var(--mono); font-size: 13px; line-height: 1.7; white-space: normal; }

/* small labels next to a value, in place of "· note" text */
.tag-sm { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border: 1px solid var(--border-strong);
  border-radius: 3px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); vertical-align: 1px; white-space: nowrap; }
.tag-sm.warn { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }
.top-actions form { display: inline-flex; align-items: center; gap: 12px; }
.r-b { display: grid; gap: 1px; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
#all .t td, #all .t th { white-space: nowrap; padding-left: 9px; padding-right: 9px; }
#all form.row-actions { display: inline-flex; flex-wrap: nowrap; gap: 6px; }

/* ── Pages of 20 ── */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.pager-count { color: var(--muted); font-size: 14px; font-family: var(--mono); }
.pager-pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager .btn.sm { min-width: 32px; height: 32px; padding: 0 8px; font-size: 13px; }
.pager .btn.on { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-text); }
.pager [aria-disabled] { opacity: .35; }
.pager-gap { align-self: center; padding: 0 4px; color: var(--faint); }

/* ── All bookings: a short row, the rest in a popup ── */
.bk-list .bk-row { cursor: pointer; }
.bk-list .bk-row:hover td { background: var(--hover); }
.bk-list .bk-row:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.who-code { display: inline-block; min-width: 52px; font: 600 13px var(--mono); }
.modal.bk-dlg { width: min(560px, calc(100vw - 32px)); }
.bk-body { padding: 22px 24px; }
.bk-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.bk-top h2 { margin: 0; }
.bk-dlg .kv { grid-template-columns: 110px 1fr; gap: 8px 16px; }
.bk-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.bk-edit .sub-h, .bk-edit .modal-foot { grid-column: 1 / -1; }
.bk-edit .sub-h { margin: 0; }
.bk-edit label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.bk-edit .input, .bk-edit .select { width: 100%; }
.bk-edit .modal-foot { margin-top: 8px; }

/* ── Bookings: the day as a timeline, one track per facility ── */
.tl-wrap { overflow-x: auto; }
.tl { --name: 170px; --row: 52px; min-width: calc(var(--name) + var(--hours) * 46px); }
.tl-head, .tl-row { display: grid; grid-template-columns: var(--name) 1fr; }
.tl-head { border-bottom: 2px solid var(--text); }
.tl-row + .tl-row { border-top: 1px solid var(--border); }
.tl-name { padding: 0 16px; display: flex; flex-direction: column; justify-content: center; min-height: var(--row); }
.tl-head .tl-name { font-size: 13px; font-weight: 600; min-height: 40px; }
.tl-name small { color: var(--faint); font-size: 12px; }
.tl-hours { display: grid; grid-template-columns: repeat(var(--hours), 1fr); }
.tl-hours span { display: flex; align-items: center; padding-left: 6px; font: 600 12px var(--mono); border-left: 1px solid var(--border); }
/* the track: one line per hour */
.tl-track { position: relative; min-height: var(--row);
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: calc(100% / var(--hours)) 100%; }
.tl-closed { position: absolute; top: 0; bottom: 0; background: var(--bg-subtle); }
/* a booking: the element sits exactly on its hours; the box is drawn 2px in (a gap from its neighbours),
   and the hour lines inside are laid on the element's own hours, so they meet the track's lines */
.tl-block { position: absolute; top: 6px; bottom: 6px; isolation: isolate;
  display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 10px; overflow: hidden;
  color: var(--blue); font-size: 12px; white-space: nowrap; }
.tl-block::before, .tl-block::after { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; right: 2px; z-index: -1; }
.tl-block::before { border: 1px solid var(--blue); border-radius: 4px; background: var(--blue-bg); }
.tl-block::after { top: 1px; bottom: 1px;
  background-image: linear-gradient(to right, var(--blue-line) 1px, transparent 1px);
  background-size: calc((100% + 4px) / var(--n)) 100%; background-position: -2px 0; }
.tl-block b { font: 700 12px var(--mono); }


/* ── Overview: billing and bookings side by side, one row */
.ov-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ov-row .section-head { margin-bottom: 8px; }
.ov-tally .tally-cell { padding: 14px 18px; gap: 2px; }
.ov-tally .tally-cell .value { font-size: 30px; white-space: nowrap; }
.ov-tally .tally-cell .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.ov-row > section { display: flex; flex-direction: column; }
.ov-row .ov-tally { flex: 1; }
@media (max-width: 1000px) { .ov-row { grid-template-columns: 1fr; } }

/* ── Invoices schedule: the next invoices, a row that opens their page; there each can be edited or skipped ── */
.sched-row { cursor: pointer; }
.sched-row:hover td { background: var(--hover); }
.sched-row:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.plan-t .is-skipped td { color: var(--faint); }
.plan-t td:last-child { width: 1%; white-space: nowrap; }

/* ── Invoices title line: automatic invoicing on (green) or off (amber) ── */
.page-head:has(.auto-ctl) { align-items: center; }
.auto-ctl { display: inline-flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; border: 1px solid; border-radius: var(--radius); }
.auto-ctl.is-on { background: var(--green-bg); border-color: var(--green-line); }
.auto-ctl.is-off { background: var(--amber-bg); border-color: var(--amber-line); }
.auto-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.is-on .auto-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-line); }
.is-off .auto-dot { background: var(--amber); }
.auto-txt { display: flex; flex-direction: column; line-height: 1.25; }
.auto-txt b { font-size: 14px; }
.is-on .auto-txt b { color: var(--green); }
.is-off .auto-txt b { color: var(--amber); }
.auto-txt small { font-size: 12px; color: var(--muted); }
.auto-ctl .select { height: 32px; }
.auto-ctl .btn:not(.sm) { height: 32px; }
.plan-t td, .plan-t th { padding-top: 8px; padding-bottom: 8px; }
.plan-t .sub-n { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
a.sub-n { color: var(--muted); }
a.sub-n:hover { color: var(--text); }
/* a booking on the timeline is a button: it opens the booking (details, changes, cancel) */
button.tl-block { margin: 0; border: 0; background: none; font: inherit; color: var(--blue); text-align: left; cursor: pointer; align-items: flex-start; }
button.tl-block:hover::before { background: var(--blue-line); }
button.tl-block:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
/* the booking an invoice line links to */
button.tl-block.is-hl::before { background: var(--blue); }
button.tl-block.is-hl { color: #fff; }
button.tl-block.is-hl::after { opacity: .35; }
.send-when { color: var(--muted); font-size: 14px; }
.send-when b { color: var(--text); font-weight: 600; }

/* ── Send now: the invoices being created and sent ── */
.snd { padding: 22px 24px; }
.snd-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.snd-now { font-size: 18px; font-weight: 600; }
.snd-pct { font: 700 28px/1 var(--mono); }
.snd-bar { height: 10px; border-radius: 5px; background: var(--bg-subtle); overflow: hidden; }
.snd-bar span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .4s ease; }
.snd.is-done .snd-bar span { background: var(--green); }
.snd-steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.snd-steps li { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--faint); }
.snd-steps li b { font-size: 14px; }
.snd-steps li span { font-size: 13px; }
.snd-steps li.on { border-color: var(--blue-line); background: var(--blue-bg); color: var(--blue); }
.snd-steps li.ok { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.snd-nums { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 20px 0 0; border: 1px solid var(--border); border-radius: var(--radius); }
.snd-nums div { padding: 12px 16px; border-left: 1px solid var(--border); }
.snd-nums div:first-child { border-left: 0; }
.snd-nums dt { font-size: 12px; color: var(--muted); }
.snd-nums dd { margin: 4px 0 0; font: 600 22px/1.1 var(--mono); }
.snd-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.snd-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 760px) { .snd-steps { grid-template-columns: 1fr; } .snd-nums { grid-template-columns: repeat(3, 1fr); } }

/* ═══════════════ Phone ═══════════════
   The bar takes two rows (name and Sign out, then the tabs); numbers stay side by side; filters fill the width;
   wide tables scroll inside their panel with the first column held in place. */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px 0; gap: 0 10px; overflow: visible; }
  .brand .name { display: inline; font-size: 16px; }
  .brand .site { display: none; }
  .topbar .spacer { flex: 1; }
  .top-actions { gap: 8px; font-size: 13px; }
  .top-actions .tag { font-size: 11px; padding: 2px 6px; }
  .tabs { order: 3; width: calc(100% + 28px); margin: 8px -14px 0; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs { gap: 0; justify-content: space-between; }
  .tabs a { padding: 6px 7px; font-size: 13px; }
  [id] { scroll-margin-top: 110px; }
  .table-wrap > .t.bk-list { min-width: 0; }
  .t th, .t td { padding-left: 10px; padding-right: 10px; }
  .t .mono, .t td.mono { white-space: nowrap; }

  .page { padding: 20px 14px 56px; }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; }
  .page-head { margin-bottom: 18px; }

  /* overview: three numbers in a row */
  .ov-row { gap: 18px; }
  .tally.ov-tally { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-tally .tally-cell { border-top: 0; border-left: 1px solid var(--border); padding: 10px 12px; }
  .ov-tally .tally-cell:first-child { border-left: 0; }
  .ov-tally .tally-cell .label { font-size: 12px; line-height: 1.25; }
  .ov-tally .tally-cell .value { font-size: 24px; }
  .ov-tally .tally-cell .value small { display: block; margin: 2px 0 0; font-size: 11px; }

  /* filters and search fill the width */
  .filterbar { align-items: stretch; }
  .filterbar > *, .filterbar .toolbar, .inline-form.toolbar { width: 100%; }
  .filterbar .segmented { overflow-x: auto; }
  .inline-form.toolbar .select { flex: 1 1 120px; }
  .input[data-grow], .filterbar .input[type=search], .toolbar .input[type=search] { width: 100% !important; flex: 1 1 100%; }

  /* wide tables: scroll sideways, the first column stays */
  .table-wrap > .t td:first-child, .table-wrap > .t th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); white-space: nowrap; }
  .table-wrap > .t thead th:first-child { z-index: 2; }
  .hide-sm { display: none; }
  .table-wrap > .t.sched-t { min-width: 0; }

  /* schedule line: when, then the button */
  .section-head .toolbar { width: 100%; justify-content: space-between; }
  .auto-ctl { width: 100%; }
  .auto-ctl .auto-txt { flex: 1; }

  /* bookings: a narrower name column that stays while the hours scroll */
  .tl { --name: 104px; min-width: calc(var(--name) + var(--hours) * 42px); }
  .tl-name { position: sticky; left: 0; z-index: 3; background: var(--panel); padding: 0 10px; font-size: 13px; }
  .tl-name small { display: none; }
  .book-form { display: grid; grid-template-columns: 1fr 1fr; }
  .book-form label, .book-form .input, .book-form .select { width: 100% !important; }
  .book-form .btn { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .bk-edit { grid-template-columns: 1fr; }
  .modal-foot { flex-wrap: wrap; }
}

/* ── Bookings on a phone: the day standing up (hours down, a column per facility), so it fits without scrolling ── */
.tlv { display: none; }
@media (max-width: 720px) {
  .tl-wrap { display: none; }
  .tlv { display: block; padding: 0 8px 8px 0; }
  .tlv-head, .tlv-body { display: grid; grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .tlv-head { position: sticky; top: 96px; z-index: 4; background: var(--panel); border-bottom: 2px solid var(--text); }
  .tlv-head b { padding: 10px 4px 8px; font-size: 12px; line-height: 1.2; text-align: center; }
  .tlv-hours span { display: block; height: 36px; padding: 0 6px 0 8px; font: 600 11px/1 var(--mono); color: var(--muted); transform: translateY(-5px); }
  .tlv-hours span:first-child { transform: none; padding-top: 3px; }
  .tlv-col { position: relative; height: calc(var(--hours) * 36px); border-left: 1px solid var(--border);
    background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px); background-size: 100% 36px; }
  .tlv-closed { left: 0; right: 0; }
  /* the button sits exactly on its hours; the box is drawn 2px in, so back-to-back bookings keep a gap */
  .tlv-block { position: absolute; left: 0; right: 0; margin: 0; border: 0; background: none; isolation: isolate;
    display: flex; align-items: flex-start; justify-content: center; padding: 6px 2px; overflow: hidden;
    color: var(--blue); font: 700 11px/1.2 var(--mono); cursor: pointer; }
  .tlv-block::before { content: ""; position: absolute; inset: 2px 3px; z-index: -1; border: 1px solid var(--blue);
    border-radius: 4px; background: var(--blue-bg); }
  .tlv-block.is-hl { color: #fff; }
  .tlv-block.is-hl::before { background: var(--blue); }
  .tlv-block:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

  /* book for a house: pairs side by side, the day and payment on their own line */
  .book-form label:nth-of-type(3), .book-form label:nth-of-type(8) { grid-column: 1 / -1; }
  .book-form .btn { height: 44px; }
}
/* all bookings on a phone: each booking a three-line card (date and time, place and who, payment and status) */
@media (max-width: 720px) {
  #all .bk-list thead { display: none; }
  #all .bk-list, #all .bk-list tbody { display: block; }
  #all .bk-list tr.bk-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  #all .bk-list tr.bk-row td { display: block; padding: 0; border: 0; position: static; background: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #all .bk-list tr.bk-row td:nth-child(2), #all .bk-list tr.bk-row td:nth-child(4), #all .bk-list tr.bk-row td:nth-child(6) { text-align: right; }
  #all .bk-list tr.bk-row td:nth-child(3) { color: var(--muted); }
}
/* customer DB on a phone: no box with its own up-down scroll (it fights the page); the page scrolls, the table only sideways */
@media (max-width: 720px) {
  .cust-wrap { max-height: none; overflow-x: auto; overflow-y: visible; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .t.cust th { position: static; }
  .t.cust th.stick, .t.cust td.stick, .t.cust th:first-child { position: sticky; left: 0; }
}
/* hidden labels inside a scrolling table stay inside it, so they can't widen the page */
.table-wrap { position: relative; }
/* the frozen Unit column on a phone: always drawn above the fields scrolling under it (iOS paints inputs on top
   otherwise), and a field you tap is scrolled clear of it instead of ending up underneath */
@media (max-width: 720px) {
  .cust-wrap, .table-wrap { scroll-padding-left: 112px; }
  .t.cust td, .t.cust th { position: relative; z-index: 0; }
  .t.cust td.stick, .t.cust th.stick, .t.cust th:first-child { position: sticky; left: 0; z-index: 3; background: var(--panel);
    box-shadow: inset -1px 0 0 var(--border), 4px 0 6px -4px rgba(15, 28, 36, .18); transform: translateZ(0); }
}
@media (max-width: 720px) {
  .savebar { flex-wrap: nowrap; gap: 6px; padding: 8px 0; }
  .savebar > * { display: flex; gap: 6px; flex-wrap: nowrap; }
  .savebar .btn { height: 36px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
}

/* customer DB save bar: nothing takes room until there are unsaved changes, so the buttons line up */
#dirty:empty { display: none; }

/* automatic invoicing: one slim line on the title row (state, since when, the switch) */
.auto-ctl { gap: 10px; padding: 4px 4px 4px 12px; }
.auto-txt { flex-direction: row; align-items: baseline; gap: 8px; line-height: 1.2; white-space: nowrap; }
.auto-txt b { font-size: 13px; }
.auto-txt small { font-size: 12px; }
.auto-ctl .btn.sm { height: 26px; }
.auto-ctl .select, .auto-ctl .btn:not(.sm) { height: 28px; font-size: 13px; }
.auto-dot { width: 8px; height: 8px; }
.is-on .auto-dot { box-shadow: 0 0 0 2px var(--green-line); }
/* Status follows Schedule closely: they are one page about the same invoices */
#auto + #manage { margin-top: 20px; }
@media (max-width: 720px) {
  .auto-ctl { width: auto; max-width: 100%; }
  .auto-ctl .auto-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

/* Customer DB: a house's customer logins */
.login-btn { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-btn.none { color: var(--muted); border-style: dashed; }
.lg-one { padding: 14px 0; border-top: 1px solid var(--border); }
.lg-one:first-of-type { border-top: 0; }
.lg-who { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; }
.lg-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.lg-form { display: grid; gap: 10px; }
.lg-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.lg-pw { display: flex; gap: 6px; }
.lg-pw .input { flex: 1; min-width: 0; }
.lg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lg-msg { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.lg-msg.ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.lg-msg.bad { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }
.lg-where { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* payment proofs from residents */
.pf-list { display: grid; gap: 12px; margin-top: 14px; }
.pf { display: grid; grid-template-columns: 180px 1fr; gap: 18px; padding: 16px; }
.pf-file { display: grid; place-items: center; height: 200px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pf-file img { width: 100%; height: 100%; object-fit: contain; }
.pf-pdf { font: 700 22px var(--mono); color: var(--muted); }
.pf-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pf-kv { grid-template-columns: 90px 1fr; gap: 4px 14px; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pf-decline { display: flex; gap: 6px; flex: 1; min-width: 260px; }
.pf-decline .input { flex: 1; }
.proof-note { margin: 0 0 18px; padding: 12px 16px; background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: var(--radius); }
.proof-note a { color: var(--amber); font-weight: 600; }
@media (max-width: 720px) { .pf { grid-template-columns: 1fr; } .pf-file { height: 220px; } }
