/* 折讓單產生器：表單沿用共用樣式，這裡只放折讓單範例圖與列印 */
.tool { display: flex; flex-direction: column; gap: 20px; }
.notice { margin: 0; text-align: center; color: var(--pen); font-weight: 500; }

.row-card { padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; }
.row-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.link-btn { font: inherit; color: var(--error); background: none; border: 0; cursor: pointer; text-decoration: underline; min-height: 32px; }
.btn.add { background: var(--panel); color: var(--accent); border: 2px solid var(--accent); }
.btn.add:disabled { opacity: .5; cursor: default; }

/* 公司名稱候選清單（和手寫發票計算機相同） */
.suggest-host { position: relative; }
.suggest {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--panel); border: 2px solid var(--accent); border-radius: 10px; box-shadow: 0 8px 24px rgba(14, 22, 35, .12);
}
.suggest button {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; min-height: 44px;
  font: inherit; text-align: left; color: var(--ink); background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.suggest button:hover, .suggest button:focus-visible { background: var(--accent-soft); outline: none; }
.suggest-no { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 折讓單範例圖：手機上維持紙本比例，左右滑動 */
.pen { color: var(--pen); font-weight: 500; font-variant-numeric: tabular-nums; font-family: var(--font); }
.paper-scroll { overflow-x: auto; }
.paper {
  min-width: 760px; background: var(--paper); color: var(--print); font-family: var(--print-font);
  border: 2px solid var(--accent); border-radius: 8px; padding: 16px 20px 12px; font-size: 14px;
}
.copy-note { margin: 0 0 6px; font-size: .8125rem; font-weight: 600; }
.p-head { display: grid; grid-template-columns: 17rem 1fr; gap: 12px; align-items: start; }
.p-title { text-align: center; }
.p-title h3 { margin: 4px 0 6px; font-size: 1.1875rem; font-weight: 600; letter-spacing: .08em; }
.p-title p { margin: 0; font-weight: 600; }
table { border-collapse: collapse; }
.seller { width: 100%; border: 1.5px solid var(--rule); table-layout: fixed; }
.seller th, .seller td { border: 1px solid var(--rule); padding: 1px 6px; font-size: .7rem; font-weight: 600; text-align: left; height: 1.9rem; line-height: 1.15; }
.seller th.k { width: 4.2rem; text-align: center; }
.seller th.empty { width: 4.2rem; border-top: 0; }
.seller td { font-size: .85rem; overflow-wrap: anywhere; }

.items { width: 100%; margin-top: 8px; border: 1.5px solid var(--rule); table-layout: fixed; }
.items th, .items td { border: 1px solid var(--rule); padding: 0 3px; height: 2rem; font-size: .7rem; font-weight: 600; }
.items thead th { text-align: center; line-height: 1.2; }
.items td { font-size: .85rem; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.items td.c { text-align: center; }
.items td.n { text-align: right; }
.items tr.sum th { text-align: center; letter-spacing: .6em; }
.p-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; margin-top: 8px; font-size: .875rem; font-weight: 600; }
.p-foot p { margin: 0; }
.p-foot .sign { text-align: right; }
.p-foot .statement { grid-column: 1 / -1; font-weight: 500; font-size: .8125rem; }

/* 畫面上只顯示第一聯，列印才印出全部 */
@media screen { .sheets .copy:not(:first-child) { display: none; } }

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; }
  .site-header, .site-footer, main > h1, .screen-only { display: none !important; }
  main, .wrap { padding: 0; max-width: none; margin: 0; gap: 0; }
  .tool, .block { gap: 0; }
  .paper-scroll { overflow: visible; }
  .sheets .copy { display: block; height: 136mm; break-inside: avoid; page-break-inside: avoid; }
  .sheets .copy:nth-child(2n) { break-after: page; page-break-after: always; }
  .sheets .copy:last-child { break-after: auto; page-break-after: auto; }
  .paper { min-width: 0; width: 100%; border-width: 1px; border-radius: 0; padding: 4mm 5mm; font-size: 10pt; }
  .pen { color: #000; }
  .p-head { grid-template-columns: 62mm 1fr; }
  .items th, .items td { height: 7mm; font-size: 8pt; }
  .items td { font-size: 9pt; }
  .seller th, .seller td { height: 8mm; font-size: 7.5pt; }
  .seller td { font-size: 9pt; }
  .p-title h3 { font-size: 12pt; }
  .p-foot { font-size: 9pt; }
}

/* 優化：含稅輸入、記住賣方、統編提醒 */
.check-line { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; font-size: .9375rem; cursor: pointer; }
.check-line input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.warn { display: block; margin-top: 4px; color: #B45309; font-size: .875rem; font-weight: 700; }
