/* app.css — Rentr app shell and components (lab rebuild: every page works, demo data only).
   Uses the design tokens in style.css. */

html, body { height: 100%; overflow: hidden; margin: 0; }
body { background: var(--color-bg); }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Shell ---------- */
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - var(--lab-bar-h, 0px));
  background: var(--color-bg);
}
.sidebar {
  grid-row: 1 / -1; grid-column: 1;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  overflow-y: auto; overscroll-behavior: contain; z-index: 30;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5); border-bottom: 1px solid var(--color-divider); }
.logo { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; color: var(--color-text); text-decoration: none; }
.logo-icon { color: var(--color-primary); flex-shrink: 0; }
.logo-text { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.icon-btn.sidebar-close { display: none; }
.sidebar-nav { flex: 1; padding: var(--space-3); }
.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-label { padding: var(--space-4) var(--space-3) var(--space-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 44px; padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted); text-decoration: none;
  font-size: .9375rem; font-weight: 500;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--color-surface-offset); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-highlight); color: var(--color-primary); font-weight: 600; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: var(--radius-full); background: var(--color-surface-offset); color: var(--color-text-muted); font-size: 11px; font-weight: 700; text-align: center; }
.nav-item.active .nav-count { background: var(--color-surface); color: var(--color-primary); }
.sidebar-footer { padding: var(--space-4); border-top: 1px solid var(--color-divider); }
.sidebar-user { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 48px; padding: var(--space-1); border-radius: var(--radius-md); text-align: left; text-decoration: none; }
.sidebar-user:hover { background: var(--color-surface-offset); }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: .875rem; font-weight: 600; color: var(--color-text); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .75rem; color: var(--color-text-muted); line-height: 1.3; }

.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--color-primary); color: var(--color-text-inverse);
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .02em;
}
.avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar[data-tone="1"] { background: #2f6f73; } .avatar[data-tone="2"] { background: #7a4b8c; }
.avatar[data-tone="3"] { background: #a2582d; } .avatar[data-tone="4"] { background: #3d6b3a; }
.avatar[data-tone="5"] { background: #8a3b4f; }
[data-theme="dark"] .avatar { color: #f8f9fc; }

/* Topbar */
.topbar {
  grid-column: 2; grid-row: 1;
  display: flex; align-items: center; gap: var(--space-4);
  min-height: 64px; padding: var(--space-3) var(--space-6);
  background: var(--color-surface); border-bottom: 1px solid var(--color-divider);
  position: relative; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.icon-btn.hamburger, .mobile-logo { display: none; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-md);
  color: var(--color-text-muted); cursor: pointer;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.icon-btn[aria-expanded="true"] { background: var(--color-surface-offset); color: var(--color-text); }
.notif-badge {
  position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full); background: var(--color-error); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--color-surface);
}
.avatar-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-full); cursor: pointer; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--color-primary-highlight); }

/* Global search */
.search { position: relative; width: 100%; max-width: 440px; }
.search-box {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-3);
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.search-box:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 18%, transparent); }
.search-box svg { color: var(--color-text-faint); flex-shrink: 0; }
.search-box input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: .9375rem; color: var(--color-text); min-height: 40px; }
.search-box input::placeholder { color: var(--color-text-faint); }
.kbd { padding: 2px 6px; border: 1px solid var(--color-border); border-radius: 4px; font-size: 11px; color: var(--color-text-faint); }

/* Popovers (search results, notifications, user menu) */
.popover {
  position: absolute; top: calc(100% + 8px); z-index: 60;
  min-width: 300px; max-width: min(92vw, 400px);
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
.popover[hidden] { display: none; }
.popover.right { right: 0; }
.search .popover { left: 0; right: 0; max-width: none; }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); }
.popover-head strong { font-family: var(--font-display); font-size: .9375rem; }
.popover-list { max-height: min(60vh, 420px); overflow-y: auto; }
.popover-group { padding: var(--space-2) var(--space-4) var(--space-1); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-faint); }
.popover-item {
  display: flex; align-items: flex-start; gap: var(--space-3); width: 100%;
  min-height: 48px; padding: var(--space-3) var(--space-4); text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--color-divider);
}
.popover-item:last-child { border-bottom: 0; }
.popover-item:hover, .popover-item.is-active { background: var(--color-surface-offset); }
.popover-item .pi-title { font-size: .875rem; font-weight: 600; color: var(--color-text); line-height: 1.35; }
.popover-item .pi-sub { font-size: .8125rem; color: var(--color-text-muted); line-height: 1.4; }
.popover-item.unread .pi-title::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--color-primary); vertical-align: middle; }
.popover-empty { padding: var(--space-6) var(--space-4); text-align: center; color: var(--color-text-muted); font-size: .875rem; }
.dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; flex-shrink: 0; background: var(--color-text-faint); }
.dot.error { background: var(--color-error); } .dot.warning { background: var(--color-warning); }
.dot.success { background: var(--color-success); } .dot.primary { background: var(--color-primary); } .dot.blue { background: var(--color-blue); }
.menu-item { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 44px; padding: 0 var(--space-4); text-align: left; font-size: .875rem; cursor: pointer; text-decoration: none; color: var(--color-text); }
.menu-item:hover { background: var(--color-surface-offset); }
.menu-sep { height: 1px; background: var(--color-divider); }

/* ---------- Main ---------- */
.main { grid-column: 2; grid-row: 2; overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.main-inner { width: 100%; max-width: 1640px; margin: 0 auto; padding: var(--space-8) clamp(var(--space-4), 3vw, var(--space-10)) var(--space-12); }
.view { animation: fade-up 240ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-title { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem); font-weight: 800; letter-spacing: -0.025em; color: var(--color-text); line-height: 1.15; margin: 0 0 var(--space-1); }
.page-subtitle { margin: 0; font-size: .9375rem; color: var(--color-text-muted); max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.crumbs { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; margin-bottom: var(--space-2); font-size: .8125rem; font-weight: 600; color: var(--color-text-muted); text-decoration: none; }
.crumbs:hover { color: var(--color-primary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font-size: .875rem; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background var(--transition-interactive), border-color var(--transition-interactive), color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.btn:hover { background: var(--color-surface-offset); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-danger { color: var(--color-error); }
.btn-danger:hover { background: var(--color-error-highlight); border-color: var(--color-error); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: .8125rem; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { min-height: 36px; display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 600; color: var(--color-primary); text-decoration: none; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Toolbar: filters, search, segmented controls */
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar .grow { flex: 1; }
.field-search { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; min-width: 220px; flex: 1 1 260px; max-width: 380px; padding: 0 var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.field-search:focus-within { border-color: var(--color-primary); }
.field-search svg { color: var(--color-text-faint); flex-shrink: 0; }
.field-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; min-height: 40px; font-size: .875rem; color: var(--color-text); }
.select, .input, .textarea {
  min-height: 44px; padding: 0 var(--space-3);
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font: inherit; font-size: .875rem;
}
.select { padding-right: var(--space-8); appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { min-height: 96px; padding: var(--space-3); resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 16%, transparent); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--color-surface-offset); border-radius: var(--radius-md); flex-wrap: wrap; }
.segmented button { min-height: 38px; padding: 0 var(--space-3); border-radius: calc(var(--radius-md) - 2px); font-size: .8125rem; font-weight: 600; color: var(--color-text-muted); cursor: pointer; white-space: nowrap; }
.segmented button:hover { color: var(--color-text); }
.segmented button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.segmented .count { margin-left: 4px; color: var(--color-text-faint); font-weight: 600; }
.result-count { font-size: .8125rem; color: var(--color-text-muted); }

/* Cards */
.card { background: var(--color-surface); border: 1px solid color-mix(in oklab, var(--color-text) 9%, transparent); border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--color-text); margin: 0; }
.card-sub { font-size: .8125rem; color: var(--color-text-faint); white-space: nowrap; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { padding: var(--space-5) var(--space-5) 0; }

/* Dashboard grid */
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-5); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* KPIs */
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin-bottom: var(--space-5); }
.kpi-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); background: var(--color-surface); border: 1px solid color-mix(in oklab, var(--color-text) 9%, transparent); border-radius: var(--radius-lg); text-decoration: none; transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive); }
a.kpi-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.kpi-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--radius-md); flex-shrink: 0; }
.kpi-icon.primary { background: var(--color-primary-highlight); color: var(--color-primary); }
.kpi-icon.blue { background: var(--color-blue-highlight); color: var(--color-blue); }
.kpi-icon.success { background: var(--color-success-highlight); color: var(--color-success); }
.kpi-icon.warning { background: var(--color-warning-highlight); color: var(--color-warning); }
.kpi-label { font-size: .8125rem; color: var(--color-text-muted); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 1.625rem; font-weight: 800; color: var(--color-text); line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: .8125rem; font-weight: 600; color: var(--color-text-muted); }
.kpi-note.up { color: var(--color-success); } .kpi-note.warn { color: var(--color-warning); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; background: var(--color-surface-offset); color: var(--color-text-muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.success { background: var(--color-success-highlight); color: var(--color-success); }
.badge.warning { background: var(--color-warning-highlight); color: var(--color-warning); }
.badge.error { background: var(--color-error-highlight); color: var(--color-error); }
.badge.primary { background: var(--color-primary-highlight); color: var(--color-primary); }
.badge.blue { background: var(--color-blue-highlight); color: var(--color-blue); }

/* Progress */
.progress { height: 8px; background: var(--color-surface-offset); border-radius: var(--radius-full); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--color-success); transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1); }
.progress.primary > span { background: var(--color-primary); }
.progress.warning > span { background: var(--color-warning); }
.progress.error > span { background: var(--color-error); }

/* Rent collection */
.big-stat { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.big-stat strong { font-family: var(--font-display); font-size: 2.5rem; font-weight: 800; color: var(--color-success); letter-spacing: -0.03em; line-height: 1; }
.big-stat span { font-size: 1rem; color: var(--color-text-muted); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-top: var(--space-4); }
.legend-item { display: inline-flex; align-items: center; gap: var(--space-2); font-size: .8125rem; color: var(--color-text-muted); }
.legend-item b { color: var(--color-text); font-weight: 700; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* Bar chart with axes */
.chart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; column-gap: var(--space-3); height: 240px; }
.chart-y { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--color-text-faint); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(-6px); }
.chart-plot { grid-row: 1; position: relative; display: flex; align-items: flex-end; gap: clamp(8px, 2vw, 24px); padding: 0 var(--space-2); border-bottom: 1px solid var(--color-border); background-image: linear-gradient(to bottom, var(--color-divider) 1px, transparent 1px); background-size: 100% 25%; }
.chart-bar { position: relative; flex: 1; min-width: 0; height: var(--h); max-width: 72px; margin: 0 auto; border-radius: 6px 6px 0 0; background: color-mix(in oklab, var(--color-primary) 32%, var(--color-surface)); transition: height 700ms cubic-bezier(0.16, 1, 0.3, 1), background var(--transition-interactive); cursor: pointer; }
.chart-bar.current { background: var(--color-primary); }
.chart-bar:hover, .chart-bar:focus-visible { background: var(--color-primary-hover); }
.chart-bar .val { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--color-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-x { grid-column: 2; display: flex; gap: clamp(8px, 2vw, 24px); padding: var(--space-2) var(--space-2) 0; }
.chart-x span { flex: 1; max-width: 72px; margin: 0 auto; text-align: center; font-size: 12px; color: var(--color-text-muted); font-weight: 500; }
.chart-caption { margin-top: var(--space-3); font-size: .75rem; color: var(--color-text-faint); }
.card-fill { display: flex; flex-direction: column; }
.card-fill .chart { flex: 1; height: auto; min-height: 240px; }

/* Horizontal bars */
.hbars { display: flex; flex-direction: column; gap: var(--space-4); }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 52px; align-items: center; gap: var(--space-3); text-decoration: none; min-height: 36px; border-radius: var(--radius-sm); }
.hbar-row:hover .hbar-name { color: var(--color-primary); }
.hbar-name { font-size: .875rem; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-val { font-size: .8125rem; font-weight: 700; color: var(--color-text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 56px; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-divider); text-align: left; cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover .lr-title { color: var(--color-primary); }
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-size: .9375rem; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--transition-interactive); }
.lr-sub { font-size: .8125rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-meta { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; font-size: .8125rem; color: var(--color-text-faint); font-variant-numeric: tabular-nums; }

/* Tables (become cards on phones) */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { position: sticky; top: 0; z-index: 1; padding: var(--space-3) var(--space-4); text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-faint); background: var(--color-surface-2); border-bottom: 1px solid var(--color-divider); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--color-text); }
.table th .arrow { margin-left: 4px; opacity: .35; }
.table th[aria-sort="ascending"] .arrow, .table th[aria-sort="descending"] .arrow { opacity: 1; color: var(--color-primary); }
.table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); vertical-align: middle; color: var(--color-text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background var(--transition-interactive); }
.table tbody tr.clickable:hover { background: var(--color-surface-2); }
.table .muted { color: var(--color-text-muted); }
.table .num { font-variant-numeric: tabular-nums; }
.cell-person { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.cell-person strong { display: block; font-weight: 600; white-space: nowrap; }
.cell-person small { display: block; color: var(--color-text-muted); font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
.empty { padding: var(--space-10) var(--space-4); text-align: center; color: var(--color-text-muted); }
.empty strong { display: block; font-family: var(--font-display); font-size: 1rem; color: var(--color-text); margin-bottom: var(--space-1); }

/* Property cards */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-5); }
.prop-card { display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid color-mix(in oklab, var(--color-text) 9%, transparent); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; transition: box-shadow var(--transition-interactive), transform var(--transition-interactive), border-color var(--transition-interactive); }
.prop-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: color-mix(in oklab, var(--color-primary) 40%, transparent); }
.prop-art { position: relative; height: 112px; background: var(--art, var(--color-primary)); overflow: hidden; }
.prop-art svg { position: absolute; inset: auto 0 0 0; width: 100%; height: 86px; color: rgba(255,255,255,.22); }
.prop-art .badge { position: absolute; top: var(--space-3); left: var(--space-3); background: rgba(255,255,255,.92); color: #1a1f2e; }
.prop-body { padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.prop-name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; color: var(--color-text); margin: 0; }
.prop-addr { font-size: .8125rem; color: var(--color-text-muted); margin: 2px 0 0; }
.prop-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--color-divider); }
.prop-stats div { display: flex; flex-direction: column; }
.prop-stats b { font-family: var(--font-display); font-size: 1.125rem; color: var(--color-text); }
.prop-stats span { font-size: .75rem; color: var(--color-text-muted); }
.occ-line { display: flex; align-items: center; gap: var(--space-3); font-size: .8125rem; color: var(--color-text-muted); }
.occ-line .progress { flex: 1; }

/* Stat row on detail pages */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.mini-stat { padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid color-mix(in oklab, var(--color-text) 9%, transparent); border-radius: var(--radius-lg); }
.mini-stat span { display: block; font-size: .8125rem; color: var(--color-text-muted); }
.mini-stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--color-text); letter-spacing: -0.02em; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-2); }
.board-col { background: var(--color-surface-offset); border-radius: var(--radius-lg); padding: var(--space-3); min-height: 200px; }
.board-col h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 var(--space-3); padding: 0 var(--space-1); font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); }
.board-card { display: block; width: 100%; margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid color-mix(in oklab, var(--color-text) 8%, transparent); border-radius: var(--radius-md); text-align: left; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition-interactive), transform var(--transition-interactive); }
.board-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.board-card .bc-title { font-size: .875rem; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.board-card .bc-sub { font-size: .75rem; color: var(--color-text-muted); margin-bottom: var(--space-3); }
.board-card .bc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: .75rem; color: var(--color-text-faint); }

/* Payment history chips */
.months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); }
.month { padding: var(--space-2); border-radius: var(--radius-md); text-align: center; font-size: .75rem; font-weight: 600; background: var(--color-surface-offset); color: var(--color-text-muted); }
.month b { display: block; font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .8; }
.month.ontime { background: var(--color-success-highlight); color: var(--color-success); }
.month.late { background: var(--color-warning-highlight); color: var(--color-warning); }
.month.overdue { background: var(--color-error-highlight); color: var(--color-error); }
.month.pending { background: var(--color-blue-highlight); color: var(--color-blue); }

/* Drawer + modal */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(10, 14, 22, .45); animation: fade-in 160ms ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  display: flex; flex-direction: column; width: min(520px, 100vw);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
  animation: slide-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal {
  position: fixed; top: 50%; left: 50%; z-index: 71;
  display: flex; flex-direction: column; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%); animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-divider); }
.panel-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--color-text); }
.panel-head p { margin: 4px 0 0; font-size: .875rem; color: var(--color-text-muted); }
.panel-body { flex: 1; overflow-y: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); }
.panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-divider); background: var(--color-surface-2); }
.panel-foot .left { margin-right: auto; }
.section-title { margin: 0 0 var(--space-3); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: var(--space-2) var(--space-4); margin: 0; font-size: .875rem; }
.dl dt { color: var(--color-text-muted); }
.dl dd { margin: 0; color: var(--color-text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.form-field label, .label { font-size: .8125rem; font-weight: 600; color: var(--color-text); }
.form-field .hint { font-size: .75rem; color: var(--color-text-muted); }
.form-field .input, .form-field .select, .form-field .textarea { width: 100%; }
.form-error { grid-column: 1 / -1; font-size: .8125rem; color: var(--color-error); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.timeline li { position: relative; padding-left: var(--space-6); font-size: .875rem; color: var(--color-text); }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-highlight); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: calc(-1 * var(--space-4)); width: 1px; background: var(--color-divider); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--color-text-muted); font-size: .75rem; margin-top: 2px; }
.note-demo { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-blue-highlight); color: var(--color-text); font-size: .8125rem; line-height: 1.5; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); align-items: start; }
.settings-grid .card p.desc { margin: -8px 0 var(--space-4); font-size: .875rem; color: var(--color-text-muted); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 56px; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-divider); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row strong { display: block; font-size: .875rem; font-weight: 600; color: var(--color-text); }
.toggle-row small { display: block; font-size: .8125rem; color: var(--color-text-muted); }
.switch { position: relative; flex-shrink: 0; width: 48px; height: 28px; border-radius: var(--radius-full); background: var(--color-surface-dynamic); cursor: pointer; transition: background var(--transition-interactive); }
.switch::before { content: ""; position: absolute; inset: -8px -4px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--transition-interactive); }
.switch[aria-checked="true"] { background: var(--color-primary); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.choice { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 2px solid var(--color-divider); border-radius: var(--radius-md); cursor: pointer; text-align: left; font-size: .875rem; font-weight: 600; }
.choice[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-highlight); }
.choice .swatch { height: 44px; border-radius: 6px; border: 1px solid var(--color-divider); }

/* Toasts */
.toasts { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 90; display: flex; flex-direction: column; gap: var(--space-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-text); color: var(--color-bg); box-shadow: var(--shadow-lg); font-size: .875rem; line-height: 1.45; animation: toast-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.toast svg { flex-shrink: 0; margin-top: 2px; }
.toast.out { animation: toast-out 200ms ease both; }

/* Sidebar overlay (phones) */
.sidebar-overlay { position: fixed; inset: var(--lab-bar-h, 0px) 0 0 0; z-index: 25; background: rgba(10,14,22,.45); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
.search-toggle { display: none !important; }
@media (max-width: 1280px) {
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
  .span-6 { grid-column: span 6; }
}
@media (max-width: 1100px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .span-3, .span-4, .span-5, .span-6 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: var(--lab-bar-h, 0px); left: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .icon-btn.sidebar-close { display: inline-flex; }
  .topbar { grid-column: 1; padding: var(--space-2) var(--space-3); gap: var(--space-2); }
  .main { grid-column: 1; }
  .icon-btn.hamburger { display: inline-flex; }
  .mobile-logo { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; text-decoration: none; color: var(--color-text); }
  .mobile-logo .logo-text { font-size: 1.0625rem; }
  .search { display: none; }
  .search.mobile-open { display: block; position: absolute; left: var(--space-3); right: var(--space-3); top: calc(100% + 6px); max-width: none; z-index: 61; }
  .search.mobile-open .search-box { background: var(--color-surface); box-shadow: var(--shadow-lg); }
  .search-toggle { display: inline-flex !important; }
  .kbd { display: none; }
}
@media (max-width: 720px) {
  .main-inner { padding: var(--space-5) var(--space-4) var(--space-10); }
  .kpi-strip { gap: var(--space-3); }
  .kpi-card { padding: var(--space-4); gap: var(--space-3); }
  .kpi-icon { width: 40px; height: 40px; }
  .kpi-value { font-size: 1.375rem; }
  .grid-12 { gap: var(--space-4); }
  .page-header { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .field-search { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 140px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: 120px 1fr; }
  .choice-row { grid-template-columns: minmax(0, 1fr); }
  .panel-head, .panel-body, .panel-foot { padding-left: var(--space-4); padding-right: var(--space-4); }
  .chart { height: 200px; }
  .board { grid-template-columns: repeat(4, minmax(240px, 82vw)); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  /* Tables become cards */
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface); }
  .table.cards td { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border: 0; text-align: right; }
  .table.cards td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; color: var(--color-text-muted); text-align: left; flex-shrink: 0; }
  .table.cards td.primary-cell { justify-content: flex-start; text-align: left; padding-bottom: var(--space-3); margin-bottom: var(--space-1); border-bottom: 1px solid var(--color-divider); }
  .table.cards td.primary-cell::before { display: none; }
  .table.cards td:empty { display: none; }
  .card-flush .table.cards { padding: var(--space-3); }
  .table.cards tbody tr:last-child td { border-bottom: 0; }
  .table.cards tbody tr:last-child td.primary-cell { border-bottom: 1px solid var(--color-divider); }
  .row-actions { justify-content: flex-end; flex-wrap: wrap; }
  .toasts { left: var(--space-4); right: var(--space-4); top: calc(var(--lab-bar-h, 0px) + 72px); bottom: auto; }
}
@media (max-width: 480px) {
  .months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .kpi-strip { grid-template-columns: minmax(0, 1fr); }
  .hbar-row { grid-template-columns: minmax(90px, 120px) 1fr 44px; }
  .prop-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar-right { gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .view, .drawer, .modal, .popover, .toast, .scrim { animation: none; }
}
