/* style.css — Return Grid: rental investment calculator
   Design concept: precision fintech instrument for real estate underwriting.
   Cool slate surfaces, brand green + navy accent, red/amber/green semantic scale for risk. */

:root {
  /* ---- Type scale (fluid clamp) ---- */
  --text-xs: clamp(0.75rem, 0.71rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.03rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.28rem + 1vw, 2.125rem);

  /* ---- 4px spacing ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- Fonts ---- */
  --font-display: 'Cabinet Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.375rem;
  --radius-full: 9999px;

  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --content-wide: 1240px;
}

/* ---- Light mode (default) ---- */
:root,
[data-theme='light'] {
  color-scheme: light;
  --color-bg: #f2f3f5;
  --color-surface: #ffffff;
  --color-surface-2: #fbfbfc;
  --color-surface-offset: #e9ebee;
  --color-divider: #e1e4e8;
  --color-border: #d5d9df;

  --color-text: #171b21;
  --color-text-muted: #565f6c;
  --color-text-faint: #98a1ac;
  --color-text-inverse: #f5f6f8;

  --color-primary: #006837;
  --color-primary-hover: #005a2f;
  --color-primary-active: #004425;
  --color-primary-highlight: #d4e8dc;

  --color-brand-navy: #243d86;

  --color-success: #2f7d43;
  --color-success-highlight: #dbeadf;
  --color-warning: #a8720f;
  --color-warning-highlight: #f0e3c8;
  --color-error: #b23a3a;
  --color-error-highlight: #f2dbdb;

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 240 / 0.06);
  --shadow-md: 0 6px 16px oklch(0.2 0.02 240 / 0.08);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 240 / 0.14);
}

[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #12151a;
  --color-surface: #181c22;
  --color-surface-2: #1d2128;
  --color-surface-offset: #21262e;
  --color-divider: #2a3038;
  --color-border: #333a44;

  --color-text: #e7e9ec;
  --color-text-muted: #98a1ac;
  --color-text-faint: #626b78;
  --color-text-inverse: #12151a;

  --color-primary: #3fae66;
  --color-primary-hover: #5cc47e;
  --color-primary-active: #2f8a52;
  --color-primary-highlight: #1a2f22;

  --color-brand-navy: #6d84d6;

  --color-success: #6fbf7c;
  --color-success-highlight: #1f3324;
  --color-warning: #d9a53f;
  --color-warning-highlight: #3a2f18;
  --color-error: #e07a7a;
  --color-error-highlight: #3a2222;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
}

/* ================= Layout shell ================= */

html {
  /* overflow-x: clip (not hidden) -- clipping horizontal overflow without
     establishing a scroll container. "hidden" on only one axis forces the
     other axis's used overflow value to "auto" per spec, which turns html
     and body into scroll containers and breaks position: sticky everywhere
     on the page (site-header, results-col, results-tabs, export-row) since
     sticky then anchors to those non-scrolling boxes instead of the real
     viewport scroll. clip has no such side effect. */
  overflow-x: clip;
  max-width: 100%;
}
body {
  font-family: var(--font-body);
  overflow-x: clip;
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) clamp(var(--space-4), 4vw, var(--space-10));
  background: color-mix(in oklab, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  text-decoration: none;
}
.brand-mark {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .brand-name {
    font-size: var(--text-sm);
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (max-width: 420px) {
  .brand-name {
    max-width: 6.5rem;
  }
}
.brand-tag {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
@media (max-width: 480px) {
  .header-actions {
    gap: var(--space-1);
  }
  .header-actions .btn-export {
    padding: var(--space-2);
    gap: 0;
  }
  .header-actions .btn-label {
    display: none;
  }
  .header-actions .nav-caret {
    display: none;
  }
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
}
@media (max-width: 420px) {
  .site-header {
    padding-inline: var(--space-3);
  }
  .header-actions .btn-export {
    padding: var(--space-1) var(--space-2);
  }
}

.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  cursor: pointer;
}
.nav-caret {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform var(--transition-interactive);
}
.nav-dropdown.open .nav-caret {
  transform: rotate(180deg);
}
.nav-dropdown.open .nav-dropdown-toggle {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 40;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.16));
}
.nav-dropdown-menu[hidden] {
  display: none;
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
.nav-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.nav-dropdown-item:hover {
  background: var(--color-surface-muted, var(--color-bg));
  color: var(--color-primary);
}
@media (max-width: 480px) {
  .nav-dropdown-menu:not([style*="position: fixed"]) {
    left: auto;
    right: 0;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-faint);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}

main {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding: clamp(var(--space-6), 5vw, var(--space-12)) clamp(var(--space-4), 4vw, var(--space-10));
}

/* The single-property analysis view (income/equity/amortization tables)
   and the portfolio dashboard (wide deals table) benefit from more
   horizontal room on large screens instead of a fixed 1240px column with
   growing dead space on either side. Floor matches the shared --content-wide
   so nothing changes on smaller/medium screens; only wide monitors expand. */
#calculator-main,
#dashboard-main {
  max-width: clamp(var(--content-wide), 92vw, 1760px);
}

.page-intro {
  max-width: 68ch;
  margin-bottom: var(--space-8);
}
.page-intro h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 650;
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
}
.page-intro p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 62ch;
}

.export-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  position: sticky;
  top: var(--header-h, 64px);
  z-index: 15;
  margin-inline: calc(-1 * clamp(var(--space-4), 4vw, var(--space-10)));
  padding: var(--space-3) clamp(var(--space-4), 4vw, var(--space-10));
  margin-bottom: var(--space-8);
  background: color-mix(in oklab, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.export-row[hidden] {
  display: none;
}
.sticky-save-bar .modal-note {
  flex: 1 1 100%;
  margin: 0;
}
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: border-color var(--transition-interactive), color var(--transition-interactive);
}
.btn-export svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn-export svg[hidden] {
  display: none;
}
.btn-export:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-save-success {
  border-color: var(--color-success) !important;
  color: var(--color-success) !important;
  background: var(--color-success-highlight) !important;
}
/* The toolbar's Pull Remote Data spinner: same refresh glyph as its idle
   state, spun while the RentCast calls are in flight. */
#pullRemoteDataBtn[aria-busy='true'] #pullRemoteDataBtnIcon {
  animation: pull-remote-spin 0.9s linear infinite;
}
@keyframes pull-remote-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  #pullRemoteDataBtn[aria-busy='true'] #pullRemoteDataBtnIcon { animation: none; }
}

/* Transient completion notice for Pull Remote Data (success / partial /
   failure). Fixed to the viewport bottom so it never shifts page layout. */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(90vw, 34rem);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  text-align: center;
}
.app-toast.app-toast-success {
  border-color: var(--color-success);
  background: var(--color-success-highlight);
}
.app-toast.app-toast-warn {
  border-color: var(--color-warning);
  background: var(--color-warning-highlight);
}
.app-toast.app-toast-error {
  border-color: var(--color-error);
}
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}
.empty-state .panel-heading {
  justify-content: center;
}
.empty-state .field-note {
  margin: 0 auto;
  max-width: 40ch;
  color: var(--color-text-muted);
}
.record-status-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}
.record-status-group[hidden] {
  display: none;
}
.status-pill {
  border-radius: var(--radius-full);
  border-width: 1px;
  cursor: pointer;
}
.status-legend-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-faint);
  transition: background var(--transition-interactive), color var(--transition-interactive);
}
.status-legend-btn svg {
  width: 16px;
  height: 16px;
}
.status-legend-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}
.btn-export[hidden] {
  display: none;
}

/* ================= Property page header ================= */
.property-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}
.property-header-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  align-self: flex-start;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-interactive);
}
.property-header-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.property-header-back:hover {
  color: var(--color-primary);
}
.property-header-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
  overflow-wrap: anywhere;
}
.property-header-address {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-base);
}
.property-header-address[hidden] {
  display: none;
}

/* ================= Property actions row ================= */
.property-actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: sticky;
  top: var(--header-h, 64px);
  z-index: 15;
  margin-inline: calc(-1 * clamp(var(--space-4), 4vw, var(--space-10)));
  padding: var(--space-3) clamp(var(--space-4), 4vw, var(--space-10));
  margin-bottom: var(--space-6);
  background: color-mix(in oklab, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.property-actions-row[hidden] {
  display: none;
}
.property-actions-scroll {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.property-actions-scroll::-webkit-scrollbar {
  display: none;
}
.property-actions-row .btn-export {
  flex-shrink: 0;
}
.btn-export-primary {
  flex-shrink: 0;
  margin-left: auto;
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-export-primary:hover {
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
  opacity: 0.9;
}
.property-more-dropdown {
  flex-shrink: 0;
}
.property-more-menu {
  left: auto;
  right: 0;
}

/* Hidden modal-trigger proxies: the Showings/Repairs buttons are no longer
   shown in the actions row (their main-tab-nav items call .click() on them
   instead), but they stay in the DOM with their original ids/handlers
   untouched. This wrapper keeps them invisible regardless of their own
   `hidden` attribute, which is still toggled by updateSaveButtonState(). */
.hidden-modal-triggers {
  display: none;
}

/* ================= Main tab navigation ================= */
/* .calculator is a 2-column grid (input col + results col) left over from
   the old side-by-side layout. The tab nav and each tab panel are direct
   children of .calculator now, so they must span both grid columns --
   otherwise grid auto-placement would put the nav and the one visible
   panel side by side instead of stacked. */
.main-tabs,
.main-tabpanel {
  grid-column: 1 / -1;
}
.main-tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-6);
}
.main-tabs::-webkit-scrollbar {
  display: none;
}
.main-tab {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--transition-interactive), border-color var(--transition-interactive);
}
.main-tab:hover {
  color: var(--color-text);
}
.main-tab[aria-selected='true'] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.main-tab[hidden] {
  display: none;
}
.main-tabpanel[hidden] {
  display: none;
}
.main-tabpanel .input-panel {
  max-width: 46rem;
}

/* Overview tab placeholder -- real dashboard content is Phase 2. */
.overview-placeholder {
  padding: var(--space-8) var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

/* Status card at the top of the Property Info tab. */
.status-card-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2, var(--color-bg));
  max-width: 46rem;
}
.status-card-row[hidden] {
  display: none;
}
.status-card-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .property-actions-row .btn-export .btn-label {
    display: none;
  }
  .property-actions-row .btn-export {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .btn-export-primary {
    width: auto;
    padding: var(--space-2) var(--space-4);
  }
  .btn-export-primary .btn-label {
    display: inline;
  }
  .main-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}


/* ================= Landing page ================= */
#landing-main[hidden] {
  display: none;
}
#landing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.landing-hero {
  max-width: 38rem;
  margin-bottom: var(--space-8);
  text-align: center;
}
.landing-mark {
  height: 48px;
  width: auto;
  display: block;
  margin-bottom: var(--space-4);
}
.landing-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.landing-hero p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}
.landing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 18rem));
  gap: var(--space-4);
  width: 100%;
  max-width: 40rem;
}
.landing-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.landing-card:hover,
.landing-card:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.landing-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.landing-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  flex-shrink: 0;
}
.landing-card-icon svg {
  width: 16px;
  height: 16px;
}
.landing-card-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.landing-card-desc {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
  display: none;
}
@media (min-width: 641px) {
  .landing-card-desc {
    display: block;
  }
}

/* ================= Landing dashboard ================= */
.landing-pipeline-card {
  width: 100%;
  max-width: clamp(var(--content-wide), 92vw, 1400px);
  margin: var(--space-6) auto 0;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-5);
}
.landing-pipeline-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.landing-pipeline-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.landing-pipeline-total {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.landing-dashboard {
  width: 100%;
  max-width: clamp(var(--content-wide), 92vw, 1400px);
  margin: var(--space-8) auto 0;
  text-align: left;
}
.landing-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.landing-pipeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full, 999px);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive);
}
.landing-pipeline-chip:hover,
.landing-pipeline-chip:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.landing-pipeline-chip-count {
  font-weight: 700;
}
.landing-pipeline-chip-units {
  font-weight: 500;
  opacity: 0.75;
}
.landing-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
@media (max-width: 900px) {
  .landing-dashboard-grid {
    grid-template-columns: 1fr;
  }
}
.landing-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-5);
}
.landing-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.landing-panel-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 650;
  margin: 0;
}
.landing-recent-list,
.landing-searchwatch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.landing-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-decoration: none;
}
.landing-recent-item + .landing-recent-item {
  border-top: 1px solid var(--color-divider);
}
.landing-recent-item:hover .landing-recent-address {
  color: var(--color-primary);
}
.landing-recent-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.landing-recent-address {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}
.landing-recent-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.landing-recent-side {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.landing-recent-caprate {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.landing-searchwatch-item {
  padding: var(--space-3) 0;
}
.landing-searchwatch-item + .landing-searchwatch-item {
  border-top: 1px solid var(--color-divider);
}
.landing-searchwatch-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 0.2rem;
}
.landing-searchwatch-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.landing-searchwatch-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  flex-shrink: 0;
}
.landing-searchwatch-badge[data-enabled='true'] {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.landing-searchwatch-summary {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ================= Calculator grid ================= */

.calculator {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 900px) {
  .calculator {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.input-panel {
  padding: var(--space-6);
}

.field-group {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-6) 0;
}
.field-group:last-child {
  margin-bottom: 0;
}
.field-group legend {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  width: 100%;
}

.field {
  margin-bottom: var(--space-4);
}
.field:last-child {
  margin-bottom: 0;
}
.field-row[hidden] {
  display: none;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.field label,
.field .group-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field .group-label .hint,
.field label .hint {
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
}
.field-note {
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-text-faint);
  margin-top: var(--space-3);
}
.field-note.is-saving {
  color: var(--color-text-muted);
}
.field-note.is-error {
  color: var(--color-error);
}
.user-admin-toggle {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-top: 26px;
}
.user-admin-toggle label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 0;
}
.user-admin-toggle input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.hint-required {
  color: var(--color-error) !important;
  font-weight: 700 !important;
  font-size: var(--text-sm) !important;
  line-height: 1 !important;
}
.field-error {
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-error);
  margin-top: var(--space-2);
}
.field input:invalid.field-input-error,
.field input.field-input-error,
.field select.field-input-error {
  border-color: var(--color-error);
}

.address-validated-badge {
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--text-xs);
  font-weight: 600 !important;
  color: var(--color-success);
}

.autofill-note {
  color: var(--color-primary);
  font-weight: 600;
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.field-with-suggestions {
  position: relative;
}
.address-suggestions {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: var(--space-1) 0 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 15rem;
  overflow-y: auto;
}
.address-suggestions li {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.4;
}
.address-suggestions li .suggestion-secondary {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.address-suggestions li:hover,
.address-suggestions li.is-active {
  background: var(--color-primary-highlight);
}
.address-suggestions li.is-loading,
.address-suggestions li.is-empty {
  cursor: default;
  color: var(--color-text-faint);
  font-style: italic;
}
.address-suggestions li.is-loading:hover,
.address-suggestions li.is-empty:hover {
  background: transparent;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .prefix,
.input-wrap .suffix {
  position: absolute;
  color: var(--color-text-faint);
  font-size: var(--text-sm);
  pointer-events: none;
}
.input-wrap .prefix {
  left: var(--space-3);
}
.input-wrap .suffix {
  right: var(--space-3);
}
.field input[type='number'],
.field input[type='text'],
.field input[type='url'],
.field input[type='email'],
.field input[type='password'],
.field input[type='date'],
.field select,
.unit-cell input,
.unit-cell select {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
}
.field select {
  font-family: inherit;
  cursor: pointer;
}
.input-wrap.has-prefix input {
  padding-left: var(--space-8);
}
.input-wrap.has-suffix input {
  padding-right: var(--space-8);
}
.input-wrap.has-link-action input {
  padding-right: var(--space-8);
}
.input-link-action {
  position: absolute;
  right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.input-link-action svg {
  width: 1rem;
  height: 1rem;
}
.input-link-action:hover,
.input-link-action:focus-visible {
  color: var(--color-primary);
  background: var(--color-surface-offset);
}
.input-link-action:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type='number'] {
  -moz-appearance: textfield;
}

.lock-remember {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  text-align: left;
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}
.lock-remember input[type='checkbox'] {
  margin-top: 0.15rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.footer-meta {
  margin-top: var(--space-3);
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--color-text-muted);
}

.segmented {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-2);
}
.segmented button {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-right: 1px solid var(--color-border);
}
.segmented button:last-child {
  border-right: none;
}
.segmented button[aria-pressed='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.segmented button:not([aria-pressed='true']):hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.financing-fields {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-divider);
}

.loan-summary {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
}
.loan-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.loan-summary-row span:last-child {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.loan-summary-total {
  padding-top: var(--space-2);
  border-top: 1px dashed var(--color-divider);
  font-weight: 600;
  color: var(--color-text);
}
.loan-summary-total span:last-child {
  color: var(--color-text);
}
.loan-summary-payment span:last-child {
  color: var(--color-primary);
}

.btn-ghost {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}
.btn-ghost:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

/* ================= Comparable rent lookup ================= */

.rent-comps {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-divider);
}
legend + .rent-comps {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.rent-comps .btn-export {
  width: 100%;
  justify-content: center;
}
.rent-comps-panel {
  margin-top: var(--space-3);
}
.rent-comps-status {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}
.rent-comps-status.rent-comps-error {
  color: var(--color-error);
}
.rent-comps-result {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
}
.rent-comps-estimate {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
}
.rent-comps-estimate-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  width: 100%;
}
.rent-comps-estimate-value {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-primary);
}
.rent-comps-estimate-range {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rent-comps-result > .btn-ghost {
  justify-self: start;
  font-weight: 500;
}
.rent-comps-result > .btn-ghost:disabled {
  color: var(--color-success);
  text-decoration: none;
  cursor: default;
}
.rent-comps-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--color-divider);
}
.rent-comps-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 var(--space-3);
  font-size: var(--text-xs);
}
.rent-comps-item-link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-column: 1 / -1;
  gap: 0 var(--space-3);
  padding: var(--space-1) var(--space-2);
  margin: calc(var(--space-1) * -1) calc(var(--space-2) * -1);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}
.rent-comps-item-link:hover,
.rent-comps-item-link:focus-visible {
  background-color: var(--color-surface-offset);
}
.rent-comps-item-link:hover .rent-comps-item-address,
.rent-comps-item-link:focus-visible .rent-comps-item-address {
  color: var(--color-primary);
  text-decoration: underline;
}
.rent-comps-item-address {
  color: var(--color-text);
  font-weight: 500;
}
.rent-comps-item-rent {
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
}
.rent-comps-item-meta {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
}
.rent-comps-source {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rent-comps-source a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
}
.rent-comps-details-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rent-comps-chip {
  font-size: var(--text-xs);
  color: var(--color-text);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full, 999px);
  padding: var(--space-1) var(--space-3);
  white-space: nowrap;
}
.rent-comps-subsection {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-divider);
}
/* Advanced-mode per-unit-type rent estimates, one block per bed/bath combo. */
.rent-comps-fanout {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-divider);
}
.rent-comps-fanout-item {
  border-top: none;
  padding-top: 0;
}
.rent-comps-fanout-item .rent-comps-fanout-apply {
  justify-self: start;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}
.unit-listing-apply-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.unit-listing-apply-row .unit-listing-apply-btn {
  flex: 0 0 auto;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}
.unit-listing-specs {
  font-size: var(--text-sm);
}
.rent-comps-subsection-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.rent-comps-owner-name {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.rent-comps-owner-type {
  font-weight: 400;
  color: var(--color-text-muted);
}
.rent-comps-owner-address {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rent-comps-delta {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.rent-comps-delta-good {
  color: var(--color-success);
  background: var(--color-success-highlight);
}
.rent-comps-delta-warn {
  color: var(--color-warning);
  background: var(--color-warning-highlight);
}
.rent-comps-delta-bad {
  color: var(--color-error);
  background: var(--color-error-highlight);
}
.rent-comps-delta-neutral {
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
}

/* ================= Results column ================= */

.results-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: sticky;
  top: calc(var(--header-h, 64px) + var(--action-bar-h, 0px) + var(--space-6));
  max-height: calc(100vh - var(--header-h, 64px) - var(--action-bar-h, 0px) - var(--space-6) - var(--space-6));
  overflow-y: auto;
  padding-right: var(--space-2);
  padding-bottom: var(--space-2);
}
@media (max-width: 900px) {
  .results-col {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}

.results-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
  padding-bottom: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.results-tabs .tabs {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}
.results-tabs .tabs button {
  flex: 1 1 auto;
  white-space: nowrap;
}
.results-tabpanel[hidden] {
  display: none;
}
.results-tabpanel {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Help toggle ("?") buttons that reveal field-note text on click */
.help-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  margin-left: var(--space-2);
  cursor: pointer;
  vertical-align: middle;
}
/* Wraps a field label's text together with its help-toggle button so
   the two stay adjacent as a single flex item -- keeps the "?" right
   next to the field name instead of drifting to the middle when a
   trailing hint/badge span is also present in the label. */
.field-label-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.field-label-name .help-toggle-btn {
  margin-left: 0;
}
/* Pairs a full-width lookup/action button with its help-toggle button
   on one row, so the "?" sits next to the button's own label text
   instead of floating below it. */
.rent-comps-action-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.rent-comps-action-row .btn-export {
  flex: 1 1 auto;
  width: auto;
}
.rent-comps-action-row .help-toggle-btn {
  margin-left: 0;
  flex-shrink: 0;
}
/* Panel heading, since these panels no longer carry their own lookup button
   to name them -- the pull is driven from the toolbar's Pull Remote Data. */
.rent-comps-heading {
  flex: 1 1 auto;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.rent-comps-pulled-at {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}
.rent-comps-empty {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
  font-style: italic;
}
.help-toggle-btn:hover,
.help-toggle-btn[aria-expanded='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.field-note {
  margin-top: var(--space-2);
}
/* Small checkmark badge appended to a field's <label> to flag that its
   value is actually sent to RentCast's comp lookups (rent + sale-price),
   as opposed to the majority of Building details fields which are stored
   for reference only. See the Building details help note for the legend. */
.comp-used-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 3px;
  vertical-align: -2px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.field-note .comp-used-icon {
  vertical-align: -2.5px;
  margin-left: 0;
  margin-right: 2px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 901px) {
  #dashboardContent .kpi-grid,
  #landingKpiGrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-value.deal-grade {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
}
.deal-grade-A { color: var(--color-success); }
.deal-grade-B { color: var(--color-primary); }
.deal-grade-C { color: var(--color-warning); }
.deal-grade-D,
.deal-grade-F { color: var(--color-error); }

.kpi-card {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.kpi-card[data-flag-level='good'] {
  border-left-color: var(--color-success);
}
.kpi-card[data-flag-level='mid'] {
  border-left-color: var(--color-warning);
}
.kpi-card[data-flag-level='low'] {
  border-left-color: var(--color-error);
}
.kpi-card-clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi-card-clickable:hover {
  box-shadow: var(--shadow-md, var(--shadow-sm));
  border-color: var(--color-primary);
}
.kpi-card-clickable:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.kpi-card-clickable[aria-pressed='true'] {
  border-color: var(--color-primary);
}
.kpi-sort-hint {
  margin-left: auto;
  color: var(--color-text-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.dashboard-legend-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.dashboard-legend-row-top {
  margin-bottom: var(--space-3);
}
.kpi-legend-btn-top {
  display: inline-block;
}
.dashboard-sort-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.link-btn-inline {
  background: none;
  border: none;
  padding: 0;
  margin-left: var(--space-1);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.legend-flag-row-note {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}
.kpi-card .kpi-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.kpi-card .kpi-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1;
}
.kpi-card .kpi-sub {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.kpi-card[data-tone='primary'] .kpi-value {
  color: var(--color-primary);
}
.kpi-card .kpi-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.kpi-flag[data-level='good'] {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.kpi-flag[data-level='mid'] {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}
.kpi-flag[data-level='low'] {
  background: var(--color-error-highlight);
  color: var(--color-error);
}

.legend-flag-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.legend-flag-row {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}
.legend-flag-row strong {
  color: var(--color-text);
}
.flag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
  vertical-align: middle;
}
.flag-dot[data-level='good'] {
  background: var(--color-success);
}
.flag-dot[data-level='mid'] {
  background: var(--color-warning);
}
.flag-dot[data-level='low'] {
  background: var(--color-error);
}

.breakdown-panel {
  padding: var(--space-6);
}
.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.panel-heading h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 650;
}
.panel-heading .panel-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.ledger {
  width: 100%;
  font-size: var(--text-sm);
}
.ledger tr {
  border-bottom: 1px solid var(--color-divider);
}
.ledger tr:last-child {
  border-bottom: none;
}
.ledger td {
  padding: var(--space-2) 0;
}
.ledger td:first-child {
  color: var(--color-text-muted);
}
.ledger td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.ledger tr.subtotal td {
  font-weight: 600;
  color: var(--color-text);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.ledger tr.subtotal td:first-child {
  color: var(--color-text);
}
.ledger tr.deduct td:last-child::before {
  content: '\2212\00A0';
  color: var(--color-error);
}
.ledger-subnote {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
  margin-top: 2px;
}
.ledger tr.result td {
  font-weight: 700;
  padding-top: var(--space-3);
  border-top: 2px solid var(--color-primary);
}
.ledger tr.result td:last-child {
  color: var(--color-primary);
  font-size: var(--text-base);
}

/* ================= Sensitivity section ================= */

.sensitivity-panel {
  padding: var(--space-6);
}

.projection-panel {
  padding: var(--space-6);
}
#yearlyTable {
  min-width: 760px;
}

.sensitivity-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.heatmap {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  min-width: 560px;
}
.heatmap caption {
  text-align: left;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  padding: var(--space-3);
}
.heatmap th,
.heatmap td {
  padding: var(--space-3);
  text-align: center;
  border-bottom: 1px solid var(--color-divider);
  border-right: 1px solid var(--color-divider);
}
.heatmap th:last-child,
.heatmap td:last-child {
  border-right: none;
}
.heatmap tbody tr:last-child td {
  border-bottom: none;
}
.heatmap thead th {
  background: var(--color-surface-2);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
}
.heatmap tbody th {
  background: var(--color-surface-2);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
  text-align: left;
}
.heatmap thead th:first-child {
  background: var(--color-surface-offset);
}
.heatmap td[data-current='true'] {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  position: relative;
}
.heatmap .cell-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: block;
}
.heatmap .cell-sub {
  font-size: var(--text-xs);
  opacity: 0.75;
  display: block;
  margin-top: 2px;
}

.legend-scale {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.legend-swatch {
  width: 68px;
  height: 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    to right,
    var(--color-error),
    var(--color-warning),
    var(--color-success)
  );
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.tabs button {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-right: 1px solid var(--color-border);
}
.tabs button:last-child {
  border-right: none;
}
.tabs button[aria-selected='true'] {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.tabs button:not([aria-selected='true']):hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.tab-panel[hidden] {
  display: none;
}

.rent-view-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
}
.rent-view-toggle-row[hidden] {
  display: none;
}
.unit-mode-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.unit-mode-toggle-row[hidden] {
  display: none;
}
/* Per-unit editor. The input column is capped at 400px on desktop and only
   goes full-width below the 900px breakpoint, so the usual wide-table-that-
   stacks-on-mobile pattern is backwards here -- a nine-column row never fits
   where this lives. Each unit is a card at every width instead, and only the
   field grid inside it reflows. */
/* Advanced mode hides one of the two fields in several .field-row pairs;
   without this the survivor keeps its half-width column and reads as a
   layout bug. Degrades to that same half-width look where :has() is
   unsupported. */
.field-row:has(> .field[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}
.unit-editor-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.unit-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-surface);
}
.unit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.unit-card-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
}
.unit-card-actions {
  display: flex;
  gap: var(--space-2);
}
.unit-action-btn {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1;
  padding: var(--space-2);
  cursor: pointer;
}
.unit-action-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.unit-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.unit-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.unit-cell {
  min-width: 0;
}
.unit-cell-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}
.unit-cell input,
.unit-cell select {
  width: 100%;
}
.unit-row-error[hidden] {
  display: none;
}
.unit-editor-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.unit-editor-totals {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 650;
}
@media (max-width: 420px) {
  .unit-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Inside .results-col (the per-property Overview/Sensitivity/etc. panel),
   the parent is itself a flex column with its own var(--space-6) gap
   between children. Without this override, that gap STACKS with this row's
   own top/bottom margins, roughly doubling the visual space above and below
   the Current/Market rents toggle vs. every other gap in that column. Zero
   the row's own margins here so the parent's gap is the only spacing. */
.results-col > .rent-view-toggle-row {
  margin-top: 0;
  margin-bottom: 0;
}
.rent-view-note {
  margin-top: 0;
  color: var(--color-warning);
}

.scenario-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
}
.scenario-summary-note {
  margin: 0;
  color: var(--color-text-muted);
}

.line-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}
@media (max-width: 720px) {
  .line-tables {
    grid-template-columns: 1fr;
  }
}
.line-tables h3 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
  margin-bottom: var(--space-3);
}
.rent-scenario-block {
  margin-top: var(--space-6);
}
.rent-scenario-block h3 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
  margin-bottom: var(--space-3);
}
#rentScenarioTable {
  min-width: 640px;
}
#rentScenarioTable th,
#rentScenarioTable td {
  white-space: nowrap;
}
@media (max-width: 640px) {
  #rentScenarioTable th,
  #rentScenarioTable td {
    padding: var(--space-2) var(--space-1);
    font-size: 12px;
  }
}
.mini-table {
  width: 100%;
  font-size: var(--text-sm);
}
.mini-table th,
.mini-table td {
  padding: var(--space-2) var(--space-2);
  text-align: right;
  border-bottom: 1px solid var(--color-divider);
}
.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
  color: var(--color-text-muted);
}
.grid-scroll .mini-table th:first-child,
.grid-scroll .mini-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--color-bg);
  box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.18);
}
.grid-scroll .mini-table thead th:first-child {
  z-index: 2;
}
.grid-scroll .mini-table tr[data-current='true'] td:first-child {
  background: var(--color-bg);
}
.mini-table td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.year-zero-row td {
  background: var(--color-surface-2);
}
.grid-scroll .mini-table tr.year-zero-row td:first-child {
  background: var(--color-surface-2);
}
.panel-note-inline {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
}
.dashboard-totals-row td {
  background: var(--color-surface-2);
  border-top: 2px solid var(--color-border);
  font-weight: 600;
}
.grid-scroll .mini-table tr.dashboard-totals-row td:first-child {
  background: var(--color-surface-2);
}
.mini-table thead th {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.mini-table tr[data-current='true'] td {
  color: var(--color-primary);
  font-weight: 700;
}

.sort-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.sort-btn:hover {
  color: var(--color-text);
}
.sort-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.sort-indicator {
  font-size: 0.65em;
  opacity: 0.35;
  min-width: 0.7em;
  display: inline-block;
  line-height: 1;
}
th[aria-sort='ascending'] .sort-indicator,
th[aria-sort='descending'] .sort-indicator {
  opacity: 1;
  color: var(--color-primary);
}

/* ================= Search watch jobs page ================= */

.sw-job-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  white-space: nowrap;
}
.sw-status-on {
  color: var(--color-success, #2f855a);
  font-weight: 600;
}
.sw-status-off {
  color: var(--color-text-muted);
}
.sw-job-name {
  font-weight: 600;
  color: var(--color-text);
}
.sw-job-meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

.methodology {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 78ch;
}
.methodology strong {
  color: var(--color-text-muted);
}

.site-footer {
  margin-top: var(--space-16);
  padding: var(--space-8) clamp(var(--space-4), 4vw, var(--space-10));
  border-top: 1px solid var(--color-divider);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.site-footer a {
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .brand-tag {
    display: none;
  }
}

/* ===== Zoho sign-in lock screen ===== */
#appRoot {
  display: none;
}
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: var(--space-6);
}
.lock-screen[hidden] {
  display: none;
}
.lock-card {
  width: 100%;
  max-width: 22rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.lock-mark {
  height: 2.75rem;
  width: auto;
  display: block;
  margin: 0 auto var(--space-4);
}
.lock-card h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}
.lock-sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.5;
}
#lockPassword,
.lock-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
}
#lockPassword:focus-visible,
.lock-input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.lock-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.lock-divider::before,
.lock-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
#localLoginToggle {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: var(--space-4);
}
.local-login-form {
  text-align: left;
}
.local-login-form .lock-submit {
  margin-top: var(--space-1);
}
.lock-submit {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
}
.lock-submit:hover {
  background: var(--color-primary-hover);
}
.lock-submit:active {
  background: var(--color-primary-active);
}
.lock-error {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-error);
}
.lock-notice {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.lock-forgot-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
}
.lock-forgot-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}
#forgotPasswordCancel {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: var(--space-3);
}
.modal-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-5) 0;
}

/* ================= Plan picker + checkout (subscription signup) =================
   Both screens reuse the .lock-screen/.lock-card shell above (they are part of
   the same unauthenticated signup flow) and only widen it -- three pricing
   cards and an embedded checkout page don't fit the 22rem sign-in card. */

.plan-screen,
.checkout-screen {
  /* Taller than the viewport on small screens, so scroll instead of clipping. */
  align-items: flex-start;
  overflow-y: auto;
}
.plan-select-card {
  max-width: 56rem;
  margin: auto;
}
.checkout-card {
  max-width: 48rem;
  margin: auto;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  text-align: left;
}
.plan-grid[hidden] {
  display: none;
}
.plan-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}
/* The recommended plan gets the primary border rather than a different
   background, matching how .landing-card signals emphasis on hover. */
.plan-card-featured {
  border-color: var(--color-primary);
}
.plan-badge {
  align-self: flex-start;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: var(--text-xs);
  font-weight: 600;
}
.plan-badge-trial {
  color: var(--color-success);
  background: var(--color-success-highlight);
  border-color: var(--color-success);
}
.plan-badge-popular {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  border-color: var(--color-primary);
}
.plan-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 650;
}
.plan-price {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.plan-price strong {
  font-size: var(--text-xl);
  color: var(--color-text);
}
/* Enterprise shows words rather than a figure -- at --text-xl "Custom pricing"
   wraps onto two lines and dwarfs the two real prices beside it. */
.plan-price-text strong {
  font-size: var(--text-lg);
}
.plan-features {
  list-style: none;
  margin: var(--space-2) 0 var(--space-4);
  padding: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}
/* Pushes every card's button to the bottom edge so the three line up even
   when the feature lists differ in length. */
.plan-cta {
  margin-top: auto;
  text-align: center;
  text-decoration: none;
}
.plan-cta[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* An empty card with no badge (Enterprise) would otherwise sit lower than the
   two badged ones. */
.plan-card:not(:has(.plan-badge)) .plan-name {
  margin-top: 1.6rem;
}

.checkout-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  justify-content: space-between;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}
.checkout-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.checkout-summary-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.checkout-frame {
  width: 100%;
  min-height: 700px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

@media (max-width: 720px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .plan-card:not(:has(.plan-badge)) .plan-name {
    margin-top: 0;
  }
}

/* ================= Viewing banner (loaded saved analysis) ================= */

.viewing-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-6);
}
.viewing-banner .link-btn {
  flex-shrink: 0;
  color: var(--color-primary);
}
.viewing-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.viewing-banner[hidden] {
  display: none;
}

/* ================= Save & Saved-analyses modals ================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklab, var(--color-bg) 55%, transparent);
  padding: var(--space-6);
}
.modal-overlay[hidden] {
  display: none;
}
.modal-card {
  width: 100%;
  max-width: 26rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  max-height: 85vh;
  overflow-y: auto;
}
.modal-card-wide {
  max-width: 46rem;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}
.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}
.modal-close svg {
  width: 16px;
  height: 16px;
}
.modal-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-3);
}
.share-link-row {
  display: flex;
  gap: var(--space-2);
}
.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.share-link-row .btn-export {
  flex-shrink: 0;
}
.public-share-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}
.public-share-actions .btn-export {
  text-decoration: none;
}
.public-share-sms-row {
  align-items: center;
}
/* .lock-input is sized for the full-width sign-in card; inside this flex row
   its intrinsic input width would push the send button onto its own line. */
.public-share-sms-row .lock-input {
  flex: 1 1 10rem;
  width: auto;
  min-width: 0;
  margin-bottom: 0;
}

.share-with-users-panel {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.share-with-users-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 10rem;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--color-surface-2);
}
.share-with-users-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
  padding: 0.3rem 0;
}
.share-with-users-row label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.share-with-users-row .share-with-users-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-with-users-row .share-with-users-pref-badge {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.share-with-users-empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: 0.3rem 0;
}
.share-with-users-result-sent {
  color: var(--color-success, #1a7f37);
}
.share-with-users-result-failed {
  color: var(--color-danger, #c0392b);
  font-weight: 600;
}
.share-with-users-result-failed-heading {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-top: 0.35rem;
}
.share-with-users-result-failed-list {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.share-with-users-result-failed-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  font-size: var(--text-sm);
}
.share-with-users-result-reason {
  color: var(--color-text-muted);
}

/* Read-only public share view (?public=<token>) — hide anything that
   requires sign-in or edits access, leave the calculator readable. */
body.public-view #saveAnalysisBtn,
body.public-view #pullRemoteDataBtn,
body.public-view #duplicateAnalysisBtn,
body.public-view #shareAnalysisBtn,
body.public-view #statusCard,
body.public-view #recordStatusGroup,
body.public-view #propertiesNavGroup,
body.public-view #compareNavGroup,
body.public-view #reportsNavGroup,
body.public-view #settingsNavGroup,
body.public-view #viewingBannerDismiss,
body.public-view #landing-main,
body.public-view #saved-main,
body.public-view #search-watch-main,
body.public-view #landingNewBtn,
body.public-view #landingSavedBtn,
body.public-view #comparePickerRow,
body.public-view #compareSaveBtn,
body.public-view #compareShareBtn,
body.public-view #compareBackBtn,
body.public-view #dashboard-main,
body.public-view #map-main,
body.public-view #saved-compares-main,
body.public-view #unitModeToggleRow,
body.public-view #unitsFieldset {
  display: none !important;
}
body.public-view .calculator button:disabled,
body.public-view .calculator input:disabled,
body.public-view .calculator select:disabled,
body.public-view .calculator textarea:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}
.saved-open-link {
  font-weight: 600;
  color: var(--color-primary);
}
.dashboard-property-link {
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.dashboard-property-link:hover {
  text-decoration: underline;
}
.saved-delete-btn {
  color: var(--color-error);
}

/* ================= Saved analyses page (back link, bulk actions, pagination) ================= */

.saved-back-link {
  display: inline-block;
  margin-bottom: var(--space-3);
}
.link-btn-danger {
  color: var(--color-error);
}
.link-btn-danger:hover {
  color: var(--color-error);
  opacity: 0.75;
}
.bulk-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.bulk-action-count {
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}
.bulk-action-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.bulk-action-controls select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}
.saved-pagination,
.list-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.saved-pagination .link-btn:disabled,
.list-pagination-bar .link-btn:disabled {
  color: var(--color-text-faint);
  opacity: 0.5;
  cursor: default;
  text-decoration: none;
}
/* Shared "rows per page" control -- reused on every unbounded table
   (Properties, Dashboard, Actuals, Search Watch jobs, Users). Positioned
   as its own group on one side of the pagination bar via margin-left:auto
   on the nav group next to it, so it doesn't fight the centered prev/next. */
.page-size-control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
}
.page-size-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}
.pagination-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
#savedListTable th:first-child,
#savedListTable td:first-child {
  width: 2rem;
  text-align: center;
}
.saved-row-checkbox,
#savedListSelectAll {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ================= Status filter + status select ================= */

.saved-list-toolbar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.saved-list-toolbar label {
  color: var(--color-text-muted);
  font-weight: 600;
}
.saved-list-toolbar select,
.status-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}
.status-select {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.3rem 0.5rem;
}
.status-select-to_review {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.status-select-reviewing {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border-color: transparent;
}
.status-select-offer_submitted {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border-color: transparent;
}
.status-select-offer_accepted {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
  border-color: transparent;
}
.status-select-offer_lost {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border-color: transparent;
}
.status-select-closed {
  background: var(--color-success-highlight);
  color: var(--color-success);
  border-color: transparent;
}
.status-select-not_interested {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  border-color: transparent;
}

.saved-search-group {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 360px;
}
.saved-search-input-wrap {
  position: relative;
  width: 100%;
}
.saved-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--color-text-faint);
  pointer-events: none;
}
.saved-search-input {
  width: 100%;
  padding: 0.45rem var(--space-8) 0.45rem var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
}
.saved-search-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.saved-search-clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.saved-search-clear:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.saved-search-clear[hidden] {
  display: none;
}

.status-filter-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.status-filter-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}
.status-filter-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}
.status-filter-checkboxes label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  white-space: nowrap;
}
.status-filter-checkboxes input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
}
.basement-split-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: var(--space-3);
}
.basement-split-inputs .field {
  margin-bottom: 0;
}

/* Multi-select dropdown (e.g. Basement type): a closed toggle button that
   opens a checkbox panel, reusing the same open/hidden/caret-rotate
   conventions as the header nav dropdowns above. */
.multiselect-dropdown {
  position: relative;
}
.multiselect-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.multiselect-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.multiselect-dropdown.open .multiselect-toggle {
  border-color: var(--color-primary);
}
.multiselect-toggle-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multiselect-toggle-text.is-placeholder {
  color: var(--color-text-faint);
}
.multiselect-caret {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform var(--transition-interactive);
}
.multiselect-dropdown.open .multiselect-caret {
  transform: rotate(180deg);
}
.multiselect-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.16));
}
.multiselect-panel[hidden] {
  display: none;
}
.multiselect-panel label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-text);
  cursor: pointer;
}
.multiselect-panel input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
}

/* ================= Status guide (explanations) ================= */

.status-guide {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.status-guide-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}
.status-guide-row + .status-guide-row {
  border-top: 1px solid var(--color-divider);
}
.status-guide-badge {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.status-guide-desc {
  color: var(--color-text-muted);
}

/* ================= Listing link ================= */

.saved-listing-link {
  color: var(--color-primary);
  font-size: var(--text-sm);
  text-decoration: none;
}
.saved-listing-link:hover {
  text-decoration: underline;
}
.saved-listing-none {
  color: var(--color-text-faint);
}

/* ================= Notes / comments thread ================= */

.notes-thread {
  max-height: 18rem;
  overflow-y: auto;
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.note-item {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}
.note-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.note-author {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
}
.note-date {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-shrink: 0;
}
.note-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.note-delete-btn {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-error);
}
.notes-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.notes-form textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
}
.notes-submit-btn {
  align-self: flex-end;
  padding: 0.55rem 1.1rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  border: none;
}
.notes-submit-btn:hover {
  background: var(--color-primary-hover);
}
.notes-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Search Watch settings modal */
.field textarea {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  resize: vertical;
}
.field textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.sw-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-2) var(--space-3);
}
.sw-checkbox-grid label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.sw-checkbox-grid input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.sw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.sw-area-type-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.sw-area-type-group label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.sw-area-type-group input[type='radio'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

/* ================= Tabs (Notes / Activity) ================= */

.tab-group {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}
.tab-btn {
  padding: var(--space-2) var(--space-1);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab-btn:hover {
  color: var(--color-text);
}
.tab-btn.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ================= @mention autocomplete ================= */

.notes-input-wrap {
  position: relative;
}
.mention-suggest {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + var(--space-1));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 5;
}
.mention-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
}
.mention-suggest-item:hover,
.mention-suggest-item:focus {
  background: var(--color-surface-offset);
}

/* ================= Dashboard status breakdown ================= */

.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.status-breakdown .status-guide-badge {
  padding: 0.25rem 0.65rem;
}

/* ================= Map view ================= */

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.map-legend-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: var(--radius-full);
}
.map-container {
  width: 100%;
  height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.map-pin-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.map-legend-dot.map-pin-to_review,
.map-pin-to_review .map-pin-dot {
  background: var(--color-primary);
}
.map-legend-dot.map-pin-reviewing,
.map-pin-reviewing .map-pin-dot {
  background: var(--color-primary-highlight);
  border-color: var(--color-primary);
}
.map-legend-dot.map-pin-offer_submitted,
.map-pin-offer_submitted .map-pin-dot {
  background: var(--color-text-muted);
}
.map-legend-dot.map-pin-offer_accepted,
.map-pin-offer_accepted .map-pin-dot {
  background: var(--color-warning);
}
.map-legend-dot.map-pin-offer_lost,
.map-pin-offer_lost .map-pin-dot {
  background: var(--color-error);
}
.map-legend-dot.map-pin-closed,
.map-pin-closed .map-pin-dot {
  background: var(--color-success);
}
.map-legend-dot.map-pin-not_interested,
.map-pin-not_interested .map-pin-dot {
  background: var(--color-text-faint);
}

/* ================= Dashboard/Map page export actions ================= */

.dashboard-export-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-left: auto;
}

/* ================= Print-friendly Map view export ================= */

@media print {
  body.printing-map .site-header,
  body.printing-map .site-footer,
  body.printing-map .page-intro,
  body.printing-map .saved-list-toolbar {
    display: none !important;
  }
  body.printing-map main:not(#map-main) {
    display: none !important;
  }
  body.printing-map #map-main {
    padding: 0;
    margin: 0;
  }
  body.printing-map #mapContent {
    display: block !important;
  }
  body.printing-map .map-container {
    width: 100%;
    height: 100vh;
  }
}

/* ================= Compare deals page (Feature 2) ================= */

.compare-picker-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.compare-picker-label {
  display: block;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}
.compare-picker-field {
  min-width: 260px;
}
.compare-picker-field input[type='text'] {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}

.compare-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  white-space: nowrap;
}
.compare-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
}
.compare-chip-remove:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.compare-col-address {
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.compare-table th[scope='col'] {
  text-align: left;
  vertical-align: top;
}
.compare-best-cell {
  background: var(--color-success-highlight);
  color: var(--color-success);
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ================= Actual vs. projected tracking (Feature 4) ================= */

.actuals-summary-grid {
  margin-bottom: var(--space-5);
}
.actuals-entry-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.6fr auto;
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-2);
}
.actuals-entry-field {
  display: flex;
  flex-direction: column;
}
.actuals-entry-field-note {
  grid-column: span 1;
}
.actuals-entry-field label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.actuals-entry-field input {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
}
.actuals-entry-form .btn-export {
  height: fit-content;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .actuals-entry-form {
    grid-template-columns: 1fr 1fr;
  }
  .actuals-entry-field-note {
    grid-column: span 2;
  }
  .actuals-entry-form .btn-export {
    grid-column: span 2;
  }
}
#actualsTable {
  min-width: 980px;
  table-layout: fixed;
}
@media (max-width: 900px) {
  #actualsTable {
    min-width: 760px;
  }
  #actualsTable th:nth-child(7),
  #actualsTable td:nth-child(7) {
    width: 160px;
  }
  #actualsTable th:nth-child(8),
  #actualsTable td:nth-child(8) {
    width: 130px;
  }
}
#actualsTable th:nth-child(1),
#actualsTable td:nth-child(1) {
  width: 90px;
}
#actualsTable th:nth-child(2),
#actualsTable td:nth-child(2),
#actualsTable th:nth-child(3),
#actualsTable td:nth-child(3),
#actualsTable th:nth-child(4),
#actualsTable td:nth-child(4),
#actualsTable th:nth-child(5),
#actualsTable td:nth-child(5),
#actualsTable th:nth-child(6),
#actualsTable td:nth-child(6) {
  width: 110px;
}
#actualsTable th:nth-child(7),
#actualsTable td:nth-child(7) {
  width: 240px;
  white-space: normal;
  text-align: left;
}
#actualsTable th:nth-child(8),
#actualsTable td:nth-child(8) {
  width: 190px;
  white-space: nowrap;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
#actualsTable th:nth-child(9),
#actualsTable td:nth-child(9) {
  width: 70px;
}
.actuals-variance-positive {
  color: var(--color-success);
  font-weight: 600;
}
.actuals-variance-negative {
  color: var(--color-error);
  font-weight: 600;
}
.actuals-delete-btn {
  color: var(--color-text-faint);
}

/* ================= Property showings / walkthrough checklist ================= */

.showings-list-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-4);
}
.showing-item {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  cursor: pointer;
  transition: border-color var(--transition-interactive);
}
.showing-item:hover {
  border-color: var(--color-primary);
}
.showing-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}
.showing-item-date {
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text);
}
.showing-status-pill {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-transform: capitalize;
}
.showing-status-pill.is-completed {
  color: var(--color-success);
  border-color: var(--color-success);
}
.showing-item-meta {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.showings-empty {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  padding: var(--space-4) 0;
  text-align: center;
}
.showings-form-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.showings-form-status {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.showings-form-status.is-saving {
  color: var(--color-text-muted);
}
.showings-form-status.is-error {
  color: var(--color-error);
}
.showings-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.showings-form-actions .link-btn-danger {
  margin-right: auto;
}
#showingSharedFieldStatus:empty,
#showingsFormStatus:empty {
  display: none;
}

/* Generic config-driven field renderer used for the simple checklist
   sections (exterior, cold-climate flags, mechanical systems, garage &
   parking, common areas, tenant observations, neighborhood impression,
   overall assessment). Mirrors .field / .field-row spacing so it matches
   the rest of the form without needing bespoke markup per section. */
.showing-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}
.showing-field-grid .field-full {
  grid-column: 1 / -1;
}
@media (max-width: 420px) {
  .showing-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Shrink empty note/textarea fields -- these render as a single-row input
   by default (see showingFieldControlHtml rows="1") instead of a fixed
   3-line empty box, cutting a lot of the "dead space" on mobile. Users can
   still drag the native resize handle open for longer free-text notes. */
.showing-field-grid textarea,
.showing-subcard textarea {
  min-height: 2.1rem;
  resize: vertical;
}

/* Accordion sections -- the 9 dynamic checklist sections (exterior,
   cold-climate flags, mechanical, interior/per-unit, garage & parking,
   common areas, tenant observations, neighborhood impression, repairs,
   overall assessment) render as native <details>/<summary> instead of a
   plain fieldset/legend, so the whole section collapses on mobile instead
   of forcing one long linear scroll. "Shared property details" stays an
   always-visible plain fieldset since it's short and used every time.
   Sections auto-open on load if they already have data (see
   setShowingAccordionOpenState in app.js); everything else starts
   collapsed. Native <details> gives free keyboard + screen-reader support. */
.showing-accordion {
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: var(--space-3);
}
.showing-accordion:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}
.showing-accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text);
  padding: var(--space-1) 0;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.showing-accordion > summary::-webkit-details-marker {
  display: none;
}
.showing-accordion > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition-interactive);
}
.showing-accordion[open] > summary::after {
  transform: rotate(-135deg);
}
.showing-accordion > summary:hover {
  color: var(--color-primary);
}
.showing-accordion > summary:hover::after {
  border-color: var(--color-primary);
}
.showing-accordion > summary ~ * {
  margin-top: var(--space-3);
}

/* Per-unit card nesting -- bathrooms and bedrooms render as sub-cards
   inside the unit card, one level down from .unit-card. */
.showing-unit-card {
  margin-bottom: var(--space-4);
}
.showing-unit-card:last-child {
  margin-bottom: 0;
}
.showing-subsection-title {
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin: var(--space-4) 0 var(--space-2);
}
.showing-subsection-title:first-child {
  margin-top: 0;
}
.showing-subcard-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.showing-subcard {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--color-surface-2);
}

.showing-repairs-total {
  font-weight: 650;
  color: var(--color-text);
}
.unit-card-badge {
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Showing photo widget. Auto-fill rather than a fixed column count so the
   same grid works inside a full-width checklist section and inside the
   narrower repair/unit subcards without a per-context override. */
.showing-photos {
  margin-top: var(--space-3);
}
.showing-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--space-2);
}
.showing-photo-grid:empty {
  display: none;
}
.showing-photo {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface-2);
}
.showing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.showing-photo.is-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}
.showing-photo-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  line-height: 1;
  font-size: var(--text-sm);
  border: none;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.showing-photo-delete:hover {
  background: rgba(0, 0, 0, 0.8);
}
.showing-photo-add {
  display: inline-block;
  margin-top: var(--space-2);
  cursor: pointer;
}

/* ================= Repairs & Capital Improvements tracker ================= */

.repairs-summary-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.repairs-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}
.repairs-summary-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.repairs-summary-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 650;
  color: var(--color-text);
}
.repairs-summary-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.repairs-summary-sub:empty {
  display: none;
}

.repairs-promote-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
}
.repairs-promote-banner[hidden] {
  display: none;
}

.repairs-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.repairs-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.repairs-chip {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color var(--transition-interactive), color var(--transition-interactive), background var(--transition-interactive);
}
.repairs-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}
.repairs-chip.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
}

.repair-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  cursor: pointer;
  transition: border-color var(--transition-interactive);
}
.repair-item:hover {
  border-color: var(--color-primary);
}
.repair-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.repair-item-desc {
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.repair-item-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.repair-item-side {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.repair-status-pill {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-transform: capitalize;
  white-space: nowrap;
}
.repair-status-pill.status-done {
  color: var(--color-success);
  border-color: var(--color-success);
}
.repair-status-pill.status-blocked {
  color: var(--color-error);
  border-color: var(--color-error);
}
.repair-status-pill.status-in_progress {
  color: var(--color-warning);
  border-color: var(--color-warning);
}
.repair-item-cost {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.repair-category-tag {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
}
.repairs-empty {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  padding: var(--space-4) 0;
  text-align: center;
}

.is-auto-generated-note {
  font-style: italic;
}

/* AI Cost Estimator (Phase 2) -- "Estimate with AI" widget on a repair item */
.ai-estimate-widget {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-surface-2);
}
.ai-estimate-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}
.ai-estimate-btn:hover {
  background: var(--color-primary-highlight);
}
.ai-estimate-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.ai-estimate-status {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.ai-estimate-status.is-error {
  color: var(--color-error);
}
.ai-estimate-result {
  margin-top: var(--space-3);
}
.ai-estimate-range {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-1);
}
.ai-estimate-confidence {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}
.ai-estimate-rationale {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}
.ai-estimate-citations {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  font-size: var(--text-xs);
}
.ai-estimate-citations li {
  margin-bottom: 0.2rem;
}
.ai-estimate-citations a {
  color: var(--color-primary);
  text-decoration: none;
  word-break: break-all;
}
.ai-estimate-citations a:hover {
  text-decoration: underline;
}
.ai-estimate-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
