:root {
  --brand: #5b4cf5;          /* 시안 보라 — ⚠️ 플로우 브랜드 값 받으면 교체 */
  --brand-soft: #f5f3ff;
  --brand-pill: #ecebff;
  --text: #1b1b1f;
  --sub: #4a4a55;
  --muted: #8a8a96;
  --danger: #e5484d;
  --line: #dedee6;
  --line-soft: #ececf1;
  --page: #f4f4f6;
  --panel: #ffffff;
  --dark: #1b1b1f;
}

* { box-sizing: border-box; font-style: normal; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--text);
  font-family: Pretendard, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }

.panel {
  max-width: 1040px; margin: 32px auto; padding: 56px 60px;
  background: var(--panel); border-radius: 16px;
}
.page-head h1 { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { margin: 12px 0 0; color: var(--sub); font-size: 17px; }

.block { margin-top: 44px; }
.label { margin: 0 0 16px; font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req { color: var(--danger); }
.pill { margin-left: 8px; padding: 4px 10px; border-radius: 999px; background: var(--brand-pill); color: var(--brand); font-size: 14px; font-weight: 600; }

/* 조건 입력 */
.conditions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.stepper {
  display: flex; align-items: center; width: 280px; height: 60px;
  border: 1px solid var(--line); border-radius: 8px;
}
.stepper button {
  width: 64px; height: 100%; border: 0; background: none; cursor: pointer;
  color: var(--brand); font-size: 26px; line-height: 1;
}
.stepper button:disabled { color: var(--line); cursor: default; }
.stepper-value { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 19px; }
.stepper-value input {
  width: 3.2ch; border: 0; outline: 0; text-align: right; font-weight: 700; font-size: 19px;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper-value input::-webkit-outer-spin-button,
.stepper-value input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper:focus-within { border-color: var(--brand); }

.check { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 19px; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box {
  width: 26px; height: 26px; border-radius: 6px; border: 1.5px solid var(--line);
  display: grid; place-items: center; background: #fff;
}
.check input:checked + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box::after { content: ''; width: 7px; height: 13px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-2px) rotate(45deg); }
.check input:focus-visible + .box { outline: 3px solid var(--brand-pill); outline-offset: 2px; }

.discount-type { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; }
.discount-type select { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.min-badge { display: inline-flex; align-items: center; gap: 6px; margin: 12px 0 0; padding: 5px 12px; border: 1px solid #d9d3ff; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 14px; font-weight: 600; }
.notice { margin: 12px 0 0; color: var(--danger); font-size: 15px; }
.notice a { color: var(--brand); font-weight: 600; }

/* 상품 카드 */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  position: relative; display: block; padding: 32px 30px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .15s, background-color .15s;
}
.card:hover { border-color: #bdb6ff; }
.card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.card.selected { border: 2px solid var(--brand); padding: 31px 29px; background: var(--brand-soft); }
.card:has(input:focus-visible) { outline: 3px solid var(--brand-pill); outline-offset: 2px; }
.card .badge {
  position: absolute; top: -14px; right: 22px; padding: 4px 14px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; display: none;
}
.card.selected .badge { display: block; }
/* 추천 요금제: 선택 전에도 «추천» 배지와 보라 테두리로 강조 */
.card.recommended { border: 2px solid var(--brand); padding: 31px 29px; }
.card.recommended .badge { display: block; padding: 5px 16px; font-size: 14px; font-weight: 700; box-shadow: 0 4px 12px rgba(91, 76, 245, .25); }
.card .name { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 700; }
.card .dot { position: relative; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--muted); flex: none; background: #fff; }
.card.selected .dot { border-color: var(--brand); background: var(--brand); }
.card.selected .dot::after { content: ''; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.card .tagline { margin-top: 8px; color: var(--sub); font-size: 15px; }
.card .unit { margin-top: 18px; color: var(--sub); font-size: 15px; }
.card .unit s { color: var(--muted); margin-right: 2px; }
.card .off { font-style: normal; color: #0f9d58; font-weight: 700; white-space: nowrap; }
.card .big { margin-top: 8px; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.card .big small { font-size: 16px; font-weight: 500; color: var(--sub); margin-left: 4px; }
.card .sub { margin-top: 6px; color: var(--sub); font-size: 14px; }
.card .specs { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); display: grid; gap: 7px; font-size: 14px; }
.card .specs div { display: flex; justify-content: space-between; gap: 10px; }
.card .specs dt { color: var(--sub); }
.card .specs dd { margin: 0; color: var(--text); text-align: right; }
.card .summary { margin-top: 12px; color: var(--sub); font-size: 13px; line-height: 1.5; }
.basis { margin-left: 6px; color: var(--muted); font-size: 15px; font-weight: 500; }
.char-count { margin: 6px 0 0; text-align: right; color: var(--muted); font-size: 13px; }
/* 문의사항 · 의견 상자 */
.ask-box { margin-bottom: 28px; padding: 24px 26px; border: 1.5px solid #cfc8ff; border-left: 5px solid var(--brand); border-radius: 12px; background: var(--brand-soft); }
.ask-head { display: flex; align-items: center; gap: 10px; color: var(--brand); }
.ask-box .ask-head label { margin: 0; font-size: 18px; font-weight: 700; color: var(--text); }
.ask-sub { margin: 6px 0 14px; color: var(--sub); font-size: 15px; }
.ask-box textarea { background: #fff; border-color: #d9d3ff; }

/* 예상 금액 */
.estimate { border-top: 2px solid var(--dark); border-bottom: 2px solid var(--dark); padding: 0 4px; }
.estimate + .estimate { margin-top: 20px; }
.empty { margin: 0; padding: 28px 0; color: var(--muted); text-align: center; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }

/* 단계 */
.steps { display: flex; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--page); }
.steps li b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: #fff; font-size: 13px; }
.steps li.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.steps li.on b { background: var(--brand); }
.sub-block { margin-top: 40px; }
.sub-block:first-of-type { margin-top: 0; }
.label-hint { margin: -8px 0 16px; color: var(--sub); font-size: 15px; }
.info-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 36px; padding: 14px 18px; border-radius: 10px; background: var(--page); font-size: 15px; color: var(--sub); }
.info-summary .link { font-size: 14px; }
#next-btn { margin-top: 4px; }

/* 여러 장 견적서: 화면에선 탭으로 한 장씩, 인쇄·PDF 는 전부 */
.quote-tabs { display: flex; justify-content: center; gap: 8px; margin: 4px auto 28px; }
.quote-tabs button { height: 38px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.quote-tabs button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
#quote-sheets .sheet { display: none; }
#quote-sheets .sheet.current { display: block; }
.is-pdf #quote-sheets .sheet { display: block; }
.rows { margin: 0; padding: 24px 0 18px; border-bottom: 1px solid var(--line-soft); }
.rows .row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; font-size: 18px; color: var(--sub); }
.rows dt, .rows dd { margin: 0; }
.rows dd { font-variant-numeric: tabular-nums; text-align: right; }
.rows .minus dd { color: var(--danger); }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 28px 0 30px; }
.total span { font-size: 26px; font-weight: 700; }
.total strong { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* 발급 */
.primary {
  width: 100%; height: 72px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--dark); color: #fff; font-size: 22px; font-weight: 700;
}
.primary:disabled { background: #b9b9c2; cursor: not-allowed; }

.is-blocked .estimate { opacity: .35; pointer-events: none; }


/* 발급 정보 입력 */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.field.wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 8px; font-size: 16px; font-weight: 600; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 16px; outline: 0;
}
.field textarea { height: auto; padding: 14px 16px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.err { margin: 6px 0 0; color: var(--danger); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consents { margin: 28px 0 24px; padding: 20px 22px; border-radius: 10px; background: var(--page); display: grid; gap: 14px; }
.consent { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.consent .check { font-size: 16px; gap: 10px; }
.consent .check .box { width: 22px; height: 22px; flex: none; }
.consent .check b { font-weight: 600; }
.consent .hint { flex-basis: 100%; margin: 0 0 0 32px; color: var(--brand); font-size: 14px; }
.consent .err { flex-basis: 100%; margin-left: 32px; }
.link { border: 0; background: none; padding: 4px 0; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; }

.form-error { margin: 0 0 14px; padding: 12px 16px; border-radius: 8px; background: #fff0f0; color: var(--danger); font-size: 15px; }
.primary.loading { position: relative; color: transparent; }
.primary.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 동의서 레이어 */
dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 28px; border: 0; border-radius: 14px;
  color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(20, 20, 30, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h3 { margin: 0; font-size: 20px; }
.close { border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.dialog-body { margin: 16px 0 22px; font-size: 15px; line-height: 1.65; color: var(--sub); }
.dialog-body h4 { margin: 0 0 8px; font-size: 16px; color: var(--text); }
.dialog-body p { margin: 0 0 10px; }
.dialog-body table { width: 100%; border-collapse: collapse; margin: 12px 0 14px; font-size: 14px; }
.dialog-body th, .dialog-body td { border: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
.dialog-body th { width: 30%; background: var(--page); color: var(--text); font-weight: 600; }
.primary.small { height: 52px; font-size: 17px; }

/* 모바일 (360px 이상) */
@media (max-width: 860px) {
  .panel { margin: 0; padding: 32px 16px 40px; border-radius: 0; }
  .page-head h1 { font-size: 28px; }
  .page-head p { font-size: 15px; }
  .block { margin-top: 32px; }
  .label { font-size: 17px; }
  .pill { font-size: 12px; margin-left: 4px; }
  .conditions { gap: 16px; }
  .stepper { width: 100%; height: 54px; }
  .check { font-size: 17px; }
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 22px 20px; }
  .card.selected, .card.recommended { padding: 21px 19px; }
  .card .name { font-size: 22px; }
  .card .unit { margin-top: 12px; font-size: 14px; }
  .card .big { font-size: 26px; }
  .basis { display: block; margin: 4px 0 0; font-size: 13px; }
  .ask-box { padding: 18px 16px; }
  .ask-box .ask-head label { font-size: 16px; }
  .ask-sub { font-size: 14px; }
  .rows .row { font-size: 15px; }
  .total span { font-size: 18px; }
  .total strong { font-size: 28px; }
  .primary { height: 60px; font-size: 18px; }
  .steps { font-size: 13px; }
  .info-summary { font-size: 14px; }
  .fields { grid-template-columns: 1fr; gap: 14px; }
  .consents { padding: 16px; }
  .consent .check { font-size: 15px; align-items: flex-start; }
  dialog { padding: 22px 18px; }
}

/* 견적서 — 기존 양식 */
.is-quote .page-head, .is-quote .block { display: none; }
.back { display: block; width: min(700px, 100%); text-align: left; border: 0; background: none; padding: 0; margin: 0 auto 6px; font-size: 16px; color: var(--sub); cursor: pointer; }
.back:hover { color: var(--brand); }
.quote-actions { display: flex; justify-content: center; gap: 10px; margin-top: 48px; }
.quote-actions .primary, .quote-actions .secondary { width: 112px; height: 38px; border-radius: 6px; font-size: 13px; font-weight: 700; padding: 0; }
.secondary {
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--dark); border-radius: 6px;
  background: #fff; color: var(--text); text-decoration: none; cursor: pointer;
}
.pay-link { display: block; width: max-content; margin: 44px auto 0; color: var(--text); font-size: 13px; text-decoration: none; }
.pay-link:hover { color: var(--brand); }

.sheet { max-width: 700px; margin: 0 auto; color: #111; font-size: 10.5px; line-height: 1.55; }
.sheet a { color: #2f6fe4; }
.sheet .top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.sheet h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.sheet .qno { margin-top: 10px; font-size: 10.5px; }
.sheet .supplier { font-size: 10.5px; line-height: 1.9; }
.sheet .supplier b { font-weight: 700; margin-right: 4px; }
.sheet .supplier .gap { margin-left: 10px; }
.sheet .supplier img { width: 42px; height: 12px; vertical-align: -2px; margin-left: 4px; }
.sheet .to { margin-top: 64px; font-size: 14px; font-weight: 700; }
.sheet .dates { margin-top: 8px; }
.sheet .dates b { font-weight: 700; margin-right: 8px; }
.sheet .dates .gap { margin-left: 16px; }

.sheet table.items { width: 100%; margin-top: 22px; border-collapse: collapse; border-top: 2px solid #111; border-bottom: 2px solid #111; font-variant-numeric: tabular-nums; }
.sheet .items th { padding: 9px 4px; border-bottom: 1px solid #111; font-weight: 700; text-align: center; white-space: nowrap; }
.sheet .items td { padding: 11px 4px; text-align: right; white-space: nowrap; }
.sheet .items td.name { text-align: left; white-space: normal; }
.sheet .items tbody tr:first-child td { padding-top: 14px; }
.sheet .items tbody tr:last-child td { padding-bottom: 14px; }
.sheet .items .disc td { color: #d93025; }
.sheet .items .sum td { border-top: 1px solid #111; border-bottom: 1px solid #111; font-weight: 700; padding: 11px 4px; }
.sheet .items .sum td.name { text-align: left; }
.sheet .items .grand td { padding: 16px 4px 18px; vertical-align: middle; }
.sheet .items .grand .g-label { text-align: left; }
.sheet .items .grand .g-label b { display: block; font-size: 17px; font-weight: 800; }
.sheet .items .grand .g-label small { font-size: 9px; }
.sheet .items .grand .amount { font-size: 20px; font-weight: 800; text-align: right; }

.sheet .billing { margin-top: 48px; }
.sheet .billing h3, .sheet .q-notice h3 { margin: 0 0 6px; font-size: 10.5px; font-weight: 700; }
.sheet .billing p { margin: 0; }
.sheet .q-notice { margin-top: 24px; padding: 18px 20px; border: 1px solid #888; border-radius: 8px; }
.sheet .q-notice ol { margin: 0; padding: 0; list-style: none; }
.sheet .q-notice li { margin-top: 8px; white-space: pre-line; padding-left: 14px; text-indent: -14px; }

@media (max-width: 860px) {
  .sheet .top { flex-direction: column; }
  .sheet .to { margin-top: 32px; }
  /* 휴대폰: 견적금액이 화면 밖으로 밀리지 않게 표를 화면 폭에 맞춘다 (빈 «비고» 칸 숨김). PDF 는 .is-pdf 가 되돌린다 */
  .sheet .items col { width: auto !important; }
  .sheet .items th:last-child, .sheet .items td:last-child { display: none; }
  .sheet .items th, .sheet .items td { font-size: 9px; padding-left: 2px; padding-right: 2px; white-space: normal; word-break: keep-all; }
  .sheet .items .grand .amount { font-size: 16px; white-space: nowrap; }
  .sheet .items .grand .g-label b { font-size: 15px; }
}

/* PDF 만드는 동안: html2pdf 가 A4 안쪽 폭(756px) 틀에 담는다 → 그 폭에 꽉 맞추고, 화면 폭과 상관없이 인쇄 모양으로 */
/* html2pdf 는 PDF 틀(756px)을 화면 가운데에 둔다. 휴대폰(360px)에선 틀이 왼쪽 밖으로 밀려 그림이 어긋나므로 왼쪽 끝에 붙인다 */
.html2pdf__container { left: 0 !important; right: auto !important; margin: 0 !important; }
.is-pdf .sheet { width: 756px; max-width: none; margin: 0; overflow: visible; }   /* = A4 210mm − 여백 5mm×2 = 200mm (96dpi) */
.is-pdf .sheet .top { flex-direction: row; }
.is-pdf .sheet .top > div:first-child { flex: 1 1 auto; min-width: 0; }
.is-pdf .sheet .supplier { flex: 0 0 auto; white-space: nowrap; }
.is-pdf .sheet .to { margin-top: 64px; }
.is-pdf .sheet .items th:last-child, .is-pdf .sheet .items td:last-child { display: table-cell; }
.is-pdf .sheet .items th, .is-pdf .sheet .items td { font-size: 10.5px; padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.is-pdf .sheet .items td.name { white-space: normal; }
.is-pdf .sheet .items .grand .amount { font-size: 20px; }
.is-pdf .sheet .items .grand .g-label b { font-size: 17px; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .panel { margin: 0; padding: 0; max-width: none; }
  .no-print { display: none !important; }
  #quote-sheets .sheet { display: block; }
  #quote-sheets .sheet + .sheet { break-before: page; page-break-before: always; }
  .sheet { max-width: none; overflow: visible; }
  .sheet .top { flex-direction: row; }
}
