/* style.css — Crossroads Rentals Investment Analyzer: rental investment calculator
   Design concept: precision fintech instrument for real estate underwriting.
   Cool slate surfaces, Crossroads Rentals 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-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-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: hidden;
  max-width: 100%;
}
body {
  font-family: var(--font-body);
  overflow-x: hidden;
  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 {
    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;
  margin-bottom: var(--space-8);
}
.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:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-pull-all-rentcast {
  width: 100%;
  justify-content: center;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.btn-pull-all-rentcast:hover {
  color: var(--color-text-inverse);
  opacity: 0.9;
}
.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-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.record-status-group[hidden] {
  display: none;
}
.record-status-group .viewing-status-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.btn-export[hidden] {
  display: none;
}

/* ================= Landing page ================= */
#landing-main[hidden] {
  display: none;
}
#landing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 60vh;
  justify-content: center;
}
.landing-hero {
  max-width: 38rem;
  margin-bottom: var(--space-10);
}
.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, 20rem));
  gap: var(--space-5);
  width: 100%;
  max-width: 44rem;
}
.landing-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-3);
  padding: var(--space-6);
  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-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  flex-shrink: 0;
}
.landing-card-icon svg {
  width: 20px;
  height: 20px;
}
.landing-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}
.landing-card-desc {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}
@media (max-width: 640px) {
  .landing-actions {
    grid-template-columns: 1fr;
  }
  #landing-main {
    min-height: 50vh;
  }
}

/* ================= 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 {
  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 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);
}
.hint-required {
  color: var(--color-error) !important;
  font-weight: 600 !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 {
  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 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);
}

.reset-row {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-divider);
}
.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);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-divider);
}
.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);
}
.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(64px + var(--space-6));
  max-height: calc(100vh - 64px - 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;
}
.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);
}

.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 {
    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-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-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-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);
}

/* ================= 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;
}

/* 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 #duplicateAnalysisBtn,
body.public-view #shareAnalysisBtn,
body.public-view #recordStatusGroup,
body.public-view #propertiesNavGroup,
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 {
  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 {
  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);
}
.saved-pagination .link-btn:disabled {
  color: var(--color-text-faint);
  opacity: 0.5;
  cursor: default;
  text-decoration: none;
}
#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;
}

.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);
}

/* ================= 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-row 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;
  min-width: 240px;
}

.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);
}
