:root{
  --joa-bg:#ffffff;
  --joa-muted:#6b7280;
  --joa-text:#111827;
  --joa-line:#e5e7eb;
  --joa-card:#ffffff;
  --joa-soft:#f3f4f6;
  --joa-soft2:#f8fafc;
  --joa-primary:#0f172a;
  --joa-primary-2:#2563eb;
  --joa-danger:#ef4444;
  --joa-radius:14px;
  --joa-shadow: 0 10px 25px rgba(17,24,39,.08);
  --joa-shadow2: 0 6px 18px rgba(17,24,39,.06);
  --joa-max: 980px;
  --joa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR",
              "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
}

.joa-wrap{
  font-family: var(--joa-font);
  color: var(--joa-text);
  background: var(--joa-bg);
  padding: 34px 14px 54px;
}
.joa-wrap *{box-sizing:border-box;}
.joa-wrap button, .joa-wrap input, .joa-wrap select{font-family:inherit;}

.hero{
  max-width: var(--joa-max);
  margin: 0 auto 18px;
  text-align:center;
}
.hero-title{
  font-size: 30px;
  font-weight: 800;
  margin: 6px 0 6px;
  letter-spacing: -0.02em;
}
.hero-sub{
  margin: 0 0 14px;
  color: var(--joa-muted);
  font-size: 14px;
}

.top-tabs{
  width: min(var(--joa-max), 920px);
  margin: 0 auto;
  background: var(--joa-soft);
  border-radius: 10px;
  padding: 4px;
  display:flex;
  gap: 4px;
}
.top-tab{
  flex:1;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  cursor:pointer;
  font-weight: 700;
  color: var(--joa-muted);
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
}
.top-tab:disabled{cursor:not-allowed; opacity:.55;}
.top-tab.is-active{
  background: var(--joa-card);
  color: var(--joa-text);
  box-shadow: var(--joa-shadow2);
}

.panel{display:none; max-width: var(--joa-max); margin:0 auto;}
.panel.is-active{display:block;}

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

.card-head{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  margin-bottom: 12px;
}
.step-badge{
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #1d4ed8;
  font-weight: 800;
  display:flex;
  align-items:center;
  justify-content:center;
}
.card-title{
  margin:0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing:-0.02em;
}
.card-desc{
  margin: 4px 0 0;
  color: var(--joa-muted);
  font-size: 13px;
}

.stepper{ margin: 10px 0 14px; }
.stepper-list{
  list-style:none;
  padding:0;
  margin:0 0 10px;
  display:flex;
  gap: 14px;
  font-size: 12px;
  color: var(--joa-muted);
  overflow:auto;
}
.stepper-item{
  white-space:nowrap;
  position:relative;
  padding-bottom: 8px;
  font-weight: 700;
}
.stepper-item.is-active{color: var(--joa-text);}
.stepper-item.is-active::after{
  content:"";
  position:absolute;
  left:0; right:0;
  bottom:0;
  height: 3px;
  border-radius: 999px;
  background: var(--joa-primary-2);
}
.stepper-bar{
  width:100%;
  height: 6px;
  background: var(--joa-soft);
  border-radius: 999px;
  overflow:hidden;
}
.stepper-bar-fill{
  height:100%;
  width: 0%;
  background: linear-gradient(90deg, var(--joa-primary-2), #60a5fa);
  border-radius: 999px;
  transition: width .25s ease;
}

.step{display:none;}
.step.is-active{display:block;}

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 760px){
  .grid-2{grid-template-columns: 1fr;}
}

.field{margin: 2px 0;}
.label{
  display:block;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
}
.control{ position:relative; }
.input, .select{
  width:100%;
  height: 44px;
  border: 1px solid var(--joa-line);
  border-radius: 10px;
  padding: 0 12px;
  outline:none;
  background: #fff;
}
.input:focus, .select:focus{
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.prefix{
  position:absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--joa-muted);
  font-weight: 800;
  font-size: 12px;
}
.input-money{ padding-left: 28px; }

.hint{
  margin: 8px 0 0;
  color: var(--joa-muted);
  font-size: 12px;
  line-height: 1.5;
}
.tiny{font-size: 12px; color:#374151;}
.muted2{color: var(--joa-muted);}

.mt-10{margin-top:10px;}
.mt-12{margin-top:12px;}
.mt-16{margin-top:16px;}
.mt-18{margin-top:18px;}

.row-between{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.pill{
  background: var(--joa-soft);
  border:1px solid var(--joa-line);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 12px;
}

.range{ width:100%; margin-top: 6px; }

.switch{
  position:relative;
  display:inline-block;
  width: 48px;
  height: 26px;
}
.switch input{display:none;}
.slider{
  position:absolute; inset:0;
  background: #e5e7eb;
  border-radius: 999px;
  transition: .2s;
  cursor:pointer;
}
.slider::before{
  content:"";
  position:absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
  transition: .2s;
}
.switch input:checked + .slider{ background: #60a5fa; }
.switch input:checked + .slider::before{ transform: translateX(22px); }

.info-box{
  display:flex;
  gap:10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 12px;
}
.info-ic{
  width: 22px; height: 22px;
  border-radius: 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  color: #1d4ed8;
  background: #dbeafe;
  flex: 0 0 auto;
}
.info-text{margin:6px 0 0; color:#1f2937; font-size:12px; line-height:1.6;}

.rate-card{
  border:1px solid var(--joa-line);
  border-radius: 14px;
  padding: 14px;
  background: var(--joa-soft2);
}
.rate-title{font-weight: 900; font-size: 13px;}
.rate-sub{color: var(--joa-muted); font-size: 12px; margin-top: 4px;}
.rate-value{
  text-align:right;
  font-weight: 900;
  font-size: 22px;
  color: var(--joa-primary-2);
}
.rate-unit{font-size: 14px; font-weight: 900;}
.rate-caption{font-size: 12px; color: var(--joa-muted); margin-top: 2px;}
.rate-sum{
  margin-top: 12px;
  border-top: 1px dashed var(--joa-line);
  padding-top: 10px;
}
.sum-row{
  display:flex;
  justify-content:space-between;
  padding: 7px 0;
  font-size: 13px;
}
.sum-row b{font-weight: 900;}

.preview{
  border:1px solid var(--joa-line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.preview-row{
  display:flex;
  justify-content:space-between;
  padding: 6px 0;
  font-size: 13px;
}
.preview-row.total{
  border-top: 1px dashed var(--joa-line);
  margin-top: 8px;
  padding-top: 10px;
  font-weight: 900;
}
.preview-row b{font-weight:900;}

.calc-note{
  border:1px solid #e5e7eb;
  background: #fafafa;
  border-radius: 12px;
  padding: 12px;
}
.calc-note p{margin:6px 0 0; color: var(--joa-muted); font-size:12px; line-height:1.6;}

.card-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top: 14px;
  border-top:1px solid var(--joa-line);
  padding-top: 14px;
}
.foot-right{display:flex; align-items:center; gap: 10px;}
.mini-msg{color: var(--joa-danger); font-size: 12px; min-height: 18px;}

.btn{
  border:1px solid transparent;
  border-radius: 10px;
  height: 40px;
  padding: 0 12px;
  font-weight: 900;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap: 8px;
}
.btn-ghost{
  background:#fff;
  border-color: var(--joa-line);
  color: var(--joa-text);
}
.btn-ghost:hover{background: var(--joa-soft);}
.btn-primary{
  background: var(--joa-primary);
  color:#fff;
}
.btn-primary:hover{filter: brightness(1.05);}
.btn:disabled{opacity:.55; cursor:not-allowed;}

.faq{
  max-width: var(--joa-max);
  margin: 18px auto 0;
  padding: 0 2px;
}
.sec-title{
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 900;
}
.acc-item{
  border-top: 1px solid var(--joa-line);
  padding: 10px 0;
}
.acc-item:last-child{ border-bottom: 1px solid var(--joa-line); }
.acc-item summary{
  cursor:pointer;
  font-weight: 800;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.acc-item summary::-webkit-details-marker{display:none;}
.acc-item summary::after{
  content:"▾";
  color: var(--joa-muted);
  font-weight: 900;
}
.acc-item[open] summary::after{content:"▴";}
.acc-body{
  padding: 10px 0 2px;
  color: #374151;
  font-size: 13px;
  line-height:1.7;
}
.bullets{margin: 8px 0 0 18px;}
.bullets li{margin: 6px 0;}
.ordered{margin: 8px 0 0 18px;}
.ordered li{margin: 6px 0;}

.result-head{margin-bottom: 12px;}
.result-grid{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
}
@media (max-width: 860px){
  .result-grid{grid-template-columns: 1fr;}
}

.result-box{
  border:1px solid var(--joa-line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}
.sub-title{
  margin:0 0 10px;
  font-size: 14px;
  font-weight: 900;
}

.kv{ margin:0; }
.kv-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 7px 0;
  font-size: 13px;
}
.kv-row dt{color: var(--joa-muted);}
.kv-row dd{margin:0; font-weight:900;}
.kv-row.total{
  border-top: 1px dashed var(--joa-line);
  margin-top: 8px;
  padding-top: 12px;
}
.kv-row.total dd{color: var(--joa-primary-2); font-size: 15px;}

.mini-card{
  margin-top: 12px;
  background: #eff6ff;
  border:1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px;
}
.mini-title{font-weight: 900; font-size: 13px; margin-bottom: 8px;}
.mini-kv{display:flex; gap: 10px; justify-content:space-between;}
.mini-kv span{display:block; color:#1f2937; font-size: 12px;}
.mini-kv b{display:block; font-weight: 900; color:#1d4ed8; margin-top: 4px;}

.formula{
  margin-top: 10px;
  font-size: 12px;
  color:#1f2937;
  font-weight: 800;
}
.formula2{
  margin-top: 6px;
  font-size: 12px;
  color:#111827;
  background:#ffffff;
  border:1px dashed #bfdbfe;
  border-radius: 10px;
  padding: 10px;
  line-height:1.55;
}

.chart-wrap{
  display:flex;
  gap: 14px;
  align-items:center;
  justify-content:space-between;
  flex-wrap: wrap;
}
.chart-legend{flex: 1 1 240px; min-width: 220px;}
.legend-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 6px 0;
  font-size: 13px;
}
.legend-row b{font-weight: 900;}
.dot{width:10px;height:10px;border-radius:999px;display:inline-block;margin-right:8px;}
.dot-a{background: var(--joa-primary-2);}
.dot-b{background: #f97316;}
.legend-total{
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--joa-line);
  display:flex;
  justify-content:space-between;
  font-size: 13px;
}
.legend-total-r{font-weight: 900; color: var(--joa-primary-2);}

.result-detail{margin-top: 14px;}

.table{
  border:1px solid var(--joa-line);
  border-radius: 12px;
  overflow:hidden;
  background:#fff;
}
.table .tr{
  display:grid;
  grid-template-columns: 1fr 1fr;
  border-top:1px solid var(--joa-line);
}
.table .tr:first-child{border-top:0;}
.th, .td{padding: 10px 12px; font-size: 13px;}
.th{background: #fafafa; color: var(--joa-muted); font-weight: 800;}
.td{background:#fff; text-align:right; font-weight: 800; color:#111827;}
.tr.total .th{background:#eff6ff; color:#1d4ed8;}
.tr.total .td{background:#eff6ff; color:#1d4ed8;}

.formulaBox{
  margin-top: 10px;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height:1.7;
  color:#1f2937;
  font-weight: 800;
}

.bar-wrap{
  border:1px solid var(--joa-line);
  border-radius: 12px;
  padding: 12px;
  background:#fff;
  overflow:auto;
}

.strategy-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 760px){
  .strategy-grid{grid-template-columns: 1fr;}
}
.strategy-card{
  border:1px solid #bfdbfe;
  background:#eff6ff;
  border-radius: 12px;
  padding: 12px;
  display:flex;
  gap: 10px;
}
.strategy-ic{
  width: 30px; height: 30px;
  border-radius: 10px;
  background:#dbeafe;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:#1d4ed8;
  flex: 0 0 auto;
}
.strategy-title{font-weight: 900; font-size: 13px; margin-bottom: 4px;}
.strategy-desc{color:#374151; font-size: 12px; line-height:1.6; margin:0;}

.actions{
  display:flex;
  gap: 8px;
  justify-content:center;
  padding: 14px 0 2px;
  flex-wrap: wrap;
}
.actions .btn{height: 38px;}

.muted{color: var(--joa-muted); font-size: 13px; line-height:1.7;}

/* ===========================
   ✅ FIX 1: FAQ 세율표 카드형
   =========================== */
.taxrate-list{
  margin-top: 10px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.taxrate-item{
  border:1px solid var(--joa-line);
  background:#fff;
  border-radius: 12px;
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.taxrate-left{
  font-weight: 900;
  color:#111827;
  font-size: 13px;
}
.taxrate-right{
  font-size: 13px;
  color:#374151;
  white-space: nowrap;
}
.taxrate-right b{
  color:#2563eb;
  font-weight: 900;
}

/* ===========================
   ✅ FIX 3: 결과 구간표 콤팩트(한 줄)
   =========================== */
.bracket-compact{
  border:1px solid var(--joa-line);
  border-radius: 12px;
  overflow:auto;        /* 모바일 가로 스크롤 */
  background:#fff;
}
.brk-row{
  display:grid;
  grid-template-columns: 1.35fr 0.45fr 0.70fr; /* 한 줄 3컬럼 */
  gap: 0;
  border-top:1px solid var(--joa-line);
  min-width: 680px; /* 좁은 화면에서는 가로 스크롤 */
}
.brk-row:first-child{border-top:0;}
.brk-h{
  background:#fafafa;
  color: var(--joa-muted);
  font-weight: 900;
  font-size: 12px;
  padding: 10px 12px;
  white-space: nowrap;
}
.brk-c{
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 800;
  color:#111827;
  white-space: nowrap; /* ✅ 두 줄 방지 */
}
.brk-c:nth-child(3n+2),
.brk-c:nth-child(3n+3){
  text-align:right;
}
.brk-active .brk-c{
  background:#ecfeff;
}
.brk-active .brk-c:nth-child(3n+2),
.brk-active .brk-c:nth-child(3n+3){
  color:#0ea5e9;
  font-weight: 900;
}

/* 단순경비율 설정 영역 */
.simple-rate-wrap{
  border:1px solid var(--joa-line);
  border-radius: 14px;
  padding: 14px;
  background:#ffffff;
}

@media print{
  .top-tabs, .card-foot, .actions, .faq, .stepper {display:none !important;}
  .joa-wrap{padding:0;}
  .card{box-shadow:none; border:0;}
  canvas{max-width: 100% !important;}
}
.result-copyright{
  text-align:center;
  color:#8b8b99;
  font-size:11.5px;
  margin-top:8px;
}