/* ============ Property page: tabs, Edit button, Notes + Details ============ */

/* Overview | Bills & Expenses | Details (the middle label is the longest) */
.prop-tabs {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr) minmax(0, 0.85fr); margin: 0 0 18px;
  border-bottom: 1px solid var(--divider);
}
.prop-tabs button {
  position: relative; width: auto; margin: 0; padding: 12px 4px 13px; border-radius: 0;
  background: none; color: var(--text-subtle); font-size: 0.92em; font-weight: 600; white-space: nowrap;
}
.prop-tabs button:hover { filter: none; color: var(--text); }
.prop-tabs button:active { transform: none; }
.prop-tabs button.active { color: var(--text); font-weight: 700; }
.prop-tabs button.active::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--nav-item-active);
}
.prop-pane[hidden] { display: none; }
/* Business Overheads / Other Income: numbers only, so the Overview is the whole page */
#detailView.general-mode :is(.prop-tabs, #editPropertyBtn) { display: none; }
/* Add Expense / Add Income belong to the Overview; Bills has its own Add Bill */
#detailView.records-tab .action-bar { display: none; }
#detailView.records-tab.with-actions { padding-bottom: 24px; }

/* Edit button on the property photo */
.detail-hero .hero-edit-btn {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: auto; height: 42px; padding: 0 16px; margin: 0;
  border-radius: 21px; background: var(--hero-btn-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--hero-btn-border); color: var(--on-photo); font-size: 0.9em; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.detail-hero .hero-edit-btn svg { width: 16px; height: 16px; }

@media (min-width: 1100px) {
  .finance-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
  .finance-grid .finance-wide { grid-column: 1 / -1; }
}

/* ---------- Overview: year selector + January–December ---------- */
.ys { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 0 0 12px; }
.ys button { width: auto; margin: 0; background: none; color: var(--text-subtle); font-weight: 600; }
.ys button:hover { filter: none; color: var(--text); }
.ys button:active { transform: none; }
.ys-arrow { width: 34px; height: 34px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ys-arrow svg { width: 17px; height: 17px; }
.ys-arrow.next svg { transform: scaleX(-1); }
.ys-arrow:disabled { opacity: 0.3; cursor: default; }
.ys-year { min-width: 64px; padding: 6px 10px; border-radius: 10px; font-size: 0.92em; text-align: center; font-variant-numeric: tabular-nums; }
span.ys-year.active { color: var(--text); font-weight: 800; font-size: 1.08em; background: var(--lavender-wash); }

/* 12 compact month tiles: 4 per row (Jan–Apr, May–Aug, Sep–Dec), fewer on narrow phones */
.ym-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.ym-tile {
  min-width: 0; width: 100%; margin: 0; padding: 10px 10px 11px; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; text-align: left;
  background: var(--card); border: 1px solid var(--border); color: inherit; font-weight: normal;
  box-shadow: var(--shadow-float-sm);
}
.ym-tile:hover { filter: none; background: var(--card-hover); }
.ym-tile:active { transform: scale(0.98); }
.ym-tile.now { border-color: rgba(var(--plum-rgb), 0.35); }
.ym-name { font-size: 0.9em; font-weight: 800; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ym-tile.now .ym-name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--plum); vertical-align: middle; }
.ym-tile.empty .ym-name { color: var(--text-subtle); font-weight: 600; }
.ym-tag { margin-top: -4px; font-size: 0.66em; color: var(--muted); }
.ym-line { display: flex; flex-direction: column; min-width: 0; }
.ym-tile .ym-line.net { margin-top: 1px; padding-top: 5px; border-top: 1px solid var(--divider); }
.ym-label { font-size: 0.66em; color: var(--muted); line-height: 1.2; }
.ym-fig { font-size: 0.86em; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.25; color: var(--muted); }
.ym-fig.income { color: var(--green); }
.ym-fig.expense { color: var(--red); }
.ym-fig.net { color: var(--brand-ink); font-weight: 800; }

/* Year total: one slim card under the tiles */
.ym-total {
  display: grid; grid-template-columns: minmax(0, 0.9fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: 8px;
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-float-sm);
}
.ym-total.ym-cols-2 { grid-template-columns: minmax(0, 0.9fr) repeat(2, minmax(0, 1fr)); }
.ym-total.ym-cols-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ym-total-name { font-size: 0.88em; font-weight: 800; color: var(--text); }
.ym-total .ym-fig { font-size: 0.9em; }

@media (min-width: 700px) {
  .ym-grid { gap: 12px; }
  .ym-tile { padding: 12px 14px 13px; }
  .ym-fig { font-size: 0.95em; }
}
@media (max-width: 399px) {
  .ym-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 329px) {
  .ym-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Overview: one month's breakdown ---------- */
.ym-month-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.ym-month-head h2 { margin: 0; font-size: 1.25em; font-weight: 800; letter-spacing: -0.01em; }
.ym-back {
  width: auto; margin: 0; padding: 6px 12px 6px 6px; border-radius: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--lavender-wash); color: var(--plum); font-size: 0.88em; font-weight: 700;
}
.ym-back svg { width: 17px; height: 17px; }
.ym-back:hover { filter: none; }
.ym-summary.ym-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ym-summary.ym-cols-1 { grid-template-columns: minmax(0, 1fr); }
.ym-net { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ym-net span { font-weight: 700; color: var(--text); }
.ym-net b { font-size: 1.15em; font-weight: 800; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.ym-note { margin: 0 0 6px; font-size: 0.85em; color: var(--muted); }
.ym-hist .rec-head .icon-btn, .ym-hist-note .icon-btn { flex-shrink: 0; }
.ym-hist-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 4px 16px; font-size: 0.85em; color: var(--muted); }
.hp-setup-line.ym-setup { margin: 10px 0 0; }

/* ---------- Shared ---------- */
.rec-root { min-width: 0; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rec-head h2 { margin: 0; }
.rec-head .icon-btn { flex-shrink: 0; }
.rec-head-btn { width: auto; margin: 0; padding: 8px 16px; font-size: 0.88em; border-radius: 12px; flex-shrink: 0; }
.rec-head [hidden] { display: none; }
.rec-status { font-size: 0.88em; color: var(--muted); padding: 10px 0; line-height: 1.45; }
.rec-status.error { color: var(--red); }
.rec-msg { font-size: 0.85em; color: var(--muted); margin-top: 8px; line-height: 1.45; overflow-wrap: anywhere; }
.rec-msg:empty { display: none; }
.rec-msg.error { color: var(--red); }
.rec-empty { color: var(--muted); font-size: 0.9em; padding: 10px 0 4px; line-height: 1.45; }
.rec-none { color: var(--muted); }
.rec-group-title {
  margin: 18px 0 2px; font-size: 0.78em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle);
}
.rec-root form[hidden], .rec-root [hidden] { display: none; }
.rec-root 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; line-height: 1.5; resize: vertical; min-height: 120px;
}
.rec-root textarea::placeholder { color: var(--placeholder); }
.rec-root textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ---------- Notes ---------- */
.notes-text { font-size: 0.95em; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; padding: 4px 0; }

/* ---------- Details ---------- */
.detail-list { margin: 0; }
.detail-item { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.detail-item:last-child { border-bottom: none; }
.detail-item dt { color: var(--text-soft); font-size: 0.9em; flex-shrink: 0; max-width: 45%; overflow-wrap: anywhere; }
.detail-item dd { margin: 0; font-weight: 600; font-size: 0.92em; text-align: right; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.details-form .rec-group-title:first-child { margin-top: 8px; }
.custom-fields { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.custom-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 38px; gap: 8px; align-items: center; }
.custom-remove-btn {
  width: 38px; height: 38px; padding: 0; margin: 0; border-radius: 10px; background: var(--btn-danger-bg); color: var(--btn-danger-text);
  display: flex; align-items: center; justify-content: center;
}
.custom-remove-btn svg { width: 14px; height: 14px; }
.custom-add-btn, .tenant-add-btn { width: auto; margin-top: 8px; padding: 10px 14px; font-size: 0.9em; }
@media (max-width: 400px) {
  .custom-row { grid-template-columns: minmax(0, 1fr) 38px; }
  .custom-row .custom-value { grid-column: 1; }
  .custom-row .custom-remove-btn { grid-row: 1; grid-column: 2; }
}

/* Long-Term: the tenancy is set up on the Overview tab; Details points there */
.rec-lt-note {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 4px 0 14px; padding: 12px 14px; border-radius: 14px;
  background: rgba(var(--brand-teal-rgb), 0.08); border: 1px solid rgba(var(--brand-teal-rgb), 0.25);
  font-size: 0.9em; color: var(--text-soft); line-height: 1.4;
}
.rec-lt-note b { display: block; color: var(--text); margin-bottom: 2px; }
.rec-lt-note span { flex: 1 1 180px; min-width: 0; }
.rec-lt-btn { width: auto; margin: 0; padding: 9px 16px; }
