:root {
  --ink: #17211e;
  --muted: #66736e;
  --forest: #0d3b35;
  --forest-2: #155f52;
  --mint: #dff4e9;
  --cream: #f6f1e7;
  --amber: #f3ab27;
  --red: #b83a2f;
  --line: #dce4df;
  --paper: #fffefb;
  --shadow: 0 18px 55px rgba(22, 47, 41, 0.1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 4%, rgba(243, 171, 39, 0.14), transparent 26rem),
    linear-gradient(180deg, #f8f5ee 0, #f5f8f6 34rem, #eef4f1 100%);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}

button, input { font: inherit; }

.rei-topbar {
  width: min(1380px, calc(100% - 40px));
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rei-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.rei-brand img { width: 42px; height: 42px; }
.rei-brand span { display: grid; line-height: 1.15; }
.rei-brand strong { font-family: "Manrope", sans-serif; font-size: 0.95rem; }
.rei-brand small { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.rei-home { color: var(--forest); font-weight: 800; text-decoration: none; }
.rei-home:hover { text-decoration: underline; }

main { width: min(1380px, calc(100% - 40px)); margin: 0 auto; }

.rei-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 34px;
  align-items: end;
  padding: 68px 0 42px;
}

.rei-kicker {
  margin: 0 0 10px;
  color: #a76105;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.rei-hero h1 {
  max-width: 800px;
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.rei-hero > div > p:last-child {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.65;
}

.rei-hero-note {
  position: relative;
  overflow: hidden;
  padding: 25px;
  border-radius: 24px;
  background: var(--forest);
  color: white;
  box-shadow: var(--shadow);
}

.rei-hero-note::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -70px;
  bottom: -90px;
  border: 28px solid rgba(243, 171, 39, 0.28);
  border-radius: 50%;
}

.rei-hero-note span { display: block; margin-bottom: 10px; color: #f8c969; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.rei-hero-note strong { position: relative; z-index: 1; display: block; max-width: 390px; font-family: "Manrope", sans-serif; font-size: 1.12rem; line-height: 1.45; }

.rei-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 0.74fr); gap: 24px; align-items: start; }
.rei-inputs { display: grid; gap: 18px; }

.rei-card, .rei-results {
  border: 1px solid rgba(61, 92, 83, 0.16);
  border-radius: 28px;
  background: rgba(255, 254, 251, 0.94);
  box-shadow: var(--shadow);
}

.rei-card { padding: clamp(22px, 4vw, 34px); }

.rei-step-head { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 25px; }
.rei-step-head > span { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--forest); color: #fff; font-weight: 800; }
.rei-step-head h2, .rei-results-head h2 { margin: 0; font-family: "Manrope", sans-serif; font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -0.03em; }
.rei-step-head p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }

.rei-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.rei-rent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rei-field-wide { grid-column: 1 / -1; }
.rei-field { display: grid; gap: 8px; }
.rei-field > span:first-child { display: flex; justify-content: space-between; gap: 12px; color: #39433f; font-size: 0.84rem; font-weight: 700; }
.rei-field output { color: var(--forest-2); font-weight: 800; }
.rei-field small { color: var(--muted); font-size: 0.78rem; }
.rei-featured-field { padding: 13px; margin: -13px; border: 1px solid rgba(243, 171, 39, 0.55); border-radius: 16px; background: #fffaf0; }

.rei-money-input, .rei-suffix-input {
  display: flex;
  align-items: center;
  min-height: 49px;
  overflow: hidden;
  border: 1px solid #ccd8d2;
  border-radius: 13px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.rei-money-input:focus-within, .rei-suffix-input:focus-within { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(21, 95, 82, 0.12); }
.rei-money-input b, .rei-suffix-input b { padding: 0 11px; color: #78847f; font-size: 0.72rem; letter-spacing: 0.04em; white-space: nowrap; }
.rei-money-input input, .rei-suffix-input input { width: 100%; min-width: 0; padding: 12px 12px 12px 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 700; }
.rei-suffix-input input { padding-left: 13px; }

.rei-range { width: 100%; accent-color: var(--forest-2); cursor: pointer; }

.rei-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rei-choice label { position: relative; cursor: pointer; }
.rei-choice input { position: absolute; opacity: 0; pointer-events: none; }
.rei-choice span { display: block; padding: 15px; border: 1px solid #ccd8d2; border-radius: 14px; background: white; text-align: center; font-weight: 800; }
.rei-choice input:checked + span { border-color: var(--forest); background: var(--mint); color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.rei-strategy-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rei-choice span strong, .rei-choice span small { display: block; }
.rei-choice span small { margin-top: 4px; color: var(--muted); font-size: 0.7rem; font-weight: 500; line-height: 1.3; }
.rei-choice input:checked + span small { color: #3c7167; }
.rei-income-fields { margin-top: 18px; }
.rei-loan-fields { margin-top: 18px; }

.rei-furnishing-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.rei-furnishing-summary div { padding: 15px 17px; border-radius: 16px; background: var(--forest); color: white; }
.rei-furnishing-summary span { display: block; color: #bfe3d6; font-size: 0.72rem; }
.rei-furnishing-summary strong { display: block; margin-top: 4px; font-family: "Manrope", sans-serif; font-size: 1.12rem; }
.rei-inventory-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 17px; }
.rei-inventory-table { width: 100%; min-width: 660px; border-collapse: collapse; background: white; }
.rei-inventory-table th { padding: 11px 9px; background: #f0f5f2; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; }
.rei-inventory-table td { padding: 8px 9px; border-top: 1px solid #e8eeea; vertical-align: middle; }
.rei-inventory-table .rei-category-row td { padding: 10px 12px; background: #fbf8f0; color: #9b6410; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.rei-inventory-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--forest-2); }
.rei-inventory-table input[type="text"],
.rei-inventory-table input[type="number"] { width: 100%; min-height: 38px; padding: 7px 8px; border: 1px solid #d7e0db; border-radius: 9px; background: #fff; }
.rei-inventory-table .rei-item-name { min-width: 190px; }
.rei-inventory-table .rei-item-qty { width: 68px; }
.rei-inventory-table .rei-item-price { width: 120px; }
.rei-inventory-table .rei-item-total { min-width: 105px; text-align: right; font-weight: 800; }
.rei-remove-item { border: 0; background: transparent; color: #a33c34; cursor: pointer; font-size: 1.1rem; }
.rei-add-item { margin-top: 13px; padding: 10px 14px; border: 1px solid var(--forest-2); border-radius: 12px; background: white; color: var(--forest-2); cursor: pointer; font-weight: 800; }
.rei-inventory-note { margin: 12px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

.rei-results {
  position: sticky;
  top: 18px;
  overflow: hidden;
  padding: clamp(22px, 3.5vw, 34px);
  background: #fff;
}
#investment-premium-output[hidden] { display: none !important; }
#investment-paywall:empty { display: none; }
#investment-paywall .premium-inline-panel { margin: 16px 0 4px; }
.rei-results::before { content: ""; position: absolute; inset: 0 0 auto; height: 7px; background: linear-gradient(90deg, var(--amber), #e67538, var(--forest-2)); }
.rei-results-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.rei-results-head .rei-kicker { margin-bottom: 5px; }
.rei-live-pill { padding: 6px 10px; border-radius: 999px; background: var(--mint); color: var(--forest-2); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }

.rei-result-hero { margin-top: 23px; padding: 23px; border-radius: 22px; background: var(--forest); color: #fff; }
.rei-result-hero span { display: block; color: #bfe3d6; font-size: 0.8rem; font-weight: 700; }
.rei-result-hero strong { display: block; margin: 6px 0 4px; font-family: "Manrope", sans-serif; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -0.05em; }
.rei-result-hero small { color: rgba(255,255,255,0.68); }
.rei-result-hero.is-negative { background: #7f2f29; }

.rei-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.rei-metric-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: #f8faf8; }
.rei-metric-grid span { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 700; }
.rei-metric-grid strong { display: block; margin: 6px 0 3px; font-family: "Manrope", sans-serif; font-size: 1.25rem; }
.rei-metric-grid small { display: block; color: #87908c; font-size: 0.68rem; line-height: 1.35; }

.rei-cost-strip { display: grid; gap: 1px; margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--line); }
.rei-cost-strip div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 15px; background: #fff; }
.rei-cost-strip span { color: var(--muted); font-size: 0.78rem; }
.rei-cost-strip strong { text-align: right; font-size: 0.85rem; }

.rei-scenarios { margin-top: 22px; }
.rei-section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.rei-section-title h3 { margin: 0; font-family: "Manrope", sans-serif; font-size: 1rem; }
.rei-section-title span { color: var(--muted); font-size: 0.7rem; }
.rei-scenario { display: grid; grid-template-columns: 72px minmax(70px, 1fr) auto; align-items: center; gap: 10px; min-height: 38px; font-size: 0.76rem; }
.rei-scenario > span { color: var(--muted); }
.rei-scenario > div { height: 8px; overflow: hidden; border-radius: 999px; background: #edf1ef; }
.rei-scenario i { display: block; width: 0; height: 100%; border-radius: inherit; background: #8aa59b; transition: width 0.25s ease; }
.rei-scenario.is-expected i { background: var(--amber); }
.rei-scenario strong { min-width: 90px; text-align: right; }
.rei-scenario.is-negative strong { color: var(--red); }

.rei-breakdown { margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rei-breakdown summary { padding: 15px 0; cursor: pointer; color: var(--forest); font-weight: 800; }
.rei-breakdown dl { margin: 0 0 14px; }
.rei-breakdown dl div { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; color: var(--muted); font-size: 0.8rem; }
.rei-breakdown dt, .rei-breakdown dd { margin: 0; }
.rei-breakdown dd { text-align: right; color: var(--ink); font-weight: 700; }
.rei-breakdown .rei-total-line { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 800; }

.rei-message { margin-top: 18px; padding: 14px 16px; border-radius: 15px; background: var(--mint); color: #174a40; font-size: 0.82rem; line-height: 1.5; }
.rei-message.is-warning { background: #fff1d2; color: #7a4b06; }
.rei-message.is-danger { background: #fce8e5; color: #8b3028; }

.rei-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 17px; }
.rei-actions button { min-height: 46px; padding: 11px 15px; border-radius: 13px; cursor: pointer; font-weight: 800; }
.rei-primary-button { border: 0; background: var(--amber); color: #251805; }
.rei-primary-button:hover { background: #f9bc4b; }
.rei-secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.rei-disclaimer { margin: 14px 0 0; color: #89928f; font-size: 0.67rem; line-height: 1.5; }

footer { width: min(1380px, calc(100% - 40px)); margin: 48px auto 0; padding: 27px 0 38px; border-top: 1px solid rgba(61,92,83,.18); color: var(--muted); text-align: center; font-size: 0.82rem; }

@media (max-width: 980px) {
  .rei-hero, .rei-layout { grid-template-columns: 1fr; }
  .rei-hero { padding-top: 48px; }
  .rei-results { position: static; }
}

@media (max-width: 660px) {
  .rei-topbar, main, footer { width: min(100% - 24px, 1380px); }
  .rei-brand small { display: none; }
  .rei-hero { gap: 22px; padding: 36px 0 28px; }
  .rei-hero h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
  .rei-card, .rei-results { border-radius: 22px; }
  .rei-field-grid, .rei-rent-grid { grid-template-columns: 1fr; }
  .rei-featured-field { margin: 0; }
  .rei-choice { grid-template-columns: 1fr 1fr; }
  .rei-strategy-grid { grid-template-columns: 1fr; }
  .rei-metric-grid { grid-template-columns: 1fr 1fr; }
  .rei-furnishing-summary { grid-template-columns: 1fr 1fr; }
}

@media print {
  body { background: white; }
  .rei-topbar, .rei-hero-note, .rei-inputs, .rei-actions, footer { display: none !important; }
  main, .rei-layout { width: 100%; display: block; margin: 0; }
  .rei-hero { display: block; padding: 0 0 20px; }
  .rei-hero h1 { font-size: 2.4rem; }
  .rei-results { position: static; box-shadow: none; border: 1px solid #999; }
  .rei-breakdown[open] { display: block; }
}
