/* Property app design system. Patterns follow professional dashboard kits (shadcn/ui, Tremor):
   sidebar on computers, tabs on phones, white cards on a cool grey page, status shown as pills.
   Public Sans throughout, one deep green accent. Colours mean things: green good or go, amber
   needs attention soon, red late or urgent. The tenant portal and printed packs share this file. */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --raise: #EFF1F4;
  --ink: #14191F; --soft: #3C4651; --muted: #65707C; --line: #E2E5EA; --line-strong: #CCD1D8;
  --accent: #0A6C5A; --accent-dark: #075244; --accent-ink: #FFFFFF; --accent-soft: #E5F3F0; --accent-line: #B5DBD3;
  --ok: #0B7A52; --ok-bg: #E6F6EE; --warn: #9A5800; --warn-bg: #FDF2DF; --bad: #B42318; --bad-bg: #FDECEA;
  --in: #0A6C5A; --out: #87919F;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 25, 31, .05);
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin: 0; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 8px; }
code { font-size: 13px; overflow-wrap: anywhere; }
em { font-style: normal; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .pre { white-space: pre-line; }
.good { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; } .ic.sm { width: 15px; height: 15px; vertical-align: -3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- App frame ---------- */
body.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--ink); padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.prop { margin: 0 8px; padding: 10px 12px; background: var(--raise); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.35; }
.prop b { display: block; font-weight: 600; }
.prop span { color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 10px 4px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--soft); font-weight: 500; font-size: 14px; }
.side nav a:hover { background: var(--raise); text-decoration: none; }
.side nav a.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.count { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; border-radius: 99px; padding: 0 7px; line-height: 20px; }
.me { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.me form { margin: 0; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 500; padding: 0; }
.link.danger { color: var(--bad); }
.link:hover { text-decoration: underline; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 36px 72px; }
.back { display: none; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 18px; font-weight: 500; }
.tabs { display: none; }

/* ---------- Page headings ---------- */
.detail { max-width: 800px; }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.say { margin: 4px 0 0; color: var(--soft); font-size: 15px; max-width: 65ch; }
.say em.bad, .say .bad { color: var(--bad); } .say em.good { color: var(--ok); }
.sec-h { font-size: 15px; font-weight: 600; margin: 28px 0 10px; }
.sec-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 28px 0 10px; }
.sec-row h2 { margin: 0; }
.next { margin: 14px 0 0; color: var(--soft); font-size: 14px; }
.next.bad { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: var(--radius-sm); }
.next.warn { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: var(--radius-sm); }
.next.good { color: var(--ok); }
.next a { color: inherit; text-decoration: underline; }
.fine { margin: 14px 0 0; font-size: 13px; color: var(--muted); max-width: 65ch; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }
.alert { display: flex; gap: 10px; align-items: center; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); } .alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Cards and figures ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 14px; }
.figures { margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.figures div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.figures dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.figures dd { margin: 4px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; overflow-wrap: anywhere; }
.figures dd.good { color: var(--ok); } .figures dd.bad { color: var(--bad); } .figures dd.warn { color: var(--warn); }

/* Home */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.dash > * { margin: 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: inherit; display: flex; flex-direction: column; gap: 2px; min-width: 0; grid-column: span 3; }
a.tile:hover { border-color: var(--line-strong); text-decoration: none; }
.tile .k { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile .n { font-size: 22px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.tile .s { font-size: 13px; color: var(--muted); }
.rent { grid-column: span 6; gap: 6px; }
.rent-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rent .n.bad { color: var(--bad); }

/* The rent strip: one square per rent week, oldest first. */
.strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.strip span { height: 26px; border-radius: 4px; background: var(--ok); }
.strip span.late { background: var(--bad); }
.strip span.part { background: var(--warn); }
.strip span.none { background: var(--raise); }
.strip-key { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.all-clear { display: flex; align-items: center; gap: 10px; background: var(--ok-bg); color: var(--ok); border-radius: var(--radius); padding: 14px 16px; font-weight: 500; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.split .rows { margin-top: 0; }

/* Lists */
.rows { list-style: none; margin: 18px 0 0; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sec-h + .rows, .sec-row + .rows { margin-top: 0; }
.rows li, .rows li > a { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.rows li { padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li > a { flex: 1; min-width: 0; color: var(--ink); margin: -12px 0; padding: 12px 0; }
.rows li > a:hover { text-decoration: none; }
.rows li > a:hover b { color: var(--accent); }
.rows .t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rows .t b { font-weight: 500; overflow-wrap: anywhere; }
.rows .t > span { font-size: 13px; color: var(--muted); }
.rows .v { font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.rows .v.good { color: var(--ok); } .rows .v.bad { color: var(--bad); }
.rows .v form, .rows form { margin: 0; }
.rows .btn { min-height: 44px; padding: 0 12px; font-size: 13px; }
.rows select.quiet, .quiet-select { background: transparent; border: 0; color: var(--muted); font-size: 13px; padding: 0; height: auto; width: auto; max-width: 100%; min-height: 0; }
.rows select.quiet.warn { color: var(--warn); font-weight: 600; }
.rows.tradies li { flex-wrap: wrap; }
.tradie-docs { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; font-size: 13px; }
.tradie-docs input { width: auto; max-width: 150px; }
.tradie-docs label { flex-direction: row; align-items: center; gap: 6px; }

/* Status pills */
.tag { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 8px; border-radius: 99px; background: var(--raise); color: var(--soft); white-space: nowrap; }
.tag.ok, .tag.good { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.seg-q { display: inline-flex; gap: 2px; background: var(--raise); border-radius: var(--radius-sm); padding: 3px; font-size: 13px; }
.seg-q a { color: var(--soft); padding: 3px 10px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.seg-q a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-q a:hover { text-decoration: none; }
.quiet-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; font-weight: 500; }

/* Foldaway sections */
.tuck { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 10px; }
.rows + .tuck, .figures + .tuck, .next + .tuck, .say + .tuck, .quiet-links + .tuck { margin-top: 18px; }
.tuck > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; font-weight: 500; border-radius: var(--radius); }
.tuck > summary::-webkit-details-marker { display: none; }
.tuck > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 3px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.tuck[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.tuck > summary:hover { background: var(--bg); }
.tuck > summary .tag { margin-left: auto; }
.tuck.item > summary .t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tuck.item > summary .t b { font-weight: 500; }
.tuck.item > summary .t span { font-size: 13px; font-weight: 400; color: var(--muted); }
.tuck.item > summary .t span.bad { color: var(--bad); } .tuck.item > summary .t span.warn { color: var(--warn); }
.tuck-in { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.tuck-in > .rows { margin-top: 0; padding: 0; border: 0; box-shadow: none; }
.tuck-in p { margin: 0; }
.tuck-in .fine { margin: 0; }
.tuck-in .next { margin: 0; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.row-btns .fine { margin: 0 auto 0 0; }
pre.digest { white-space: pre-wrap; font: 14px/1.6 var(--sans); margin: 18px 0 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* Plain words on a legal decision, the tenant portal's lists, and its emergency card */
.what { margin: 8px 0; font-weight: 500; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list.tight li:first-child { border-top: 0; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; align-self: start; }
.card.emergency { border-color: var(--bad); }
.card.emergency h2 { color: var(--bad); }
.btn.call { display: flex; align-items: center; justify-content: center; width: 100%; font-size: 17px; margin: 10px 0; }

/* Forms */
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-height: 40px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; } /* under 16px, iPhones zoom in on focus */
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input[type=file] { padding: 6px; }
textarea { resize: vertical; line-height: 1.5; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--soft); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.inline, .amt { flex-direction: row; align-items: center; gap: 10px; }
label.inline input, .amt input { max-width: 170px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 100%; }
form.inline input { flex: 1 1 120px; width: auto; min-width: 0; }
.tuck-in form.inline { display: flex; width: 100%; }
.row-forms { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.btn { font: inherit; font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: var(--surface); }
.btn:disabled { opacity: .55; cursor: default; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

/* Messages */
.person { display: flex; flex-direction: column; gap: 1px; }
.person span { font-size: 14px; color: var(--muted); }
.chat { max-width: 760px; }
.thread { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
.msg { display: flex; flex-direction: column; max-width: 80%; margin: 0; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble audio { display: block; width: 100%; min-width: 220px; margin-top: 8px; }
.bubble { padding: 10px 13px; border-radius: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.msg.in .bubble { background: var(--raise); border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.draft { gap: 6px; }
.msg.draft .bubble { background: var(--warn-bg); color: var(--ink); border: 1px dashed var(--warn); border-bottom-right-radius: 4px; }
.msg small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.edit summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--accent); list-style: none; }
.edit summary::-webkit-details-marker { display: none; }
.edit[open] { align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
.draft-actions { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); position: sticky; bottom: 0; }
.tester { margin-top: 12px; }
.tester > summary { padding: 11px 16px; }

/* Money tiles and the More menu */
.next-bill { margin: 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.next-bill div { display: flex; flex-direction: column; min-width: 0; }
.next-bill b { font-weight: 600; }
.next-bill span { font-size: 13px; color: var(--muted); }
.more-group { margin-top: 22px; max-width: 800px; }
.more-group h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.more-group ul { list-style: none; margin: 0; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.more-group li + li { border-top: 1px solid var(--line); }
.more-group li a, .more-group li button { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--ink); font-weight: 500; width: 100%; }
.more-group li .ic { color: var(--muted); }
.more-group li .go { margin-left: auto; color: var(--muted); }
.more-group li a:hover { text-decoration: none; color: var(--accent); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--sans); }
.chart .gl { stroke: var(--line); }
.b-in { fill: var(--in); } .b-out { fill: var(--out); }
.legend { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 400; }
.li { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.li:first-child { margin-left: 0; }
.li.in { background: var(--in); } .li.out { background: var(--out); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; font-size: 14px; }
.bars .track { display: block; grid-column: 1 / -1; height: 7px; background: var(--raise); border-radius: 99px; overflow: hidden; }
.bars .fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bars b { font-weight: 600; }

/* Repairs, loan, tax */
.steps { display: flex; list-style: none; padding: 0; margin: 0; gap: 4px; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 74px; font-size: 12px; font-weight: 500; color: var(--muted); padding-top: 6px; border-top: 3px solid var(--line); }
.steps li.done { border-color: var(--accent); color: var(--ink); }
.steps li.on { border-color: var(--accent); color: var(--accent-dark); font-weight: 700; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.quotes { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 500; }
.formula { background: var(--raise); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.check { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.check.ok { background: var(--ok-bg); } .check.warn { background: var(--warn-bg); }
label.check { padding: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tr.total td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
.table-wrap { overflow-x: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0 4px; }

/* Emergency */
.emergency { border: 1px solid var(--bad); background: var(--bad-bg); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
.em-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--bad); font-size: 15px; }
.em-h b { font-weight: 700; }
.em-h .muted { margin-left: auto; font-size: 13px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 0% { box-shadow: 0 0 0 0 var(--bad); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .tuck > summary::after { transition: none; } }
.em-steps { display: flex; list-style: none; padding: 0; margin: 12px 0; gap: 6px; flex-wrap: wrap; }
.em-steps li { flex: 1; min-width: 110px; font-size: 13px; font-weight: 500; color: var(--muted); padding-top: 6px; border-top: 3px solid color-mix(in srgb, var(--bad) 25%, transparent); }
.em-steps li.done { color: var(--ink); border-color: var(--bad); }
.em-steps li.done::before { content: "\2713  "; color: var(--bad); }
.em-warn { font-size: 14px; color: var(--bad); font-weight: 500; }
.em-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.em-actions form { display: inline; }
.em-actions .btn.primary { background: var(--bad); border-color: var(--bad); }

/* Sign in, tenant portal, printed packs */
body.bare { background: var(--bg); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 380px; margin: 0; padding: 24px; }
.login .logo { width: 44px; height: 44px; border-radius: 11px; }
.login h1 { font-size: 21px; }
.portal { max-width: 620px; margin: 0 auto; padding: 18px 16px 50px; }
.portal h1 { margin: 18px 0 14px; }
.portal-h { display: flex; gap: 12px; align-items: center; }
.portal-h img { width: 40px; height: 40px; border-radius: 10px; }
.portal-h span { display: block; color: var(--muted); font-size: 13px; }
.print { max-width: 860px; margin: 0 auto; padding: 16px; background: var(--surface); }
.print .photos img { width: 160px; height: 120px; }
.only-print { display: none; }
.timeline { list-style: none; padding: 0; margin: 16px 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 18px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline time { display: block; font-size: 13px; color: var(--muted); }
.timeline p { margin: 2px 0 0; white-space: pre-line; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 14px; }
.sig-pad { width: 100%; max-width: 600px; height: auto; aspect-ratio: 600 / 160; background: #fff; border: 1px dashed var(--muted); border-radius: var(--radius-sm); touch-action: none; }
.sig-saved { max-width: 240px; background: #fff; border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--line); display: block; }
.room.flagged { border-color: var(--bad); }

/* ---------- Tablets and phones ---------- */
@media (max-width: 1000px) {
  .tile { grid-column: span 4; }
  .rent { grid-column: span 12; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body.app { display: block; padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .topbar .brand { padding: 0; }
  .topbar .where { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
  .back { display: inline-flex; }
  h1 { font-size: 22px; }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .tabs a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 12px; font-weight: 500; color: var(--muted); border-radius: var(--radius-sm); }
  .tabs a:hover { text-decoration: none; }
  .tabs a.on { color: var(--accent); font-weight: 600; }
  .tabs .count { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; font-size: 11px; line-height: 17px; padding: 0 5px; }
  .tile { grid-column: span 6; }
  .tile.rent { grid-column: span 12; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures dd { font-size: 19px; }
  .figures div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .msg { max-width: 90%; }
  .composer { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .thread { padding: 14px; }
  .next-bill { flex-wrap: wrap; }
}
@media print {
  .side, .tabs, .topbar, .no-print, .flash { display: none !important; }
  body, body.app { display: block; background: #fff; color: #111; padding: 0; }
  main { padding: 0; max-width: none; }
  .only-print { display: block; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}
