/* ============ Long-term rentals (rentals.js) ============
   Rental type cards in Add Property, the Tenancy card and rent schedule on a property's
   Overview, and the tenancy sheets. Built on the Bills styles (bills.css) so lists, pills
   and sheets look the same; long-term rentals take a muted teal accent. */

/* ---------- Add Property: Short-Term / Long-Term cards ---------- */
.rt-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 4px 0 6px; }
.rt-card {
  margin: 0; padding: 14px 13px 13px; border-radius: 16px; text-align: left; font-weight: normal;
  background: var(--input-bg); border: 1.5px solid var(--input-border); color: var(--text);
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.rt-card:hover { filter: none; border-color: rgba(var(--plum-rgb), 0.35); }
.rt-card:active { transform: none; }
.rt-card b { font-size: 0.95em; font-weight: 700; }
.rt-card small { font-size: 0.76em; color: var(--text-subtle); line-height: 1.35; }
.rt-ico {
  width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: var(--lavender-wash); color: var(--plum); margin-bottom: 4px;
}
.rt-ico svg { width: 19px; height: 19px; }
.rt-card[data-rental="long_term"] .rt-ico { background: rgba(var(--brand-teal-rgb), 0.12); color: var(--brand-teal-ink); }
.rt-card.on { border-color: var(--plum); background: var(--card-solid); box-shadow: 0 4px 14px rgba(var(--plum-rgb), 0.12); }
.rt-card[data-rental="long_term"].on { border-color: var(--brand-teal-ink); box-shadow: 0 4px 14px rgba(var(--brand-teal-rgb), 0.16); }
.lt-new-fields[hidden] { display: none; }
.lt-new-fields { margin-top: 4px; padding-top: 4px; }

/* Edit property: rental type */
.view-toggle.rt-toggle { display: flex; margin: 0; }
.view-toggle.rt-toggle button { flex: 1; }

/* Property cards: the ownership badge (with · LT or · Vacant) stays on one line */
.pc-tags { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* ---------- Tenancy card ---------- */
#tenancyPane[hidden] { display: none; }
#tenancyPane { margin-bottom: 22px; }
.card.lt-card {
  padding: 18px 18px 16px; margin-bottom: 14px;
  background: linear-gradient(160deg, rgba(var(--brand-teal-rgb), 0.08), rgba(var(--brand-teal-rgb), 0) 65%), var(--card);
}
.lt-card-top { display: flex; align-items: center; gap: 9px; }
.lt-tag {
  padding: 3px 7px; border-radius: 7px; font-size: 0.7em; font-weight: 800; letter-spacing: 0.06em;
  background: rgba(var(--brand-teal-rgb), 0.14); color: var(--brand-teal-ink); flex-shrink: 0;
}
.lt-who { flex: 1; min-width: 0; font-weight: 700; font-size: 1em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-manage { width: auto; margin: 0; padding: 4px 2px; font-size: 0.88em; }
.lt-rent { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; }
.lt-rent b { font-size: 1.9em; font-weight: 800; letter-spacing: -0.03em; color: var(--text-bright); font-variant-numeric: tabular-nums; line-height: 1.1; }
.lt-rent > span { font-size: 0.92em; color: var(--text-subtle); font-weight: 600; }
.lt-est { font-size: 0.78em; color: var(--muted); font-weight: 600; }
.lt-rent .lt-est { width: 100%; }
.lt-dates { font-size: 0.84em; color: var(--text-subtle); }
.lt-next {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--hairline); font-size: 0.88em; color: var(--text-soft);
}
.lt-next b { color: var(--text); font-variant-numeric: tabular-nums; }
.lt-vacant { font-size: 0.88em; color: var(--text-subtle); margin: 12px 0 14px; line-height: 1.45; }
.lt-over { margin: 10px 0 0; font-size: 0.82em; color: var(--gold); line-height: 1.45; }
.lt-card.vacant { background: var(--card); }
.lt-card.vacant .lt-tag { background: var(--chip-bg); color: var(--text-subtle); }

.lt-summary .bl-sum:first-child { background: linear-gradient(160deg, rgba(var(--brand-teal-rgb), 0.07), rgba(var(--brand-teal-rgb), 0) 70%), var(--card); }
.lt-summary .bl-v small { font-size: 0.5em; letter-spacing: 0; }
.lt-summary { margin-bottom: 18px; }

/* Schedule rows */
.bl-ico.lt-ico { background: rgba(var(--brand-teal-rgb), 0.1); color: var(--brand-teal-ink); }
.lt-row.upcoming .bl-name { color: var(--text-soft); }
.lt-row.upcoming .lt-ico { background: var(--chip-bg); color: var(--muted); }
.bl-pill.lt-proj { background: none; color: var(--muted); border: 1px dashed rgba(var(--muted-rgb), 0.45); }

/* ---------- Tenancy fields ---------- */
.lt-fields [hidden] { display: none !important; }
.lt-money { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.lt-money > div { min-width: 0; }
.lt-every { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.9em; color: var(--text-soft); }
.lt-every input { width: 84px; margin: 0; text-align: center; }
.lt-fields .bl-seg button { font-size: 0.8em; padding: 9px 0; min-width: 0; letter-spacing: -0.01em; }
.lt-more-btn { width: auto; margin: 14px 0 0; padding: 2px 0; font-size: 0.88em; }
.lt-opt { font-weight: 500; color: var(--muted); font-size: 0.9em; }
.lt-hint { font-size: 0.78em; color: var(--muted); line-height: 1.45; margin: 6px 0 0; }
.lt-fields textarea {
  width: 100%; padding: 12px 14px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 12px;
  color: var(--text); font-size: 16px; font-family: inherit; resize: vertical; min-height: 72px;
}

/* ---------- Sheets ---------- */
.lt-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 16px; margin: 16px 0 4px; font-size: 0.9em; }
.lt-facts dt { color: var(--text-subtle); }
.lt-facts dd { margin: 0; text-align: right; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lt-actions { display: flex; flex-direction: column; margin-top: 18px; border: 1px solid var(--border); border-radius: 16px; padding: 2px 6px; }
.lt-action {
  width: 100%; margin: 0; padding: 13px 8px; display: flex; align-items: center; gap: 12px; text-align: left;
  background: none; color: inherit; font-weight: normal; border-radius: 12px;
}
.lt-action + .lt-action { border-top: 1px solid var(--hairline); border-radius: 0; }
.lt-action:hover { filter: none; background: rgba(var(--lavender-rgb), 0.07); }
.lt-action > svg:first-child { width: 19px; height: 19px; color: var(--brand-teal-ink); flex-shrink: 0; }
.lt-action > svg:last-child { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.lt-action span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lt-action b { font-size: 0.94em; color: var(--text); }
.lt-action small { font-size: 0.78em; color: var(--text-subtle); }
.bl-pickrow > svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }

@media (max-width: 380px) {
  .rt-choice { gap: 8px; }
  .rt-card { padding: 12px 10px; }
  .lt-rent b { font-size: 1.65em; }
}

/* ---------- Reporting: Properties summary, filter and sort; P&L rent line ---------- */
.props-summary { margin: 0 0 14px; }
.props-summary .pnl-summary { margin-bottom: 8px; }
.props-count { margin: 0 2px 8px; font-size: 0.88em; color: var(--text-subtle); display: flex; align-items: center; gap: 8px; }
.props-count b { color: var(--text); font-weight: 750; }
.props-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.props-tools[hidden], .props-filter[hidden] { display: none !important; }
.view-toggle.props-filter { margin: 0; padding: 3px; gap: 2px; border-radius: 12px; box-shadow: none; }
.view-toggle.props-filter button { padding: 6px 12px; border-radius: 9px; font-size: 0.84em; white-space: nowrap; }
.period-pill.props-sort { height: 40px; flex: 0 1 220px; margin-left: auto; border-radius: 12px; box-shadow: none; }
.period-pill.props-sort select { padding: 0 38px 0 14px; font-size: 0.9em; border-radius: 12px; }
.period-pill.props-sort .chev { right: 12px; width: 16px; height: 16px; }

/* "Operating profit · Mortgage" and "Rent earned · Received · Outstanding": quiet lines under a summary */
.fin-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: -8px 2px 14px; padding: 0 2px;
  font-size: 0.84em; color: var(--muted);
}
.fin-line b { color: var(--text-soft); font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 3px; }
.fin-line small { font-size: 0.92em; opacity: 0.85; }
.fin-line .owed b { color: var(--gold); }
.props-summary .fin-line { margin-top: 0; margin-bottom: 4px; }
.ym-total + .fin-line { margin-top: 8px; }

/* "More figures": secondary figures (operating profit, Mortgage, long-term rent) folded
   under the Properties summary and the P&L, opened with a tap */
.more-figs { margin: 2px 2px 14px; font-size: 0.86em; color: var(--muted); }
.more-figs summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-weight: 650; color: var(--text-soft); padding: 4px 0;
}
.more-figs summary::-webkit-details-marker { display: none; }
.more-figs summary::after { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
.more-figs[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.more-figs dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; margin: 8px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--chip-bg); }
.more-figs dt { color: var(--muted); }
.more-figs dd { margin: 0; text-align: right; font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.more-figs dd.owed { color: var(--gold); }

/* P&L: a month tile's Mortgage line, and the Financing card */
.ym-tile .ym-line.ym-fin .ym-fig { color: var(--text-subtle); }
.pl-group.pl-fin .stat-icon { background: rgba(var(--lavender-rgb), 0.18); box-shadow: none; }
.pl-group.pl-fin .stat-icon svg { color: var(--brand-plum); }
.pl-group-head h3 small { margin-left: 6px; font-size: 0.72em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
