#print-root, #print-cover { display: none; }

@media print {
  @page {
    size: A4;
    margin: 10mm 12mm;
  }
   
  /* Chrome and Edge specific margin override */
  @media screen and (-webkit-min-device-pixel-ratio:0) {
    @page {
      margin: 10mm 15mm;
    }
  }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  html, body { height: auto !important; overflow: visible !important; }

  /* hide everything except print root */
  .app, .toast, .modal-overlay { display: none !important; }

  /* ── 기본 글자 크기 (13pt) ── */
  #print-root {
    display: block !important;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13pt;
    color: #000;
    line-height: 1.5;
    background: #fff;
  }

  /* ── 클래스별 글자 크기 ── */
  .print-title { font-size: 30pt !important; }
  .print-subtitle { font-size: 14pt !important; }
  .print-body { font-size: 13pt !important; }
  .print-caption { font-size: 11pt !important; }
  .print-small { font-size: 10pt !important; }

  /* ── 가변 글자 크기 클래스 ── */
  .print-title-28 { font-size: 28pt !important; }
  .print-title-30 { font-size: 30pt !important; }
  .print-title-32 { font-size: 32pt !important; }

  .print-subtitle-12 { font-size: 12pt !important; }
  .print-subtitle-14 { font-size: 14pt !important; }
  .print-subtitle-16 { font-size: 16pt !important; }

  .print-body-12 { font-size: 12pt !important; }
  .print-body-13 { font-size: 13pt !important; }
  .print-body-14 { font-size: 14pt !important; }
  .print-body-15 { font-size: 15pt !important; }

  .print-caption-10 { font-size: 10pt !important; }
  .print-caption-11 { font-size: 11pt !important; }
  .print-caption-12 { font-size: 12pt !important; }

  .print-small-9 { font-size: 9pt !important; }
  .print-small-10 { font-size: 10pt !important; }
  .print-small-11 { font-size: 11pt !important; }

  .print-fs-13,
  .print-fs-13 table,
  .print-fs-13 td { font-size: 13pt !important; font-weight: 500; }

  #print-root table { border-collapse: collapse !important; border-spacing: 0 !important; }
  #print-root table tr, #print-root table td { border: none !important; outline: none !important; }
  #print-root .pr-cov-table td { border-bottom: 0.1pt solid #FCFCFC !important; }
  #print-root .pr-cov-table th { border-bottom: 0.1px solid #BDBDBD !important; }
  #print-root .pr-cov-table tr:last-child td { border-bottom: none !important; }
  #print-root .pr-analysis-table td { border-bottom: 0.1pt solid #BDBDBD !important; }
  #print-root .pr-analysis-table th { border-bottom: 0.1pt solid #BDBDBD !important; }
  #print-root .pr-analysis-table tr:last-child td { border-bottom: none !important; }

  /* ── PRINT: cover header ── */
  .pr-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    border-bottom: 3pt solid #2563eb;
    padding-bottom: 4pt;
    margin-bottom: 6pt;
  }
  .pr-header-left { }
  .pr-report-title {
  	font-size: 25pt;
	text-align: center;
	font-weight: 700;
      color: #000;
    letter-spacing: -0.3pt;
    line-height: 1.1;
  }
  .pr-report-sub {
     color: #333;
    margin-top: 2pt;
   }
  .pr-header-right { text-align: right; color: #333; }
  .pr-header-right strong { color: #000; }

  /* ── PRINT: customer info box ── */
  .pr-customer-box {
    background: #f0f9ff;
    border: 2.5pt solid #3b82f6;
    border-radius: 4pt;
    padding: 6pt 10pt;
    margin-bottom: 6pt;
    display: flex;
    gap: 16pt;
    align-items: center;
  }
  .pr-customer-name {
      color: #000;
  }
  .pr-customer-meta { color: #333; margin-top: 2pt; }
  .pr-customer-stats { display: flex; gap: 12pt; }

  /* ── PRINT: customer stats table (migrated from print.js inline) ── */
  .pr-customer-stats-table {
    width: 100%;
    border-collapse: collapse;
    border: transparent;
    margin-bottom: 6pt;
  }
  .pr-customer-stats-table td {
    padding: 3px;
  }
  .pr-customer-stats-table td.col-label {
    width: 15%;
    text-align: center;
  }
  .pr-customer-stats-table td.col-colon {
    width: 5%;
    text-align: center;
  }
  .pr-customer-stats-table td.col-value {
    width: 30%;
  }
  .pr-customer-stats-table td.col-value-right {
    text-align: right;
    padding-right: 10px;
  }
  .pr-customer-stats-table .bg-yellow { background: #FFE699; font-size: 15pt !important; }
  .pr-customer-stats-table .bg-blue  { background: #C4DEFF; font-size: 15pt !important; }
  .pr-customer-stats-table .text-alert { color: #b83232; }

  .pr-cstat { text-align: center; }
  .pr-cstat-num { color: #10b981; line-height: 1; }
  .pr-cstat-label { color: #666; margin-top: 2pt; }

  /* ── PRINT: section titles ── */
  .pr-section {
    margin-bottom: 6pt;
  }
  .pr-section-title {
      color: #000;
    border-left: 4pt solid #10b981;
    padding-left: 6pt;
    margin-bottom: 4pt;
  }

  /* ── PRINT: contract cards ── */
  .pr-contract-card {
    border: 0.7px solid #cbd5e1;
    border-radius: 4pt;
    padding: 6pt 8pt;
    margin-bottom: 4pt;
    display: grid;
    grid-template-columns: 70pt 1fr auto;
    gap: 8pt;
    page-break-inside: avoid;
    background: #fff;
  }
  .pr-company-badge {
    display: inline-block;
      padding: 3pt 6pt;
    border-radius: 4pt;
    white-space: nowrap;
    border: 2pt solid;
  }
  .pr-contract-product { color: #000; margin-bottom: 2pt; }
  .pr-contract-dates { color: #333; margin-bottom: 2pt; }
  .pr-contract-tags { display: flex; gap: 4pt; flex-wrap: wrap; }
  .pr-tag {
     padding: 2pt 7pt; border-radius: 3pt;
    border: 2pt solid;
  }
  .pr-tag-normal { color: #10b981; border-color: #10b981; background: #d1fae5; }
  .pr-tag-cancel { color: #ef4444; border-color: #ef4444; background: #fee2e2; }
  .pr-tag-same   { color: #3b82f6; border-color: #3b82f6; background: #dbeafe; }
  .pr-tag-different { color: #f59e0b; border-color: #f59e0b; background: #fef3c7; }
  .pr-premium { text-align: right; }
  .pr-premium-amount { color: #000; line-height: 1; }
  .pr-premium-unit { color: #666; }
  .pr-premium-sub { color: #333; margin-top: 2pt; }

  /* ── PRINT: summary stats bar ── */
  .pr-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4pt;
    margin-bottom: 6pt;
  }
  .pr-stat-box {
    border: 2.5pt solid #cbd5e1;
    border-radius: 4pt;
    padding: 4pt 6pt;
    text-align: center;
    background: #F6F6F6;
  }
  .pr-stat-num { color: #000; line-height: 1; }
  .pr-stat-label { color: #666; margin-top: 2pt; }
  .pr-stat-sub { color: #10b981; margin-top: 2pt; }

  /* ── PRINT: coverage tables ── */
  .pr-cov-block {
    margin-bottom: 6pt;
  }
  .pr-cov-product-header {
    display: flex;
    align-items: center;
    gap: 6pt;
    background: #2563eb;
    color: #fff;
    padding: 4pt 8pt;
    border-radius: 3pt 3pt 0 0;
  }
  .pr-cov-product-name { }
  .pr-cov-product-dates { color: rgba(255,255,255,.8); }
  .pr-cov-type-label {
    padding: 4pt 8pt;
    border-left: 2.5pt solid #fff;
    border-right: 2.5pt solid #fff;
    border-top: none;
    color: #B4FFFF;
    background: transparent;
  }
.pr-cov-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    border-top: 0.1pt solid #cbd5e1;
    border-bottom: 0.1pt solid #cbd5e1;
  }
  .pr-cov-table th {
    background: #F6F6F6;
    padding: 4pt 4pt;
	font-size: 13pt;
    text-align: center;
     color: #000;
    border: 0.2pt solid #cbd5e1;
    border-left: none;
    border-right: none;
   }
  .pr-cov-table td {
    padding: 4pt 4pt;
    border: 0.3pt solid #cbd5e1;
    border-left: none;
    border-right: none;
    vertical-align: middle;
   }
  .pr-cov-table td:last-child, .pr-cov-table th:last-child { border-right: none; }
  .pr-status-normal { color: #000; }
  .pr-status-cancel { color: #8C8C8C; text-decoration: line-through; }
.pr-cov-cancel { color: #8C8C8C; }
.pr-cov-cancel td { text-decoration: line-through; }
.pr-cov-cancel td.type { color: #8C8C8C !important; }
.pr-cov-cancel td.name { color: #8C8C8C !important; }
.pr-cov-cancel td.amount { color: #8C8C8C !important; }
  .pr-type-pill {
    display: inline-block;
    background: #fff;
    border: none;
    color: #000 !important;
    padding: 2pt 6pt;
    border-radius: 0;
    text-align: center;
  }
  .pr-type-pill-important {
    border-bottom: 2pt solid #10b981;
  }
  .pr-cov-cancel .pr-type-pill {
    color: #8C8C8C !important;
    text-decoration: line-through;
  }
  .pr-type-pill-teal { background: #fff; border: none; color: #10b981; }

  /* ── PRINT: analysis section ── */
  .pr-analysis-table {
    border: none !important;
    font-size: 10pt !important;
  }
  .pr-analysis-table th:first-child,
  .pr-analysis-table td:first-child {
    border-left: none !important;
    padding-left: 1pt !important;
  }
  .pr-analysis-table th:last-child,
  .pr-analysis-table td:last-child {
    border-right: none !important;
    padding-right: 1pt !important;
  }
  .pr-analysis-table thead tr:first-child th {
    border-top: none !important;
    padding-top: 1pt !important;
  }
  .pr-analysis-table tbody tr:last-child td {
    border-bottom: none !important;
    padding-bottom: 1pt !important;
  }
  .pr-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6pt;
    margin-bottom: 6pt;
    page-break-inside: avoid;
  }
  .pr-analysis-box {
    border: 2.5pt solid #cbd5e1;
    border-radius: 4pt;
    padding: 6pt 8pt;
    page-break-inside: avoid;
    width: 100%;
  }
  .pr-analysis-box-title {
     color: #000;
    margin-bottom: 4pt;
    padding-bottom: 3pt;
    border-bottom: 2pt solid #e2e8f0;
  }
  .pr-analysis-box-title.print-hide {
    display: none !important;
  }
  .pr-bar-row { margin-bottom: 4pt; }
  .pr-bar-label { display: flex; justify-content: space-between; margin-bottom: 2pt; }
  .pr-bar-track { background: #e8edf5; border-radius: 2pt; height: 6pt; overflow: hidden; border: 2pt solid #cbd5e1; }
  .pr-bar-fill { height: 100%; border-radius: 2pt; }
  .pr-alert-row {
    display: flex; align-items: center; gap: 6pt;
    padding: 3pt 0;
    border-bottom: 2pt solid #e2e8f0;
    }
  .pr-alert-row:last-child { border-bottom: none; }
  .pr-alert-dot { width: 8pt; height: 8pt; border-radius: 50%; flex-shrink: 0; }

  /* ── PRINT: footer ── */
  .pr-footer {
    margin-top: 8pt;
    padding-top: 4pt;
    border-top: 2pt solid #cbd5e1;
    display: flex;
     color: #000;
   }
  .pr-note {
    background: #fffbf0;
    border: 2.5pt solid #f59e0b;
    border-radius: 3pt;
    padding: 6pt 8pt;
     color: #78350f;
    margin-top: 6pt;
   }
    .pr-page-break { page-break-before: always; }

    /* ── PRINT: Cover page ── */
    #print-cover {
      display: flex !important;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      font-family: 'Noto Sans KR', sans-serif;
      font-size: 12pt;
      color: #000;
      line-height: 1.4;
      background: #fff;
      /* full printable height (A4 height minus page margins) */
      height: 277mm;
      width: 100%;
      position: relative;
      padding: 0;
      page-break-before: always;
      page-break-after: always;
      box-sizing: border-box;
    }

    /* cover 페이지에만 적용되는 테두리 */
    #print-cover::before {
      content: '';
      position: absolute;
      top: 1mm;
      left: 1mm;
      right: 1mm;
      bottom: 1mm;
      border: 0.5px solid #DA0F46;
      pointer-events: none;
      z-index: 1;
    }

    #print-cover::after {
      content: '';
      position: absolute;
      top: 3mm; /* 첫 번째 테두리에서 2mm 여백 */
      left: 3mm;
      right: 3mm;
      bottom: 3mm;
      border: 5px solid #0A1F9C;
      pointer-events: none;
      z-index: 2;
    }
    .cover-image {
      width: 50%;
      max-width: 200mm;
      margin: 30mm auto 0 auto; /* top margin to space from top */
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .cover-image img {
      max-width: 100%;
      height: auto;
    }
    .cover-title {
      display: block;
      position: relative;
      text-align: center;
      font-size: 36pt;
      font-weight: 700;
      margin: 0 auto 4pt;
    }

    
    .cover-subtitle {
      text-align: center;
      font-size: 36pt;
      font-weight: 700;
      margin: 0mm 0 8pt 0;
    }
    .cover-info-block {
      display: flex;
      justify-content: flex-end;
      margin-top: auto;
      margin-bottom: 30mm; /* space above footers */
      text-align: justify;
      font-size: 20pt;
      font-weight: 500;
    }
    .cover-table {
      width: 140mm;
      height: 40mm;
      border: none !important;
      border-collapse: collapse !important;
      margin: 0 auto;
      text-align: center;
    }
    .cover-table tr {
      border: none !important;
      border-width: 0 !important;
    }
    .cover-table td {
      padding: 0;
      text-align: justify;
      font-size: 18pt;
      font-weight: 700;
      border: none !important;
      border-width: 0 !important;
      outline: none !important;
      box-shadow: none !important;
    }
    .cover-table td:nth-child(2) { /* 담당자, 연락처, 팩스 cells */
      text-align: right;
      width: 29mm;
    }
    .cover-table td:nth-child(3) { /* colon cells */
      text-align: center;
      width: 10mm;
    }
    .cover-table td:nth-child(4) { /* data cells */
      text-align: left;
      width: 50mm;
    }
    .cover-divider {
      width: 105mm;
      height: 0.7px;
      background-color: #B00E3A;
      margin: 3mm auto;
      border: none;
    }
    .cover-box {
      width: 140mm;
      height: 76mm;
      margin: 20mm auto 0;
      position: relative;
      border: 1px solid #B00E3A;
      box-sizing: border-box;
    }
    .cover-gradient-top,
    .cover-gradient-bottom {
      position: absolute;
      left: 0;
      right: 0;
      height: 20px;
      background: linear-gradient(to right, #FF7F90, #B00E3A);
      z-index: 1;
    }
    .cover-gradient-top {
      top: 0;
    }
    .cover-gradient-bottom {
      bottom: 0;
    }
    .cover-content {
      position: relative;
      z-index: 2;
      padding: 30px;
      height: 100%;
      display: block;
      text-align: center;
      width: 100%;
    }
    
    .cover-brand {
      text-align: right;
      font-size: 34pt;
      font-weight: 700;
      color: #DA0F46;
      margin-right: 10mm;
    }

    .cover-info div {
      margin: 2pt 0;
      font-size: 12pt;
    }
    .cover-date {
      position: absolute;
      top: 10mm;
      right: 10mm;
      font-size: 11pt;
      font-weight: 500;
      text-align: right;
      z-index: 10;
    }
    
    .cover-footer-right {
      position: absolute;
      right: 7mm;
      bottom: 10mm;
      font-size: 10pt;
      color: black;
    }

    .print-header-left, .print-header-right {
      position: fixed;
      top: 5mm;
      font-size: 10pt;
      color: #666;
      z-index: 100;
    }
    .print-header-left { left: 12mm; }
    .print-header-right { right: 12mm; }

    .print-footer-left, .print-footer-center, .print-footer-right {
      position: fixed;
      bottom: 5mm;
      font-size: 10pt;
      color: #666;
      z-index: 100;
    }
    .print-footer-left { left: 12mm; }
    .print-footer-center { left: 50%; transform: translateX(-50%); }
    .print-footer-right { right: 12mm; }

    .print-center-content {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 60pt;
      color: rgba(0, 0, 0, 0.20);
      font-weight: bold;
      pointer-events: none;
      white-space: nowrap;
      z-index: 9999;
      text-shadow: 0 0 2px rgba(255,255,255,0.8);
    }

    body.print-no-cover #print-cover { display:none !important; }
}
