/* 유즈킷 — 견적서·거래명세표·발주서 PDF 발급기
   외부 폰트·아이콘·스크립트를 불러오지 않는 자체 완결형 스타일시트 */

:root {
  --bg: #f5f7fc;
  --bg-soft: #eef1f9;
  --card: #ffffff;
  --ink: #141b2d;
  --ink-2: #38415a;
  --muted: #68718a;
  --line: #e2e6f0;
  --line-strong: #cdd4e4;
  --brand: #3b5bfd;
  --brand-dark: #2b45d6;
  --brand-soft: #eef1ff;
  --ok: #0a8f52;
  --warn: #b45309;
  --danger: #c2413b;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 14px 32px -18px rgba(16, 24, 40, .28);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
          "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.3; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(1.62rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.22rem, 2.5vw, 1.6rem); margin-top: 0; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
canvas { display: block; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tiny { font-size: .8rem; }
.muted { color: var(--muted); }
a.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: #fff; color: var(--brand-dark); font-weight: 700; padding: 10px 16px;
  border-radius: 0 0 10px 0;
}
a.skip:focus { left: 0; }

/* ---------------- 자체 헤더(통합 배포 시 공통 헤더로 교체됨) ---------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .head-in { display: flex; align-items: center; gap: 16px; height: 64px; }
.site-head .brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.site-head .brand:hover { text-decoration: none; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-txt strong { font-size: 1rem; letter-spacing: -.01em; }
.brand-txt span { font-size: .64rem; color: var(--muted); letter-spacing: .08em; }
.head-nav { display: flex; gap: 18px; margin-left: 10px; }
.head-nav a { color: var(--ink-2); font-size: .92rem; font-weight: 600; }

.btn {
  --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; font-size: .92rem;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 8px 18px -10px rgba(59, 91, 253, .9); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { --btn-fg: var(--ink-2); --btn-bd: transparent; --btn-bg: transparent; }
.btn-sm { padding: 7px 11px; font-size: .82rem; border-radius: 9px; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--muted); font-size: .82rem;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.link-btn:hover { color: var(--danger); }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 1rem; line-height: 1; cursor: pointer;
}
.icon-btn:disabled { opacity: .4; cursor: default; }

/* ---------------- 히어로 ---------------- */
.hero { padding: 42px 0 10px; }
.eyebrow {
  display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: .76rem; font-weight: 800; letter-spacing: .02em;
}
.hero h1 { margin-bottom: 14px; }
.h1-sub { display: block; margin-top: 6px; font-size: .5em; font-weight: 700; color: var(--ink-2); letter-spacing: -.01em; }
.lead { max-width: 780px; color: var(--ink-2); font-size: 1rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; list-style: none; }
.hero-badges li {
  padding: 5px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: .8rem; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-sm);
}

/* ---------------- 도구 레이아웃 ---------------- */
.tool { padding: 22px 0 10px; }
.inv-app {
  display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 22px;
  align-items: start;
}
.inv-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 22px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.doc-tabs {
  display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.doc-tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 9px;
  font-size: .9rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.doc-tab.is-on { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.panel-tools { display: flex; gap: 6px; }

.grp { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 4px; min-width: 0; }
.grp:first-of-type { border-top: 0; }
.grp legend {
  float: left; width: 100%; padding: 0 0 8px; margin: 0;
  font-size: .92rem; font-weight: 800; color: var(--ink);
}
.grp legend small { font-weight: 600; color: var(--muted); font-size: .78rem; }
.grp legend + * { clear: both; }

.grid-2, .grid-3 { display: grid; gap: 8px 10px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .72rem; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font-family: inherit; font-size: .92rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(59, 91, 253, .28); outline-offset: 1px; border-color: var(--brand);
}
.field textarea { resize: vertical; min-height: 44px; }
.field input[type="color"] { padding: 3px; height: 38px; }
.field input.invalid { border-color: var(--danger); background: #fff7f6; }

.remember-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check small { font-weight: 500; color: var(--muted); font-size: .74rem; }

/* 품목 표 */
.items-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.item-table { width: 100%; border-collapse: collapse; min-width: 500px; font-size: .86rem; }
.item-table th {
  background: var(--bg-soft); color: var(--ink-2); font-size: .76rem; font-weight: 800;
  text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line);
}
.item-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.item-table tr:last-child td { border-bottom: 0; }
.item-table input {
  width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 4px;
  border-radius: 6px; font-family: inherit; font-size: .86rem; color: var(--ink);
}
.item-table input:hover { border-color: var(--line); background: #fff; }
.item-table input:focus { outline: 2px solid rgba(59, 91, 253, .25); background: #fff; border-color: var(--brand); }
.col-no { width: 34px; text-align: center; }
.col-qty { width: 62px; }
.col-price, .col-amount { width: 104px; text-align: right; }
.col-act { width: 62px; }
.item-table td.col-no { text-align: center; color: var(--muted); font-size: .78rem; }
.item-table td.col-qty input, .item-table td.col-price input { text-align: right; }
.item-table td.col-amount { text-align: right; font-weight: 700; white-space: nowrap; }
.row-btns { display: inline-flex; gap: 2px; }
.row-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; line-height: 1;
}
.row-btn:hover { background: var(--bg-soft); border-color: var(--line); color: var(--ink); }
.row-btn.del:hover { color: var(--danger); }
.items-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; }
.items-hint { font-size: .76rem; color: var(--muted); }
.paste-box { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }

.vat-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.radio { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 9px; background: #fff; border: 1px solid var(--line-strong); font-size: .85rem; font-weight: 600; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.radio input { accent-color: var(--brand); }
.option-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }

/* 도장 */
.stamp-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.stamp-preview-wrap { position: relative; width: 90px; height: 90px; border-radius: 12px; background:
  repeating-conic-gradient(#f2f4f9 0% 25%, #fff 0% 50%) 50% / 12px 12px; border: 1px solid var(--line); display: grid; place-items: center; }
.stamp-preview-wrap canvas { width: 78px; height: 78px; }
.stamp-cap { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); }
.stamp-controls { flex: 1; min-width: 220px; }
.inline-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.slider-row { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.slider { display: flex; flex-direction: column; gap: 2px; font-size: .76rem; color: var(--ink-2); font-weight: 700; flex: 1; min-width: 140px; }
.slider b { color: var(--brand-dark); }
.slider input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ---------------- 미리보기 ---------------- */
.inv-preview {
  position: sticky; top: 80px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.preview-head strong { font-size: .92rem; }
.preview-meta { margin-left: 8px; font-size: .8rem; color: var(--muted); }
.page-nav { display: flex; gap: 4px; }
.canvas-wrap {
  position: relative; border-radius: 10px; overflow: hidden; background: #e9edf6;
  border: 1px solid var(--line); padding: 8px;
}
#inv-canvas { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 4px 14px -6px rgba(16, 24, 40, .35); background: #fff; }
.canvas-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .72); font-size: .86rem; font-weight: 700; color: var(--brand-dark);
}
.preview-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 10px 2px 4px; font-size: .84rem; color: var(--ink-2); }
.preview-summary b { font-size: 1.06rem; color: var(--ink); }
.preview-summary .warn { color: var(--warn); font-weight: 700; }
.preview-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; margin-top: 8px; }
.btn-download { flex-direction: column; gap: 0; padding: 9px 14px; line-height: 1.25; }
.btn-sub { font-size: .68rem; font-weight: 600; opacity: .85; }
.status { margin: 9px 2px 4px; font-size: .82rem; min-height: 1.2em; color: var(--ok); font-weight: 700; }
.status.is-error { color: var(--danger); }
.status.is-busy { color: var(--brand-dark); }

/* ---------------- 모달 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 22, 41, .45);
  display: grid; place-items: center; padding: 18px;
}
.modal-card {
  width: min(640px, 100%); max-height: 92vh; overflow: auto; background: #fff;
  border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(15, 22, 41, .5);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.06rem; }
.modal-body { padding: 16px; }
.stamp-maker { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
#inv-stamp-preview { width: 180px; height: 180px; border-radius: 12px; background:
  repeating-conic-gradient(#f2f4f9 0% 25%, #fff 0% 50%) 50% / 14px 14px; border: 1px solid var(--line); }
.stamp-form { display: flex; flex-direction: column; gap: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ---------------- 본문 섹션 ---------------- */
.section { padding: 40px 0 8px; }
.section-lead { color: var(--ink-2); max-width: 820px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 6px; }
.step { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px 8px; box-shadow: var(--shadow-sm); }
.step-no {
  position: absolute; top: -12px; left: 16px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: .82rem; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 4px 10px -4px rgba(59, 91, 253, .8);
}
.step h3 { margin-top: 4px; }
.step p { font-size: .9rem; color: var(--ink-2); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.doc-compare { width: 100%; border-collapse: collapse; min-width: 620px; font-size: .9rem; }
.doc-compare th, .doc-compare td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-compare thead th { background: var(--bg-soft); font-size: .82rem; color: var(--ink-2); }
.doc-compare tbody th { width: 126px; font-size: .82rem; color: var(--muted); font-weight: 700; background: #fbfbfe; }
.doc-compare tr:last-child th, .doc-compare tr:last-child td { border-bottom: 0; }

.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check-card { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 12px; padding: 14px 15px 4px; }
.check-card h3 { font-size: .95rem; }
.check-card p { font-size: .86rem; color: var(--ink-2); }

.privacy-box {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  background: linear-gradient(135deg, #fff, #f3f6ff); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px;
}
.privacy-box h2 { font-size: 1.2rem; }
.privacy-box p { font-size: .92rem; color: var(--ink-2); }
.bullet { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--ink-2); }
.bullet li { margin-bottom: 6px; }
.privacy-badge {
  width: 132px; height: 132px; border-radius: 50%; background: #fff; border: 2px dashed #c9d5ff;
  display: grid; place-content: center; text-align: center; color: var(--brand-dark);
}
.privacy-badge span { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.privacy-badge b { font-size: .78rem; margin-top: 4px; }

.faq { display: grid; gap: 8px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; }
.faq summary { cursor: pointer; font-weight: 700; font-size: .95rem; }
.faq summary::marker { color: var(--brand); }
.faq p { margin: 9px 0 2px; font-size: .9rem; color: var(--ink-2); }

.related { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.related-card {
  display: flex; flex-direction: column; gap: 3px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; color: var(--ink); box-shadow: var(--shadow-sm);
}
.related-card:hover { text-decoration: none; border-color: #bfcaff; }
.related-card b { font-size: .92rem; color: var(--brand-dark); }
.related-card span { font-size: .8rem; color: var(--muted); }

/* ---------------- 푸터(통합 배포 시 공통 푸터로 교체됨) ---------------- */
.site-foot { margin-top: 48px; padding: 28px 0 16px; background: #0f1629; color: #c8cfe0; }
.site-foot .foot-in { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 24px; }
.site-foot .brand-txt strong { color: #fff; }
.site-foot .foot-note { font-size: .82rem; color: #98a2b8; margin-top: 10px; }
.site-foot .foot-col { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; }
.site-foot .foot-col b { color: #fff; margin-bottom: 2px; }
.site-foot .foot-col a { color: #c8cfe0; }
.site-foot .foot-base { max-width: 1140px; margin: 18px auto 0; padding: 12px 20px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .76rem; color: #8d98af; }

/* ---------------- 반응형 ---------------- */
@media (max-width: 1080px) {
  .inv-app { grid-template-columns: 1fr; }
  .inv-preview { position: static; }
  .related { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .steps, .check-grid { grid-template-columns: 1fr; }
  .privacy-box { grid-template-columns: 1fr; }
  .privacy-badge { display: none; }
  .stamp-maker { grid-template-columns: 1fr; justify-items: center; }
  #inv-stamp-preview { width: 150px; height: 150px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .head-nav { display: none; }
  .inv-panel { padding: 14px 12px 18px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .panel-head { gap: 8px; }
  .doc-tab { padding: 7px 10px; font-size: .84rem; }
  .preview-actions { grid-template-columns: 1fr 1fr; }
  .preview-actions .btn-download { grid-column: 1 / -1; }
  .related { grid-template-columns: 1fr; }
  .site-foot .foot-in { grid-template-columns: 1fr; }
}

/* ---------------- 인쇄 ---------------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  .site-head, .site-foot, .hero, .inv-panel, .section, #inv-status,
  .preview-head, .preview-summary, .preview-actions, .tiny, .canvas-loading,
  a.skip, .modal { display: none !important; }
  .tool, .inv-app, .inv-preview { display: block; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .canvas-wrap { padding: 0; border: 0; background: #fff; border-radius: 0; }
  #inv-canvas { width: 210mm; height: 297mm; box-shadow: none; border-radius: 0; }
}
