/* ==============================================
   SEED Billing System - Print & Template Styles
   ============================================== */

/* ---------- 帳票テンプレート共通 ---------- */
.invoice-template {
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 16mm;
  background: #fff;
  margin: 0 auto;
  color: #1a1a1a;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 10.5pt;
  line-height: 1.6;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.08);
  position: relative;
}

.tpl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16mm;
}

.tpl-doc-title {
  font-size: 26pt;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.tpl-doc-meta {
  text-align: right;
  font-size: 10pt;
}

.tpl-doc-meta .meta-row {
  margin-bottom: 4px;
}

.tpl-doc-meta .meta-label {
  display: inline-block;
  width: 80px;
  color: #555;
  font-size: 9.5pt;
}

.tpl-doc-meta .meta-value {
  font-weight: 500;
}

.tpl-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12mm;
  margin-bottom: 14mm;
}

.tpl-customer {
  padding-right: 8mm;
}

.tpl-customer-name {
  font-size: 16pt;
  font-weight: 600;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1a1a1a;
}

.tpl-customer-meta {
  font-size: 9pt;
  color: #555;
  line-height: 1.7;
}

.tpl-issuer {
  text-align: right;
  font-size: 9.5pt;
}

.tpl-issuer-name {
  font-size: 12pt;
  font-weight: 600;
  margin-bottom: 4px;
}

.tpl-issuer-line {
  margin-bottom: 2px;
  color: #333;
}

.tpl-issuer-invoice-no {
  margin-top: 6px;
  font-size: 9pt;
  color: #666;
  font-family: 'Inter', monospace;
}

.tpl-summary {
  margin-bottom: 12mm;
}

.tpl-subject {
  font-size: 11pt;
  margin-bottom: 8px;
}

.tpl-total-display {
  background: #f5f3ee;
  padding: 14px 20px;
  border-left: 4px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tpl-total-label {
  font-size: 11pt;
  font-weight: 500;
}

.tpl-total-amount {
  font-size: 20pt;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.tpl-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10mm;
}

.tpl-items thead th {
  background: #f5f3ee;
  padding: 8px 10px;
  font-size: 9.5pt;
  font-weight: 600;
  text-align: left;
  border-top: 1.5px solid #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
}

.tpl-items thead th.right { text-align: right; }
.tpl-items thead th.center { text-align: center; }

.tpl-items tbody td {
  padding: 8px 10px;
  font-size: 10pt;
  border-bottom: 1px solid #d4d0c4;
  vertical-align: top;
}

.tpl-items tbody td.right {
  text-align: right;
  font-family: 'Inter', sans-serif;
}

.tpl-items tbody td.center { text-align: center; }

.tpl-totals-area {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12mm;
}

.tpl-totals {
  width: 80mm;
  font-size: 10pt;
}

.tpl-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid #e5e2da;
}

.tpl-totals-row.tpl-tax-detail {
  font-size: 9pt;
  color: #555;
  padding: 3px 10px;
}

.tpl-totals-row.tpl-grand {
  background: #f5f3ee;
  font-size: 12pt;
  font-weight: 700;
  border-top: 1.5px solid #1a1a1a;
  border-bottom: 1.5px solid #1a1a1a;
  padding: 9px 10px;
}

.tpl-totals-row span:last-child {
  font-family: 'Inter', sans-serif;
}

.tpl-remarks {
  border: 1px solid #d4d0c4;
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 9.5pt;
  background: #faf9f5;
  margin-bottom: 8mm;
  white-space: pre-wrap;
}

.tpl-remarks-title {
  font-weight: 600;
  font-size: 10pt;
  margin-bottom: 4px;
}

.tpl-bank {
  border: 1px solid #d4d0c4;
  padding: 12px 16px;
  font-size: 9.5pt;
  background: #faf9f5;
  margin-bottom: 8mm;
}

.tpl-bank-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.tpl-receipt-note {
  text-align: center;
  font-size: 11pt;
  margin: 14mm 0;
}

.tpl-receipt-note .note-label {
  display: inline-block;
  width: 100px;
  border-bottom: 1px solid #333;
  padding-bottom: 4px;
  margin: 0 12px;
  font-weight: 500;
}

.tpl-stamp-area {
  position: absolute;
  right: 16mm;
  top: 50mm;
  width: 24mm;
  height: 24mm;
  border: 1.5px solid #b04030;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b04030;
  font-size: 8pt;
  font-weight: 600;
  opacity: 0.7;
}

/* ========== Modern Template ========== */
.invoice-template.template-modern .tpl-doc-title {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 32pt;
  color: #8a6d3b;
  letter-spacing: 0.15em;
}

.invoice-template.template-modern .tpl-customer-name {
  border-bottom: 2px solid #8a6d3b;
}

.invoice-template.template-modern .tpl-total-display {
  background: #fff;
  border-left: 5px solid #8a6d3b;
  border-top: 1px solid #e5e2da;
  border-right: 1px solid #e5e2da;
  border-bottom: 1px solid #e5e2da;
}

.invoice-template.template-modern .tpl-total-amount {
  color: #8a6d3b;
}

.invoice-template.template-modern .tpl-items thead th {
  background: #fff;
  border-top: 2px solid #8a6d3b;
  border-bottom: 1px solid #d4d0c4;
  color: #8a6d3b;
}

.invoice-template.template-modern .tpl-totals-row.tpl-grand {
  background: #fff;
  color: #8a6d3b;
  border-top: 2px solid #8a6d3b;
  border-bottom: 2px solid #8a6d3b;
}

/* ========== Classic Template ========== */
.invoice-template.template-classic {
  font-family: 'Noto Serif JP', serif;
}

.invoice-template.template-classic .tpl-doc-title {
  font-size: 28pt;
  letter-spacing: 0.5em;
  border-bottom: 3px double #1a1a1a;
  padding-bottom: 8px;
  display: inline-block;
}

.invoice-template.template-classic .tpl-customer-name {
  border-bottom: 3px double #1a1a1a;
}

.invoice-template.template-classic .tpl-total-display {
  background: #fff;
  border: 3px double #1a1a1a;
  border-left: 3px double #1a1a1a;
}

.invoice-template.template-classic .tpl-items thead th {
  background: #ebe8e0;
  border-top: 3px double #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
}

.invoice-template.template-classic .tpl-totals-row.tpl-grand {
  border-top: 3px double #1a1a1a;
  border-bottom: 3px double #1a1a1a;
  background: #ebe8e0;
}

/* ========== 印刷時 ========== */
@media print {
  body * { visibility: hidden; }

  #printArea, #printArea * {
    visibility: visible;
  }

  #printArea {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .invoice-template {
    box-shadow: none;
    width: 100%;
    min-height: auto;
    padding: 12mm 14mm;
    margin: 0;
  }

  @page {
    size: A4;
    margin: 0;
  }
}
