:root{
  --bg:#ffffff;
  --card:#F5F7FA;
  --text:#374151;
  --muted:#6B7280;
  --primary:#0B3D3F;
  --primary2:#0F5E5F;
  --border:#E5E7EB;
  --shadow:0 10px 24px rgba(0,0,0,.07);
  --teal:#2AA7A1;
  --coral:#E06B5A;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

.container{
  width:min(900px, 92vw);
  margin:32px auto 60px;
}

.header{
  margin:0 0 18px;
}
.header.center{ text-align:center; }
.header h1{
  margin:0 0 6px;
  color:var(--primary);
  font-size: clamp(24px, 3vw, 34px);
}
.sub{ margin:0; color:var(--muted); }

.view.hidden{ display:none; }

.form{ display:flex; flex-direction:column; gap:14px; }

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow: var(--shadow);
}

.cardTitle{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.cardTitle h2{
  margin:0;
  font-size:18px;
  color:var(--primary);
}

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.grid-3{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
}

.grid-span-2{ grid-column: span 2; }

label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:14px;
}

input, select{
  width:100%;
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px 12px;
  font-size:15px;
  outline:none;
  background:#fff;
  color:var(--text);
}

input:focus, select:focus{
  border-color: rgba(11,61,63,.45);
  box-shadow:0 0 0 3px rgba(11,61,63,.12);
}

small{ color:var(--muted); }

.money, .percent{
  display:flex;
  align-items:center;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  overflow:hidden;
}
.money span, .percent span{
  padding:10px 10px;
  color:var(--muted);
  border-right:1px solid var(--border);
}
.percent span{ border-right:0; border-left:1px solid var(--border); }
.money input, .percent input{
  border:0;
  border-radius:0;
  padding:10px 12px;
  flex:1;
}

.btn{
  border:0;
  background:var(--primary);
  color:#fff;
  padding:12px 16px;
  border-radius:12px;
  font-size:16px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn:hover{ background:var(--primary2); }

.btn.ghost{
  background:transparent;
  color:var(--primary);
  border:1px solid rgba(11,61,63,.35);
}
.btn.ghost:hover{
  background: rgba(11,61,63,.06);
}

.errorBox{
  display:none;
  background:#FEF2F2;
  border:1px solid #FCA5A5;
  color:#991B1B;
  padding:10px 12px;
  border-radius:12px;
  font-size:14px;
}

.summary{ margin-bottom:18px; }

.miniCard{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:20px 14px;
  box-shadow: var(--shadow);
  text-align:center;
}
.miniValue{
  font-size:26px;
  font-weight:700;
  color:var(--primary);
  margin-bottom:4px;
}
.miniLabel{ color:var(--muted); font-size:13px; }

.chartWrap{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
  min-height:350px;
  position:relative;
}

.legend{
  display:flex;
  gap:18px;
  justify-content:center;
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
}
.dot{
  display:inline-block;
  width:10px; height:10px;
  border-radius:999px;
  margin-right:6px;
}
.dot.teal{ background:var(--teal); }
.dot.coral{ background:var(--coral); }

#viewResults .card{ margin-bottom:18px; }

.analysis h3{ margin:6px 0 8px; color:var(--primary); }
.analysis p{ margin:0 0 10px; color:var(--text); line-height:1.65; font-size:15px; }

/* UPDATED: allow 2 buttons side-by-side, wrap on mobile */
.actions{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}

/* ── Wizard Progress Bar ── */
.wizard-progress{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:20px;
}
.wizard-step{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  flex-shrink:0;
}
.wizard-dot{
  width:36px; height:36px;
  border-radius:50%;
  background:var(--border);
  color:var(--muted);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:14px;
  transition:background .3s, color .3s;
}
.wizard-step.active .wizard-dot,
.wizard-step.completed .wizard-dot{
  background:var(--primary);
  color:#fff;
}
.wizard-step.completed .wizard-dot{
  background:var(--teal);
}
.wizard-label{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  transition:color .3s;
}
.wizard-step.active .wizard-label{
  color:var(--primary);
  font-weight:600;
}
.wizard-connector{
  flex:1;
  height:2px;
  background:var(--border);
  margin:0 8px;
  margin-bottom:22px;
  transition:background .3s;
}
.wizard-connector.completed{
  background:var(--teal);
}

/* ── Wizard Panels ── */
.wizard-panel{
  display:none;
  flex-direction:column;
  gap:14px;
  animation:fadeIn .3s ease;
}
.wizard-panel.active{
  display:flex;
}
@keyframes fadeIn{
  from{ opacity:0; transform:translateY(8px); }
  to{ opacity:1; transform:translateY(0); }
}

/* ── Wizard Navigation ── */
.wizard-nav{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:4px;
}
.wizard-nav .btn{
  flex:1;
  max-width:200px;
}
#prevBtn[hidden]{
  visibility:hidden;
}

/* ── Range Sliders ── */
.slider{
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:6px;
  border-radius:3px;
  background:var(--border);
  outline:none;
  margin-top:2px;
  cursor:pointer;
  border:none;
  padding:0;
}
.slider::-webkit-slider-runnable-track{
  height:6px;
  border-radius:3px;
}
.slider::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:20px; height:20px;
  border-radius:50%;
  background:var(--primary);
  cursor:pointer;
  margin-top:-7px;
  border:2px solid #fff;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
  transition:transform .15s;
}
.slider::-webkit-slider-thumb:hover{
  transform:scale(1.15);
}
.slider::-moz-range-thumb{
  width:20px; height:20px;
  border-radius:50%;
  background:var(--primary);
  cursor:pointer;
  border:2px solid #fff;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
}
.slider::-moz-range-track{
  height:6px;
  border-radius:3px;
  background:var(--border);
}
.slider:focus{
  box-shadow:none;
  border-color:transparent;
}

@media (max-width: 720px){
  .container{
    width:94vw;
    margin:16px auto 40px;
  }

  .header h1{ font-size:22px; }
  .sub{ font-size:14px; }

  .card{ padding:14px 12px; border-radius:12px; }
  .cardTitle h2{ font-size:16px; }

  .grid-2{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .grid-span-2{ grid-column: auto; }

  .miniCard{ padding:16px 10px; }
  .miniValue{ font-size:20px; }
  .miniLabel{ font-size:12px; }

  .chartWrap{
    padding:10px 6px;
    min-height:250px;
  }

  .analysis p{ font-size:14px; }

  .btn{
    width:100%;
    padding:14px 16px;
    font-size:15px;
  }

  .actions{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }

  .wizard-label{ font-size:10px; }
  .wizard-dot{ width:30px; height:30px; font-size:12px; }

  .wizard-nav{
    flex-direction:column;
    align-items:stretch;
  }
  .wizard-nav .btn{ max-width:none; width:100%; }
  #prevBtn[hidden]{ display:none; }

  .slider::-webkit-slider-thumb{
    width:24px; height:24px; margin-top:-9px;
  }
  .slider::-moz-range-thumb{
    width:24px; height:24px;
  }
}
