/* Resident Ville design system ------------------------------------------------ */
:root {
  --ink: #0b1220;
  --ink-2: #16213a;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #dbeafe;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --success: #059669;
  --success-soft: #d1fae5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--slate-50);
  color: var(--slate-900);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
small { font-size: .82rem; }
hr { border: 0; border-top: 1px solid var(--slate-200); margin: 1.25rem 0; }
img { max-width: 100%; }

.muted { color: var(--slate-500); }
.tiny { font-size: .78rem; }
.strong { font-weight: 650; }
.mono { font-family: "Consolas", "SF Mono", monospace; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

/* Layout ------------------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 246px; flex: 0 0 246px; background: var(--ink);
  color: #cbd5e1; padding: .9rem 0 .5rem; position: sticky; top: 0;
  height: 100vh; max-height: 100vh;
  display: flex; flex-direction: column; z-index: 60;
  transition: width .18s ease, flex-basis .18s ease, transform .22s ease;
}
.sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: 0 1.15rem .65rem;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  color: #fff; font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em;
}
.sidebar .brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: #201D50; color: #fff; font-weight: 800; font-size: .9rem; flex: 0 0 32px;
}
.brand-mark .logo-glyph { width: 17px; height: 17px; }
/* On the dark sidebar the badge would disappear, so lift it slightly. */
.sidebar .brand-mark { background: rgba(255, 255, 255, .12); }
.nav-group { padding: .25rem 0 .1rem; }
.nav-label {
  padding: 0 1.15rem .2rem; font-size: .62rem; text-transform: uppercase;
  letter-spacing: .09em; color: #64748b; font-weight: 700;
}
.nav-link {
  position: relative; display: flex; align-items: center; gap: .7rem;
  padding: .38rem 1.15rem; color: #cbd5e1; font-size: .86rem;
  /* The body's 1.55 line-height made every row ~4px taller than the text
     needs. Setting it here buys back the space that used to be taken out
     of the font size instead. */
  line-height: 1.25;
  border-left: 3px solid transparent; white-space: nowrap;
}
.nav-link .ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-link.active .ico { opacity: 1; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(37,99,235,.16); color: #fff; border-left-color: var(--brand); font-weight: 600; }
.nav-count {
  background: var(--brand); color: #fff; border-radius: 999px;
  padding: .05rem .42rem; font-size: .7rem; font-weight: 700;
}
.sidebar-foot { padding-top: .6rem; margin-top: .35rem; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--slate-200);
  padding: .75rem 1.6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar .who { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.content { padding: 1.6rem; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* Cards and grids --------------------------------------------------------- */
.card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.15rem; margin-bottom: 1.15rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .9rem 1.15rem; border-bottom: 1px solid var(--slate-200); background: var(--slate-50);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.15rem; }
.grid { display: grid; gap: 1.15rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* Stats ------------------------------------------------------------------- */
.stat { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--slate-500); font-weight: 700; }
.stat .value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin-top: .25rem; }
.stat .sub { font-size: .8rem; color: var(--slate-500); }
.stat.accent { border-left: 3px solid var(--brand); }
.stat.good .value { color: var(--success); }
.stat.bad .value { color: var(--danger); }

.meter { height: 7px; border-radius: 999px; background: var(--slate-200); overflow: hidden; margin-top: .5rem; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.good > span { background: var(--success); }
.meter.warn > span { background: var(--warning); }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data th {
  text-align: left; padding: .6rem .9rem; background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200); font-size: .73rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--slate-500); font-weight: 700; white-space: nowrap;
}
table.data td { padding: .68rem .9rem; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--slate-50); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 2.4rem 1rem; text-align: center; color: var(--slate-500); }
.empty .big { font-size: 2rem; margin-bottom: .4rem; }

/* Badges ------------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem;
  border-radius: 999px; font-size: .74rem; font-weight: 650; letter-spacing: .01em;
  background: var(--slate-100); color: var(--slate-600); white-space: nowrap;
}
.badge.success { background: var(--success-soft); color: #065f46; }
.badge.danger { background: var(--danger-soft); color: #991b1b; }
.badge.warning { background: var(--warning-soft); color: #92400e; }
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }
.badge.muted { background: var(--slate-100); color: var(--slate-500); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: .88rem; font-weight: 600;
  cursor: pointer; font-family: inherit; line-height: 1.35; transition: background .13s ease, box-shadow .13s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.ghost { background: #fff; border-color: var(--slate-300); color: var(--slate-700); }
.btn.ghost:hover { background: var(--slate-50); color: var(--slate-900); }
.btn.subtle { background: var(--slate-100); color: var(--slate-700); }
.btn.subtle:hover { background: var(--slate-200); }
.btn.success { background: var(--success); }
.btn.success:hover { background: #047857; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: .3rem .6rem; font-size: .8rem; }
.btn.lg { padding: .7rem 1.35rem; font-size: 1rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.btn-link.danger { color: var(--danger); }

/* Forms ------------------------------------------------------------------- */
.field { margin-bottom: .95rem; }
.field > label, .label {
  display: block; font-size: .8rem; font-weight: 650; color: var(--slate-700); margin-bottom: .3rem;
}
.input, select.input, textarea.input,
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; padding: .52rem .7rem; border: 1px solid var(--slate-300); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .9rem; color: var(--slate-900); background: #fff; line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { padding: .35rem; font-size: .85rem; }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; accent-color: var(--brand); }
.check { display: flex; align-items: flex-start; gap: .5rem; font-size: .87rem; margin-bottom: .5rem; }
.check label { margin: 0; font-weight: 500; color: var(--slate-700); }
.hint { font-size: .78rem; color: var(--slate-500); margin-top: .25rem; }
.error-text { color: var(--danger); font-size: .78rem; margin-top: .25rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; align-items: center; padding-top: .4rem; }
fieldset { border: 0; padding: 0; margin: 0 0 .5rem; }
legend { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--slate-500); padding: 0 0 .5rem; }

/* Alerts ------------------------------------------------------------------ */
.alert {
  border-radius: var(--radius-sm); padding: .7rem .95rem; margin-bottom: 1.1rem;
  font-size: .89rem; border: 1px solid transparent;
}
.alert.ok { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert.err { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert.warn { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }
.alert.info { background: var(--brand-soft); border-color: #bfdbfe; color: #1e40af; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* Tabs / filters ---------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--slate-200); margin-bottom: 1.15rem; flex-wrap: wrap; }
.tabs a {
  padding: .55rem .9rem; font-size: .88rem; color: var(--slate-600);
  border-bottom: 2px solid transparent; font-weight: 550;
}
.tabs a:hover { color: var(--slate-900); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.filters { display: flex; gap: .55rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.15rem; }
.filters .field { margin: 0; min-width: 150px; }

/* Pagination -------------------------------------------------------------- */
.pagination { display: flex; gap: .25rem; list-style: none; padding: 0; margin: 1.15rem 0 0; flex-wrap: wrap; font-size: .85rem; }
.pagination li span, .pagination li a {
  display: block; padding: .35rem .65rem; border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm); background: #fff; color: var(--slate-600);
}
.pagination li a:hover { background: var(--slate-50); text-decoration: none; }
.pagination .active span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled span { color: var(--slate-300); }

/* Chart (pure CSS bars) --------------------------------------------------- */
.chart { display: flex; align-items: flex-end; gap: .9rem; height: 170px; padding-top: .5rem; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; }
.chart .bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.chart .bar { width: 16px; border-radius: 4px 4px 0 0; background: var(--brand); min-height: 2px; }
.chart .bar.expense { background: var(--slate-300); }
.chart .cap { font-size: .74rem; color: var(--slate-500); font-weight: 600; }
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--slate-600); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: .3rem; }

/* Timeline / comments ----------------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: .85rem; }
.bubble { display: flex; gap: .65rem; }
.bubble .body {
  background: var(--slate-100); border-radius: 12px; padding: .6rem .85rem;
  font-size: .89rem; max-width: 70%; white-space: pre-wrap;
}
.bubble.me { flex-direction: row-reverse; }
.bubble.me .body { background: var(--brand-soft); color: #1e3a8a; }
.bubble .meta { font-size: .72rem; color: var(--slate-500); margin-top: .2rem; }

/* Listing cards ----------------------------------------------------------- */
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.listing-card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform .14s ease, box-shadow .14s ease;
}
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.listing-photo {
  height: 178px; background: linear-gradient(135deg, #1e3a8a, #0ea5e9); position: relative;
  display: grid; place-items: center; color: rgba(255,255,255,.85); font-size: 2.2rem;
  background-size: cover; background-position: center;
}
.listing-photo .price {
  position: absolute; left: .75rem; bottom: .75rem; background: rgba(11,18,32,.86);
  color: #fff; padding: .25rem .6rem; border-radius: 999px; font-weight: 700; font-size: .88rem;
}
.listing-body { padding: .95rem 1.05rem 1.1rem; flex: 1; display: flex; flex-direction: column; }
.listing-body h3 { margin-bottom: .15rem; font-size: 1rem; }
.facts { display: flex; gap: .8rem; font-size: .82rem; color: var(--slate-600); margin: .5rem 0 .75rem; flex-wrap: wrap; }
.facts span { display: inline-flex; align-items: center; gap: .25rem; }

/* Public site ------------------------------------------------------------- */
.public-nav {
  background: #fff; border-bottom: 1px solid var(--slate-200); position: sticky; top: 0; z-index: 20;
}
.public-nav .inner {
  max-width: 1180px; margin: 0 auto; padding: .8rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.public-nav .links { display: flex; gap: 1.3rem; align-items: center; font-size: .92rem; }
.public-nav .links a { color: var(--slate-700); font-weight: 550; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 2.2rem 1.4rem; }
.hero {
  background: linear-gradient(135deg, var(--ink) 0%, #16325c 55%, #0e4f7a 100%);
  color: #fff; padding: 4rem 1.4rem 4.4rem;
}
.hero .inner { max-width: 1180px; margin: 0 auto; }
.hero h1 { font-size: 2.9rem; max-width: 15ch; margin-bottom: .6rem; letter-spacing: -.03em; }
.hero p.lede { font-size: 1.12rem; color: #cbd5e1; max-width: 56ch; }
.hero .cta { display: flex; gap: .7rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero .btn.ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.hero .btn.ghost:hover { background: rgba(255,255,255,.1); }
.hero-stats { display: flex; gap: 2.4rem; margin-top: 2.6rem; flex-wrap: wrap; }
.hero-stats .n { font-size: 1.75rem; font-weight: 700; }
.hero-stats .l { font-size: .82rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .07em; }

.section-title { text-align: center; margin-bottom: 2rem; }
.section-title p { color: var(--slate-500); max-width: 60ch; margin: .4rem auto 0; }
.feature { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.feature .ico {
  width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-size: 1.15rem; margin-bottom: .8rem;
}
.feature h3 { font-size: 1rem; }
.feature p { font-size: .89rem; color: var(--slate-600); margin: 0; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.2rem; background: var(--slate-100); }
.auth-card { width: 100%; max-width: 430px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.9rem; }
.auth-card .brand { display: inline-flex; align-items: center; gap: .55rem; justify-content: center; width: 100%; margin-bottom: 1.3rem; font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.auth-card .brand:hover { text-decoration: none; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .95rem; }
.role-pick label {
  border: 1px solid var(--slate-300); border-radius: var(--radius-sm); padding: .7rem;
  cursor: pointer; text-align: center; font-size: .87rem; font-weight: 600; color: var(--slate-600);
}
.role-pick input { display: none; }
.role-pick input:checked + span { color: var(--brand-dark); }
.role-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

.footer { background: var(--ink); color: #94a3b8; padding: 2.4rem 1.4rem; font-size: .87rem; margin-top: 3rem; }
.footer .inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer a { color: #cbd5e1; }

/* Print ------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .sidebar-backdrop, .skip-link, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  /* Signature blocks must stay legible once the colour is gone. */
  .sig-block { background: #fff !important; border: 1px solid #333 !important; break-inside: avoid; }
  .sig-grid { gap: 1.5rem; }
  .sig-rule { border-bottom-color: #333; }
  form, .btn { display: none !important; }
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .content { padding: 1.1rem; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .listing-grid { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 2.05rem; }
  .bubble .body { max-width: 85%; }
}

/* Lease signature blocks -------------------------------------------------- */
.sig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.sig-block {
  border: 1px dashed var(--slate-300); border-radius: var(--radius-sm);
  padding: .85rem .95rem; background: var(--slate-50);
}
.sig-block.signed { border-style: solid; border-color: #a7f3d0; background: #f0fdf9; }
.sig-role {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--slate-500); margin-bottom: .5rem;
}
.sig-name {
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  font-size: 1.35rem; line-height: 1.3; color: var(--ink); min-height: 1.9rem;
  overflow-wrap: anywhere;
}
.sig-name.pending { font-size: .88rem; font-style: normal; color: var(--slate-400); }
.sig-rule { border-bottom: 1px solid var(--slate-300); margin: .35rem 0 .45rem; }
.sig-meta { font-size: .74rem; color: var(--slate-500); }

@media (max-width: 640px) {
  .sig-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Collapsible sidebar ----------------------------------------------------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: .55rem .9rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px; padding: 0;
  border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
  background: #fff; color: var(--slate-600); cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.icon-btn:hover { background: var(--slate-100); color: var(--slate-900); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon-btn .ico { width: 20px; height: 20px; }

.topbar-left { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.topbar-title { min-width: 0; }
.topbar-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-close {
  display: none; background: transparent; border-color: rgba(255,255,255,.18); color: #cbd5e1;
  width: 34px; height: 34px; flex-basis: 34px;
}
.sidebar-close:hover { background: rgba(255,255,255,.08); color: #fff; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 55;
  background: rgba(8, 13, 25, .55);
}

/* Wide screens: the toggle shrinks the sidebar to an icon rail. */
@media (min-width: 821px) {
  html.nav-collapsed .sidebar { width: 68px; flex-basis: 68px; }
  html.nav-collapsed .sidebar-top { justify-content: center; padding-left: 0; padding-right: 0; }
  html.nav-collapsed .nav-text,
  html.nav-collapsed .nav-label { display: none; }
  html.nav-collapsed .nav-link { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
  html.nav-collapsed .nav-group { padding-top: .45rem; }
  html.nav-collapsed .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.07); }
  html.nav-collapsed .nav-count {
    position: absolute; top: 4px; right: 12px;
    min-width: 15px; padding: 0 3px; font-size: .62rem; line-height: 15px; text-align: center;
  }

  /* Hovering a rail icon reveals its label as a flyout. */
  html.nav-collapsed .nav-link:hover .nav-text {
    display: block; position: absolute; left: calc(100% + 6px); top: 50%;
    transform: translateY(-50%); z-index: 70;
    background: var(--ink-2); color: #fff; padding: .3rem .6rem;
    border-radius: var(--radius-sm); font-size: .82rem; box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.1);
  }
}

/* Narrow screens: the sidebar becomes an off-canvas drawer. */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 268px; flex-basis: 268px;
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
  }
  html.nav-open .sidebar { transform: none; }
  html.nav-open .sidebar-backdrop { display: block; }
  html.nav-open, html.nav-open body { overflow: hidden; }
  .sidebar-close { display: inline-flex; }
  .topbar { padding: .7rem 1rem; }
  .who-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Sidebar collapse control ------------------------------------------------ */
.sidebar-collapse {
  background: transparent; border-color: rgba(255, 255, 255, .16); color: #cbd5e1;
  width: 30px; height: 30px; flex-basis: 30px; border-radius: 8px;
}
.sidebar-collapse:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar-collapse .ico { width: 17px; height: 17px; }
/* Show the arrow that matches what the click will do. */
.sidebar-collapse .ico:last-child { display: none; }
html.nav-collapsed .sidebar-collapse .ico:first-child { display: none; }
html.nav-collapsed .sidebar-collapse .ico:last-child { display: block; }

@media (min-width: 821px) {
  /* Collapsed rail: stack the brand over the toggle so both stay reachable. */
  html.nav-collapsed .sidebar-top {
    flex-direction: column; gap: .5rem; padding-left: 0; padding-right: 0;
  }
  html.nav-collapsed .brand { justify-content: center; }
}

@media (max-width: 820px) {
  /* The drawer is opened from the top bar, so the rail toggle is not needed. */
  .sidebar-collapse { display: none; }
  /* A drawer may legitimately exceed the screen, so let it scroll there only. */
  .sidebar { height: 100dvh; min-height: 0; }
  .sidebar-nav { overflow-y: auto; }
}

.role-pick-3 { grid-template-columns: repeat(3, 1fr); }
.role-pick-3 label { padding: .6rem .35rem; font-size: .8rem; }

/* Legal document (lease agreement) ---------------------------------------- */
.legal-doc {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: clamp(1.5rem, 4vw, 3.5rem);
  max-width: 8.5in; margin: 0 auto; font-size: .95rem; line-height: 1.7; color: #1f2937;
}
.legal-doc p { margin: 0 0 1rem; text-align: justify; }
.legal-title {
  text-align: center; font-size: 1.5rem; line-height: 1.35; letter-spacing: .02em;
  text-transform: uppercase; margin: 0 0 2rem; color: var(--ink);
}
.legal-h2 {
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em;
  margin: 2rem 0 .8rem; padding-top: 1rem; border-top: 1px solid var(--slate-200);
}
.legal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1rem; }
.legal-label { font-weight: 700; margin-bottom: .35rem !important; }
.legal-additional {
  white-space: pre-wrap; text-align: left !important;
  border-left: 3px solid var(--slate-300); padding-left: 1rem;
}
.legal-note {
  background: var(--warning-soft); border: 1px solid #fde68a; color: #92400e;
  border-radius: var(--radius-sm); padding: .6rem .85rem; font-size: .82rem;
  text-align: left !important;
}

@media (max-width: 700px) { .legal-cols { grid-template-columns: 1fr; } }

@media print {
  .legal-doc { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 11pt; }
  .legal-doc p { orphans: 3; widows: 3; }
  .legal-title { font-size: 16pt; }
  .legal-h2 { break-after: avoid; }
}

/* Sidebar scrollbar — only appears when the menu genuinely cannot fit, and
   stays visually quiet when it does. */
.sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }

/* The footer link must always stay pinned and reachable. */
.sidebar-foot { flex: 0 0 auto; }

/*
 * Short screens. Every heading and every item has to stay on screen, and the
 * type size stays exactly as it is on a tall one - only the space around the
 * rows gives way. Measured against the tightest real case: a landlord's
 * 14 items plus 4 group headings plus Browse rentals.
 */
@media (min-width: 821px) and (max-height: 900px) {
  .sidebar { padding-top: .6rem; padding-bottom: .4rem; }
  .sidebar-top { padding-bottom: .5rem; }
  .nav-group { padding: .2rem 0 .06rem; }
  .nav-label { padding-bottom: .14rem; }
  .nav-link { padding-top: .34rem; padding-bottom: .34rem; }
  .sidebar-foot { padding-top: .4rem; margin-top: .2rem; }
}

@media (min-width: 821px) and (max-height: 660px) {
  .sidebar { padding-top: .5rem; padding-bottom: .35rem; }
  .sidebar-top { padding-bottom: .45rem; }
  .nav-group { padding: .16rem 0 .04rem; }
  .nav-label { padding-bottom: .1rem; }
  .nav-link { padding-top: .28rem; padding-bottom: .28rem; }
  .sidebar-foot { padding-top: .35rem; margin-top: .18rem; }
}

/* Payment dialog ---------------------------------------------------------- */
/*
 * A native <dialog>, so focus trapping, Esc-to-close and the backdrop come
 * from the browser. Styled to read as one of the page's cards.
 */
.modal {
  position: relative;
  width: min(440px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  overflow: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
  padding: 1.25rem;
  color: var(--ink);
  background: #fff;
}
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.modal h3 { margin-top: 0; }
.modal .field:last-of-type { margin-bottom: .9rem; }
.modal-dismiss { position: absolute; top: .6rem; right: .6rem; margin: 0; }
.modal-dismiss .icon-btn { font-size: 1.35rem; line-height: 1; color: var(--slate-500, #64748b); }
.modal-actions { display: flex; align-items: center; gap: .6rem; }
.modal-actions .btn:first-child { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .modal[open] { animation: none; }
}
