:root {
  --ink: #14231F;
  --muted: #5B6B66;
  --deep: #0E2A26;
  --deep-2: #16443D;
  --primary: #0B5D4B;
  --primary-dark: #08463A;
  --amber: #E5A00D;
  --bg: #F3F5F4;
  --card: #fff;
  --border: #DDE3E1;
  --field: #C5CFCB;
  --ok-bg: #DDF3E4; --ok-fg: #14663A;
  --warn-bg: #FFF1CC; --warn-fg: #7A4F00;
  --bad-bg: #FDE7E4; --bad-fg: #9B2318;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 'Plus Jakarta Sans', system-ui, sans-serif; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 248px; max-width: 280px; background: var(--deep); color: #fff; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 4px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--amber); display: flex; align-items: center; justify-content: center; }
.brand-mark svg, .public-brand svg { fill: none; stroke: var(--deep); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-weight: 800; font-size: 16px; }
.org-name { margin: 6px 8px 16px; color: #A9CBC2; font-size: 13px; }
.nav-group { margin: 18px 8px 6px; color: #7FA89E; font-size: 12px; font-weight: 700; }
.nav-link { display: block; padding: 10px 12px; border-radius: 8px; color: #CFE3DD; text-decoration: none; font-weight: 600; font-size: 14px; }
.nav-link:hover { background: var(--deep-2); color: #fff; }
/* Selected page: a stronger fill plus an amber edge, clearly different from hover. */
.nav-link.active, .nav-link.active:hover { background: var(--primary); color: #fff; font-weight: 800; box-shadow: inset 3px 0 0 var(--amber); }
.nav-group.has-active { color: #E7F2EE; }

/* Sidebar and page scroll independently.
   Wide screens (1024px and up): the sidebar is pinned to the viewport and scrolls inside itself while the page scrolls on its own.
   Narrower screens: the sidebar becomes a slide-in drawer, closed until the menu button is tapped (see shell.css and shell.js). */
.sidebar { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--deep-2) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--deep-2); border-radius: 8px; }
@media (min-width: 1024px) {
  .shell { flex-wrap: nowrap; align-items: flex-start; }
  .sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; }
  .main { align-self: stretch; min-height: 100vh; }
}

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 32px; background: var(--card); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.topbar-user form { margin: 0; }
.content { padding: 24px 32px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1100px; width: 100%; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.card h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font: 700 14px 'Plus Jakarta Sans', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--field); }
.btn-outline:hover { background: #F8FAF9; color: var(--ink); }
.btn-quiet { min-height: 36px; padding: 0 12px; background: #fff; color: var(--ink); border: 1.5px solid var(--field); }
.btn-quiet:hover { background: #F8FAF9; color: var(--ink); }
.btn-danger { background: #fff; color: var(--bad-fg); border: 1.5px solid #E3A39B; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad-fg); }
.btn-small { min-height: 36px; padding: 0 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 13px; }
.field input, .field select, .field textarea { min-height: 44px; border: 1px solid var(--field); border-radius: 10px; padding: 0 14px; font: 500 15px 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--ink); background: #fff; width: 100%; }
.field textarea { padding: 10px 14px; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, .nav-link:focus-visible { outline: 3px solid #8CC9B9; outline-offset: 1px; }
.field-validation-error, .validation-summary-errors { color: var(--bad-fg); font-size: 13px; }
.validation-summary-errors ul { margin: 0 0 12px; padding-left: 18px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14px; }
.check input { width: 20px; height: 20px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-narrow { max-width: 520px; }

.notice { border-radius: 12px; padding: 12px 16px; font-size: 14px; border: 1px solid; }
.notice.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: #9BD3AE; }
.notice.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: #E6C56A; }
.notice.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: #E3A39B; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; min-width: 640px; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 8px; }
table.grid td { padding: 12px 8px; border-top: 1px solid #E5EAE8; vertical-align: middle; font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-actions form { margin: 0; display: flex; gap: 6px; align-items: center; }
.row-actions select { min-height: 36px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; font: 500 14px 'Plus Jakarta Sans', system-ui, sans-serif; background: #fff; }

.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.bad { background: var(--bad-bg); color: var(--bad-fg); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; }
.step.disabled { opacity: 0.65; }
.step-mark { flex: 0 0 34px; height: 34px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 800; background: #EEF1F0; color: var(--muted); }
.step-mark.done { background: var(--primary); color: #fff; }
.step-body { flex: 1 1 260px; min-width: 0; }
.step-title { font-weight: 700; }

.perm-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.perm { background: #F3F5F4; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.link-box { word-break: break-all; background: #F3F5F4; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

body.public { background: var(--deep); }
.public-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px 16px; }
.public-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 18px; }
.public-card { width: 100%; max-width: 440px; padding: 28px; }
.public-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.public-card .btn { width: 100%; }
.public-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; }

@media (max-width: 720px) {
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-link { transition: background-color .12s ease; }
}

/* ---- properties and units */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 14px; }
.legend-item { white-space: nowrap; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 12px; }
.unit-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--field); background: #fff; color: var(--ink); text-decoration: none; }
a.unit-tile:hover { border-color: var(--primary); color: var(--ink); }
.unit-name { font-weight: 800; font-size: 15px; }
.unit-status { font-size: 12px; color: var(--muted); }
.status-vacant { background: #fff; }
.status-occupied { background: var(--ok-bg); border-color: #9BD3AE; }
.status-reserved { background: var(--warn-bg); border-color: #E6C56A; }
.status-underrepair { background: var(--bad-bg); border-color: #E3A39B; border-style: dashed; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; margin-top: 8px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; }
.inline-form .field { margin-bottom: 0; flex: 1 1 160px; }
.perm-clash { background: var(--bad-bg); color: var(--bad-fg); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Step 13: caretaker job list, easy to tap on a phone */
.job-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.job-list li { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.job-list a { font-weight: 700; font-size: 16px; }

/* Tenant registrations (Step 20) */
dl.facts { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; margin: 12px 0 0; }
dl.facts dt { color: var(--muted); font-size: 13px; font-weight: 700; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { list-style: none; margin: 8px 0 0; padding: 0; }
ul.plain li { padding: 10px 0; border-top: 1px solid #E5EAE8; font-size: 14px; }
.choice-row { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 8px; font-size: 14px; }
.struck { text-decoration: line-through; color: var(--muted); }
@media (max-width: 560px) { dl.facts { grid-template-columns: 1fr; } }

/* Live demo banner (shown on every back-office page during a demo session) */
.demo-banner { position: sticky; top: 0; z-index: 100; background: #F5B83D; color: #2A1D00; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; align-items: center; font-size: 14px; text-align: center; }
.demo-banner-btn { background: #0F2A3D; color: #fff; padding: 6px 14px; border-radius: 8px; text-decoration: none; font-weight: 700; }
.demo-banner-btn:hover { background: #163D57; }
.demo-banner-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Tenant registration link panel (property page): tidy form, real checkbox, link cards that stack on small screens. */
.reg-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px 16px; align-items: end; margin-top: 14px; }
.reg-form .field { margin-bottom: 0; }
.reg-guarantor { grid-column: 1 / -1; }
.reg-submit { grid-column: 1 / -1; justify-self: start; }
.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--field); border-radius: 10px; background: #fff; cursor: pointer; }
.check-row input[type=checkbox], .check-row input[type=radio] { flex: 0 0 auto; width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
.check-row span { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.check-row small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.check-row:focus-within { outline: 3px solid #8CC9B9; outline-offset: 1px; }
.reg-list-title { margin: 26px 0 10px; font-size: 16px; }
.reg-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.reg-link { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: #fff; display: grid; gap: 10px; min-width: 0; }
.reg-link-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.reg-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0; }
.reg-meta dt { font-size: 12px; color: var(--muted); }
.reg-meta dd { margin: 0; font-size: 14px; }
.reg-url { width: 100%; min-height: 44px; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px; font: 14px ui-monospace, Consolas, monospace; background: #F7F9F8; color: var(--ink); text-overflow: ellipsis; }
.reg-actions { gap: 8px; }
.reg-actions .btn { min-height: 40px; }
.reg-revoke { margin-left: auto; }
@media (max-width: 720px) {
  .reg-form { grid-template-columns: 1fr; }
  .reg-submit { justify-self: stretch; width: 100%; }
  .reg-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .reg-actions .btn, .reg-revoke, .reg-revoke .btn { width: 100%; text-align: center; justify-content: center; }
  .reg-revoke { grid-column: 1 / -1; margin-left: 0; }
}

/* Subscription and billing pages. */
.sub-hero-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sub-kicker { margin: 0; font-size: 13px; color: var(--muted); }
.sub-plan { margin: 2px 0 0; font-size: 26px; }
.sub-badge { font-size: 13px; padding: 5px 12px; }
.sub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 16px 0; }
.sub-facts dt { font-size: 12px; color: var(--muted); }
.sub-facts dd { margin: 2px 0 0; font-weight: 700; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sub-meters { display: grid; gap: 16px; margin: 12px 0; }
.sub-meter-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 14px; margin-bottom: 6px; }
.meter { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.meter.warn > span { background: #C98A0B; }
.meter.bad > span { background: #B3261E; }
.sub-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.sub-plans-pay { margin-top: 14px; }
.sub-plan-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: #fff; display: grid; gap: 8px; min-width: 0; }
.card.sub-plan-card { margin: 0; }
.sub-plan-card.current { border-color: var(--primary); }
.sub-plan-card.picked { box-shadow: 0 0 0 2px #8CC9B9; }
.sub-plan-card header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sub-plan-card h3 { margin: 0; font-size: 18px; }
.sub-limits { margin: 0; padding-left: 18px; font-size: 14px; }
.sub-price { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-weight: 700; }
.sub-price small { font-weight: 500; color: var(--muted); }
.sub-terms { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.sub-terms legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.sub-term { align-items: center; }
.sub-quote { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: grid; gap: 6px; font-size: 14px; }
.sub-quote > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.sub-quote .total { border-top: 1px solid var(--border); padding-top: 8px; font-size: 16px; }
table.sub-compare { min-width: 0; }
.sub-compare th, .sub-compare td { padding: 6px 8px; font-size: 14px; }
.sub-result.ok { border-color: #9BD3AE; }
.sub-result.bad { border-color: #E3A39B; }
@media (max-width: 720px) {
  .sub-actions .btn, .sub-plan-card .btn { width: 100%; text-align: center; justify-content: center; }
  .sub-plan { font-size: 22px; }
}
