:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --line:#e5e7eb;
  --text:#111827;
  --muted:#6b7280;
  --accent:#111827;
  --soft:#f3f4f6;
  --blue-soft:#eef2ff;
  --blue-line:#c7d2fe;
  --blue-text:#1e3a8a;
  --danger-line:#fecaca;
  --danger-text:#991b1b;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

.wrap{
  max-width:1200px;
  margin:auto;
  padding:20px;
}

.hero{
  margin-bottom:20px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:20px;
  margin-bottom:20px;
}

h1{
  margin:0 0 10px;
}

h2{
  margin:0 0 14px;
}

h3{
  margin:0 0 12px;
}

h4{
  margin:0 0 10px;
  font-size:14px;
}

p{
  line-height:1.6;
}

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

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

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.field label{
  font-size:14px;
  font-weight:700;
}

input{
  padding:10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}

.radioRow{
  display:flex;
  gap:20px;
  align-items:center;
  min-height:42px;
}

button{
  margin-top:12px;
  padding:10px 16px;
  border:none;
  border-radius:8px;
  background:var(--accent);
  color:#fff;
  cursor:pointer;
  font-weight:600;
}

.btn.danger{
  background:#fff;
  color:var(--danger-text);
  border:1px solid var(--danger-line);
}

#msgBox{
  display:none;
  margin-top:10px;
  color:#b91c1c;
  line-height:1.6;
}

/* 그래프 3개 한 줄 */
.charts3{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
  margin-top:12px;
}

.charts3 canvas{
  width:100% !important;
  height:300px !important;
}

.chartLegend{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:20px;
  margin-top:12px;
  width:100%;
  white-space:nowrap;
}

.chartLegend .l{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--text);
}

.chartLegend .l::before{
  content:"";
  width:16px;
  height:6px;
  display:inline-block;
  border-radius:3px;
}

.chartLegend .current::before{ background:#3b82f6; }
.chartLegend .prev::before{ background:#f87171; }
.chartLegend .p3::before{ background:#f59e0b; }
.chartLegend .p50::before{ background:#eab308; }
.chartLegend .p97::before{ background:#14b8a6; }

/* 결과 버튼 */
.resultActions{
  display:flex;
  justify-content:center;
  gap:12px;
  margin-top:18px;
  flex-wrap:wrap;
}

/* 상세 분석 섹션 */
.detailSection{
  margin-top:18px;
}

.detailDesc{
  color:var(--muted);
  line-height:1.6;
  margin-bottom:14px;
}

.detailButtons{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}

/* 결제 placeholder */
.paymentPlaceholder{
  margin-bottom:16px;
}

.paymentPlaceholderBox{
  border:1px dashed var(--blue-line);
  background:var(--blue-soft);
  border-radius:12px;
  padding:14px;
  color:var(--blue-text);
  line-height:1.6;
}

.paymentPlaceholderBox strong{
  display:block;
  margin-bottom:6px;
}

/* 이전 기록 카드 */
.recordItem{
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  background:#fff;
  margin-top:12px;
}

.recordHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}

.recordHead strong{
  font-size:15px;
}

.modeRow{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  align-items:center;
  margin:8px 0 12px;
}

.modeRow label{
  font-size:14px;
  font-weight:500;
}

/* free summary 내부 card 간격 안정화 */
#freeSummary .card{
  margin-bottom:16px;
}

#freeSummary .card:last-child{
  margin-bottom:0;
}

@media (max-width:900px){
  .grid,
  .grid3{
    grid-template-columns:1fr;
  }

  .wrap{
    max-width:100%;
  }
}

/* 유료 리포트 안내 모달 */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
}

.modal-content {
  background: white;
  max-width: 420px;
  margin: 10% auto;
  padding: 20px;
  border-radius: 12px;
}

.modal-content h3 {
  margin-top: 0;
}

.modal-content ul {
  padding-left: 18px;
  line-height: 1.6;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.modal-buttons button {
  padding: 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

#btnPreview {
  background: #e5e7eb;
  color: #111;
}

#btnProceed {
  background: #111827;
  color: white;
}

#btnCancel {
  background: #9ca3af;
  color: white;
}

/* Admnin Modal */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.admin-modal-content {
  background: #fff;
  width: min(420px, 88vw);
  padding: 28px 24px;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.admin-modal-content h3 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

#adminPasswordInput {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 16px;
  outline: none;
}

#adminPasswordInput:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.admin-modal-actions {
  display: flex;
  gap: 10px;
}

.admin-modal-actions button {
  background: #0f172a;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#adminCancelBtn {
  background: #475569;
}