:root {
  --bg: #f6f4ef; --surface: #ffffff; --ink: #1d2321; --muted: #5d6662; --line: #e2ded5;
  --accent: #1f6f5c; --accent-ink: #ffffff; --accent-soft: #e3efe9;
  --warn: #9a5b00; --warn-soft: #fbf0dc; --bad: #a3322b; --bad-soft: #f8e4e2; --good-soft: #e3efe9;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816; --surface: #1c211f; --ink: #e8ebe9; --muted: #9aa49f; --line: #2c3330;
    --accent: #4fb596; --accent-ink: #0d1411; --accent-soft: #1f3a31;
    --warn: #e0a64a; --warn-soft: #3a2e17; --bad: #ef8a82; --bad-soft: #3d1f1d; --good-soft: #1f3a31;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .5rem; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Layout */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 1040px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav.main { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
nav.main a { color: var(--muted); text-decoration: none; padding: .35rem .6rem; border-radius: 6px; font-size: .95rem; }
nav.main a.on, nav.main a:hover { background: var(--accent-soft); color: var(--ink); }
.who { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--muted); }
main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
main.narrow { max-width: 460px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .875rem; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list li { padding: .75rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.list a.row-link:hover { color: var(--accent); }
.empty { padding: 1.25rem 1rem; color: var(--muted); text-align: center; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .6rem .75rem; border-top: 1px solid var(--line); font-size: .95rem; vertical-align: top; }
th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-top: 0; }
.table-wrap { overflow-x: auto; }
th.num, td.num { text-align: right; white-space: nowrap; }
.stat b.neg, .neg { color: var(--bad); }

/* Badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field { margin-bottom: 1rem; }
.field .hint { color: var(--muted); font-size: .825rem; margin-top: .2rem; }
.field .err { color: var(--bad); font-size: .85rem; margin-top: .2rem; }
input:not([type]), input[type=text], input[type=tel], input[type=time], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .6rem .7rem; min-height: 44px;
}
textarea { min-height: 96px; }
select[multiple] { min-height: 140px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 40px; padding: .5rem .95rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: .25rem .6rem; font-size: .85rem; }
.btn.block { width: 100%; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--accent-soft); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.info { background: var(--bg); border: 1px solid var(--line); }

/* Landing */
.hero { padding: 2.5rem 0 1.5rem; max-width: 640px; }
.hero h1 { font-size: 2.1rem; letter-spacing: -.02em; }
.hero p { font-size: 1.1rem; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-top: 1.5rem; }
.features .card h3 { margin: 0 0 .25rem; font-size: 1rem; }
footer { color: var(--muted); font-size: .85rem; text-align: center; padding: 2rem 16px; }

/* Applications */
.grid3 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .grid3 { grid-template-columns: 2fr 1fr 2fr; } }
.tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .5rem .75rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.checklist ul { list-style: none; padding: 0; margin: .25rem 0 0; display: grid; gap: .35rem; }
.checklist li { display: flex; gap: .5rem; align-items: flex-start; }
.checklist li input { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
.checklist li label { font-weight: 500; margin: 0; }
dl.kv { display: grid; grid-template-columns: 1fr; gap: .15rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; margin-top: .5rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) { dl.kv { grid-template-columns: minmax(180px, 1fr) 2fr; } dl.kv dt { margin-top: 0; } }
h3.sub, h2.sub { font-size: 1rem; margin: 1rem 0 .5rem; }
.evidence { display: grid; gap: 1rem; }
.sigbox { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; max-width: 360px; min-height: 80px; display: flex; align-items: center; }
.sigbox img { width: 100%; height: auto; display: block; }
.typed-sig, .typed-sig-input { font-family: "Segoe Script", "Bradley Hand", "Snell Roundhand", cursive; font-size: 1.6rem; color: #111; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Applicant pages */
body.apply main { max-width: 680px; }
.apply-for { margin: 0 0 .75rem; }
.progress { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 1.25rem; }
.progress li { flex: 1; height: 6px; border-radius: 3px; background: var(--line); position: relative; }
.progress li.done { background: var(--accent); opacity: .5; }
.progress li.on { background: var(--accent); }
.progress li span { position: absolute; left: -9999px; }
.progress li.on span { position: static; display: block; margin-top: 10px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.step-nav { justify-content: space-between; margin-top: 1rem; }
.step-nav .btn.primary { flex: 1; max-width: 320px; margin-left: auto; }
.doc-slot { margin-bottom: 1rem; }
ul.files { list-style: none; padding: 0; margin: 0 0 .75rem; }
ul.files li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem 0; border-top: 1px solid var(--line); }
ul.files li:first-child { border-top: 0; }
.review { margin-bottom: .75rem; }
.review-head { display: flex; justify-content: space-between; align-items: baseline; }
.review-head h2 { margin: 0 0 .5rem; }
.sig-tabs { display: flex; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 .75rem; }
.sig-tabs label { display: flex; gap: .4rem; align-items: center; font-weight: 500; }
.sigpad { width: 100%; height: 180px; background: #fff; border: 2px dashed var(--line); border-radius: 8px; touch-action: none; display: block; cursor: crosshair; }
.sig-drawn .actions { margin-top: .4rem; }

/* Address search dropdown */
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; z-index: 20; margin-top: 2px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); overflow: hidden; }
.ac-item { padding: .6rem .75rem; cursor: pointer; font-size: .95rem; border-top: 1px solid var(--line); }
.ac-item:first-child { border-top: 0; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }
.ac-foot { padding: .45rem .75rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }

/* Photos and what's included */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.photo { margin: 0; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { padding: .4rem .5rem; display: flex; flex-direction: column; gap: .3rem; }
.photo figcaption input[type=text] { width: 100%; }
.room-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; float: left; margin-right: .6rem; }
.tick-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem 1rem; }
.tick-set { border: 0; padding: 0; margin: 0 0 .75rem; }
.tick-set legend { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.tick-set .check { display: flex; gap: .4rem; align-items: flex-start; margin: .2rem 0; }
.ticks { list-style: none; padding: 0; margin: .2rem 0 .6rem; }
.ticks li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* House documents */
.checklist { list-style: none; padding: 0; margin: .25rem 0 0; }
.checklist li { padding: .15rem 0; }
.checklist .ok { color: var(--good, #1a7f37); }
.checklist .missing { color: var(--bad, #b42318); }
.checklist .muted, .checklist a { color: inherit; }
.doc-tile { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: var(--line);
  border-radius: 6px; font-weight: 700; letter-spacing: .1em; color: var(--muted, #555); }
ol.rules { margin: 0; padding-left: 1.4rem; }
ol.rules li { margin: .2rem 0; }
.photo-tag { font-size: .75rem; }
.sig-preview { max-height: 48px; max-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.typed-sig { font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 1.1rem; }
.checklist .unset { color: var(--muted, #666); }
.photo { position: relative; }
.photo-pick { position: absolute; top: .35rem; left: .35rem; background: rgba(255,255,255,.9); border-radius: 6px;
  padding: .15rem .3rem; line-height: 1; z-index: 1; }
.photo-pick input { width: 1.25rem; height: 1.25rem; margin: 0; }
.photo-where { display: flex; gap: .3rem; }
.photo-where select { flex: 1; min-width: 0; font-size: .85rem; }
.js .autosubmit-btn { display: none; }
.photo-bulk { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .6rem .75rem; }
.photo-bulk select { max-width: 14rem; }
.photo-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; margin-top: .6rem; }
.photo-preview .pv { position: relative; }
.photo-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--line); }
.photo-preview .pv-x { position: absolute; top: 2px; right: 2px; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.photo-preview .pv-name { font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notices */
.notice-set { margin-bottom: .6rem; }
.inline-num input[type=number] { width: 4.2rem; display: inline-block; margin: 0 .25rem; }
.notice-prefs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem .75rem; margin-bottom: .6rem; }
.notice-prefs label { display: flex; flex-direction: column; gap: .2rem; font-weight: 500; }
.email-body { white-space: pre-wrap; font-family: inherit; font-size: .92rem; margin: 0; }
.filters select { max-width: 14rem; }

/* Bin roster */
.bin-swatch { display: inline-block; width: .95rem; height: .95rem; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); vertical-align: -2px; margin-right: .3rem; background: #ccc; }
.bin-swatch[data-colour=red] { background: #d62828; } .bin-swatch[data-colour=yellow] { background: #f2c200; }
.bin-swatch[data-colour=green] { background: #2a9d3a; } .bin-swatch[data-colour=purple] { background: #9b4dca; }
.bin-swatch[data-colour=blue] { background: #1e6fd9; } .bin-swatch[data-colour=lightblue] { background: #6cb8e6; }
.bin-swatch[data-colour=orange] { background: #f08c00; } .bin-swatch[data-colour=brown] { background: #8b5a2b; }
.bin-swatch[data-colour=black] { background: #222; } .bin-swatch[data-colour=grey] { background: #8a8a8a; }
.bin-row { border: 1px solid var(--line, #e3e3e3); border-radius: 8px; padding: .5rem .75rem .25rem; }
.bin-row legend { padding: 0 .3rem; }
.bin-chip { display: inline-block; margin: 0 .6rem .3rem 0; white-space: nowrap; }

/* Platform usage */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat-grid .card { margin: 0; }
.stat-num { font-size: 1.8rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar-col:hover .bar { opacity: .75; }
.bar { display: block; width: 70%; max-width: 22px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-axis { display: flex; justify-content: space-between; margin-top: .25rem; }

/* Room listings */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.room-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: inherit; text-decoration: none; }
.room-card:hover { border-color: var(--accent); }
.room-card-img { aspect-ratio: 4 / 3; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.room-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-card-body { padding: .6rem .75rem .75rem; }
.room-card-rent { font-weight: 700; font-size: 1.1rem; }
.room-card-title { font-weight: 600; margin: .1rem 0; }
.room-search .grid3 { margin-bottom: .25rem; }
.listing-gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4px; margin: .75rem 0 1rem; border-radius: 10px; overflow: hidden; }
.listing-gallery a:first-child { grid-row: span 2; }
.listing-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4 / 3; }
.listing-gallery a:nth-child(n+6) { display: none; }
.listing-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.listing-facts { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.listing-facts div { display: flex; flex-direction: column; }
.feature-list { columns: 2; padding-left: 1.1rem; font-size: .9rem; }
.thread { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.msg { padding: .5rem .7rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); max-width: 92%; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); }
.slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .3rem; max-height: 320px; overflow-y: auto; }
.slot { display: flex; gap: .4rem; align-items: center; font-size: .9rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 6px; }
.listing-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.listing-photo { display: flex; flex-direction: column; gap: .25rem; }
.listing-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.listing-photo span { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.listing-photo input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: 0; }
.listing-photo .order-num { width: 3.5rem; min-height: 36px; padding: .3rem .4rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.tabs a.on { font-weight: 700; text-decoration: underline; }
@media (max-width: 760px) {
  .listing-layout { grid-template-columns: 1fr; }
  .listing-gallery { grid-template-columns: 1fr 1fr; }
  .listing-gallery a:first-child { grid-column: span 2; grid-row: auto; }
  .feature-list { columns: 1; }
}

/* Listings table: keep columns readable, scroll sideways on a phone rather than squashing */
.listings-table { min-width: 620px; }
.listings-table td:first-child { min-width: 200px; }
.listings-table td:nth-child(2), .listings-table td.actions { white-space: nowrap; }
.listings-table td.actions .btn { margin: 0 .2rem .2rem 0; }

/* Automatic notices as a table: Email / Text columns */
.notice-table th.c, .notice-table td.c { text-align: center; width: 3.6rem; vertical-align: middle; padding-left: .3rem; padding-right: .3rem; }
.notice-table td.c input[type=checkbox] { width: 1.2rem; height: 1.2rem; }
.notice-when { margin-top: .35rem; color: var(--ink); }

/* Payment ledger */
.ledger { min-width: 640px; }
.ledger tr.ledger-pay td { background: var(--accent-soft); }
.nowrap { white-space: nowrap; }

/* Compact top bar */
.top-inner { padding: .35rem 16px; gap: .6rem; }
nav.main a { padding: .25rem .5rem; font-size: .9rem; }
@media (max-width: 760px) {
  /* Phone: the bar scrolls away with the page, so it can be bigger: two rows of four */
  .top { position: static; }
  .top-inner { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between;
               align-items: center; gap: .3rem .2rem; padding: .55rem 10px; }
  .top-inner > nav.main { display: contents; }
  .brand { font-size: 1.15rem; padding: .5rem .2rem; }
  nav.main a { white-space: nowrap; font-size: 1rem; padding: .55rem .4rem; text-align: center; }
  .top-inner > .who:has(> span) { display: none; }
  .top-inner > .who { grid-column: 1 / -1; justify-self: end; }
  main { padding-top: .9rem; }
}

/* Overview stats that link to their section */
a.stat-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, background .15s; }
a.stat-link:hover, a.stat-link:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
a.stat-link b { color: var(--ink); }
#vacant { scroll-margin-top: 4.5rem; }

/* Notices list */
.notices-table { min-width: 760px; }
.notices-table td:nth-child(2) { min-width: 170px; }
.notices-table td:nth-child(3) { min-width: 240px; }
.notices-table td:nth-child(4) { min-width: 140px; }
.notices-table td:last-child { white-space: nowrap; }
input[readonly] { opacity: .75; }
