:root {
  --ink: #16251f;
  --ink-soft: #2d3b35;
  --paper: #f5f0e6;
  --white: #fffdf8;
  --line: #d9d1c2;
  --green: #24704d;
  --green-soft: #dcebdd;
  --amber: #b76b18;
  --amber-soft: #f5e5ca;
  --red: #a13c32;
  --red-soft: #f4dfdc;
  --muted: #6b706b;
  --shadow: 0 18px 50px rgba(22, 37, 31, .09);
  --radius: 18px;
  --max: 1180px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(36, 112, 77, .28);
  outline-offset: 2px;
}
.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  background: var(--white);
  color: var(--ink);
  padding: .7rem 1rem;
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 240, 230, .92);
  border-bottom: 1px solid rgba(22, 37, 31, .1);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 74px;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  border: 0;
  background: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0;
  text-align: left;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 850;
  letter-spacing: -.04em;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: .72rem; }
.main-nav { display: flex; gap: .25rem; }
.nav-button, .tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: .65rem .85rem;
  font-size: .9rem;
  font-weight: 700;
}
.nav-button:hover, .nav-button.is-active, .tab:hover, .tab.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(22, 37, 31, .08);
}
main { max-width: var(--max); margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.page.is-hidden, .tab-panel.is-hidden, .is-hidden { display: none !important; }
.hero {
  min-height: 310px;
  padding: clamp(2rem, 6vw, 4.8rem);
  background: var(--ink);
  color: var(--white);
  border-radius: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -100px;
  top: -150px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255,255,255,.035), 0 0 0 84px rgba(255,255,255,.025);
}
.hero > * { position: relative; z-index: 1; }
.hero h1, .guide-hero h1, .editor-heading h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
  margin: .35rem 0 1rem;
}
.hero h1 { max-width: 700px; font-size: clamp(2.8rem, 7vw, 5.3rem); }
.hero h1 em { color: #9dc8aa; font-weight: inherit; }
.hero p:not(.eyebrow) { max-width: 620px; color: #c9d1cc; font-size: 1.06rem; margin: 0; }
.eyebrow { margin: 0; font-size: .72rem; letter-spacing: .16em; font-weight: 850; color: var(--green); }
.hero .eyebrow, .guide-hero .eyebrow { color: #9dc8aa; }
.button {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: .72rem 1rem;
  font-weight: 800;
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  justify-content: center;
}
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: var(--green); color: white; }
.button-primary:hover:not(:disabled) { background: #1d5c40; }
.hero .button-primary { background: #a9d2b4; color: var(--ink); white-space: nowrap; }
.hero .button-primary:hover { background: #c0e0c8; }
.button-large { padding: 1rem 1.25rem; }
.button-secondary { background: var(--white); color: var(--ink); border-color: var(--line); }
.button-secondary:hover { border-color: var(--ink); }
.button-danger { background: var(--red); color: white; }
.text-button { border: 0; background: none; color: var(--green); padding: .4rem 0; font-weight: 750; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.25rem 0 3rem; }
.stat-card, .result-card {
  background: var(--white);
  border: 1px solid rgba(22, 37, 31, .1);
  border-radius: var(--radius);
  padding: 1.2rem;
}
.stat-card span, .result-card span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.stat-card strong, .result-card strong { display: block; font-size: 1.65rem; line-height: 1.1; margin-top: .4rem; letter-spacing: -.035em; }
.section-block { margin-top: 2rem; }
.section-heading, .editor-title-row, .card-heading, .danger-zone {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}
.section-heading { align-items: flex-end; margin-bottom: 1rem; }
.section-heading h2, .card-heading h2 { margin: .2rem 0 0; letter-spacing: -.025em; }
.compact-field { color: var(--muted); font-size: .78rem; font-weight: 750; display: flex; align-items: center; gap: .55rem; }
.compact-field select { width: auto; }
.card-list { display: grid; gap: .75rem; }
.deal-card {
  background: var(--white);
  border: 1px solid rgba(22,37,31,.11);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(100px, .55fr)) auto;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 1px 0 rgba(22,37,31,.03);
}
.deal-card:hover { border-color: rgba(36,112,77,.45); box-shadow: var(--shadow); transform: translateY(-1px); }
.deal-title { min-width: 0; }
.deal-title h3 { margin: 0 0 .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-title p { margin: 0; color: var(--muted); font-size: .82rem; }
.deal-metric span { display: block; color: var(--muted); font-size: .7rem; font-weight: 700; }
.deal-metric strong { font-size: .98rem; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: .3rem .6rem;
  background: #ebe7de;
  color: var(--ink-soft);
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .03em;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: #8e4f0d; }
.badge.red { background: var(--red-soft); color: var(--red); }
.card-arrow { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--paper); color: var(--ink); font-weight: 900; }
.empty-state {
  border: 1px dashed #b9b1a3;
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  background: rgba(255,253,248,.5);
}
.empty-state h3 { margin-bottom: .3rem; }
.empty-state p { color: var(--muted); margin-top: 0; }
.editor-heading { margin-bottom: 1.25rem; }
.editor-heading h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); margin-bottom: 0; }
.editor-title-row { align-items: flex-end; margin-top: .75rem; }
.advice-panel {
  padding: 1.35rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--white);
}
.advice-panel h2 { margin: .25rem 0; font-size: 1.45rem; }
.advice-panel p:not(.eyebrow) { margin: 0; color: var(--muted); }
.advice-good { background: var(--green-soft); border-color: #a5c9af; }
.advice-warn { background: var(--amber-soft); border-color: #ddbd8c; }
.advice-stop { background: var(--red-soft); border-color: #d8a59f; }
.advice-numbers { display: grid; grid-template-columns: repeat(3, auto); gap: 1.6rem; align-items: center; }
.advice-numbers span { display: block; font-size: .7rem; color: var(--muted); font-weight: 750; }
.advice-numbers strong { font-size: 1.16rem; white-space: nowrap; }
.tabs {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  padding: .35rem;
  margin: 1rem 0;
  border: 1px solid rgba(22,37,31,.1);
  background: rgba(255,253,248,.6);
  border-radius: 999px;
}
.tab { flex: 1 0 auto; }
.form-card {
  background: var(--white);
  border: 1px solid rgba(22,37,31,.1);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.7rem);
  margin-bottom: 1rem;
}
.card-heading { margin-bottom: 1.2rem; }
.card-heading > p { max-width: 470px; color: var(--muted); margin: .15rem 0 0; font-size: .88rem; }
.step-number { color: var(--green); font-family: Georgia, serif; margin: 0; font-size: .85rem; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.money-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .4rem; font-size: .78rem; color: var(--ink-soft); font-weight: 750; }
.field-wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefa;
  color: var(--ink);
  padding: .75rem .8rem;
  min-height: 44px;
}
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #afa696; }
.check-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--paper);
}
.check-row input, .checklist input { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }
.check-row strong, .check-row small { display: block; }
.check-row small { color: var(--muted); margin-top: .15rem; }
.formula { margin-top: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); font-size: .86rem; }
.formula summary { color: var(--ink); font-weight: 800; cursor: pointer; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.reality-note {
  background: var(--ink);
  color: var(--white);
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.reality-note p { color: #c9d1cc; margin: .3rem 0 0; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checklist { display: grid; gap: .15rem; margin-bottom: 1rem; }
.checklist label {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .62rem .3rem;
  border-bottom: 1px solid #eee8dc;
  font-size: .88rem;
}
.upload-zone {
  border: 1.5px dashed #aaa190;
  background: var(--paper);
  border-radius: 14px;
  min-height: 155px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .2rem;
  text-align: center;
  padding: 1rem;
  margin: .8rem 0;
  cursor: pointer;
}
.upload-zone:hover { border-color: var(--green); background: var(--green-soft); }
.upload-zone small { color: var(--muted); }
.upload-icon { font-size: 2rem; color: var(--green); line-height: 1; }
.photo-preview img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: var(--paper); margin-bottom: .7rem; }
.photo-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; }
.photo-card { background: var(--paper); border-radius: 13px; overflow: hidden; border: 1px solid var(--line); }
.photo-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #e6e0d4; }
.photo-card-body { padding: .7rem; }
.photo-card-body strong { display: block; font-size: .78rem; }
.photo-card-actions { display: grid; grid-template-columns: 1fr auto; gap: .4rem; margin-top: .5rem; }
.photo-card-actions input { min-height: 36px; padding: .4rem; }
.icon-button { border: 1px solid #d4cbc0; border-radius: 9px; background: white; color: var(--red); padding: .4rem .55rem; font-weight: 800; }
.field-help { color: var(--muted); font-size: .78rem; }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.danger-zone { border: 1px solid #d8a59f; background: var(--red-soft); border-radius: var(--radius); padding: 1.1rem 1.25rem; align-items: center; }
.danger-zone p { margin: .2rem 0 0; color: #74433e; font-size: .82rem; }
.guide-page { max-width: 980px; margin: 0 auto; }
.guide-hero {
  padding: clamp(2rem, 6vw, 4.5rem);
  background: var(--ink);
  color: white;
  border-radius: 28px;
  margin-bottom: 1.2rem;
}
.guide-hero h1 { font-size: clamp(2.8rem, 8vw, 5.4rem); max-width: 700px; }
.guide-hero > p:not(.eyebrow) { color: #c9d1cc; max-width: 650px; font-size: 1.05rem; }
.steps { background: var(--white); border-radius: var(--radius); border: 1px solid rgba(22,37,31,.1); padding: .5rem 1.4rem; }
.steps article { display: grid; grid-template-columns: 52px 1fr; gap: 1rem; padding: 1.4rem 0; border-bottom: 1px solid #eee7da; }
.steps article:last-child { border-bottom: 0; }
.steps article > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-family: Georgia, serif; font-weight: 800; }
.steps h2 { margin: 0 0 .25rem; font-size: 1.12rem; }
.steps p { margin: 0; color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.guide-card { background: var(--white); border: 1px solid rgba(22,37,31,.1); border-radius: var(--radius); padding: 1.4rem; }
.guide-card dl { margin-bottom: 0; }
.guide-card dl > div { padding: .75rem 0; border-bottom: 1px solid #eee7da; }
.guide-card dl > div:last-child { border-bottom: 0; }
.guide-card dt { font-weight: 850; }
.guide-card dd { margin: .15rem 0 0; color: var(--muted); }
.checklist-card { background: var(--green-soft); }
.checklist-card h2 { margin: .3rem 0; }
.checklist-card ul { padding-left: 1.2rem; margin: 1rem 0 1.4rem; }
.checklist-card li { margin-bottom: .6rem; }
.disclaimer { border-left: 4px solid var(--amber); padding: .8rem 1rem; background: var(--amber-soft); border-radius: 0 12px 12px 0; }
.disclaimer p { margin: .25rem 0 0; color: #704c28; }
.loading-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(22,37,31,.5); display: grid; place-items: center; align-content: center; gap: .75rem; color: white; font-weight: 800; backdrop-filter: blur(3px); }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 110; max-width: 390px; padding: .85rem 1rem; background: var(--ink); color: white; border-radius: 12px; box-shadow: var(--shadow); }
.toast.error { background: var(--red); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 900px) {
  .hero { display: grid; align-items: end; }
  .stats-grid, .result-grid { grid-template-columns: repeat(2, 1fr); }
  .money-grid { grid-template-columns: repeat(2, 1fr); }
  .deal-card { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(90px,.55fr)) auto; }
  .deal-card .deal-metric:nth-of-type(3) { display: none; }
  .advice-panel { display: grid; }
  .advice-numbers { grid-template-columns: repeat(3, 1fr); }
  .photo-gallery { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .topbar-inner { align-items: flex-start; flex-direction: column; padding: .65rem 1rem .5rem; }
  .main-nav { width: 100%; overflow-x: auto; }
  .nav-button { flex: 1 0 auto; padding: .55rem .65rem; font-size: .78rem; }
  main { padding: 1rem .85rem 4rem; }
  .hero { min-height: 430px; padding: 1.5rem; border-radius: 22px; }
  .hero h1 { font-size: 3.2rem; }
  .hero .button { width: 100%; }
  .stats-grid { gap: .6rem; margin-bottom: 2rem; }
  .stat-card, .result-card { padding: .9rem; }
  .stat-card strong, .result-card strong { font-size: 1.25rem; }
  .section-heading { align-items: flex-start; }
  .deal-card { grid-template-columns: 1fr auto; gap: .7rem; }
  .deal-card .deal-metric { display: none; }
  .editor-title-row { display: grid; }
  .editor-title-row .button { width: 100%; }
  .advice-numbers { grid-template-columns: 1fr 1fr; gap: .8rem; }
  .advice-numbers > div:last-child { grid-column: 1 / -1; }
  .tabs { border-radius: 15px; }
  .form-grid, .money-grid, .two-column, .guide-grid { grid-template-columns: 1fr; }
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .danger-zone { display: grid; }
  .danger-zone .button { width: 100%; }
  .card-heading { display: grid; gap: .3rem; }
  .guide-hero { border-radius: 22px; padding: 1.5rem; }
  .guide-hero h1 { font-size: 3rem; }
}
@media (max-width: 390px) {
  .photo-gallery { grid-template-columns: 1fr; }
  .advice-numbers { grid-template-columns: 1fr; }
  .advice-numbers > div:last-child { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .spinner { animation-duration: 1.8s; }
}