/* ============ Property Investment (property-investment.js) ============
   The optional section on an Owned property's Details tab, and the folded Portfolio
   equity card on the Dashboard. Built on the Details card (property-records.css) and the
   "More figures" fold (rentals.css), so it reads as part of the same screens. */

#propInvestment[hidden], #dashInvestment[hidden] { display: none; }
#propInvestment { margin-top: 14px; }
.pi-card [hidden] { display: none !important; }

.pi-empty p { margin: 0 0 12px; font-size: 0.9em; color: var(--text-subtle); line-height: 1.5; }
.pi-empty button { width: auto; margin: 0; padding: 10px 18px; }

/* Equity: the one figure that leads */
.pi-hero { display: flex; flex-direction: column; gap: 3px; margin: 2px 0 14px; }
.pi-label { font-size: 0.84em; color: var(--text-subtle); font-weight: 600; }
.pi-equity {
  font-size: 1.9em; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15;
  color: var(--text-bright); font-variant-numeric: tabular-nums;
}
.pi-equity.neg { color: var(--red, #c2410c); }
.pi-hero small { font-size: 0.84em; color: var(--muted); }
.pi-add { font-size: 0.9em; color: var(--muted); }
.pi-est { font-size: 0.8em; font-weight: 600; color: var(--muted); }

/* Metrics: one quiet row each; tap for what it means */
.pi-metrics { border-top: 1px solid var(--hairline); }
.pi-metric { border-bottom: 1px solid var(--hairline); }
.pi-metric summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 11px 2px; cursor: pointer; list-style: none; font-size: 0.92em;
}
.pi-metric summary::-webkit-details-marker { display: none; }
.pi-metric summary span { color: var(--text-soft); }
.pi-metric summary b { color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.pi-metric.missing summary b { color: var(--muted); font-weight: 500; font-size: 0.9em; }
.pi-metric p { margin: -4px 2px 11px; font-size: 0.8em; color: var(--muted); line-height: 1.45; }
.pi-basis { margin: 10px 2px 0; font-size: 0.78em; color: var(--muted); }
.more-figs.pi-more { margin: 12px 2px 0; }

/* Form: three folded groups */
.pi-form .settings-hint { margin: 0 0 6px; }
.pi-group { border-bottom: 1px solid var(--hairline); }
.pi-group summary {
  display: flex; align-items: center; justify-content: space-between; padding: 13px 2px;
  cursor: pointer; list-style: none; font-weight: 700; color: var(--text); font-size: 0.95em;
}
.pi-group summary::-webkit-details-marker { display: none; }
.pi-group summary::after {
  content: ''; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.15s;
}
.pi-group[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.pi-group[open] { padding-bottom: 12px; }
.pi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.pi-field { min-width: 0; }
.pi-field input { width: 100%; }
.pi-check { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 600; font-size: 0.9em; cursor: pointer; }
.pi-check input { width: auto; margin: 0; }
.pi-form .form-row-buttons { margin-top: 16px; }
.pi-clear { display: block; margin: 12px auto 0; font-size: 0.85em; color: var(--muted); }

/* ---------- Dashboard: Portfolio equity, one line until tapped ---------- */
.sb-card.pi-dash { padding: 14px 16px; }
.pi-dash summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
}
.pi-dash summary::-webkit-details-marker { display: none; }
.pi-dash-label { flex: 1; min-width: 0; font-weight: 700; color: var(--text); font-size: 0.95em; }
.pi-dash summary b { font-size: 1.15em; font-weight: 800; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.pi-dash summary::after {
  content: ''; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; margin-left: 2px;
}
.pi-dash[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.pi-dash dl {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 16px; margin: 12px 0 0;
  padding: 12px 14px; border-radius: 14px; background: var(--chip-bg); font-size: 0.9em;
}
.pi-dash dt { color: var(--muted); }
.pi-dash dd { margin: 0; text-align: right; font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }

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