:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-tint: rgba(42, 120, 214, 0.08);
  --accent-tint-strong: rgba(42, 120, 214, 0.16);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --critical-tint: rgba(208, 59, 59, 0.08);
  --critical-tint-strong: rgba(208, 59, 59, 0.16);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --gridline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-tint: rgba(57, 135, 229, 0.12);
    --accent-tint-strong: rgba(57, 135, 229, 0.22);
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #e66767;
    --critical-tint: rgba(230, 103, 103, 0.12);
    --critical-tint-strong: rgba(230, 103, 103, 0.22);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
a { color: var(--accent); }
a:hover { opacity: 0.8; }
.num { font-variant-numeric: tabular-nums; }
.shell { max-width: 1180px; margin: 0 auto; padding: 32px 24px 96px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.subtitle { font-size: 14px; color: var(--ink-2); margin: 0; max-width: 680px; line-height: 1.5; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.section-label { font-size: 18px; font-weight: 700; margin: 40px 0 14px; letter-spacing: -0.01em; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 8px; }
.stat-value { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.stat-sub { font-size: 12px; color: var(--ink-2); margin: 4px 0 0; }
.occ-bar-wrap { margin-top: 18px; }
.occ-bar-track { height: 10px; background: var(--gridline); border-radius: 4px; overflow: hidden; }
.occ-bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.occ-bar-caption { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-top: 6px; }

.expense-list { display: flex; flex-direction: column; gap: 6px; }
.expense-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.expense-name { color: var(--ink); }
.expense-type { color: var(--ink-muted); font-size: 12px; }
.expense-rate { font-weight: 600; }
.card-note { font-size: 12px; color: var(--ink-muted); margin: 0 0 12px; }

.expense-editor { margin: 4px 0 18px; padding: 12px 14px; background: var(--page); border: 1px solid var(--border); border-radius: 10px; }

.breakeven-note {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px;
}
.breakeven-note strong { color: var(--ink); font-weight: 700; }
.breakeven-note svg { flex-shrink: 0; }
.expense-editor-title { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 8px; }
.expense-edit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--gridline); flex-wrap: wrap; }
.expense-edit-row:last-child { border-bottom: none; }
.expense-edit-label { font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.expense-edit-type { font-size: 11px; color: var(--ink-muted); font-weight: 400; }
.expense-edit-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.expense-basis-select {
  font: inherit; font-size: 12px; color: var(--ink-2); padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
}
.expense-edit-input-wrap { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); flex-shrink: 0; }
.expense-edit-input {
  width: 84px; font: inherit; font-size: 13px; text-align: right; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink);
}
.expense-edit-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.expense-edit-computed { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }

.props-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 40px 0 14px; }
.props-head .section-label { margin: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600;
  border-radius: 8px; padding: 8px 14px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink-2); }
.btn-ghost:hover { background: var(--accent-tint); color: var(--ink); }
.btn-danger { background: var(--critical); color: #ffffff; }
.btn-danger:hover { opacity: 0.9; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--accent-tint); color: var(--accent); }
.icon-btn.danger { background: var(--critical-tint); color: var(--critical); border-color: var(--critical); }
.icon-btn.danger:hover { background: var(--critical-tint-strong); color: var(--critical); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-muted); font-size: 14px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 11, 11, 0.5); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 100;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  max-width: 380px; width: 100%; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.modal-body { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.saved-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.saved-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.saved-card-head .icon-btn { flex-shrink: 0; }
.saved-card-name { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.saved-card-address { font-size: 12px; color: var(--ink-muted); margin: 0 0 4px; }
.saved-card-meta { font-size: 12px; color: var(--ink-2); margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.saved-card-net { font-size: 18px; font-weight: 700; margin: 0; }
.saved-card-sub { font-size: 12px; color: var(--ink-muted); margin: 2px 0 0; }

.property-card { margin-bottom: 16px; }
.property-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.name-block { display: flex; flex-direction: column; gap: 1px; flex: 1 1 200px; min-width: 0; }
.name-field { display: flex; align-items: center; gap: 4px; }
.name-input {
  font-size: 17px; font-weight: 700; border: 1px solid transparent; background: transparent; color: var(--ink);
  border-radius: 7px; padding: 5px 8px; min-width: 100px; flex: 1 1 auto; font-family: inherit;
}
.name-input:hover { border-color: var(--border); }
.name-input:focus { border-color: var(--accent); outline: none; background: var(--page); }
.pencil-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0;
  border: none; background: transparent; color: var(--ink-muted); cursor: pointer; border-radius: 6px;
}
.pencil-btn:hover { background: var(--accent-tint); color: var(--accent); }
.address-input {
  font-size: 12px; font-family: inherit; color: var(--ink-muted); border: 1px solid transparent; background: transparent;
  border-radius: 7px; padding: 3px 8px 3px 36px; width: 100%;
}
.address-input::placeholder { color: var(--ink-muted); opacity: 0.7; }
.address-input:hover { border-color: var(--border); }
.address-input:focus { border-color: var(--accent); outline: none; background: var(--page); color: var(--ink-2); }
.icon-btn.active { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.select-input {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--page); border: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.meta-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 10px 0 16px; font-size: 13px; color: var(--ink-2); }
.rate-block { display: flex; flex-direction: column; gap: 2px; }
.rate-sub { font-size: 12px; color: var(--ink-muted); }
.stepper { display: inline-flex; align-items: center; gap: 10px; background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; }
.stepper-value { font-size: 13px; font-weight: 700; min-width: 44px; text-align: center; }
.stepper-btn { width: 22px; height: 22px; border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.stepper-btn:hover { background: var(--accent-tint); color: var(--accent); }

.scenario-scroll { overflow-x: auto; }
.scenario-table { min-width: 520px; }
.scenario-header-row, .scenario-row {
  display: grid; grid-template-columns: 80px 90px 100px 90px 1fr; gap: 10px; align-items: center; padding: 8px 4px;
}
.scenario-header-row { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-muted); border-bottom: 1px solid var(--gridline); }
.scenario-row { border-bottom: 1px solid var(--gridline); cursor: pointer; border-radius: 6px; }
.scenario-row:last-child { border-bottom: none; }
.scenario-row:hover { background: var(--accent-tint) !important; }
.scenario-cell { font-size: 13px; }
.scenario-cell.occ { font-weight: 600; }
.bar-track { height: 10px; background: var(--gridline); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }

.property-footer { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gridline); }
.footer-stat-label { font-size: 11px; color: var(--ink-muted); margin: 0 0 3px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.footer-stat-value { font-size: 15px; font-weight: 700; margin: 0; }
.footer-stat-value.muted { color: var(--ink-2); font-weight: 600; }

.load-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); font-size: 14px; }
.sample-tag { font-size: 11px; color: var(--ink-muted); margin: 8px 0 0; }

.toast-container {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; z-index: 200; pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--page); font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; white-space: nowrap;
}
.toast-visible { opacity: 1; transform: translateY(0); }
