/* =====================================================================
   DOMU SPACE design system — warm editorial, Linen / Khaki / Camel / Cocoa / Espresso
   ===================================================================== */
:root {
  /* ---- DOMU SPACE palette (final, Berry 30 Sep 2026) — the ONLY source colours ---- */
  --color-linen: #F5F1EA;
  --color-khaki: #D7C9B8;
  --color-camel: #B2967D;
  --color-cocoa: #7D5A44;
  --color-espresso: #4A342A;

  /* ---- Theme tokens (names kept from the approved design; values now come from the palette) ---- */
  --cream: var(--color-linen);              /* page canvas */
  --cream-2: #EAE3D8;                       /* linen -> khaki, muted surfaces */
  --ivory: #FAF7F2;                         /* cards / inputs (a light linen, never pure white) */
  --paper: #F8F4ED;
  --line: #E3D9CC;
  --line-2: var(--color-khaki);

  --ink: var(--color-espresso);
  --ink-2: #6F5748;
  --ink-3: #806B59;

  --olive: var(--color-cocoa);              /* primary interactive (was olive) */
  --olive-2: #8A664F;
  --olive-ink: var(--color-espresso);
  --sage: var(--color-camel);               /* accent surfaces / selected (was sage) */
  --sage-2: #C9B7A3;
  --sage-soft: #E4DBCE;                     /* soft khaki panel */

  /* muted, palette-harmonised accents */
  --peach: #C99A85;
  --peach-2: #E4CDBE;
  --peach-soft: #EFE0D6;
  --yellow: #C9A55F;
  --yellow-soft: #F0E5CC;
  --blue: #9BA8AA;
  --blue-soft: #E1E4E2;
  --lilac-soft: #E3DBD8;
  --terracotta: #A2523E;                    /* error / danger: muted brick */

  /* semantic status colours (kept distinguishable, softened to sit under the palette) */
  --ok: #71835E;                            /* success: muted natural green */
  --ok-soft: #E1E6D5;
  --ok-ink: #465532;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(74, 52, 42, .04), 0 8px 24px -14px rgba(74, 52, 42, .20);
  --shadow-lift: 0 2px 0 rgba(74, 52, 42, .04), 0 18px 36px -18px rgba(74, 52, 42, .32);

  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --accent-font: "Caveat Brush", "Caveat", "Segoe Print", cursive;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--cream); -webkit-font-smoothing: antialiased;
}
a { color: var(--olive); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 800; }
p { margin: 0 0 .6em; }
small, .muted { color: var(--ink-3); }
.num, .money, td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.accent { font-family: var(--accent-font); font-weight: 400; letter-spacing: .01em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--olive) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.shell.no-sidebar { grid-template-columns: 1fr; }
.shell.collapsed { --sidebar-w: 76px; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px;
  background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 800; font-size: 17px; line-height: 1; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.sidebar .brand-sub { letter-spacing: .05em; white-space: nowrap; }   /* sidebar only: keep PROPERTY MANAGEMENT on one line */
.nav-label { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 12px 12px 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; color: var(--ink-2);
  font-weight: 700; font-size: 14.5px;
}
.nav a:hover { background: var(--cream-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--sage-soft); color: var(--olive-ink); }
.nav a.active .ico { color: var(--olive); }
.nav .ico { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.shell.collapsed .brand-text, .shell.collapsed .nav-text, .shell.collapsed .nav-label, .shell.collapsed .sidebar-foot .nav-text { display: none; }
.shell.collapsed .nav a { justify-content: center; padding: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: color-mix(in srgb, var(--cream) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--ivory); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 20px; height: 20px; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--peach-2); color: var(--olive-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.user-meta { line-height: 1.15; }
.user-meta b { font-size: 14px; display: block; }
.user-meta span { font-size: 12px; color: var(--ink-3); }
.menu { position: relative; }
.menu > button { all: unset; cursor: pointer; border-radius: 14px; padding: 4px 6px; }
.menu > button:focus-visible { outline: 3px solid color-mix(in srgb, var(--olive) 55%, transparent); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--ivory); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lift); padding: 6px; display: none;
}
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; color: var(--ink);
  font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--cream-2); text-decoration: none; }

.content { padding: 8px 28px 48px; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 22px; }
.page-head .eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 60ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }

/* ---------------------------------------------------------------------
   Global search
   --------------------------------------------------------------------- */
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch input {
  width: 100%; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--ivory);
  padding: 0 44px 0 44px; font: inherit; font-size: 15px; color: var(--ink);
}
.gsearch input::placeholder { color: var(--ink-3); }
.gsearch input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
.gsearch .s-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }
.gsearch kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 700 11px var(--font); color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: var(--paper);
}
.gsearch-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--ivory); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lift); max-height: 70vh; overflow: auto; padding: 6px; display: none; z-index: 40;
}
.gsearch.open .gsearch-pop { display: block; }
.gs-group { padding: 6px 4px; }
.gs-group-label { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 4px 10px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: var(--ink); }
.gs-item:hover, .gs-item.sel { background: var(--sage-soft); text-decoration: none; }
.gs-item .t { font-weight: 700; }
.gs-item .s { font-size: 12.5px; color: var(--ink-3); }
.gs-item .grow { flex: 1; min-width: 0; }
.gs-item .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-empty { padding: 16px; color: var(--ink-3); text-align: center; }
.gs-all { display: block; text-align: center; padding: 10px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; }

/* ---------------------------------------------------------------------
   Buttons, badges, flashes
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 800; font-size: 14.5px;
  cursor: pointer; white-space: nowrap; transition: transform .08s ease, background .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--olive); color: var(--cream); }
.btn-primary:hover { background: var(--olive-ink); }
.btn-ghost { background: var(--ivory); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-2); background: var(--paper); }
.btn-soft { background: var(--sage-soft); color: var(--olive-ink); }
.btn-soft:hover { background: var(--sage-2); }
.btn-danger { background: var(--terracotta); color: var(--cream); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--olive); cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge-sage { background: var(--ok-soft); color: var(--ok-ink); }
.badge-yellow { background: var(--yellow-soft); color: #7A5A12; }
.badge-blue { background: var(--blue-soft); color: #47595F; }
.badge-peach { background: var(--peach-soft); color: #8A4633; }
.badge-grey { background: var(--cream-2); color: var(--ink-2); }
/* long badge text may wrap on phones (Owner Statements list, Excel months) */
.badge-wrap { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; line-height: 1.3; max-width: 100%; }
.pill-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px;
  background: var(--cream-2); font-size: 13px; font-weight: 800; color: var(--ink-2);
}

.flashes { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 16px; background: var(--ivory);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift); font-weight: 600; animation: rise .25s ease;
}
.flash.success { border-left: 5px solid var(--ok); }
.flash.error { border-left: 5px solid var(--terracotta); }
.flash.info { border-left: 5px solid var(--blue); }
.flash button { margin-left: auto; background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--yellow-soft);
  color: #66501F; font-weight: 600; margin-bottom: 18px;
}
.notice.sage { background: var(--sage-soft); color: var(--olive-ink); }
.notice.peach { background: var(--peach-soft); color: #7A3E2C; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.card {
  background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { flex: 1; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.blob-ico {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; color: var(--olive-ink);
  border-radius: 46% 54% 42% 58% / 55% 45% 55% 45%;
}
.blob-ico svg { width: 20px; height: 20px; }
.tone-sage { background: var(--sage-soft); }
.tone-peach { background: var(--peach-soft); }
.tone-yellow { background: var(--yellow-soft); }
.tone-blue { background: var(--blue-soft); }
.tone-lilac { background: var(--lilac-soft); }
.tone-cream { background: var(--cream-2); }
.card-foot { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--cream-2); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .r { text-align: right; flex: none; }
.list a.row-link { color: inherit; display: contents; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 10px;
  color: var(--ink-3); font-size: 14px;
}
.empty .empty-art { width: 64px; height: 44px; }
.empty b { color: var(--ink-2); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 14px 16px; border-radius: 16px; background: var(--paper); border: 1px solid var(--cream-2); }
.kpi .k { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .h { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--ivory); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--cream-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #F7F2E9; }
.table td.num, .table th.num { text-align: right; }
.table .strong { font-weight: 800; }
.table a.rowlink { font-weight: 800; color: var(--ink); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search input { padding-left: 38px; }
.toolbar .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a { padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--ink-2); background: transparent; border: 1px solid var(--line); }
.tabs a:hover { text-decoration: none; background: var(--ivory); }
.tabs a.active { background: var(--olive); border-color: var(--olive); color: var(--cream); }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 14px; font-size: 14px; color: var(--ink-3); }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 18px; }
.field { grid-column: span 3; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.third { grid-column: span 2; }
.field label { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.field .req { color: var(--terracotta); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 13px; color: var(--terracotta); font-weight: 700; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--ivory); padding: 10px 14px;
  font: inherit; color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
input[readonly], .readonly { background: var(--cream-2); color: var(--ink-2); }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--terracotta); }
.money-input { position: relative; }
.money-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; }
.money-input input { padding-left: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.select-pill { height: 42px; border-radius: 999px; padding: 0 38px 0 16px; font-weight: 800; background: var(--ivory); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235E574C' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; min-height: 42px; border: 1px solid var(--line-2); }

dl.facts { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); gap: 10px 16px; margin: 0; }
dl.facts dt { color: var(--ink-3); font-weight: 700; font-size: 13.5px; }
dl.facts dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--ink-3); font-size: 12px; }
.change { font-size: 12.5px; color: var(--ink-2); }
.change del { color: var(--terracotta); text-decoration: line-through; }
.change ins { color: var(--ok-ink); text-decoration: none; font-weight: 700; }

/* Occupancy dots */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--cream-2); border: 1px solid var(--line-2); }
.dots i.on { background: var(--sage); border-color: var(--olive-2); }

/* ---------------------------------------------------------------------
   Dashboard
   --------------------------------------------------------------------- */
.dash-hero {
  position: relative; z-index: 5; border-radius: 28px; padding: 26px 28px; margin: 6px 0 20px;
  background: var(--sage-soft); display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: end;
}
.hero-bg { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.hero-bg::before, .hero-bg::after { content: ""; position: absolute; pointer-events: none; }
.hero-bg::before { width: 220px; height: 170px; right: -40px; top: -60px; background: var(--yellow-soft);
  border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%; opacity: .9; }
.hero-bg::after { width: 160px; height: 120px; left: -50px; bottom: -60px; background: var(--sage-2);
  border-radius: 45% 55% 40% 60% / 55% 45% 55% 45%; }
.dash-hero > *:not(.hero-bg) { position: relative; z-index: 1; }
.rule-value { font-size: 24px; font-weight: 900; overflow-wrap: anywhere; }
.rule-value.long { font-size: 17px; line-height: 1.4; }
.dash-hero .greet { font-size: 26px; color: var(--olive-2); line-height: 1; }
.dash-hero h1 { font-size: 34px; margin-top: 4px; }
.dash-hero .gsearch { max-width: none; margin-top: 16px; }
.dash-hero .gsearch input { height: 52px; font-size: 16px; box-shadow: var(--shadow); }
.month-box label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--olive-2); margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 14px 12px; border-radius: 18px; color: var(--ink);
  border: 1px solid transparent; transition: transform .12s ease, box-shadow .12s ease; min-width: 0;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tile .n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { font-size: 12.5px; font-weight: 800; color: var(--ink-2); line-height: 1.25; }
.tile.zero { opacity: .72; }
.tile.alert .n { color: var(--terracotta); }

.fin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.meter { height: 10px; border-radius: 999px; background: var(--cream-2); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--sage); border-radius: 999px; }
.fin-note { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; }

/* ---------------------------------------------------------------------
   Map (HOME)
   --------------------------------------------------------------------- */
.map-page { min-height: 100vh; display: flex; flex-direction: column; }
.map-top { display: flex; align-items: center; gap: 16px; padding: 14px 24px; }
.map-top .gsearch { max-width: 460px; }
.map-stage { position: relative; flex: 1; padding: 0 24px 24px; }
.map-frame {
  position: relative; border-radius: 30px; overflow: hidden; background: #EFE8DC; border: 1px solid var(--line);
  box-shadow: var(--shadow); aspect-ratio: 1200 / 760; max-height: calc(100vh - 110px); margin: 0 auto;
}
.map-frame svg.village { display: block; width: 100%; height: 100%; }
.map-title {
  position: absolute; left: 26px; top: 22px; z-index: 2; background: color-mix(in srgb, var(--ivory) 90%, transparent);
  border-radius: 22px; padding: 14px 20px 14px; box-shadow: var(--shadow); max-width: 330px; border: 1px solid var(--line);
}
.map-title .accent { font-size: 30px; color: var(--olive); line-height: 1; display: block; }
.map-title p { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.map-cta { position: absolute; right: 24px; bottom: 22px; z-index: 2; display: flex; gap: 10px; }

.zone { cursor: pointer; outline: none; }
.zone .zone-art { transition: transform .22s cubic-bezier(.2,.8,.2,1); transform-box: fill-box; transform-origin: 50% 100%; }
.zone .zone-hit { fill: transparent; }
.zone .zone-glow { fill: #F3ECDD; opacity: 0; transition: opacity .2s ease; }
.zone .tag rect { fill: #FAF7F2; stroke: #D7C9B8; stroke-width: 1; transition: fill .2s ease, stroke .2s ease; }
.zone .tag text { font-family: var(--font); fill: var(--ink); }
.zone .tag .tag-name { font-size: 15px; font-weight: 900; letter-spacing: .14em; }
.zone .tag .tag-stat { font-size: 11.5px; font-weight: 700; fill: var(--ink-3); }
.zone:hover .zone-art, .zone:focus .zone-art { transform: translateY(-5px) scale(1.02); }
.zone:hover .zone-glow, .zone:focus .zone-glow { opacity: .75; }
.zone:hover .tag rect, .zone:focus .tag rect { fill: var(--olive); stroke: var(--olive); }
.zone:hover .tag text, .zone:focus .tag text { fill: var(--cream); }
.zone:focus-visible .tag rect { stroke: var(--yellow); stroke-width: 3; }
.zone.disabled { cursor: default; opacity: .55; }
.map-areas { display: none; }

@media (prefers-reduced-motion: reduce) {
  .zone .zone-art, .tile, .btn { transition: none; }
}

/* ---------------------------------------------------------------------
   Auth
   --------------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: var(--sage-soft); display: flex; align-items: flex-end; padding: 48px; }
.auth-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .quote { position: relative; z-index: 1; max-width: 420px; }
.auth-art .quote .accent { font-size: 46px; color: var(--olive); line-height: 1.05; }
.auth-art .quote p { color: var(--olive-ink); font-weight: 600; margin-top: 12px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 30px; margin: 18px 0 6px; }
.auth-card p.lead { color: var(--ink-2); margin-bottom: 26px; }
.auth-card .field { grid-column: auto; margin-bottom: 14px; }
.auth-card .btn { width: 100%; height: 48px; margin-top: 8px; }

/* ---------------------------------------------------------------------
   Error page
   --------------------------------------------------------------------- */
.error-box { max-width: 520px; margin: 10vh auto; text-align: center; }
.error-box .code { font-family: var(--accent-font); font-size: 72px; color: var(--sage); line-height: 1; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; --sidebar-w: 280px; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lift);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(74, 52, 42, .32); z-index: 45; }
  .shell.collapsed .brand-text, .shell.collapsed .nav-text, .shell.collapsed .nav-label { display: initial; }
  .shell.collapsed .nav a { justify-content: flex-start; padding: 9px 12px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .content { padding: 4px 16px 40px; }
  .user-meta { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .dash-hero { grid-template-columns: 1fr; padding: 22px 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .map-frame { aspect-ratio: auto; max-height: none; }
  .map-frame svg.village { height: auto; }
  .map-title { position: static; max-width: none; margin: 0 0 12px; box-shadow: none; }
  .map-cta { position: static; margin-top: 12px; justify-content: flex-end; }
  .map-areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
  .map-areas a { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; background: var(--ivory); border: 1px solid var(--line); color: var(--ink); font-weight: 800; }
  .map-areas a span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
  .map-stage { padding: 0 16px 20px; }
  .map-top { padding: 12px 16px; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .dash-hero h1 { font-size: 28px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field, .field.third { grid-column: 1 / -1; }
  dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
  dl.facts dd { margin-bottom: 10px; }
  .gsearch kbd { display: none; }
  /* Tables become cards on phones: readable, never shrunk */
  table.table.stack thead { display: none; }
  table.table.stack, table.table.stack tbody, table.table.stack tr, table.table.stack td { display: block; width: 100%; }
  table.table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  table.table.stack td::before { content: attr(data-label); font-size: 12px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; text-align: left; }
  table.table.stack td.num { text-align: right; }
  .map-areas { grid-template-columns: 1fr; }
  .flashes { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}
@media print {
  .sidebar, .topbar, .flashes, .page-actions { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* ---- fixes after visual review ---- */
.brand-text { display: flex; flex-direction: column; }
.gsearch input[type=search] { padding: 0 44px 0 44px; border-radius: 999px; min-height: 44px; }
.dash-hero .gsearch input[type=search] { min-height: 52px; }
.toolbar .search input[type=search] { padding-left: 40px; }
.card-foot a { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; }
.card-foot svg, .list svg.ico { width: 16px; height: 16px; }
@media (max-width: 640px) { .topbar .gsearch input::placeholder { color: transparent; } }
@media (max-width: 640px) {
  .map-top { gap: 8px; flex-wrap: wrap; }
  .map-top .brand-text, .map-top .btn span { display: none; }
  .map-top .btn { width: 42px; padding: 0; }
  .map-top .gsearch { order: 5; flex-basis: 100%; max-width: none; }
  .map-title .accent { font-size: 24px; }
}

.toolbar select.select-pill { width: auto; min-width: 180px; }
.mini-meter { display: inline-block; vertical-align: middle; width: 120px; height: 8px; border-radius: 999px; background: var(--cream-2); overflow: hidden; }
.mini-meter > span { display: block; height: 100%; background: var(--sage); }

/* ---- Rental (Phase 2) -------------------------------------------------- */
.sub { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--terracotta); }
.big { font-size: 22px; }
.tight { margin: 6px 0 0; padding-left: 18px; }
.case-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.kpi-link { color: inherit; transition: border-color .15s, transform .15s; }
.kpi-link:hover { text-decoration: none; border-color: var(--sage); transform: translateY(-1px); }
.kpi-link.on { border-color: var(--olive); box-shadow: inset 0 0 0 1px var(--olive); }
.kpi-link.warn { background: var(--peach-soft); border-color: #E4C9BB; }
.stepper { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--cream-2); font-weight: 700; font-size: 14px; color: var(--ink-3); }
.stepper li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--cream-2); font-size: 12px; font-weight: 800; }
.stepper li.done { color: var(--ok-ink); } .stepper li.done span { background: var(--ok); color: var(--cream); }
.stepper li.now { color: var(--ink); border-color: var(--olive); } .stepper li.now span { background: var(--olive); color: var(--cream); }
.seg { border: 0; padding: 4px; margin: 0 0 6px; display: inline-flex; gap: 4px; background: var(--ivory); border-radius: 999px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 8px 18px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.seg label:has(input:checked) { background: var(--olive); color: var(--cream); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--olive); outline-offset: 2px; }
.form-section { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 26px 0 12px; font-weight: 800; }
.form-section .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
.form-card .field { margin-bottom: 2px; }
.stack-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack-col .card .field { margin-bottom: 12px; }
.checks { flex-direction: row; flex-wrap: wrap; gap: 10px 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--olive); }
.table-wrap.flat { box-shadow: none; border: 1px solid var(--cream-2); }
.table tr.changed td { background: var(--yellow-soft, #FBF3D9); }
.list.compact li { padding: 8px 0; justify-content: space-between; }
.list.compact li > div:first-child { min-width: 0; }
.list.compact .num { flex: none; text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-weight: 700; }
.list.compact .grow .sub { overflow-wrap: anywhere; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
.card.slim { padding: 12px 16px; margin-bottom: 18px; gap: 12px; }
.toolbar-card .fin-note { margin-top: 4px; }
.settle-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.settle-bar > div { background: var(--paper); border: 1px solid var(--cream-2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.settle-bar span { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.settle-bar b { font-size: 20px; font-variant-numeric: tabular-nums; }
.settle-bar .hl { background: var(--sage-soft); border-color: transparent; }
.settle-bar .bad { background: var(--peach-soft); color: #7A3E2C; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::before { content: "+ "; color: var(--ink-3); }
details.card[open] summary::before { content: "− "; }
.settle td { vertical-align: top; }
@media (max-width: 720px) {
  .settle-bar { grid-template-columns: 1fr; }
  .stepper li { flex: 1 1 45%; }
  .page-actions form { display: contents; }
}
@media print {
  .sidebar, .topbar, .page-head, .tabs, .flashes { display: none !important; }
  .main, .content { padding: 0 !important; margin: 0 !important; }
}
.num .sub, dd.num .sub { white-space: normal; }

input[type=file] { font: inherit; font-size: 14px; padding: 8px 0; }
.card.slim.toolbar { display: flex; align-items: center; flex-wrap: wrap; }
.card.slim.toolbar input[type=date] { width: auto; }
.contents { display: contents; } .contents[hidden] { display: none; }
[hidden] { display: none !important; }
.settle td, .settle th { white-space: nowrap; }
.owner-charge { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.doc-frame { overflow-x: auto; } .doc-frame .bk { box-shadow: 0 2px 10px rgba(60,60,30,.08); }
.exp-grid .money-input { max-width: 170px; margin-left: auto; }
.exp-grid tr.prefilled td { background: var(--yellow-soft); }
.exp-grid tr.locked td { opacity: .75; }
.exp-grid select { min-width: 110px; }
.check.small { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
@media (max-width: 720px) { .exp-grid .money-input { max-width: none; margin-left: 0; } }
.inline-form { display: inline-flex; gap: 6px; align-items: center; } .inline-form input { width: 130px; }
.clues { margin-top: 14px; display: grid; gap: 12px; } .compact-facts { grid-template-columns: minmax(120px, 22%) minmax(0,1fr); } tr.muted-row td { opacity: .55; }
.recon td { padding: 9px 4px; border-bottom: 1px solid var(--cream-2); }
.recon td .sub { display: block; }
.recon tr.sum td { font-weight: 800; border-bottom: 1.5px solid var(--line); }
.recon tr.big-row td { font-size: 18px; background: var(--peach-soft); }
.checks-list { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; font-weight: 700; }
.checks-list li.ok { color: var(--ok-ink); } .checks-list li.bad { color: var(--terracotta); }

/* Historical tenancies (Migration Review) */
.hist-group { display: grid; gap: 14px; }
.hist-gap { border-top: 1px dashed var(--line-2); padding-top: 14px; display: grid; gap: 8px; min-width: 0; }
.hist-gap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hist-gap-head .muted { font-size: 12.5px; }
.table.small td, .table.small th { font-size: 12.5px; padding-top: 7px; padding-bottom: 7px; }
tr.strong-row td { background: var(--yellow-soft); font-weight: 700; }
.hist-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.hist-form summary { cursor: pointer; font-weight: 800; color: var(--olive-ink); }
.hist-form form { margin-top: 12px; }
.check-list { display: grid; gap: 4px; font-size: 13px; }
.check-list label { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.stmt-review { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stmt-review input[type=text] { flex: 1; min-width: 240px; }
.hist-gap-head .muted { overflow-wrap: anywhere; min-width: 0; }
.hist-group .card-head { flex-wrap: wrap; }
.hist-group .card-head > div { min-width: 200px; }
.hist-group, .hist-gap > * { min-width: 0; }

/* Maintenance Records */
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-pair figure { margin: 0; }
.photo-pair img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.photo-pair .photo-none { aspect-ratio: 4/3; border-radius: var(--radius-sm); border: 1px dashed var(--line-2); display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.photo-pair figcaption { font-size: 12px; font-weight: 800; color: var(--ink-3); margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; }

.readiness { margin-bottom: 18px; }
.readiness td { vertical-align: top; }
.num.rule-value.long, .rule-value.long { white-space: normal; overflow-wrap: anywhere; }

/* ---- login, small screens only (art panel hidden <=960px): compact wordmark + short subtitle. Desktop unchanged. ---- */
.auth-brand { display: contents; }
.auth-wordmark, .auth-card .lead-short { display: none; }
@media (max-width: 960px) {
  .auth-brand { display: flex; align-items: center; gap: 10px; }
  .auth-wordmark { display: flex; }
  .auth-wordmark .brand-sub { letter-spacing: .05em; white-space: nowrap; }
  .auth-card .lead-wide { display: none; }
  .auth-card .lead-short { display: inline; }
}

/* Document Center tiles on phones: a little less side padding so "Owner Statements" (soft-hyphenated) is fully readable */
@media (max-width: 640px) { .doc-tiles .tile { padding-left: 10px; padding-right: 10px; } }

/* "+ New tenant" dialog */
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--color-cocoa); text-decoration: underline; cursor: pointer; }
dialog.modal { border: 0; background: var(--ivory); color: var(--ink); border-radius: 16px; padding: 22px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(20,20,30,.45); }
dialog.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
dialog.modal .field.full { grid-column: 1 / -1; }
