/* ==========================================================================
   mandoobill — 견적서·거래명세서·영수증 웹도구
   밝고 깨끗한 핀테크 스타일: #F4F6FB 바탕 / #FFFFFF 카드 / #4F46E5 포인트
   ========================================================================== */

:root {
  --ink: #0f1729;
  --ink2: #45526b;
  --ink3: #5f6b80;
  --ink4: #8a94a8;

  --line: #e5e9f2;
  --line2: #eef1f8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --surface2: #f7f9fd;

  --brand: #4f46e5;
  --brand-mid: #5b4cf5;
  --brand-deep: #4338ca;
  --brand-soft: #eef0fe;
  --brand-line: #ddd9fe;

  --mint: #10b981;
  --mint-ink: #067a55;
  --mint-soft: #ecfdf5;
  --mint-line: #bbf7d0;

  --accent: #b45309;
  --accent-soft: #fff7ed;
  --warn: #b42318;
  --warn-soft: #fef3f2;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px -14px rgba(16, 24, 40, .18);
  --shadow: 0 2px 6px rgba(16, 24, 40, .04), 0 26px 50px -32px rgba(16, 24, 40, .28);
  --shadow-paper: 0 1px 2px rgba(16, 24, 40, .06), 0 18px 40px -22px rgba(30, 41, 82, .28), 0 50px 80px -60px rgba(30, 41, 82, .35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Pretendard Variable", "Pretendard", "Noto Sans KR", -apple-system,
    BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.012em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 420px at 8% -140px, #eaeafd 0%, rgba(234, 234, 253, 0) 62%),
    radial-gradient(900px 380px at 96% -120px, #e6f6f4 0%, rgba(230, 246, 244, 0) 60%),
    var(--bg);
}

a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px; }

/* ---------- 헤더 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(229, 233, 242, .9);
}

.app-header .wrap {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(150deg, #6366f1 0%, #4f46e5 52%, #4338ca 100%);
  box-shadow: 0 8px 18px -10px rgba(79, 70, 229, .8);
  display: grid; place-items: center;
  flex: none;
}
.brand-mark svg { display: block; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); line-height: 1.1; }
.brand-sub { display: block; font-size: 11px; font-weight: 600; color: var(--ink4); letter-spacing: -.01em; margin-top: 1px; }

.header-nav { display: flex; align-items: center; gap: 4px; margin-left: 10px; }
.header-nav a {
  padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--ink2); text-decoration: none;
}
.header-nav a:hover { background: var(--surface2); color: var(--ink); text-decoration: none; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 15px;
  border-radius: 11px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 700; letter-spacing: -.02em;
  cursor: pointer; white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, transform .12s ease, box-shadow .14s ease;
}
.btn:hover { background: #fbfcfe; border-color: #d6dded; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }

.btn-primary {
  background: linear-gradient(180deg, #5b52f0 0%, #4f46e5 100%);
  border-color: #443ad4; color: #fff;
  box-shadow: 0 10px 22px -14px rgba(79, 70, 229, .95), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { background: linear-gradient(180deg, #6459f4 0%, #4a41e0 100%); border-color: #3f36cc; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn-ghost:hover { background: var(--surface2); border-color: transparent; }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { width: 34px; padding: 0; }
.btn-danger-ghost { color: var(--warn); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--warn-soft); }

/* ---------- 히어로 ---------- */
.hero { padding: 32px 0 22px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
  color: var(--brand-deep); background: var(--brand-soft); border: 1px solid var(--brand-line);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: 33px; line-height: 1.3; letter-spacing: -.042em; font-weight: 800;
}
.hero h1 s { color: #97a0b3; text-decoration-thickness: 3px; text-decoration-color: #cfd6e4; }
.hero h1 .hl { color: var(--brand); }
.hero p.lead { margin: 0 0 18px; font-size: 15.5px; color: var(--ink2); max-width: 780px; }
.hero p.lead b { color: var(--ink); font-weight: 750; }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }
.hero-note { font-size: 12.3px; color: var(--ink4); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 650; color: var(--ink2);
  box-shadow: var(--shadow-xs);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.chip.mint .dot { background: var(--mint); }
.chip.amber .dot { background: #f59e0b; }

/* 헤더 문서함 배지 */
.hist-count {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0;
}
.hist-btn:hover .hist-count { background: #e4e7fd; }

/* 동작 유도 스트립 (역산·직인) */
.strip {
  width: 100%; display: flex; align-items: center; gap: 10px; margin-top: 11px;
  padding: 10px 12px; border-radius: 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--brand-line); background: linear-gradient(180deg, #fbfaff, #f5f4ff);
  transition: border-color .14s ease, box-shadow .14s ease, transform .12s ease;
}
.strip:hover { border-color: #c9c3fd; box-shadow: 0 10px 20px -18px rgba(79, 70, 229, .8); transform: translateY(-1px); }
.strip:active { transform: none; }
.strip-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--brand-line); color: var(--brand-deep);
}
.strip-txt { min-width: 0; flex: 1; }
.strip-txt b { display: block; font-size: 12.9px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.strip-txt span {
  display: block; font-size: 11.5px; color: var(--ink3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.strip-go { font-size: 11.8px; font-weight: 800; color: var(--brand-deep); flex: none; }
.strip.mint { border-color: var(--mint-line); background: linear-gradient(180deg, #f7fffc, #ecfdf5); }
.strip.mint .strip-ic { color: var(--mint-ink); border-color: var(--mint-line); }
.strip.mint .strip-go { color: var(--mint-ink); }
.strip.mint:hover { border-color: #a7f3d0; box-shadow: 0 10px 20px -18px rgba(16, 185, 129, .9); }

/* 비고 칩 */
.note-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 3px; }
.note-chip {
  font: inherit; font-size: 11.8px; font-weight: 650; color: var(--ink2);
  background: #fff; border: 1px dashed #d3daea; border-radius: 8px; padding: 4px 9px; cursor: pointer;
  transition: all .12s ease;
}
.note-chip:hover { border-style: solid; border-color: var(--brand-line); color: var(--brand-deep); background: #fafaff; }
.note-chip[data-on="true"] { border-style: solid; border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-deep); }

/* 최근 문서 */
.hist-mini { display: flex; flex-direction: column; gap: 6px; }
.hist-empty {
  font-size: 12.2px; color: var(--ink4); background: var(--surface2);
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 11px; line-height: 1.5;
}
.hist-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 9px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.hist-row:hover { border-color: var(--brand-line); background: #fbfaff; }
.hist-row .h-type {
  font-size: 10.8px; font-weight: 800; color: var(--brand-deep); background: var(--brand-soft);
  border-radius: 6px; padding: 2px 6px; flex: none;
}
.hist-row .h-main { min-width: 0; flex: 1; }
.hist-row .h-main b { display: block; font-size: 12.6px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row .h-main span { display: block; font-size: 11px; color: var(--ink4); margin-top: 1px; }
.hist-row .h-amt { font-size: 12.3px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; flex: none; }
.link-all {
  margin-top: 9px; padding: 0; border: 0; background: none; font: inherit;
  font-size: 11.8px; font-weight: 700; color: var(--brand-deep); cursor: pointer; text-align: left;
}
.link-all:hover { text-decoration: underline; }

/* ---------- 작업 영역 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 540px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  padding-bottom: 10px;
}

.editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 16px 17px;
}
.card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 13px;
}
.card-head h2 {
  margin: 0; font-size: 14.5px; font-weight: 800; letter-spacing: -.03em;
  display: flex; align-items: center; gap: 8px;
}
.step-no {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: 11.5px; font-weight: 800; letter-spacing: 0;
  flex: none;
}
.card-head .spacer { margin-left: auto; }

/* 문서 종류 세그먼트 */
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 5px; background: var(--surface2);
  border: 1px solid var(--line2); border-radius: 14px;
}
.seg button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; cursor: pointer;
  font-size: 12.8px; font-weight: 750; color: var(--ink3); letter-spacing: -.03em;
  transition: all .14s ease;
}
.seg button svg { opacity: .62; }
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button[aria-pressed="true"] {
  background: #fff; color: var(--brand-deep);
  border-color: var(--brand-line);
  box-shadow: 0 2px 8px -4px rgba(79, 70, 229, .35), 0 1px 0 #fff inset;
}
.seg button[aria-pressed="true"] svg { opacity: 1; }

/* 과세 유형 */
.modes { display: flex; flex-direction: column; gap: 7px; }
.mode {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; transition: all .14s ease;
}
.mode:hover { border-color: #d6dded; background: #fcfdff; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode .radio {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid #cdd5e4; background: #fff; display: grid; place-items: center;
  transition: all .14s ease;
}
.mode .radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0);
  transition: transform .14s ease;
}
.mode-body { min-width: 0; }
.mode-title { display: block; font-size: 13.5px; font-weight: 750; letter-spacing: -.025em; color: var(--ink); }
.mode-desc { display: block; font-size: 11.8px; color: var(--ink4); margin-top: 1px; letter-spacing: -.01em; }
.mode-badge {
  font-size: 11.5px; font-weight: 750; color: var(--ink3);
  background: var(--surface2); border: 1px solid var(--line2);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.mode[data-on="true"] { border-color: var(--brand-line); background: linear-gradient(180deg, #fbfaff, #f6f5ff); box-shadow: 0 0 0 3px rgba(79, 70, 229, .07); }
.mode[data-on="true"] .radio { border-color: var(--brand); background: var(--brand); }
.mode[data-on="true"] .radio::after { transform: scale(1); }
.mode[data-on="true"] .mode-badge { color: var(--brand-deep); background: #fff; border-color: var(--brand-line); }

.subcheck {
  display: flex; align-items: center; gap: 9px;
  margin-top: 9px; padding: 10px 12px;
  border-radius: 11px; background: var(--surface2); border: 1px solid var(--line2);
  font-size: 12.8px; font-weight: 650; color: var(--ink2); cursor: pointer;
}
.subcheck input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

/* 합계 요약 */
.sum-box {
  margin-top: 12px; padding: 13px 14px;
  border-radius: 13px; border: 1px solid var(--brand-line);
  background: linear-gradient(180deg, #f7f6ff 0%, #f1f0ff 100%);
}
.sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12.8px; color: var(--ink2); padding: 3px 0; }
.sum-row b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sum-row.total { margin-top: 6px; padding-top: 9px; border-top: 1px dashed var(--brand-line); font-size: 14px; }
.sum-row.total span { font-weight: 750; color: var(--ink); }
.sum-row.total b { font-size: 19px; font-weight: 800; color: var(--brand-deep); letter-spacing: -.02em; }
.sum-row.payoff b { color: var(--mint-ink); }

/* 입력 필드 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11.8px; font-weight: 700; color: var(--ink3); letter-spacing: -.01em; }
.field .hint { font-size: 11px; color: var(--ink4); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; font-size: 13.5px; color: var(--ink); letter-spacing: -.01em;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.textarea { height: auto; min-height: 62px; padding: 9px 11px; line-height: 1.55; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #b3bbc9; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12);
}
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input[readonly] { background: var(--surface2); color: var(--ink3); }
.input.invalid { border-color: #f0a9a1; box-shadow: 0 0 0 3.5px rgba(180, 35, 24, .08); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b7690' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row .field { flex: 1; }

/* 이미지 업로드 */
.upload-row { display: flex; gap: 10px; margin-top: 2px; }
.upload {
  flex: 1; display: flex; align-items: center; gap: 9px;
  padding: 9px; border: 1px dashed #d3daea; border-radius: 11px;
  background: #fcfdff; cursor: pointer; transition: all .14s ease; min-width: 0;
}
.upload:hover { border-color: var(--brand); background: #fafaff; }
.upload.drag { border-color: var(--brand); background: #f5f4ff; }
.upload .thumb {
  width: 34px; height: 34px; border-radius: 8px; background: #fff;
  border: 1px solid var(--line); display: grid; place-items: center; flex: none;
  overflow: hidden;
}
.upload .thumb img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.upload .txt { min-width: 0; }
.upload .t1 { font-size: 12.5px; font-weight: 750; color: var(--ink); letter-spacing: -.02em; }
.upload .t2 { font-size: 11px; color: var(--ink4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload .clear {
  margin-left: auto; flex: none; width: 24px; height: 24px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink3);
  display: none; place-items: center; cursor: pointer;
}
.upload[data-has="true"] .clear { display: grid; }
.upload input[type="file"] { display: none; }

/* 품목 편집 */
.items-head { display: flex; align-items: center; gap: 6px; margin: 14px -2px 7px; padding: 0 2px; }
.items-head .col { font-size: 11.5px; font-weight: 750; color: var(--ink3); }
.items-head .c-name { flex: 1; }
.items-head .c-spec { width: 58px; }
.items-head .c-qty { width: 46px; text-align: right; }
.items-head .c-unit { width: 78px; text-align: right; }
.items-head .c-amt { width: 82px; text-align: right; }
.items-head .c-del { width: 22px; }

.items { display: flex; flex-direction: column; gap: 5px; }
.item-row {
  display: flex; gap: 5px; align-items: center;
}
.item-row .f-name { flex: 1; min-width: 0; }
.item-row .f-spec { width: 58px; }
.item-row .f-qty { width: 46px; }
.item-row .f-unit { width: 78px; }
.item-row .f-amt { width: 82px; }
.item-row .input { height: 34px; font-size: 13px; padding: 0 8px; }
.item-row .f-amt { text-align: right; font-variant-numeric: tabular-nums; }
.item-row .del {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border: none; background: transparent; color: #b3bbc9; border-radius: 7px; cursor: pointer;
}
.item-row .del:hover { background: var(--warn-soft); color: var(--warn); }

.items-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.preset-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.preset {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 12px; font-weight: 650; color: var(--ink2); cursor: pointer;
}
.preset:hover { border-color: var(--brand-line); background: #fafaff; color: var(--brand-deep); }
.preset .x { color: #c3cad6; font-size: 13px; line-height: 1; }
.preset .x:hover { color: var(--warn); }

.empty-tip {
  font-size: 12px; color: var(--ink4); background: var(--surface2);
  border: 1px dashed var(--line); border-radius: 10px; padding: 9px 11px; margin-top: 10px;
}

/* 저장 상태 */
.savebar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 11px;
  background: var(--mint-soft); border: 1px solid var(--mint-line);
  font-size: 12.3px; font-weight: 650; color: var(--mint-ink);
}
.savebar .spin { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.savebar.saving { background: #f7f9fd; border-color: var(--line); color: var(--ink3); }
.savebar.saving .spin { background: #b9c1d0; }

/* ---------- 미리보기 ---------- */
.preview {
  position: sticky; top: 80px;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.preview-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line2);
  background: linear-gradient(180deg, #fff, #fcfdff);
}
.preview-bar .label { font-size: 12.5px; font-weight: 750; color: var(--ink2); display: flex; align-items: center; gap: 7px; }
.preview-bar .label .paper-icon { color: var(--brand); display: grid; place-items: center; }
.preview-bar .spacer { margin-left: auto; }
.zoom { display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.zoom button { width: 26px; height: 26px; border: none; background: transparent; border-radius: 7px; cursor: pointer; color: var(--ink2); display: grid; place-items: center; }
.zoom button:hover { background: var(--surface2); color: var(--ink); }
.zoom span { min-width: 42px; text-align: center; font-size: 11.8px; font-weight: 750; color: var(--ink3); font-variant-numeric: tabular-nums; }

.paper-viewport {
  padding: 22px;
  background:
    linear-gradient(180deg, #eef1f8 0%, #f7f9fd 100%);
  max-height: calc(100vh - 150px);
  overflow: auto;
  overscroll-behavior: contain;
}
.paper-stage { margin: 0 auto; position: relative; }
.paper-scale { transform-origin: top left; will-change: transform; }

/* ---------- A4 문서 ---------- */
.sheet {
  width: 794px;            /* 210mm @96dpi */
  min-height: 1122px;      /* A4 297mm(1122.5px) 안쪽으로 맞춤 */
  background: #fff;
  color: #16203a;
  padding: 46px 48px 38px;
  box-shadow: var(--shadow-paper);
  display: flex;
  flex-direction: column;
  font-feature-settings: "tnum" 0;
  position: relative;
}
.sheet, .sheet * { letter-spacing: -.015em; }

.doc-head { display: flex; justify-content: space-between; gap: 26px; padding-bottom: 16px; border-bottom: 2px solid #1d2540; }
.doc-supplier { min-width: 0; flex: 1; }
.doc-logo { height: 34px; max-width: 190px; object-fit: contain; margin-bottom: 9px; display: none; }
.doc-logo.on { display: block; }
.doc-supplier-name { font-size: 19px; font-weight: 800; letter-spacing: -.03em; color: #111a33; margin-bottom: 7px; }
.doc-supplier-meta { margin: 0; display: grid; grid-template-columns: 1fr; gap: 1px; font-size: 11.6px; color: #4a5570; }
.doc-supplier-meta > div { display: flex; gap: 7px; }
.doc-supplier-meta dt { color: #8792a8; flex: none; min-width: 62px; }
.doc-supplier-meta dd { margin: 0; color: #39415a; }

.doc-title-block { width: 236px; flex: none; text-align: right; }
.doc-title { font-size: 31px; font-weight: 800; letter-spacing: .22em; color: #111a33; line-height: 1.1; padding-right: 2px; }
.doc-title-en { font-size: 9.5px; font-weight: 700; letter-spacing: .28em; color: #9aa4b8; margin: 5px 0 12px; }
.doc-meta { width: 100%; border-collapse: collapse; font-size: 11.2px; }
.doc-meta th, .doc-meta td { padding: 3.5px 0; vertical-align: top; }
.doc-meta th { text-align: left; font-weight: 650; color: #8792a8; width: 68px; }
.doc-meta td { text-align: right; color: #2b3450; font-weight: 600; font-variant-numeric: tabular-nums; }

.doc-client { display: flex; align-items: flex-end; gap: 12px; padding: 15px 0 13px; border-bottom: 1px solid #e3e7f0; }
.doc-client .lbl {
  font-size: 10px; font-weight: 800; letter-spacing: .12em; color: #fff;
  background: #1d2540; border-radius: 4px; padding: 3px 7px; flex: none; align-self: center;
}
.doc-client-name .honor { font-size: 11.5px; font-weight: 600; color: #6c778f; margin-left: 5px; letter-spacing: 0; }
.doc-client-name { font-size: 15.5px; font-weight: 750; color: #111a33; letter-spacing: -.03em; flex: none; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.doc-client-meta { margin-left: auto; font-size: 11.2px; color: #6c778f; display: flex; gap: 3px 10px; min-width: 0; max-width: 470px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.doc-client-meta span { white-space: nowrap; }

.doc-amount { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 14px 0 12px; }
.doc-amount-kr { font-size: 14px; font-weight: 700; color: #1d2540; letter-spacing: -.02em; }
.doc-amount-won { font-size: 21px; font-weight: 800; color: #1d2540; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.doc-amount-won small { font-size: 11px; font-weight: 700; color: #8792a8; margin-left: 4px; letter-spacing: 0; }

.doc-table { width: 100%; border-collapse: collapse; margin-top: 2px; font-size: 11.8px; }
.doc-table thead th {
  background: #f2f4fa; color: #3c465f; font-weight: 750; font-size: 11px;
  padding: 8px 6px; border-top: 1.5px solid #1d2540; border-bottom: 1px solid #d8deec;
  letter-spacing: -.01em;
}
.doc-table thead th + th { border-left: 1px solid #e3e7f0; }
.doc-table tbody td { padding: 7.5px 6px; border-bottom: 1px solid #edf0f6; color: #2b3450; vertical-align: middle; }
.doc-table tbody td + td { border-left: 1px solid #f3f5fa; }
.doc-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.doc-table .c-no { width: 34px; text-align: center; color: #8f99ad; font-size: 10.5px; }
.doc-table .c-name { text-align: left; }
.doc-table .c-spec { width: 86px; text-align: center; color: #5c6780; font-size: 11px; }
.doc-table .c-qty { width: 62px; text-align: right; font-variant-numeric: tabular-nums; }
.doc-table .c-unit { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.doc-table .c-amt { width: 100px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.doc-table tbody tr.empty td { height: 26px; color: transparent; }
.doc-table tfoot th, .doc-table tfoot td { padding: 7px 6px; font-size: 11.6px; }
.doc-table tfoot th { text-align: right; font-weight: 650; color: #5c6780; background: #f7f9fd; border-bottom: 1px solid #edf0f6; }
.doc-table tfoot td { text-align: right; font-variant-numeric: tabular-nums; color: #2b3450; border-bottom: 1px solid #edf0f6; }
.doc-table tfoot tr.grand th, .doc-table tfoot tr.grand td { background: #eef0fb; color: #1d2540; font-weight: 800; font-size: 12.4px; border-bottom: 1.5px solid #1d2540; }
.doc-table tfoot tr.grand td { color: #3730a3; font-size: 13.4px; }

.doc-bottom { display: flex; gap: 14px; margin-top: 16px; }
.doc-box { border: 1px solid #e3e7f0; border-radius: 7px; padding: 10px 12px; flex: 1; min-width: 0; background: #fcfdff; }
.doc-box h4 { margin: 0 0 5px; font-size: 9.5px; font-weight: 800; letter-spacing: .12em; color: #8792a8; }
.doc-box p { margin: 0; font-size: 11.6px; color: #39415a; line-height: 1.55; white-space: pre-line; }
.doc-box.pay { flex: 0 0 46%; }

.doc-sign { margin-top: auto; padding-top: 26px; padding-bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.doc-footnote { margin: 0; font-size: 10.6px; color: #8792a8; line-height: 1.6; max-width: 520px; }
.doc-issuer { text-align: right; font-size: 11.8px; color: #39415a; position: relative; flex: none; }
.doc-issuer .who { font-weight: 800; color: #111a33; font-size: 14px; letter-spacing: -.03em; margin-top: 2px; display: inline-block; }
.doc-issuer .seal { position: absolute; right: -10px; top: 50%; width: 78px; height: 78px; margin-top: -50px; opacity: .9; mix-blend-mode: multiply; pointer-events: none; display: none; background-repeat: no-repeat; background-position: center; background-size: contain; }
.doc-issuer .seal.on { display: block; }
.doc-issuer .seal img { width: 100%; height: 100%; object-fit: contain; }
.doc-brandline { position: absolute; left: 48px; right: 48px; bottom: 18px; display: flex; justify-content: space-between; font-size: 8.6px; color: #b3bbc9; letter-spacing: .04em; }

/* ---------- 안내 섹션 ---------- */
.sections { padding: 46px 0 10px; }
.section-title { margin: 0 0 6px; font-size: 21px; font-weight: 800; letter-spacing: -.035em; }
.section-sub { margin: 0 0 20px; color: var(--ink2); font-size: 14.5px; }

/* 5가지 무기 */
.weapons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.weapon {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 16px 16px; box-shadow: var(--shadow-xs);
}
.weapon .w-no { position: absolute; right: 14px; top: 13px; font-size: 11px; font-weight: 800; color: #c3bffd; letter-spacing: .06em; }
.weapon .ic {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-deep);
  display: grid; place-items: center; margin-bottom: 11px;
}
.weapon h3 { margin: 0 0 6px; font-size: 14.2px; font-weight: 800; letter-spacing: -.03em; }
.weapon p { margin: 0; font-size: 12.6px; color: var(--ink2); line-height: 1.6; }

.usecases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.usecase { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-xs); }
.usecase .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; margin-bottom: 11px; }
.usecase h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; letter-spacing: -.03em; }
.usecase p { margin: 0; font-size: 13.2px; color: var(--ink2); line-height: 1.62; }

.calc-note { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-xs); }
.calc-note table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.calc-note th, .calc-note td { padding: 11px 14px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; }
.calc-note thead th { background: var(--surface2); font-size: 12px; font-weight: 800; color: var(--ink3); }
.calc-note tbody th { font-weight: 750; color: var(--ink); width: 178px; white-space: nowrap; }
.calc-note td { color: var(--ink2); }
.calc-note td code { background: var(--surface2); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; font-size: 12px; color: var(--brand-deep); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.calc-note tr:last-child th, .calc-note tr:last-child td { border-bottom: none; }

.faq { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.faq details {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.faq details[open] { border-color: var(--brand-line); }
.faq summary { cursor: pointer; font-size: 13.8px; font-weight: 750; color: var(--ink); list-style: none; display: flex; gap: 9px; align-items: flex-start; letter-spacing: -.025em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .q { color: var(--brand); font-weight: 800; flex: none; }
.faq details p { margin: 9px 0 0 22px; font-size: 13px; color: var(--ink2); line-height: 1.68; }

/* 크몽 CTA */
.cta-kmong {
  margin: 40px 0 8px;
  border-radius: 22px;
  background:
    radial-gradient(760px 300px at 90% -40%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 70%),
    linear-gradient(120deg, #4f46e5 0%, #5b4cf5 46%, #7c6bff 100%);
  color: #fff;
  padding: 26px 28px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  box-shadow: 0 30px 60px -40px rgba(79, 70, 229, .8);
}
.cta-kmong .txt { flex: 1; min-width: 280px; }
.cta-kmong .kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 750; letter-spacing: .02em; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .26); padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; }
.cta-kmong h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -.035em; }
.cta-kmong p { margin: 0; font-size: 13.6px; color: rgba(255, 255, 255, .86); }
.cta-kmong .btn { background: #fff; color: var(--brand-deep); border-color: #fff; height: 44px; padding: 0 20px; font-size: 14px; box-shadow: 0 14px 26px -18px rgba(0, 0, 0, .6); }
.cta-kmong .btn:hover { background: #f7f6ff; text-decoration: none; }
.cta-prices { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cta-price { font-size: 11.8px; font-weight: 700; padding: 4px 9px; border-radius: 7px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }

/* ---------- 푸터 ---------- */
.site-foot { margin-top: 48px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .66); }
.site-foot .wrap { padding: 26px 24px 34px; display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.site-foot .f-brand { flex: 1; min-width: 240px; }
.site-foot .f-brand p { margin: 8px 0 0; font-size: 12.4px; color: var(--ink3); max-width: 420px; line-height: 1.65; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.8px; }
.site-foot nav a { color: var(--ink2); font-weight: 600; }
.site-foot .copy { width: 100%; margin-top: 4px; font-size: 11.6px; color: var(--ink4); }

/* ---------- 모달 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 300; padding: 22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 41, .46); backdrop-filter: blur(3px);
  overflow: auto;
}
.modal-card {
  width: 100%; max-width: 530px; max-height: calc(100vh - 44px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 40px 90px -50px rgba(15, 23, 41, .75);
  animation: modal-pop .18s ease;
}
.modal-stamp { max-width: 740px; }
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(.992); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 13px; border-bottom: 1px solid var(--line2); }
.modal-head h2 { margin: 0 0 3px; font-size: 16.5px; font-weight: 800; letter-spacing: -.03em; }
.modal-head p { margin: 0; font-size: 12.3px; color: var(--ink3); line-height: 1.5; }
.modal-x {
  margin-left: auto; flex: none; width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink3);
  display: grid; place-items: center; cursor: pointer;
}
.modal-x:hover { background: var(--surface2); color: var(--ink); }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; padding: 13px 20px;
  border-top: 1px solid var(--line2); background: #fbfcff;
}
.modal-note { margin: 2px 0 0; font-size: 11.6px; color: var(--ink4); line-height: 1.55; }

/* 직인 만들기 */
.stamp-body { display: flex; gap: 18px; padding: 18px 20px; overflow: auto; }
.stamp-preview {
  width: 232px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px 12px; border-radius: 14px; border: 1px solid var(--line2);
  background: linear-gradient(180deg, #f9fbfe, #eef1f8);
}
#stampCanvas { width: 196px; height: 196px; display: block; mix-blend-mode: multiply; }
.stamp-preview-note { font-size: 11px; font-weight: 600; color: var(--ink4); }
.stamp-form { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.seg2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px;
  background: var(--surface2); border: 1px solid var(--line2); border-radius: 12px;
}
.seg2 button {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px;
  border-radius: 9px; border: 1px solid transparent; background: transparent;
  font-size: 12.8px; font-weight: 750; color: var(--ink3); letter-spacing: -.02em; cursor: pointer;
}
.seg2 button:hover { color: var(--ink); }
.seg2 button[aria-pressed="true"] {
  background: #fff; color: var(--brand-deep); border-color: var(--brand-line);
  box-shadow: 0 2px 8px -4px rgba(79, 70, 229, .35);
}
.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); background: var(--sw);
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--brand); }

/* 역산 계산기 */
.rev-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; overflow: auto; }
.money-input { position: relative; display: flex; align-items: center; }
.money-input .input { height: 46px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; padding-right: 34px; }
.money-input span { position: absolute; right: 12px; font-size: 13px; font-weight: 700; color: var(--ink4); }
.rev-presets { display: flex; gap: 6px; margin-top: 7px; }
.rev-presets button {
  flex: 1; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; font-weight: 700; color: var(--ink2); cursor: pointer;
}
.rev-presets button:hover { border-color: var(--brand-line); color: var(--brand-deep); background: #fafaff; }
.rev-result { border: 1px solid var(--brand-line); border-radius: 14px; padding: 14px 16px; background: linear-gradient(180deg, #f7f6ff, #f0efff); }
.rev-result .big { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rev-result .big span { font-size: 12.5px; font-weight: 750; color: var(--ink2); }
.rev-result .big b { font-size: 26px; font-weight: 800; color: var(--brand-deep); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rev-lines { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--brand-line); display: flex; flex-direction: column; gap: 4px; }
.rev-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.4px; color: var(--ink3); }
.rev-line b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 750; }
.rev-line.mint b { color: var(--mint-ink); }
.rev-tip { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: #fff; border: 1px solid var(--line); font-size: 11.8px; color: var(--ink3); line-height: 1.5; }

/* 발송 멘트 */
.msg-body { padding: 16px 20px; overflow: auto; }
.msg-text { min-height: 250px; font-size: 13px; line-height: 1.7; font-family: inherit; color: var(--ink); }

/* 문서함 */
.hist-body { padding: 14px 20px; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 130px; }
.hist-item { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.hist-item:hover { border-color: var(--brand-line); background: #fcfbff; }
.hist-item .hi-main { flex: 1; min-width: 0; cursor: pointer; text-align: left; background: none; border: 0; padding: 0; font: inherit; }
.hist-item .hi-top { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.hist-item .hi-type { font-size: 10.8px; font-weight: 800; color: var(--brand-deep); background: var(--brand-soft); border-radius: 6px; padding: 2px 6px; }
.hist-item .hi-no { font-size: 11px; color: var(--ink4); font-variant-numeric: tabular-nums; }
.hist-item .hi-client { font-size: 13px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item .hi-meta { font-size: 11.2px; color: var(--ink4); margin-top: 1px; }
.hist-item .hi-amt { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.hist-del {
  width: 28px; height: 28px; flex: none; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink4); display: grid; place-items: center; cursor: pointer;
}
.hist-del:hover { color: var(--warn); border-color: #f6c9c3; background: var(--warn-soft); }

/* ---------- 모바일 ---------- */
.mob-switch { display: none; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 18px; }
  .doc-amount-won { font-size: 19px; }
}

@media (max-width: 980px) {
  .header-nav { display: none; }
  .layout { grid-template-columns: 1fr; }
  .preview { position: static; }
  .paper-viewport { max-height: none; padding: 16px; }
  .mob-switch {
    display: flex; gap: 6px; padding: 5px; margin-bottom: 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-xs);
  }
  .mob-switch button {
    flex: 1; height: 38px; border-radius: 9px; border: 1px solid transparent; background: transparent;
    font-size: 13.5px; font-weight: 750; color: var(--ink3); cursor: pointer;
  }
  .mob-switch button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-line); }
  .layout[data-view="edit"] .preview { display: none; }
  .layout[data-view="view"] .editor { display: none; }
  .usecases { grid-template-columns: 1fr; }
  .faq { grid-template-columns: 1fr; }
  .weapons { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 26px; }
  .stamp-body { flex-direction: column; }
  .stamp-preview { width: 100%; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 20px 0 16px; }
  .hero h1 { font-size: 22px; line-height: 1.34; }
  .hero-actions .btn-lg { flex: 1; padding: 0 12px; font-size: 13.5px; }
  .hero-note { width: 100%; }
  .weapons { grid-template-columns: 1fr; }
  .modal { padding: 10px; }
  .modal-card { max-height: calc(100vh - 20px); border-radius: 16px; }
  .modal-head { padding: 14px 15px 11px; }
  .modal-foot { padding: 11px 15px; }
  .stamp-body, .rev-body, .msg-body, .hist-body { padding: 14px 15px; }
  #stampCanvas { width: 168px; height: 168px; }
  .hero p.lead { font-size: 14px; }
  .app-header .wrap { height: 58px; gap: 7px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 15.5px; }
  .brand-sub { display: none; }
  .header-actions { gap: 3px; }
  .header-actions .btn-label { display: none; }
  .header-actions .btn { padding: 0 8px; font-size: 12.5px; gap: 5px; }
  .header-actions .hist-count { min-width: 15px; height: 15px; font-size: 9.5px; padding: 0 4px; }
  .card { padding: 14px 13px 15px; }
  .items-head .c-spec, .items-head .c-unit { display: none; }
  .item-row { flex-wrap: wrap; row-gap: 6px; }
  .item-row .f-name { flex: 1 0 calc(100% - 30px); }
  .item-row .f-spec { width: 84px; }
  .item-row .f-qty { width: 62px; }
  .item-row .f-unit { width: calc(100% - 84px - 62px - 24px - 18px); }
  .item-row .f-amt { display: none; }
  .doc-tabs { grid-template-columns: repeat(3, 1fr); }
  .cta-kmong { padding: 20px; }
  .cta-kmong h3 { font-size: 17px; }
  .calc-note th, .calc-note td { padding: 10px 11px; font-size: 12.4px; }
  .calc-note tbody th { width: 120px; white-space: normal; }
}

/* ---------- 인쇄 / PDF ---------- */

/* ---------- 검수 추가: 할인 · 인수자 칸 ---------- */
.discount-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.discount-row > label { font-size: 12.5px; font-weight: 700; color: var(--ink2); min-width: 30px; }
.discount-row .select { width: 116px; height: 36px; }
.discount-input { display: inline-flex; align-items: center; gap: 5px; }
.discount-input .input { width: 120px; height: 36px; text-align: right; }
.discount-input .input:disabled { opacity: .55; }
.discount-input span { font-size: 12.5px; color: var(--ink3); font-weight: 650; }
.discount-calc { font-size: 12.3px; font-weight: 700; color: #c2410c; }
.discount-hint { margin: 6px 0 0; font-size: 11.6px; color: var(--ink4); line-height: 1.5; }
.doc-table tfoot tr.disc td { color: #c2410c; }
.doc-sign { flex-wrap: wrap; }
.doc-receiver { font-size: 11.8px; color: #39415a; flex: none; align-self: flex-end; margin-left: auto; margin-right: 18px; }
.doc-receiver .line { display: inline-block; width: 110px; border-bottom: 1px solid #9aa4b8; margin: 0 4px; vertical-align: -2px; }

/* 첫 장은 여백 없이(문서 안쪽 여백 사용), 품목이 많아 넘어가는 둘째 장부터는 위아래 10mm 여백 */
@page { size: A4; margin: 10mm 0; }
@page :first { margin-top: 0; }

@media print {
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .app-header, .hero, .editor, .preview-bar, .mob-switch, .sections, .site-foot, .cta-kmong, .toast-wrap, .no-print, .modal {
    display: none !important;
  }
  .layout { display: block !important; padding: 0 !important; gap: 0 !important; }
  .layout .preview, .layout[data-view] .preview { display: block !important; }
  .wrap { max-width: none; padding: 0 !important; }
  .preview {
    position: static !important; border: 0 !important; border-radius: 0 !important;
    box-shadow: none !important; background: #fff !important; overflow: visible !important;
  }
  .paper-viewport { display: contents !important; padding: 0 !important; background: #fff !important; max-height: none !important; overflow: visible !important; }
  .paper-stage { margin: 0 !important; width: auto !important; height: auto !important; }
  .paper-scale { transform: none !important; }
  .sheet {
    width: 210mm !important;
    min-height: 1084px !important;   /* 297mm − 첫 장 아래 여백 10mm */
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* 합계(tfoot)가 장마다 반복되면 중간 합계처럼 보이므로 맨 끝에 한 번만, 표 머리는 장마다 반복 */
  .doc-table thead { display: table-header-group; }
  .doc-table tfoot { display: table-row-group; }
  .doc-table tr, .doc-box, .doc-sign { break-inside: avoid; page-break-inside: avoid; }
  .doc-table thead th, .doc-table tfoot tr.grand th, .doc-table tfoot tr.grand td,
  .doc-box, .doc-client .lbl, .doc-table tbody tr:nth-child(even) td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* 토스트 */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1d2540; color: #fff; font-size: 13px; font-weight: 650;
  padding: 10px 16px; border-radius: 11px; box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(8px); transition: all .22s ease;
}
.toast.on { opacity: 1; transform: none; }

/* ---------- 정책 페이지 ---------- */
.page-hero { padding: 34px 0 10px; }
.page-hero h1 { margin: 0 0 8px; font-size: 27px; font-weight: 800; letter-spacing: -.035em; }
.page-hero p { margin: 0; color: var(--ink2); font-size: 14.5px; }
.legal {
  max-width: 860px; margin: 0 auto 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 32px 34px; box-shadow: var(--shadow-sm);
  font-size: 14.2px; color: var(--ink2); line-height: 1.78;
}
.legal h2 { margin: 26px 0 8px; font-size: 16.5px; font-weight: 800; color: var(--ink); letter-spacing: -.03em; }
.legal h2:first-child { margin-top: 0; }
.legal h3 { margin: 18px 0 6px; font-size: 14.2px; font-weight: 750; color: var(--ink); }
.legal p { margin: 0 0 10px; }
.legal ul, .legal ol { margin: 0 0 12px; padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13.2px; }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.legal th { background: var(--surface2); font-weight: 750; color: var(--ink); }
.legal .meta { font-size: 12.6px; color: var(--ink4); }
.legal .note { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; font-size: 13.4px; }
.legal a { color: var(--brand-deep); font-weight: 650; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.4px; font-weight: 700; color: var(--ink2); margin-bottom: 14px; }
.back-link:hover { color: var(--brand-deep); text-decoration: none; }

@media (max-width: 720px) {
  .legal { padding: 20px 18px 24px; border-radius: 16px; }
  .page-hero h1 { font-size: 22px; }
}

/* 검수 추가: 좁은 화면에서 미리보기 도구 줄(확대·발송 멘트·엑셀·인쇄)이 잘리지 않게 줄바꿈 */
@media (max-width: 720px) {
  .preview-bar { flex-wrap: wrap; row-gap: 8px; }
  .preview-bar .label { flex-basis: 100%; }
  .preview-bar .spacer { display: none; }
}
