:root {
  /* Type */
  --font-family: "Instrument Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Accent */
  --primary: #6c5ce0;
  --primary-hover: #5a49c9;
  --primary-bg: #f1eefc;
  --primary-bg-hover: #e7e2f9;

  /* Neutrals */
  --text: #251f36;
  --text-muted: #6d6683;
  --text-faint: #8b84a3;
  --border: #e7e4f1;
  --surface: #ffffff;
  --surface-sunken: #f8f7fc;
  --surface-hover: #f3f1fb;
  --canvas: #f2f0f8;

  /* Status */
  --success: #2f7d5d;
  --success-bg: #e6f3ec;
  --warning: #8a6417;
  --warning-bg: #f8f0dd;
  --danger: #a03a44;
  --danger-bg: #f9e9ea;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --space-4: 9px;
  --space-7: 16px;

  /* Elevation */
  --shadow-dropdown: 0 10px 30px rgba(52, 38, 110, .13);
  --shadow-modal: 0 24px 60px rgba(38, 28, 80, .28);
  --shadow-panel: -10px 0 34px rgba(52, 38, 110, .14);
  --shadow-shell: 0 1px 2px rgba(52, 38, 110, .05), 0 12px 32px rgba(52, 38, 110, .06);

  /* Quiet-zebra table */
  --zebra: #faf9fd;
  --group-band: #f6f4fc;
  --group-band-text: #7d7695;
  --col-header-text: #4b4460;
  --hairline-body: #f0edf7;
  --hairline-header: #e2ddf0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header__title h1 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.app-header__meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.app-header__actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-7);
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn--secondary:hover,
.btn--ghost:hover {
  background: var(--surface-hover);
}

.toolbar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar__search {
  flex: 1 1 220px;
  padding: var(--space-4) 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
}

.toolbar__filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Top bar directly above each table: page-size selector on the left,
   Download Excel + search on the right. A second, independent page-size
   control from the one Tabulator renders bottom-left of its own footer —
   see createPageSizeSelect in app.js for how the two stay in sync. */
.table-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  flex-wrap: wrap;
}

.table-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-topbar__right .toolbar__search {
  flex: 0 1 220px;
}

.pagesize-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
}

.toolbar__count {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 8px;
}

/* Multi-select dropdown filter */
.multiselect {
  position: relative;
}

.multiselect__toggle {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.multiselect__toggle.is-active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.multiselect__panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 10px;
}

.multiselect__panel.is-open {
  display: block;
}

.multiselect__search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.multiselect__actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.multiselect__actions button {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.multiselect__list {
  max-height: 220px;
  overflow-y: auto;
}

.multiselect__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.multiselect__item:hover {
  background: var(--surface-sunken);
}

.multiselect__item input {
  margin: 0;
}

/* Card shell — each tab's toolbar/content/table sits on one rounded,
   softly-shadowed surface floating on the lavender page canvas. */
.pt-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-shell);
  margin: 20px 24px 24px;
}

#property-table,
#subdivision-table,
#suburb-table {
  margin: 8px 0 0;
}

#definitions-table {
  margin: 8px 0 0;
  background: var(--surface);
  overflow: hidden;
}

/* Data Definitions — descriptions/formulas are long-form reference text,
   so unlike every other table here, body cells wrap instead of truncating
   (Tabulator auto-grows row height when a cell's content wraps). */
#definitions-table .tabulator-cell {
  white-space: normal;
  word-break: break-word;
  line-height: 1.5;
}

#definitions-table .tabulator-cell code {
  background: rgba(108, 92, 224, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* vs suburb median: above median (pricier) vs below median (cheaper) */
.pct-above {
  color: var(--danger);
}

.pct-below {
  color: var(--success);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tabs__btn {
  border: none;
  background: none;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font-family);
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}

.tabs__btn:hover {
  color: var(--text);
}

.tabs__btn.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.toolbar--wrap {
  align-items: center;
}

/* Secondary sub-tabs nested inside a .pt-shell (e.g. Suburb Finder's
   Explore suburbs / Shortlist) — a lighter, smaller strip than the
   top-level .tabs bar, since it lives inside the card rather than spanning
   the page. */
.subtabs {
  display: flex;
  gap: 4px;
  padding: 10px 24px 0;
  border-bottom: 1px solid var(--border);
}

.subtabs__btn {
  border: none;
  background: none;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.subtabs__btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.subtabs__btn.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.subtab-panel {
  display: none;
}

.subtab-panel.is-active {
  display: block;
}

.subdivision-note {
  margin: 14px 24px;
  padding: 14px 16px;
  background: #f8f6fe;
  border: 1px solid #e4dff4;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.65;
  color: #5f5878;
}

.subdivision-note code {
  background: rgba(108, 92, 224, 0.08);
  color: var(--text);
  padding: 1px 5px;
  border-radius: 4px;
}


/* Range (min/max) filter */
.rangefilter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rangefilter__label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rangefilter__input {
  width: 90px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
}

/* Subdivision assumptions modal */
.assumptions-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.assumptions-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assumptions-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.assumptions-field input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: var(--font-family);
  color: var(--text);
}

.assumptions-field__help {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.assumptions-group-label {
  margin: 8px 0 -6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.assumptions-group-label:first-child {
  margin-top: 0;
}

.assumptions-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* Estimated subdivision profit */
.profit-positive {
  color: var(--success);
  font-weight: 600;
}

.profit-negative {
  color: var(--danger);
  font-weight: 600;
}

/* Confidence badge (comp-count-backed) */
.confidence-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.confidence-high {
  background: var(--success-bg);
  color: var(--success);
}

.confidence-medium {
  background: var(--warning-bg);
  color: var(--warning);
}

.confidence-low {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Subdivision drill-down modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 31, 54, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
}

.modal-dialog--wide {
  width: min(1100px, 92vw);
}

/* Suburb comparison table (Suburb Finder — Compare) */
.compare-table-scroll {
  overflow-x: auto;
}

.compare-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

.compare-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  z-index: 1;
}

.compare-table thead th:first-child {
  z-index: 2;
}

.compare-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-sunken);
}

.compare-table tbody td {
  font-variant-numeric: tabular-nums;
}

.compare-table tbody tr:nth-child(even) td,
.compare-table tbody tr:nth-child(even) th {
  background: var(--zebra);
}

.compare-table .compare-group-row th {
  background: var(--group-band);
  color: var(--group-band-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 16px;
}

.compare-table td.compare-remove {
  text-align: center;
  color: var(--text-faint);
  cursor: pointer;
  white-space: nowrap;
}

.compare-table td.compare-remove:hover {
  color: var(--danger);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.modal-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
}

.modal-empty {
  color: var(--text-muted);
  font-size: 13px;
}

.modal-note {
  color: var(--text-faint);
  font-size: 12.5px;
  margin: 4px 0 10px;
}

/* One for-sale listing within a suburb's drill-down */
.listing-card {
  border: 1px solid #ece9f5;
  border-radius: var(--radius-lg);
  margin: 10px 0;
  overflow: hidden;
  background: #fdfcff;
}

.listing-card__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.listing-card__summary:hover {
  background: var(--surface-hover);
}

.listing-card__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.listing-card__address {
  font-weight: 600;
  color: var(--text);
}

.listing-card__meta {
  font-size: 12.5px;
  color: var(--text-faint);
}

.listing-card__view-link {
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
  width: fit-content;
}

.listing-card__view-link:hover {
  text-decoration: underline;
}

.listing-card__profit {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.listing-card__detail {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.listing-card__detail[hidden] {
  display: none;
}

.listing-detail__calc,
.listing-detail__zoning {
  font-size: 13px;
  margin: 12px 0;
}

.listing-detail__calc > div,
.listing-detail__zoning > div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.listing-detail__zoning > div > span:first-child {
  color: var(--text-faint);
}

.listing-detail__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: none;
}

/* One editable cost/revenue line (land surveyor, service connections,
   stamp duty %, other costs, ...) — the label stays plain text, the value
   side holds a small live-editable input plus the dollar amount it
   currently works out to. */
.listing-detail__calc-row > span:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.listing-detail__calc-input {
  width: 84px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 4px);
  font-size: 12.5px;
  font-family: var(--font-family);
  color: var(--text);
  text-align: right;
}

.listing-detail__calc-amount {
  min-width: 90px;
  text-align: right;
  color: var(--text-muted);
}

.listing-detail__actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.listing-detail__ai-summary {
  font-size: 13px;
  margin: 8px 0 4px;
  padding: 10px 14px;
  background: #f8f7fd;
  border: 1px solid #ece9f5;
  border-radius: var(--radius-md);
  list-style: none;
}

.listing-detail__ai-summary li {
  position: relative;
  padding-left: 14px;
  margin: 4px 0;
}

.listing-detail__ai-summary li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.listing-detail__total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 6px !important;
  font-weight: 600;
}

.listing-detail h4 {
  margin: 14px 0 2px;
  font-size: 13px;
  color: var(--text);
}

.comps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.comps-table th,
.comps-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.comps-table a {
  color: var(--primary);
  text-decoration: none;
}

.comps-table a:hover {
  text-decoration: underline;
}

/* Column visibility panel (Data Table tab) — slide-in from the right */
.column-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 90vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

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

.column-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.column-panel__header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.column-panel__actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.column-panel__groups {
  overflow-y: auto;
  padding: 4px 0;
}

.column-panel__group {
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
}

.column-panel__group summary {
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  color: var(--text);
}

.column-panel__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.column-panel__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.column-panel__item:hover {
  background: var(--surface-sunken);
}

.column-panel__item input {
  margin: 0;
}

/* Strategies bar (Suburb Finder toolbar) */
.strategies-bar {
  display: flex;
  gap: 8px;
}

.strategies-dropdown {
  position: relative;
}

.strategies-dropdown__panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 300px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 6px;
}

.strategies-dropdown__panel.is-open {
  display: block;
}

.strategies-dropdown__empty {
  margin: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Investment Score badges (Capital Growth / Cashflow / Lower Risk / Overall)
   — fixed server-side scores, no user weight panel any more. */
.pt-score {
  display: inline-block;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pt-score-high {
  background: var(--success-bg);
  color: var(--success);
}

.pt-score-mid {
  background: var(--warning-bg);
  color: var(--warning);
}

.pt-score-low {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Cashflow tab */
.cashflow-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  padding: 18px 24px;
  align-items: start;
}

.cashflow-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cashflow-inputs__group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fdfcff;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cashflow-inputs__group h4 {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.cashflow-inputs__group label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.cashflow-inputs__group input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: var(--font-family);
  color: var(--text);
}

.cashflow-outputs {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px 18px;
}

.cashflow-outputs h4,
.cashflow-projection-wrap h4,
.cashflow-scenarios h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.cashflow-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.cashflow-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cashflow-stat__label {
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.cashflow-stat__value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cashflow-stat__value.is-positive { color: var(--success); }
.cashflow-stat__value.is-negative { color: var(--danger); }

.cashflow-save {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cashflow-save input {
  flex: 1 1 auto;
}

.cashflow-projection-wrap,
.cashflow-scenarios {
  padding: 0 24px 24px;
}

.cashflow-table-scroll {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cashflow-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}

.cashflow-table th,
.cashflow-table td {
  padding: 8px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cashflow-table th:first-child,
.cashflow-table td:first-child {
  text-align: left;
}

.cashflow-table thead th {
  position: sticky;
  top: 0;
  background: var(--group-band);
  color: var(--group-band-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.cashflow-table tbody tr:nth-child(even) td {
  background: var(--zebra);
}

.cashflow-scenario-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 8px;
  background: #fdfcff;
}

.cashflow-scenario-card__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.cashflow-scenario-card__meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.cashflow-scenario-card__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cashflow-scenarios-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.strategy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.strategy-item:hover {
  background: var(--surface-sunken);
}

.strategy-item__name {
  flex: 1;
  text-align: left;
  border: none;
  background: none;
  padding: 6px 8px;
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
}

.strategy-item__delete {
  border: none;
  background: none;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}

.strategy-item__delete:hover {
  color: var(--danger);
}

/* hTag-style nested filter builder (Suburb Finder tab) */
.querybuilder {
  margin: 4px 24px 16px;
}

.qb-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.qb-group--nested {
  background: var(--surface-sunken);
  margin: 4px 0;
}

.qb-group-body {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.qb-combinator {
  flex: 0 0 auto;
  width: 40px;
  border: 1px solid var(--primary);
  color: var(--primary-hover);
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 8px 0;
}

.qb-combinator:hover {
  background: var(--primary-bg-hover);
}

.qb-rows {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.qb-row-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qb-row-wrap > .qb-group {
  flex: 1 1 auto;
  min-width: 0;
}

.qb-rule {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.qb-select {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
  background: var(--surface);
  color: var(--text);
}

.qb-value {
  display: flex;
  gap: 6px;
}

.qb-value-input {
  width: 140px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-family);
}

.qb-value-input--text {
  width: 200px;
}

.qb-row-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.qb-btn-icon {
  width: 30px;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1;
}

.qb-btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.qb-add {
  flex: 0 0 auto;
  align-self: flex-start;
}

/* ─────────────────────────────────────────────────────────────────────────
   Tabulator — "Quiet zebra": hairline structure only (no full grid), zebra
   stripe carries row separation, comfortable density, tabular numerals, and
   a pinned identity column (Suburb / Address — see the `frozen: true` column
   defs in app.js). Group-boundary hairlines come from the `pt-group-start`
   cssClass Tabulator applies to both the header cell and every body cell of
   the first column in each group (buildGroupedColumns / buildGroupedSuburbColumns
   in app.js) — never a full vertical grid.
   ───────────────────────────────────────────────────────────────────────── */
.tabulator {
  border: none;
  background: transparent;
  font-family: var(--font-family);
  font-size: 13.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tabulator .tabulator-header {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline-header);
}

.tabulator .tabulator-col,
.tabulator .tabulator-cell {
  border-right: none;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 12px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--col-header-text);
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
  background: var(--surface-hover);
}

.tabulator .tabulator-header .tabulator-col.tabulator-col-group {
  background: var(--group-band);
}

.tabulator .tabulator-header .tabulator-col.tabulator-col-group > .tabulator-col-content {
  padding: 9px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--group-band-text);
}

.tabulator .tabulator-header .tabulator-col.tabulator-col-group + .tabulator-col.tabulator-col-group {
  box-shadow: inset 1px 0 0 var(--border);
}

/* Hairline dividers at group boundaries only — the "no full grid" rule */
.tabulator .tabulator-col.pt-group-start .tabulator-col-content {
  box-shadow: inset 1px 0 0 var(--hairline-header);
}

.tabulator-cell.pt-group-start {
  box-shadow: inset 1px 0 0 var(--hairline-body);
}

.tabulator .tabulator-row {
  background-color: var(--surface);
  min-height: 46px;
}

.tabulator .tabulator-row.tabulator-row-even {
  background-color: var(--zebra);
}

.tabulator .tabulator-row:hover {
  background-color: var(--surface-hover);
}

/* Must come after the zebra/hover rules above to win the same-specificity
   cascade tie — otherwise a selected even-numbered row silently keeps its
   zebra tint instead of showing as selected. */
.tabulator .tabulator-row.tabulator-selected {
  background-color: var(--primary-bg);
}

.tabulator .tabulator-row.tabulator-selected:hover {
  background-color: var(--primary-bg-hover);
}

.tabulator input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.tabulator .tabulator-cell {
  padding: 14px 18px;
  font-size: 13.5px;
}

/* Identity column (Suburb / Address) — pinned via `frozen` where the table
   has no column groups (Subdivision; Tabulator refuses `frozen` on a column
   nested in a group), styled via `.pt-identity` alone where it's grouped
   (Data Table, Suburb Finder). Tabulator already makes a frozen cell inherit
   its row's background-color, so zebra + hover coloring carries through
   automatically there; only typography and the divider color need overriding. */
.tabulator .tabulator-cell.tabulator-frozen,
.tabulator .tabulator-cell.pt-identity {
  font-weight: 600;
  white-space: nowrap;
}

.tabulator .tabulator-header .tabulator-frozen,
.tabulator .tabulator-header .tabulator-col.pt-identity {
  font-weight: 600;
}

.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left {
  border-right: 1px solid var(--hairline-body);
}

/* Data Table's "AI Subdivision Notes" column — no per-row detail view in
   this table (unlike the Subdivision tab's listing cards), so the full
   3-point text lives in a native title tooltip; the cell itself is
   single-line and truncated so it doesn't blow out row height. */
.ai-summary-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left {
  border-right: 1px solid var(--hairline-header);
}

.tabulator .tabulator-placeholder {
  color: var(--text-faint);
  font-family: var(--font-family);
  font-size: 13.5px;
}

.tabulator .tabulator-footer {
  background: var(--zebra);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 8px 16px;
}

.tabulator .tabulator-footer .tabulator-page,
.tabulator .tabulator-footer .tabulator-page-size {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 12.5px;
}

.tabulator .tabulator-footer .tabulator-page:hover:not(.active):not(:disabled) {
  background: var(--surface-hover);
}

.tabulator .tabulator-footer .tabulator-page.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Suburb Finder → Live Listings — active-suburb chip row above the table
   (see buildSuburbFinderTab's renderActiveSuburbsChips in app.js). */
.livelistings-active-suburbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.livelistings-active-suburbs__label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-right: 2px;
}

.livelistings-active-suburbs__empty {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Suburb Finder → Live Listings — per-listing modal's own action row
   ("View listing ↗" + "Download report (PDF)", see openLiveListingModal). */
.livelisting-modal__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--text);
}
