/* ==========================================================================
   바로문서 (BaroDoc) — Formal Korean A4 Document Stylesheet
   Exact 210mm x 297mm A4 Layout for all 7 Official Forms
   ========================================================================== */

.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  max-height: 297mm;
  padding: 18mm 17mm 16mm;
  background: #ffffff;
  color: #111111;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Serif KR', 'Gowun Batang', 'Batang', serif;
  font-size: 10.5pt;
  line-height: 1.55;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.a4-sheet.font-gothic {
  font-family: 'Pretendard Variable', 'Pretendard', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}

.a4-sheet + .a4-sheet {
  margin-top: 18px;
}

@media print {
  .a4-sheet {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
  }
  .a4-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

/* Common Formal Header */
.doc-title {
  text-align: center;
  font-size: 23pt;
  font-weight: 800;
  letter-spacing: 0.45em;
  padding-left: 0.45em;
  margin: 0 0 10mm;
  color: #000000;
}

.doc-title.compact {
  font-size: 20pt;
  letter-spacing: 0.35em;
  padding-left: 0.35em;
  margin-bottom: 6mm;
}

.doc-title-sub {
  text-align: center;
  font-size: 9.5pt;
  color: #444444;
  margin: -5mm 0 6mm;
}

/* Formal Tables */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 5mm;
}

.doc-table th,
.doc-table td {
  border: 1px solid #222222;
  padding: 2.6mm 3mm;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
  font-size: 9.8pt;
}

.doc-table th {
  background: #f3f4f6;
  font-weight: 700;
  text-align: center;
  color: #111111;
}

.doc-table.thick-outer {
  border: 1.8px solid #111111;
}

.doc-table.compact th,
.doc-table.compact td {
  padding: 1.9mm 2.4mm;
  font-size: 9.1pt;
}

.doc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc-table .center {
  text-align: center;
}

.doc-table .left {
  text-align: left;
}

.doc-table .bold {
  font-weight: 700;
}

/* Body Statement & Clauses */
.doc-statement {
  text-align: center;
  font-size: 11.5pt;
  line-height: 1.9;
  margin: 7mm 0 8mm;
}

.doc-date {
  text-align: center;
  font-size: 11.5pt;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 6mm 0 8mm;
}

.doc-clauses {
  margin: 4mm 0 5mm;
  font-size: 9.6pt;
  line-height: 1.65;
}

.doc-clauses p {
  margin: 0 0 2.5mm;
}

.doc-clause-title {
  font-weight: 700;
  color: #000000;
}

/* Signature & Stamp Positioning */
.doc-sign-block {
  margin-top: auto;
  padding-top: 4mm;
}

.doc-sign-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8mm;
  margin: 4mm 0;
  font-size: 11pt;
}

.doc-sign-name {
  min-width: 36mm;
  text-align: center;
  letter-spacing: 0.15em;
  font-weight: 700;
}

.stamp-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18mm;
  height: 18mm;
  vertical-align: middle;
}

.stamp-anchor .in-label {
  color: #444444;
  font-size: 9.5pt;
  letter-spacing: 0.05em;
}

.stamp-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  object-fit: contain;
  z-index: 5;
}

.doc-recipient {
  margin-top: 8mm;
  font-size: 14pt;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-align: left;
}

/* Two-party Sign Grid (차용증 / 근로계약서) */
.party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6mm;
  margin-top: 4mm;
}

.party-box {
  border: 1px solid #222222;
  padding: 3.5mm 4mm;
  font-size: 9.2pt;
  line-height: 1.65;
}

.party-box-title {
  font-weight: 800;
  font-size: 10pt;
  border-bottom: 1px solid #333333;
  padding-bottom: 1.5mm;
  margin-bottom: 2.5mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.party-line {
  display: flex;
  align-items: center;
  gap: 2mm;
  margin-bottom: 1mm;
}

.party-line .lbl {
  width: 20mm;
  color: #333333;
  flex-shrink: 0;
  font-weight: 600;
}

.party-line .val {
  flex: 1;
}

/* ==========================================================================
   Quotation (견적서) & Transaction Statement (거래명세서) Specific
   ========================================================================== */

.biz-header {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 5mm;
  margin-bottom: 4mm;
  align-items: stretch;
}

.biz-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.biz-recipient-line {
  font-size: 13pt;
  font-weight: 800;
  border-bottom: 1.5px solid #111111;
  padding-bottom: 2mm;
  margin-bottom: 3mm;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.biz-meta-list {
  font-size: 9.2pt;
  line-height: 1.65;
}

.biz-total-banner {
  border: 1.8px solid #111111;
  background: #f8fafc;
  padding: 3mm 4mm;
  margin-bottom: 4mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4mm;
}

.biz-total-label {
  font-weight: 800;
  font-size: 10.5pt;
  white-space: nowrap;
}

.biz-total-korean {
  font-weight: 800;
  font-size: 11.5pt;
  flex: 1;
}

.biz-total-number {
  font-weight: 800;
  font-size: 12pt;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Color Themes for 거래명세서 (공급자 보관용 적색 / 공급받는자 보관용 청색) */
.theme-red .doc-title,
.theme-red .biz-total-label,
.theme-red .biz-total-number {
  color: #b91c1c;
}

.theme-red .doc-table.thick-outer,
.theme-red .biz-total-banner {
  border-color: #b91c1c;
}

.theme-red .doc-table th,
.theme-red .doc-table td {
  border-color: #dc2626;
}

.theme-red .doc-table th {
  background: #fef2f2;
  color: #991b1b;
}

.theme-blue .doc-title,
.theme-blue .biz-total-label,
.theme-blue .biz-total-number {
  color: #1d4ed8;
}

.theme-blue .doc-table.thick-outer,
.theme-blue .biz-total-banner {
  border-color: #1d4ed8;
}

.theme-blue .doc-table th,
.theme-blue .doc-table td {
  border-color: #2563eb;
}

.theme-blue .doc-table th {
  background: #eff6ff;
  color: #1e40af;
}

.statement-copy-badge {
  display: inline-block;
  font-size: 9pt;
  font-weight: 700;
  padding: 0.8mm 3mm;
  border-radius: 3px;
  border: 1px solid currentColor;
  letter-spacing: 0;
  vertical-align: middle;
  margin-left: 3mm;
}

.doc-notes-box {
  border: 1px solid #333333;
  padding: 3mm 3.5mm;
  font-size: 9pt;
  min-height: 18mm;
  white-space: pre-wrap;
  line-height: 1.55;
}

.doc-notes-box strong {
  display: block;
  margin-bottom: 1.5mm;
}

/* Standard Employment Contract compact styling to fit cleanly on 1 A4 page */
.contract-sheet {
  padding: 13mm 15mm 12mm;
  font-size: 9.2pt;
  line-height: 1.48;
}

.contract-sheet .doc-title {
  font-size: 18pt;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  margin-bottom: 4mm;
}

.contract-item {
  margin-bottom: 2.3mm;
}

.contract-item strong {
  color: #000000;
}

/* Certificate Border Accent (재직증명서) */
.cert-frame {
  border: 1.5px solid #222222;
  padding: 10mm 10mm 9mm;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Placeholder dim text in preview only */
.doc-empty {
  color: #9ca3af;
}

@media print {
  .doc-empty {
    color: transparent !important;
  }
}
