/* 請款申請單 A4 版面（螢幕預覽 + 列印 + html2canvas 擷取共用同一份樣式） */

.sheet-scroll {
  overflow-x: auto; padding: 22px 12px; margin-bottom: 18px;
  background: repeating-linear-gradient(-45deg, rgba(255,138,31,.06) 0 10px, transparent 10px 20px), #0d0f11;
  border: 1px solid #333a41; border-top: 3px solid #ff8a1f;
}

.sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 14mm 12mm;
  background: #fff;
  color: #000;
  box-shadow: 0 0 0 1px #4a535c, 0 6px 30px rgba(0, 0, 0, .6);
  font-family: "Noto Serif TC", "MingLiU", "PMingLiU", "Microsoft JhengHei", serif;
  font-size: 11pt;
  line-height: 1.5;
}

.sheet-title {
  text-align: center;
  font-size: 20pt;
  font-weight: 700;
  letter-spacing: .35em;
  margin: 0 0 6mm;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid #000;
  padding: 2.2mm 2.5mm;
  vertical-align: middle;
  word-break: break-word;
}

.sheet-table th {
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  background: #fff;
}

/* 抬頭列（無外框，只留底線） */
.sheet-table .head-row td.nb {
  border: 0;
  border-bottom: 1px solid #000;
  padding-bottom: 1.5mm;
  font-size: 11pt;
}

.sheet-table td.big {
  font-size: 16pt;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4mm 2.5mm;
}

.sheet-table .amount-row th { font-size: 12pt; }

.sheet-table .date-row td,
.sheet-table .date-row th { height: 32mm; }
.sheet-table .date-cell { white-space: nowrap; letter-spacing: .04em; text-align: center; }
.sheet-table .check-th { vertical-align: middle; }
.sheet-table .check-th .check-no { font-size: 10pt; margin-top: 2mm; min-height: 1.4em; }
.sheet-table .bank { vertical-align: middle; }
.sheet-table .bank div { line-height: 1.8; font-size: 10.5pt; }
.sheet-table .payee-row td,
.sheet-table .payee-row th { height: 14mm; }
.sheet-table .pay { white-space: nowrap; font-size: 10pt; text-align: left; }
.sheet-table .pay label { color: #000; font-size: 10pt; gap: 3px; display: block; }
.sheet { color-scheme: light; }
.sheet-table .pay input { margin: 0 3px 0 0; vertical-align: -1px; }
.sheet-table .amount-num { font-size: 13pt; font-weight: 600; padding-left: 4mm; }

/* 可編輯欄位：螢幕上有淡底提示，列印/PDF 時乾淨 */
.ed {
  display: inline-block;
  min-width: 2em;
  min-height: 1.35em;
  outline: none;
  border-bottom: 1px dotted transparent;
}
.ed:empty::before { content: "\00a0"; }
.ed:hover { background: #fff3e6; }
.ed:focus { background: #ffe9d1; border-bottom-color: #ff8a1f; }
.ed.w2 { min-width: 2.4em; text-align: center; }
.ed.w3 { min-width: 3.2em; text-align: center; }

select.ed {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1px dotted transparent;
  border-radius: 0;
  font: inherit;
  color: inherit;
  padding: 0;
  min-height: 0;
  cursor: pointer;
}

/* 簽名列 */
.sheet-table .sign-row th,
.sheet-table .sign-row td { height: 22mm; }
.sigcell {
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
}
.sigcell .sig-img-box {
  height: 16mm;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sigcell[data-role="applicant"] .sig-img-box { height: 10mm; }
.sigcell[data-role="applicant"].has-sig .sig-img-box { height: 16mm; }
.sigcell img {
  display: none;
  height: 100%;
  width: auto;
  max-width: 92%;
  object-fit: contain;
  margin: 0 auto;
}
.sigcell.has-sig img { display: block; }
.sigcell.has-sig .sigph { display: none; }
.sigph { color: #b6bcc4; font-size: 9pt; display: block; }
.sigcell .applicant-name { font-size: 11pt; text-align: center; }
.sigcell.has-sig .applicant-name { display: none; }

.sheet-foot { margin-top: 4mm; font-size: 9pt; font-family: "Share Tech Mono", monospace; color: #666; text-align: right; }

/* ── 列印 ── */
@page { size: A4 portrait; margin: 10mm; }

@media print {
  html, body { background: #fff; }
  .no-print, .topbar, .toast, .modal, .login { display: none !important; }
  main { padding: 0; max-width: none; }
  .panel { display: none !important; }
  .panel#panel-forms { display: block !important; }
  .sheet-scroll { overflow: visible; padding: 0; margin: 0; border: 0; background: none; }
  .sheet {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
  .ed:hover, .ed:focus { background: transparent; }
  .sigph { display: none !important; }
}

/* html2canvas 擷取時暫時套用，避免抓到 hover/focus 底色與提示字 */
.sheet.capturing .ed { background: transparent !important; border-bottom-color: transparent !important; }
.sheet.capturing .sigph { display: none !important; }
.sheet.capturing .sheet-foot { display: none; }
