/* property-details.css — v366
 *
 * Property Details tab visual redesign — section cards with a dense
 * field grid, monospaced numerics, italic N/A stamps. Mirrors the
 * Claude Design handoff at /Users/rickyreyes/Downloads/NEW CRM LOOK/
 * property.jsx + the matching `.section` / `.field-grid` rules in
 * that bundle's styles.css.
 *
 * All selectors are prefixed with `pds-` (Property Details Section)
 * so they don't collide with the legacy `.pd-field-grid` form layout
 * still used elsewhere in the deal detail page. Color tokens are the
 * existing --fg-*, --surface, --border, --primary, --font-mono set
 * from css/design-system.css — no new vars introduced.
 */

/* ── Tab content wrapper ─────────────────────────────────────── */
.pds-content { padding: 14px 20px; }

/* ── Section card ────────────────────────────────────────────── */
.pds-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  margin-bottom: 14px;
  overflow: hidden;
}

.pds-section-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fg-1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pds-section-hd svg {
  width: 13px;
  height: 13px;
  color: var(--primary);
  flex-shrink: 0;
}
.pds-section-hd .sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-3);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}
.pds-section-hd .right {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.pds-section-bd { padding: 14px 16px; }
.pds-section-bd.pds-flush { padding: 0; }

/* ── Field grid ──────────────────────────────────────────────── */
.pds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.pds-grid.pds-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pds-grid.pds-cols-4 { grid-template-columns: repeat(4, 1fr); }

.pds-field {
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 60px;
  position: relative;
}

/* Strip the trailing borders on the last col + row so the section
   card's own border carries the outer edge. */
.pds-grid > .pds-field:nth-child(3n) { border-right: none; }
.pds-grid.pds-cols-2 > .pds-field:nth-child(2n) { border-right: none; }
.pds-grid.pds-cols-4 > .pds-field:nth-child(4n) { border-right: none; }
.pds-grid > .pds-field:nth-last-child(-n+3) { border-bottom: none; }
.pds-grid.pds-cols-2 > .pds-field:nth-last-child(-n+2) { border-bottom: none; }
.pds-grid.pds-cols-4 > .pds-field:nth-last-child(-n+4) { border-bottom: none; }

.pds-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
}

.pds-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.pds-val.pds-mono {
  font-family: var(--font-mono);
  font-weight: 600;
}
.pds-val.pds-muted { color: var(--fg-4); font-weight: 400; }
.pds-val.pds-large { font-size: 15px; font-weight: 700; }
.pds-val.pds-green { color: var(--green-dark); }
.pds-val .pds-unit {
  color: var(--fg-3);
  font-size: 10px;
  font-weight: 500;
  margin-left: 2px;
}

/* ── Editable inputs that visually read as static values ─────── */
/* Inputs / selects in the field grid look like the design's read-only
   values until the user focuses — borderless, transparent background,
   font matches the surrounding .pds-val.
*/
.pds-field input.pds-input,
.pds-field select.pds-input,
.pds-field textarea.pds-input {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  color: var(--fg-1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s, background 0.12s;
}
.pds-field input.pds-input.pds-mono,
.pds-field select.pds-input.pds-mono {
  font-family: var(--font-mono);
  font-weight: 600;
}
.pds-field input.pds-input:focus,
.pds-field select.pds-input:focus,
.pds-field textarea.pds-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.pds-field input.pds-input:hover:not(:focus),
.pds-field select.pds-input:hover:not(:focus) {
  border-color: var(--border);
}
/* Native select arrow stays — but the chevron color shouldn't shout */
.pds-field select.pds-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 12px;
  padding-right: 22px;
}

/* ── Italic "N/A" stamp chip ─────────────────────────────────── */
.pds-stamp {
  font-family: var(--font-stamp);
  font-style: italic;
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  display: inline-block;
  border: 1.5px solid var(--fg-3);
  padding: 1px 7px;
  border-radius: 3px;
  opacity: 0.55;
  margin-top: 2px;
  align-self: flex-start;
  background: transparent;
}

/* ── Segmented View toggle in the section header ─────────────── */
.pds-btn-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
}
.pds-btn-group button {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--fg-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  text-transform: none;
  letter-spacing: 0;
}
.pds-btn-group button:last-child { border-right: none; }
.pds-btn-group button.active {
  background: var(--primary-lighter);
  color: var(--primary-darker);
}
.pds-btn-group button:hover:not(.active) {
  background: var(--surface-2);
  color: var(--fg-1);
}

/* ════════════════════════════════════════════════════════════════
 * v373: design vocabulary for the lower Property Details sections —
 * Highlights, Seller Motivation, Listing & Seller Details, Construction,
 * Amenities, and the asset-type-aware Unit Mix / Industrial / Tenant Mix
 * cards. Mirrors `/Users/rickyreyes/Downloads/styles.css` (Claude Design
 * handoff) with `pds-` prefix so it doesn't collide with the legacy
 * `.btn`, `.pill`, `.dt` rules elsewhere in the app.
 * ════════════════════════════════════════════════════════════════ */

/* ── Page toolbar (top of tab) ───────────────────────────────── */
.pds-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.pds-toolbar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0;
}
.pds-toolbar .right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pds-viewmode {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
}

/* ── Sub-headers inside a section body ───────────────────────── */
.pds-subhd {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-1);
  padding: 4px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pds-subhd .muted {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-3);
}
.pds-subhd .right { margin-left: auto; }
.pds-subhd-spaced {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pds-subhd-top {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}

/* ── Badges ──────────────────────────────────────────────────── */
.pds-badge-opt {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pds-badge-count {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-family: var(--font-mono);
}

/* ── Callout (info banner) ───────────────────────────────────── */
.pds-callout {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--primary-lighter);
  border: 1px solid var(--primary-light, #c7d2fe);
  border-radius: 5px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.pds-callout svg {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 1px;
}
.pds-callout .strong {
  font-weight: 700;
  color: var(--primary-darker);
  font-size: 12.5px;
}
.pds-callout .muted {
  font-size: 12px;
  color: var(--fg-2);
}

/* ── Highlights list ─────────────────────────────────────────── */
.pds-hl-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pds-hl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
}
.pds-hl-bullet {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pds-hl-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--fg-1);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 6px;
  margin: -2px -6px;
  font-family: inherit;
}
.pds-hl-text:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.pds-hl-x {
  border: 0;
  background: none;
  color: var(--fg-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
}
.pds-hl-x:hover {
  background: #fee2e2;
  color: var(--red-dark, #b91c1c);
}
.pds-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--fg-2);
  cursor: pointer;
  font-family: inherit;
}
.pds-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  border-style: solid;
}

/* ── Pills (status badges) ───────────────────────────────────── */
.pds-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pds-pill.hot     { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.pds-pill.warm    { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.pds-pill.offer   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.pds-pill.prospect{ background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.pds-pill.pitch   { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.pds-pill.muted   { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }

/* ── Segmented toggle (Listed / Not Listed / Mortgage status) ─ */
.pds-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
  flex-wrap: wrap;
}
.pds-seg button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  font-size: 11.5px;
  color: var(--fg-2);
  cursor: pointer;
  font-family: inherit;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.pds-seg button:last-child { border-right: 0; }
.pds-seg button.active {
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-weight: 600;
}
.pds-seg.sm button { padding: 4px 9px; font-size: 11px; }

/* ── Chip rows (tags, seller types, amenities) ───────────────── */
.pds-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pds-chip-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--fg-1);
  cursor: pointer;
  user-select: none;
}
.pds-chip-check input { margin: 0; accent-color: var(--primary); }
.pds-chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  background: #dcfce7;
  color: var(--green-dark);
  font-size: 11.5px;
  font-weight: 500;
}
.pds-chip-tag .pds-tag-text {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 4px;
  color: inherit;
  font: inherit;
}
.pds-chip-tag .pds-tag-text:focus {
  outline: none;
  border-color: var(--green-dark);
  background: #fff;
}
.pds-chip-tag .pds-tag-x {
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
}
.pds-chip-tag .pds-tag-x:hover { opacity: 1; }
.pds-chip-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px dashed var(--border-2);
  border-radius: 99px;
  background: transparent;
  color: var(--fg-3);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}
.pds-chip-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Mini KV stats inside section headers ────────────────────── */
.pds-kv-mini {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 10px;
  border-left: 1px solid var(--border);
  font-size: 11px;
}
.pds-kv-mini:first-of-type { border-left: 0; }
.pds-kv-mini .lbl {
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pds-kv-mini .val {
  color: var(--fg-1);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ── Textarea + paragraph styling for free-form content ──────── */
.pds-ta {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--fg-1);
  line-height: 1.5;
  background: var(--surface);
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.pds-ta:focus { outline: none; border-color: var(--primary); }
.pds-paragraph {
  font-size: 12.5px;
  color: var(--fg-1);
  line-height: 1.55;
  margin: 0;
}

/* ── Small inline button (light) used in tables ──────────────── */
.pds-lbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--fg-2);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}
.pds-lbtn:hover { background: var(--surface-2); color: var(--fg-1); }

/* ── Amenities 2-col grid ────────────────────────────────────── */
.pds-amen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 700px) {
  .pds-amen-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ── Responsive: collapse to 2-col on narrow screens ─────────── */
@media (max-width: 900px) {
  .pds-grid,
  .pds-grid.pds-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .pds-grid.pds-cols-2 { grid-template-columns: 1fr; }
  /* Recompute the last-row border strip on 2-col fallback */
  .pds-grid > .pds-field:nth-child(3n) { border-right: 1px solid var(--border); }
  .pds-grid > .pds-field:nth-child(2n) { border-right: none; }
  .pds-grid > .pds-field:nth-last-child(-n+3) { border-bottom: 1px solid var(--border); }
  .pds-grid > .pds-field:nth-last-child(-n+2) { border-bottom: none; }
}

/* ════════════════════════════════════════════════════════════════
 * v374: Financial Analysis tab vocabulary — sub-tab row, results
 * summary, 3-scenario table headers, PP&DP dual cards, Custom NOI
 * Override, expandable expense categories. Mirrors `/Users/rickyreyes/
 * Downloads/styles (1).css` from the Claude Design handoff. Scoped
 * under .fin-content (or used in tables wrapped by .pds-section) so
 * the .dt / .cat-row / .sub-line names don't collide with legacy
 * .dt rules elsewhere in the app.
 * ════════════════════════════════════════════════════════════════ */

/* Top wrapper analog to .pds-content but for the Financial tab body */
.fin-content { padding: 14px 20px; }

/* ── Sub-tab row (Financial Analysis / Offers / …) ───────────── */
.pds-tab-secondary-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -14px -20px 14px;
  padding: 8px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pds-tab-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.pds-tab-secondary svg { width: 12px; height: 12px; }
.pds-tab-secondary:hover { background: var(--surface); color: var(--fg-1); }
.pds-tab-secondary.active {
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-weight: 600;
}
.pds-tab-secondary-spacer { flex: 1; }

/* ── Results Summary table ───────────────────────────────────── */
.rs-table { display: flex; flex-direction: column; }
.rs-row {
  display: grid;
  grid-template-columns: 110px repeat(3, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.rs-row:last-child { border-bottom: 0; }
.rs-key {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
}
.rs-cell { color: var(--fg-1); }
.rs-lbl { color: var(--fg-2); }
.rs-cell .red { color: #b91c1c; }
.rs-cell .strong { font-weight: 600; }
.rs-cell .placeholder { color: var(--fg-4); font-style: italic; font-family: var(--font-mono); }

/* ── Financial tables (3-scenario + dual-column) ─────────────── */
.dt {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.dt thead th {
  background: var(--surface-2);
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dt thead th.num, .dt tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-1);
}
.dt tbody tr:last-child td { border-bottom: none; }
.dt tbody td.placeholder, .dt td.placeholder {
  color: var(--fg-4);
  font-family: var(--font-mono);
}
.dt tbody tr.total td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 2px solid var(--border);
}
.dt tbody tr.sub-total td {
  background: rgba(0,0,0,0.015);
  font-weight: 600;
}
.dt .ta-left { text-align: left !important; }
.dt .ta-right { text-align: right !important; }
.dt .ml-6 { margin-left: 6px; }
.dt .help {
  display: inline-flex;
  width: 12px;
  height: 12px;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--fg-3);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  cursor: help;
  border: 1px solid var(--border);
}
.dt .mono { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.dt .strong { font-weight: 600; color: var(--fg-1); }
.dt .primary { color: var(--primary); }
.dt .fg-2 { color: var(--fg-2); }
.dt .fg-3 { color: var(--fg-3); }

.fin-table { border-collapse: separate; border-spacing: 0; }
.fin-scenarios th {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 10px;
}
.fin-scenarios th.ta-left { text-align: left; }
.fin-sub-th th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--fg-2);
  text-align: right;
}

/* Three-scenario columns: blue / purple / green */
.fin-table thead .scen-actual { background: #2563eb !important; color: #fff !important; }
.fin-table thead .scen-pitch  { background: #7c3aed !important; color: #fff !important; }
.fin-table thead .scen-pro    { background: #15803d !important; color: #fff !important; }

/* Light tint stripes for body cells in scenario columns */
.fin-table.dual tbody td:nth-child(n+2):nth-child(-n+5) { background: rgba(37,99,235,0.025); }
.fin-table.dual tbody td:nth-child(n+6):nth-child(-n+9) { background: rgba(21,128,61,0.03); }
.fin-table.cfnoi tbody td:nth-child(n+2):nth-child(-n+4) { background: rgba(37,99,235,0.025); }
.fin-table.cfnoi tbody td:nth-child(n+5):nth-child(-n+7) { background: rgba(124,58,237,0.03); }
.fin-table.cfnoi tbody td:nth-child(n+8):nth-child(-n+10){ background: rgba(21,128,61,0.03); }

.fin-table tbody tr td.scen-actual { background: rgba(37,99,235,0.04); }
.fin-table tbody tr td.scen-pitch  { background: rgba(124,58,237,0.04); }
.fin-table tbody tr td.scen-pro    { background: rgba(21,128,61,0.04); }

.fin-table td.metric { font-weight: 600; }
.fin-table .placeholder { color: var(--fg-4); font-family: var(--font-mono); font-style: italic; }

/* ── Inline currency / % cell input ──────────────────────────── */
.cell-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  min-width: 90px;
}
.cell-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-lighter);
}
.cell-input-wrap .pre,
.cell-input-wrap .suf { font-size: 11px; color: var(--fg-3); }
.cell-input-wrap input.cell-input {
  border: 0;
  padding: 3px 2px;
  font-size: 11.5px;
  min-width: 0;
  flex: 1;
  background: transparent;
  font-family: var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cell-input-wrap input.cell-input:focus { outline: none; }
.cell-input-wrap .narrow { width: 36px; }
.cell-input.mono { font-family: var(--font-mono); font-weight: 500; }

/* ── Purchase Price & Down Payment dual cards ────────────────── */
.ppdp-grid {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  padding: 0;
}
.ppdp-divider { background: var(--border); }
.ppdp-card { padding: 16px 20px; }
.ppdp-card.is-actual .ppdp-title { color: #1d4ed8; }
.ppdp-card.is-pro .ppdp-title { color: var(--green-dark); }
.ppdp-title { font-size: 13px; font-weight: 700; }
.ppdp-source {
  font-size: 11px;
  font-style: italic;
  color: var(--fg-3);
  margin-top: 2px;
  margin-bottom: 14px;
}
.ppdp-rows { display: flex; flex-direction: column; gap: 10px; }
.ppdp-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.ppdp-row.total { padding-top: 10px; border-top: 1px solid var(--border); }
.ppdp-lbl { color: var(--fg-2); font-weight: 500; }
.ppdp-input { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ppdp-input .cell-input-wrap { min-width: 140px; }
.ppdp-radio { display: inline-flex; gap: 14px; font-size: 12px; }
.ppdp-radio label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ppdp-mono { font-size: 13px; font-weight: 700; font-family: var(--font-mono); }
.ppdp-mono.primary { color: var(--primary); }

@media (max-width: 900px) {
  .ppdp-grid { grid-template-columns: 1fr; }
  .ppdp-divider { height: 1px; width: 100%; }
}

/* ── Custom NOI Override ─────────────────────────────────────── */
.ovr-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.ovr-fld { display: flex; flex-direction: column; gap: 4px; }
.ovr-fld > span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ovr-input {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 8px;
  min-width: 200px;
}
.ovr-input .pre, .ovr-input .suf { font-size: 12px; color: var(--fg-3); }
.ovr-input input {
  border: 0;
  padding: 6px 4px;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  background: transparent;
  font-family: var(--font-mono);
}
.ovr-input input:focus { outline: none; }
.ovr-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-lighter);
}

/* Checkbox helper */
.fin-content .ck,
.pds-section .ck {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-1);
  cursor: pointer;
}
.fin-content .ck.sm,
.pds-section .ck.sm { font-size: 11.5px; }

/* ── Expandable expense categories ───────────────────────────── */
.dt.exp-table .cat-row { cursor: pointer; }
.dt.exp-table .cat-row td { background: var(--bg); }
.dt.exp-table .cat-row .cat-label {
  color: var(--primary-darker);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dt.exp-table .cat-row .chev {
  transition: transform 0.12s ease;
  color: var(--fg-3);
}
.dt.exp-table .cat-row.open .chev {
  transform: rotate(90deg);
  color: var(--primary);
}
.dt.exp-table .cat-row:hover td { background: var(--surface-2); }
.dt.exp-table tr.sub-line td {
  background: var(--surface) !important;
  font-size: 11.5px;
}
.dt.exp-table tr.sub-line td.sub-label {
  padding-left: 26px;
  color: var(--fg-2);
}

/* ── Header toolbar variants ─────────────────────────────────── */
.btn.warn-ghost {
  color: #b45309;
  background: transparent;
  border: 1px solid transparent;
}
.btn.warn-ghost:hover { background: #fef3c7; }
.btn.danger-ghost {
  color: #b91c1c;
  background: transparent;
  border: 1px solid transparent;
}
.btn.danger-ghost:hover { background: #fee2e2; }
.btn.lg { padding: 9px 18px; font-size: 13.5px; }
.btn.xs { padding: 2px 7px; font-size: 10.5px; }

/* ── Mini segmented control (inside table rows) ──────────────── */
.seg-mini {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface);
}
.seg-mini button {
  border: 0;
  background: transparent;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--fg-2);
  cursor: pointer;
  font-family: inherit;
  border-right: 1px solid var(--border);
}
.seg-mini button:last-child { border-right: 0; }
.seg-mini button.active {
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-weight: 600;
}
.row-actions-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ── Section action bars ─────────────────────────────────────── */
.fin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.fin-auto {
  font-size: 11px;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}
.fin-auto .okg {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.fin-save-row { padding: 16px 0 4px; }

/* ── Mortgage table cell select ──────────────────────────────── */
.mortgage-table .cell-select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--fg-1);
  min-width: 110px;
  font-family: inherit;
}
.mortgage-table .cell-select:focus {
  outline: none;
  border-color: var(--primary);
}
.mortgage-table td { vertical-align: middle; }

/* ── KPI strip (Offers / Tenants / Comps headers) ────────────── */
.kpi-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 -20px 14px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.kpi-row .kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.kpi-row .kpi:last-of-type { border-right: none; }
.kpi-row .kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}
.kpi-row .kpi-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-1);
  font-family: var(--font-mono);
}
.kpi-row .kpi-val.primary { color: var(--primary); }
.kpi-row .kpi-val.red { color: #b91c1c; }
.kpi-row .kpi-spacer { flex: 1; }

/* ─────────────────────────────────────────────────────────────
   v374.3 — Income table (.fin-income-table) chrome overlay.
   Overrides the legacy inline-styled <td> cells via higher
   specificity so the table inherits the design's typography
   and scenario-column tints without rewriting every cell.
   ───────────────────────────────────────────────────────────── */
.fin-income-table-wrap,
.fin-opex-table-wrap,
.fin-noi-table-wrap,
.fin-cfroll-table-wrap { overflow-x: auto; margin-top: 4px; transition: opacity 0.2s; }
.fin-income-table,
.fin-opex-table,
.fin-noi-table,
.fin-cfroll-table {
  width: 100%;
  min-width: 960px;
  /* v374.6: fixed table-layout + percentage colgroups so every dual-
     scenario table (Income / OpEx / NOI / Cash Flow) lines up at the
     same column widths. Without this, columns auto-sized to content —
     Income shrank because every row has inputs while OpEx stayed wide
     because category rows have plain text — making the four sections
     read as different widths even though they share min-width. */
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
/* Uniform colgroup proportions for every 9-col dual table.
   Label = 22%; each metric col = 9.75% (×8 = 78%). */
.fin-income-table col.col-lbl,
.fin-opex-table col.col-lbl,
.fin-noi-table col.col-lbl { width: 22%; }
.fin-income-table col.col-a,
.fin-income-table col.col-p,
.fin-opex-table col.col-a,
.fin-opex-table col.col-p,
.fin-noi-table col.col-a,
.fin-noi-table col.col-p { width: 9.75%; }

/* Cash Flow rolled-up has 5 cols not 9 — give it wider data cells but
   the same outer width as the other tables. Label still 22%; each of
   the 4 data cols = 19.5%. */
.fin-cfroll-table col.col-lbl-wide { width: 22%; }
.fin-cfroll-table col.col-a,
.fin-cfroll-table col.col-p { width: 19.5%; }

/* Force inputs inside fixed-layout cells to fit their column rather
   than expand the column. */
.fin-income-table tbody input,
.fin-opex-table tbody input,
.fin-noi-table tbody input {
  max-width: 100%;
  box-sizing: border-box;
}
.fin-income-table thead th,
.fin-opex-table thead th,
.fin-noi-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  color: var(--fg-2);
}
.fin-income-table thead tr.fin-scenarios th,
.fin-opex-table thead tr.fin-scenarios th,
.fin-noi-table thead tr.fin-scenarios th { padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fin-income-table thead tr.fin-scenarios th.scen-actual,
.fin-opex-table thead tr.fin-scenarios th.scen-actual,
.fin-noi-table thead tr.fin-scenarios th.scen-actual { background: #eff6ff; color: #1d4ed8; border-bottom: 2px solid #93c5fd; text-align: center; }
.fin-income-table thead tr.fin-scenarios th.scen-pro,
.fin-opex-table thead tr.fin-scenarios th.scen-pro,
.fin-noi-table thead tr.fin-scenarios th.scen-pro { background: #f0fdf4; color: var(--green-dark); border-bottom: 2px solid #86efac; text-align: center; }
.fin-income-table thead tr.fin-sub-th th,
.fin-opex-table thead tr.fin-sub-th th,
.fin-noi-table thead tr.fin-sub-th th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-3); padding: 7px 10px; }
.fin-income-table thead tr.fin-sub-th th:first-child,
.fin-opex-table thead tr.fin-sub-th th:first-child,
.fin-noi-table thead tr.fin-sub-th th:first-child { background: var(--surface-2); }

/* Column tints (Actual = blue, Proforma = green). Subtle background
   applied to col elements; transparent on header so scenario bands
   keep their tint. */
.fin-income-table col.col-a,
.fin-opex-table col.col-a,
.fin-noi-table col.col-a { background: rgba(37, 99, 235, 0.035); }
.fin-income-table col.col-p,
.fin-opex-table col.col-p,
.fin-noi-table col.col-p { background: rgba(21, 128, 61, 0.035); }

/* Override every legacy inline-styled td/border inside the table
   so the visual matches the design without touching tbody markup. */
.fin-income-table tbody td,
.fin-opex-table tbody td,
.fin-noi-table tbody td {
  padding: 7px 10px !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 12px !important;
  background: transparent;
  color: var(--fg-1);
  vertical-align: middle;
}
.fin-income-table tbody tr:last-child td,
.fin-opex-table tbody tr:last-child td,
.fin-noi-table tbody tr:last-child td { border-bottom: none !important; }
.fin-income-table tbody td:first-child,
.fin-opex-table tbody td:first-child,
.fin-noi-table tbody td:first-child { font-weight: 500; color: var(--fg-1); text-align: left; }
.fin-income-table tbody td:not(:first-child),
.fin-opex-table tbody td:not(:first-child),
.fin-noi-table tbody td:not(:first-child) { text-align: right; font-family: var(--font-mono); font-size: 12px !important; }

/* Total-row styling (matches existing background hints from legacy
   markup — those rows still carry inline `style="background:..."` so
   we override colors / weight via attribute selectors). */
.fin-income-table tbody tr[style*="f0f0e0"] td,
.fin-opex-table tbody tr[style*="f0f0e0"] td { background: #fef9c3 !important; font-weight: 700 !important; }
.fin-income-table tbody tr[style*="e0e8f0"] td { background: #dbeafe !important; font-weight: 700 !important; color: #1d4ed8 !important; }
.fin-opex-table tbody tr[style*="e8e0d0"] td { background: #fed7aa !important; font-weight: 700 !important; color: #9a3412 !important; }
.fin-noi-table tbody tr[style*="e8f0e8"] td { background: #dcfce7 !important; font-weight: 700 !important; color: var(--green-dark) !important; }
.fin-opex-table tbody tr.exp-subrow td { background: var(--surface-2) !important; padding: 5px 10px 5px 28px !important; font-size: 11px !important; color: var(--fg-2) !important; }
.fin-opex-table tbody tr.exp-subrow td:first-child { padding-left: 28px !important; font-style: italic; }

/* Inline-styled inputs inside the table get the .cell-input look. */
.fin-income-table tbody input.num-input,
.fin-income-table tbody input[id^="fin_"],
.fin-opex-table tbody input.num-input,
.fin-opex-table tbody input[id^="fin_"],
.fin-noi-table tbody input.num-input,
.fin-noi-table tbody input[id^="fin_"] {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  padding: 5px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-family: var(--font-mono) !important;
  color: var(--fg-1) !important;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.fin-income-table tbody input.num-input:focus,
.fin-income-table tbody input[id^="fin_"]:focus,
.fin-opex-table tbody input.num-input:focus,
.fin-opex-table tbody input[id^="fin_"]:focus,
.fin-noi-table tbody input.num-input:focus,
.fin-noi-table tbody input[id^="fin_"]:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.fin-income-table tbody span,
.fin-opex-table tbody span,
.fin-noi-table tbody span { color: var(--fg-3); }

/* Expandable category toggle link inside OpEx table. */
.fin-opex-table tbody a[onclick*="toggleExpCat"] {
  color: var(--primary) !important;
  font-weight: 600 !important;
  cursor: pointer;
  text-decoration: none;
}
.fin-opex-table tbody a[onclick*="toggleExpCat"]:hover { text-decoration: underline; }

/* OpEx % Ratio override row — modernize without rewriting markup. */
#expRatioRow {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  margin-bottom: 10px !important;
}
#expRatioRow input.form-input {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  padding: 5px 8px !important;
  border-radius: 6px !important;
  font-family: var(--font-mono) !important;
}

/* ─────────────────────────────────────────────────────────────
   v374.5 — Custom NOI Override row chrome.
   ───────────────────────────────────────────────────────────── */
.ovr-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ovr-hd .ck {
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--fg-2);
}
.ovr-hd .ck input[type="checkbox"] { accent-color: var(--primary); }
.pds-paragraph.ovr-note { font-size: 12px; color: var(--fg-2); line-height: 1.5; margin: 0 0 12px 0; }
.ovr-derive-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary-darker);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.ovr-derive-btn:hover { background: var(--primary-darker); }
.ovr-derive-btn svg { display: inline-block; vertical-align: middle; }

/* ─────────────────────────────────────────────────────────────
   v374.5 — Cash Flow rolled-up table (.fin-cfroll-table) +
   Mortgage Information sub-table (.fin-mortgage-table).
   ───────────────────────────────────────────────────────────── */
/* (Base .fin-cfroll-table layout merged into the unified rule above
   at line ~1085 so all four dual tables share min-width + table-layout +
   colgroup proportions. Only color tints declared here.) */
.fin-cfroll-table col.col-a { background: rgba(37, 99, 235, 0.035); }
.fin-cfroll-table col.col-p { background: rgba(21, 128, 61, 0.035); }
.fin-cfroll-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  color: var(--fg-2);
}
.fin-cfroll-table thead tr.fin-scenarios th { padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fin-cfroll-table thead tr.fin-scenarios th.scen-actual { background: #eff6ff; color: #1d4ed8; border-bottom: 2px solid #93c5fd; text-align: center; }
.fin-cfroll-table thead tr.fin-scenarios th.scen-pro    { background: #f0fdf4; color: var(--green-dark); border-bottom: 2px solid #86efac; text-align: center; }
.fin-cfroll-table thead tr.fin-sub-th th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-3); padding: 7px 10px; }
.fin-cfroll-table tbody td {
  padding: 7px 10px !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 12px !important;
  background: transparent;
  color: var(--fg-1);
  vertical-align: middle;
}
.fin-cfroll-table tbody td:first-child { font-weight: 500; text-align: left !important; }
.fin-cfroll-table tbody td:not(:first-child) { text-align: right !important; font-family: var(--font-mono); }
.fin-cfroll-table tbody tr[style*="e8f0e8"] td { background: #dcfce7 !important; font-weight: 700 !important; color: var(--green-dark) !important; }
.fin-cfroll-table tbody a[onclick*="toggleMortgage"] {
  color: var(--primary) !important;
  font-weight: 600 !important;
  text-decoration: none;
  cursor: pointer;
}
.fin-cfroll-table tbody a[onclick*="toggleMortgage"]:hover { text-decoration: underline; }

/* Mortgage expand sub-row wrapping cell (gets the dark amber inset) */
.fin-mort-wrap {
  padding: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
}
.fin-mort-inner {
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  padding: 14px 18px;
}
.fin-mort-hd {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fin-mortgage-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.fin-mortgage-table thead tr.fin-mort-th th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: normal;
  line-height: 1.3;
}
.fin-mortgage-table thead tr.fin-mort-th th.mort-col-lbl { width: 110px; }
.fin-mortgage-table tbody td {
  padding: 8px 10px !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 12px !important;
  background: transparent !important;
  vertical-align: middle;
  color: var(--fg-1);
}
.fin-mortgage-table tbody tr:last-child td { border-bottom: none !important; }
.fin-mortgage-table tbody tr[style*="f0ede4"] td { background: var(--surface-2) !important; font-weight: 700; }

.fin-mortgage-table tbody select.form-select,
.fin-mortgage-table tbody input.num-input,
.fin-mortgage-table tbody input[id^="fin_mort"] {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  padding: 5px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-family: var(--font-mono) !important;
  color: var(--fg-1) !important;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  min-height: 32px;
}
.fin-mortgage-table tbody select.form-select { padding-right: 22px !important; }
.fin-mortgage-table tbody select.form-select:focus,
.fin-mortgage-table tbody input.num-input:focus,
.fin-mortgage-table tbody input[id^="fin_mort"]:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.fin-mortgage-table tbody button[onclick*="mortClear"] {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--fg-3) !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  font-size: 10px !important;
  cursor: pointer;
  margin-left: 6px;
  transition: color 120ms ease, border-color 120ms ease;
}
.fin-mortgage-table tbody button[onclick*="mortClear"]:hover {
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
.fin-mortgage-table tbody td:first-child { font-weight: 600 !important; color: var(--fg-1) !important; }

