/* ── Layout ───────────────────────────────────────────────────────────── */
.result-wrap { padding: 40px 0 80px; }

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.result-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  margin-bottom: 10px;
}
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }


/* ── Cost summary cards ───────────────────────────────────────────────── */
.cost-summary {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}
.cost-summary--warn { border-color: #c8922a; }
.cost-summary-hd--warn { color: #a0701e; }

.cost-summary-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.cost-summary-hd::-webkit-details-marker { display: none; }

.cost-toggle {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.15s;
  display: inline-block;
}
.cost-summary[open] .cost-toggle { transform: rotate(90deg); }

.cost-body { padding: 0 20px 16px; }

.badge-pill {
  font-family: var(--font-body, sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  padding: 2px 9px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Cost table ───────────────────────────────────────────────────────── */
.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 10px;
}
.cost-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.cost-table th.num, .cost-table td.num { text-align: right; }
.cost-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cost-table .muted { color: var(--text-muted); font-size: 0.82rem; }
.cost-table .price-row td { font-weight: 500; }
.cost-table .row-info td { color: var(--text-muted); font-style: italic; }
.cost-table .subtotal-row td { padding-top: 10px; color: var(--text-muted); font-size: 0.84rem; }
.cost-table .total-row td {
  padding-top: 8px;
  border-top: 1.5px solid var(--border);
  border-bottom: none;
  font-size: 0.95rem;
}
.cost-note { font-size: 0.76rem; color: var(--text-muted); margin: 4px 0 0; }
.cost-note--warn { color: #c0572a; font-weight: 500; }
.cost-note--link { margin-top: 8px; font-style: italic; border-top: 1px solid var(--border); padding-top: 8px; }

/* ── Contextual callouts ──────────────────────────────────────────────── */
.result-callout {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.result-callout--info      { background: rgba(91, 143, 204, 0.1); border-left: 3px solid #5b8fcc; color: var(--text); }
.result-callout--highlight { background: rgba(208, 113, 74, 0.1); border-left: 3px solid var(--accent); color: var(--text); }
.result-callout--tip       { background: rgba(76, 154, 82, 0.1); border-left: 3px solid #4c9a52; color: var(--text); }
.result-callout--muted     { background: var(--bg); border-left: 3px solid var(--border); color: var(--text-muted); }
.result-callout--warn      { background: rgba(210, 160, 50, 0.1); border-left: 3px solid #c8922a; color: var(--text); }

.rent-watchout-list {
  margin: 0;
  padding: 0 0 4px 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
}
.rent-watchout-list li { margin-bottom: 10px; }
.rent-watchout-list li:last-child { margin-bottom: 0; }

/* ── Mortgage box ─────────────────────────────────────────────────────── */
.mortgage-box {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.mortgage-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.mortgage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 8px;
}
.mortgage-item { display: flex; flex-direction: column; gap: 2px; }
.mortgage-label { font-size: 0.72rem; color: var(--text-muted); }
.mortgage-value { font-size: 0.88rem; font-weight: 500; }
.mortgage-highlight { color: var(--accent); font-size: 0.95rem; }

/* ── Phases ───────────────────────────────────────────────────────────── */
.phase-block { margin-bottom: 48px; }
.phase-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* ── Step cards ───────────────────────────────────────────────────────── */
.steps-list { display: flex; flex-direction: column; gap: 10px; }

.step-card {
  display: flex;
  align-items: flex-start;
  gap: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, opacity 0.15s;
}
.step-card.step-done { opacity: 0.6; }
.step-card:has(.step-expand[open]) { border-color: var(--accent); }

/* ── Checkbox ─────────────────────────────────────────────────────────── */
.step-check-form { flex-shrink: 0; }

.step-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 56px;
  height: 100%;
  background: none;
  border: none;
  border-right: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--border);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  align-self: stretch;
}
.step-check:hover { background: var(--bg); color: var(--accent); border-right-color: var(--accent); }
.step-check.is-checked { background: var(--accent); color: #fff; border-right-color: var(--accent); }

/* ── Expandable details inside card ──────────────────────────────────── */
.step-expand { flex: 1; min-width: 0; }

.step-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.step-summary::-webkit-details-marker { display: none; }

.step-main { flex: 1; min-width: 0; }

.step-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
}
.step-done .step-title { text-decoration: line-through; }

.step-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.sbadge {
  font-size: 0.73rem;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.sbadge-time { background: #EEF2E6; color: #4A5E30; }
.sbadge-cost { background: #FDF0E8; color: #8B4A1A; }

.step-arrow {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.15s, background 0.15s, color 0.15s;
  margin-top: 2px;
}
.step-expand[open] .step-arrow {
  transform: rotate(90deg);
  background: var(--accent);
  color: #fff;
}

/* ── Step body ────────────────────────────────────────────────────────── */
.step-body { padding: 0 16px 16px 16px; border-top: 1px solid var(--border); }

.step-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  padding-top: 14px;
  margin-bottom: 0;
}

.step-tips {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.step-tips li {
  font-size: 0.81rem;
  color: var(--text-muted);
  padding: 3px 0 3px 16px;
  position: relative;
  line-height: 1.55;
  cursor: default;
}
.step-tips li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.78rem;
}

.step-fullmeta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Summary table ────────────────────────────────────────────────────── */
.summary-section {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
}
.summary-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 16px;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.summary-table th {
  text-align: left;
  padding: 7px 10px;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  font-size: 0.77rem;
  color: var(--text-muted);
  font-weight: 500;
}
.summary-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.summary-table .summary-phase-row td {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
  padding: 9px 10px 5px;
}
.summary-table .summary-done td { color: var(--text-muted); text-decoration: line-through; }
.summary-dur { color: var(--text-muted); width: 30%; }
.summary-cost { white-space: nowrap; width: 20%; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .result-header { flex-direction: column; gap: 16px; }
  .progress-track { width: 120px; }
  .step-check { width: 38px; font-size: 0.75rem; }
  .step-summary { padding: 12px; gap: 8px; }
  .step-badges { flex-direction: column; gap: 4px; }
  .summary-dur, .summary-cost { width: auto; }
}
