/* ── Yotathai Trans — Design System ─────────────────────────────
   แม่แบบดีไซน์มาตรฐานตระกูลแอปโยธาไทย (สืบทอดจาก operate): ใช้ง่ายก่อนสวย, มือถือหน้างานอ่านชัด */

:root {
  --blue: #1a56db;
  --blue-dark: #1240a8;
  --blue-soft: #e8effc;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1b2430;
  --text-dim: #5b6779;
  --line: #dde3ec;
  --accent-row: #f8fafd;
  --shadow: 0 1px 3px rgba(16, 30, 54, .08), 0 4px 14px rgba(16, 30, 54, .06);
  --radius: 12px;
  --ok: #067647;
  --warn: #b45309;
}
:root[data-theme="dark"] {
  --blue: #6b96f5;
  --blue-dark: #8db0ff;
  --blue-soft: #1d2a45;
  --bg: #0f1523;
  --surface: #182136;
  --text: #e8edf6;
  --text-dim: #94a1b8;
  --line: #2a3650;
  --accent-row: #1c2740;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --ok: #4ade80;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Sarabun", "Noto Sans Thai", -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--blue); }

/* ── Topbar ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; }
/* โลโก้ช้างเป็นสีน้ำเงินเข้มพื้นโปร่งใส กลืนกับพื้นหลัง Dark Mode ที่เป็นโทนน้ำเงินเข้มเช่นกัน
   ใส่แผ่นขาวรองหลังเสมอ (ไม่ว่าธีมไหน) ให้ตัดกันชัดเจนแทนการทำไฟล์โลโก้แยกสองสี (เหมือน operate) */
.brand-logo { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; background: #fff; border-radius: 9px; padding: 4px; box-sizing: border-box; }
.brand h1 { font-size: 1.12rem; margin: 0; line-height: 1.25; }
.brand p { font-size: .78rem; margin: 0; color: var(--text-dim); }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; font-size: 1.1rem; padding: .35rem .6rem; cursor: pointer; color: var(--text); }

/* ── Layout ── */
.layout { max-width: 1280px; margin: 0 auto; padding: 1rem; display: grid; grid-template-columns: 320px 1fr; gap: 1rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; position: sticky; top: 4.4rem; display: flex; flex-direction: column; gap: 1.1rem; }
.content { min-width: 0; }

.panel-step { display: flex; flex-direction: column; gap: .45rem; }
.step-label { font-weight: 700; font-size: .95rem; }
.input-lg { width: 100%; font-size: 1.05rem; font-family: inherit; padding: .65rem .75rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.input-lg:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.price-row { display: flex; gap: .5rem; }
.price-row input { flex: 1; min-width: 0; }

.map-toggle-btn { align-self: flex-start; background: none; border: none; color: var(--blue); font-family: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; padding: .2rem 0; margin-top: -.15rem; text-align: left; }
:root[data-theme="dark"] .map-toggle-btn { color: var(--blue-dark); }

/* ── ปุ่มเลือกชนิดรถ ── */
.truck-select { display: flex; flex-direction: column; gap: .45rem; }
.truck-select button { font-family: inherit; text-align: left; display: flex; flex-direction: column; gap: .1rem; padding: .55rem .75rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font-size: .95rem; }
.truck-select button span { font-size: .78rem; color: var(--text-dim); }
.truck-select button.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.truck-select button.active span { color: var(--blue); opacity: .85; }
:root[data-theme="dark"] .truck-select button.active { color: var(--blue-dark); }
:root[data-theme="dark"] .truck-select button.active span { color: var(--blue-dark); }

/* ── หน้าต่างลอย ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 28, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; backdrop-filter: blur(2px); }
.modal-backdrop[hidden] { display: none; }
.map-modal { background: var(--surface); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.35); width: min(480px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden auto; }
.map-modal-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-weight: 700; gap: .6rem; }
.map-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; justify-content: center; padding: 0 1rem 1rem; font-size: .78rem; color: var(--text-dim); }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
#map-container { width: 100%; height: 460px; display: flex; align-items: center; justify-content: center; padding: .5rem 1rem; flex-shrink: 0; }
#map-container svg { width: 100%; height: 100%; }
.province { stroke: var(--surface); stroke-width: .5; cursor: pointer; transition: filter .15s; }
.province:hover { filter: brightness(1.25) saturate(1.15); }
.province.active { filter: brightness(1.15); stroke: #1b2430; stroke-width: 1.6; }
@media (max-width: 560px) { #map-container { height: 60vh; } }
.hint { font-size: .78rem; color: var(--text-dim); margin: 0; }
.hint.ok { color: var(--ok); }
.warn { color: var(--warn); font-weight: 700; }

.truck-guide { padding: .4rem 1.2rem 1.2rem; overflow-y: auto; }
.truck-guide h3 { margin: .9rem 0 .3rem; font-size: 1rem; color: var(--blue); }
:root[data-theme="dark"] .truck-guide h3 { color: var(--blue-dark); }
.truck-guide ul { margin: 0; padding-left: 1.3rem; }
.truck-guide li { margin: .15rem 0; }
.truck-guide .hint { margin-top: .9rem; display: block; }

.btn-primary, .btn-secondary { font-family: inherit; font-size: .95rem; font-weight: 700; border-radius: 10px; padding: .6rem 1rem; cursor: pointer; border: none; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--blue-soft); color: var(--blue); }
:root[data-theme="dark"] .btn-secondary { color: var(--blue-dark); }
.btn-danger { background: #dc2626; color: #fff; border: none; font-family: inherit; font-weight: 700; border-radius: 10px; padding: .6rem .8rem; cursor: pointer; font-size: .85rem; }
.btn-danger:hover { background: #b91c1c; }

.panel-note { font-size: .78rem; color: var(--text-dim); border-top: 1px dashed var(--line); padding-top: .8rem; }
.panel-note a { display: inline-block; margin-top: .2rem; }

/* ── Status bar ── */
.status-bar { background: linear-gradient(100deg, var(--blue), var(--blue-dark)); color: #fff; border-radius: var(--radius); padding: .8rem 1.1rem; margin-bottom: .9rem; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; align-items: baseline; }
.status-bar[hidden] { display: none; }
.status-bar strong { font-size: 1.15rem; }
.status-bar .sub { font-size: .85rem; opacity: .92; }

/* ── Toolbar / Tabs ── */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs button { font-family: inherit; font-size: .95rem; font-weight: 700; padding: .55rem .95rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text-dim); cursor: pointer; }
.tabs button.active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
:root[data-theme="dark"] .tabs button.active { color: var(--blue-dark); }
.badge { background: var(--blue); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 .45rem; margin-left: .2rem; }
.toolbar-right { display: flex; gap: .5rem; justify-content: flex-end; min-width: 0; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-dim); }
.empty-icon { font-size: 3rem; }
.empty-state h2 { color: var(--text); font-size: 1.2rem; margin: .6rem 0 .3rem; }
.empty-state p { margin: 0; }

/* ── การ์ดคำนวณ ── */
.calc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .9rem; overflow: hidden; }
.calc-head { padding: .7rem 1rem; background: var(--blue-soft); font-weight: 800; }
.calc-head .sub { font-weight: 400; font-size: .8rem; color: var(--text-dim); }
.calc-body { padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }

.surface-toggle { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: .95rem; cursor: pointer; }
.surface-toggle input { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }

.plain-l { display: flex; flex-direction: column; gap: .35rem; max-width: 340px; }
.plain-l label { font-weight: 700; font-size: .95rem; }

.seg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.seg-group { border: 1.5px solid var(--line); border-radius: 10px; padding: .6rem .8rem .8rem; margin: 0; min-width: 0; }
.seg-group legend { font-weight: 700; font-size: .88rem; padding: 0 .35rem; }
.seg-row { display: grid; grid-template-columns: 1fr 90px auto 1fr; gap: .45rem; align-items: center; font-size: .9rem; margin-top: .4rem; }
.seg-row.seg-na { opacity: .45; }
.seg-input { font-family: inherit; font-size: .95rem; padding: .4rem .5rem; text-align: right; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.seg-factor { color: var(--text-dim); font-size: .85rem; white-space: nowrap; }
.seg-adj { color: var(--ok); font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; }
.seg-summary { font-size: .95rem; background: var(--accent-row); border: 1px dashed var(--line); border-radius: 10px; padding: .6rem .8rem; }

.result-card .calc-head { background: linear-gradient(100deg, var(--blue), var(--blue-dark)); color: #fff; }
.rate-duo { display: flex; gap: .8rem; flex-wrap: wrap; }
.rate-big { flex: 1; min-width: 180px; background: var(--blue-soft); border-radius: 10px; padding: .8rem 1rem; display: flex; align-items: baseline; gap: .5rem; }
.rate-num { font-size: 1.9rem; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .rate-num { color: var(--blue-dark); }
.rate-unit { color: var(--text-dim); font-weight: 700; }
.derive { font-size: .9rem; color: var(--text-dim); border-left: 3px solid var(--line); padding-left: .8rem; line-height: 1.8; }
.derive strong { color: var(--text); }

.method-box { border: 1.5px solid var(--line); border-radius: 10px; padding: .8rem; }
.method-title { font-weight: 800; font-size: .92rem; margin-bottom: .5rem; }
.method-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.method-toggle button { font-family: inherit; text-align: left; padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font-weight: 800; font-size: .92rem; }
.method-toggle button span { display: block; font-weight: 400; font-size: .76rem; color: var(--text-dim); margin-top: .1rem; }
.method-toggle button.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
:root[data-theme="dark"] .method-toggle button.active { color: var(--blue-dark); }
.method-detail { margin-top: .6rem; font-size: .85rem; color: var(--text-dim); }
.method-detail summary { cursor: pointer; font-weight: 700; color: var(--blue); }
:root[data-theme="dark"] .method-detail summary { color: var(--blue-dark); }
.method-detail p { margin: .5rem 0 0; }

.add-item-row { display: flex; gap: .5rem; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: .8rem; }
.item-name { flex: 2; min-width: 160px; }
.item-qty { flex: 1; min-width: 90px; }
.item-unit { flex: 0 0 auto; width: auto; }

/* ── ตารางเต็มแบบเล่ม ── */
.table-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.table-controls label { font-weight: 700; font-size: .92rem; }
.table-controls select { width: auto; }
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.book-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.book-table th { font-size: .74rem; color: var(--text-dim); font-weight: 700; padding: .35rem .5rem; border-bottom: 1.5px solid var(--line); text-align: right; }
.book-table td { padding: .22rem .5rem; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.book-table td:first-child, .book-table th:first-child { text-align: center; color: var(--text-dim); }
.book-table tr:nth-child(even) td { background: var(--accent-row); }
.over-note { font-size: .92rem; background: var(--blue-soft); border-radius: 10px; padding: .6rem .9rem; }
.over-note .hint { display: block; margin-top: .15rem; }

/* ── รายการขนส่ง ── */
.boq-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.boq-head { padding: .8rem 1rem; font-weight: 800; background: var(--blue-soft); display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
.boq-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }
.table-wrap { overflow-x: auto; }
table.boq { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.boq th { font-size: .8rem; color: var(--text-dim); text-align: right; padding: .5rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.boq th:first-child { text-align: left; }
table.boq td { padding: .45rem .8rem; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.boq td:first-child { text-align: left; white-space: normal; min-width: 140px; }
table.boq td.unit { color: var(--text-dim); text-align: center; }
table.boq input.qty { width: 110px; font-family: inherit; font-size: .95rem; padding: .3rem .5rem; text-align: right; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.boq-total-row td { font-weight: 800; font-size: 1.05rem; border-top: 2px solid var(--blue); }
.boq-head .hint { font-weight: 400; }
.mobile-br { display: none; }
.item-actions { display: flex; gap: .3rem; justify-content: flex-end; white-space: nowrap; }
.icon-mini { background: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: .9rem; padding: .2rem .4rem; line-height: 1; }
.icon-mini:hover { background: var(--blue-soft); }
.del-btn { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--text-dim); }
.del-btn:hover { color: #dc2626; }
/* รายการที่ปิดไม่รวมยอด — ยังเห็นตัวเลขไว้เปรียบเทียบ แต่จางลงชัดเจนว่าไม่ถูกนับ */
tr.item-excluded { opacity: .5; }
tr.item-excluded td { font-style: italic; }
.excluded-badge { font-size: .72rem; font-weight: 700; color: var(--text-dim); background: var(--accent-row); border: 1px solid var(--line); border-radius: 99px; padding: .05rem .5rem; margin-left: .3rem; font-style: normal; }
.editing-hint { background: var(--blue-soft); border-radius: 8px; padding: .5rem .7rem; color: var(--blue); font-weight: 700; }
:root[data-theme="dark"] .editing-hint { color: var(--blue-dark); }

/* ── Footer ── */
.footer { max-width: 1280px; margin: 1.5rem auto 0; padding: 1rem; border-top: 1px solid var(--line); color: var(--text-dim); font-size: .82rem; text-align: center; }
.footer p { margin: .2rem 0; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .seg-grid { grid-template-columns: 1fr; }
  .method-toggle { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: 1fr; }
  body { font-size: 15px; }
}

/* ── Print: เอกสาร A4 แนบราคากลาง ── */
.print-only { display: none; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  /* ── กันโฆษณา/สคริปต์บุคคลที่สามติดไปกับเอกสารพิมพ์ ──────────────────────
     ตรวจ DOM จริงบน production แล้วพบว่า Google แนบโฆษณาไว้ 2 ระดับ:
       (1) ลูกของ <body>  — DIV.google-auto-placed, INS.adsbygoogle, IFRAME
       (2) ลูกของ <html> โดยตรง — INS.adsbygoogle (แถบโฆษณาล่าง), DIV#google-anno-sa (fixed), IFRAME#google_esf
     กฎเดิมคุมแค่ระดับ (1) โฆษณาระดับ (2) จึงหลุดไปพิมพ์ท้ายเอกสาร → ต้องคุมทั้งสองระดับ */
  html > *:not(body) { display: none !important; }
  body > *:not(#print-sheet) { display: none !important; }
  /* กันเหนียวอีกชั้น เผื่อ Google เปลี่ยนตำแหน่งที่แทรกในอนาคต */
  ins.adsbygoogle, .google-auto-placed, .adsbygoogle,
  [id^="aswift"], [id^="google-anno"], [id^="google_ads"], [class*="google-anno"] { display: none !important; }
  #print-sheet { display: block !important; padding-right: .6mm; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  .print-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2.5px solid #1a56db; padding-bottom: 3mm; margin-bottom: 4mm; }
  .print-header .print-brand { display: flex; align-items: center; gap: 2.5mm; font-weight: 800; font-size: 13pt; letter-spacing: .5px; }
  .print-header .print-brand img { width: 11mm; height: 11mm; object-fit: contain; }
  .print-title { text-align: right; }
  .print-title h1 { font-size: 13pt; margin: 0; }
  .print-title p { font-size: 10pt; margin: .5mm 0 0; color: #444; }
  .print-meta { width: 100%; border-collapse: collapse; margin-bottom: 4mm; font-size: 10pt; }
  .print-meta td { padding: 1.4mm 2.5mm; border: .5pt solid #ccc; }
  .print-meta td:first-child { font-weight: 700; width: 38%; background: #f2f5fb; }
  .print-h2 { font-size: 11.5pt; margin: 0 0 2.5mm; }
  table.print-rates { width: 100%; border-collapse: collapse; font-size: 9.5pt; border: 1.2pt solid #444; }
  table.print-rates th, table.print-rates td { border: .6pt solid #888; padding: 1mm 1.8mm; text-align: right; }
  table.print-rates th { background: #e8effc; text-align: center; color: #1240a8; }
  table.print-rates td:first-child, table.print-rates th:first-child { text-align: left; }
  table.print-rates .p-cat td { font-weight: 800; background: #f2f5fb; color: #1240a8; }
  /* ตารางเต็มพิมพ์ 2 หน้า ตามหน้าเล่ม ว477 ตัวจริง (1–120 / 121–200) — คุมการแบ่งหน้าเอง
     ไม่ปล่อยให้เบราว์เซอร์ตัดกลางคอลัมน์ · 3 คอลัมน์ทำให้ตัวเลขใหญ่อ่านง่ายกว่า 4 คอลัมน์ */
  .print-book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; align-items: start; }
  /* ใช้ break-after บนบล็อกหน้าแรก ไม่ใช่ break-before บนหน้าสอง — Chrome ทิ้งเศษบรรทัดแรก
     ของหน้าถัดไปไว้ท้ายหน้าแรกเมื่อใช้ break-before (ตรวจพบจาก PDF จริง) */
  .print-book-page1 { break-after: page; page-break-after: always; }
  /* สระบน/วรรณยุกต์ไทย (ำ ่ ้) ลอยเหนือกล่องบรรทัด — ถ้าบรรทัดแรกของหน้า 2 ชิดขอบบนพอดี
     ส่วนที่ล้นจะไปพิมพ์ค้างท้ายหน้า 1 เป็นเศษจางๆ (ตรวจพบจาก PDF จริง: เห็นคำว่า "น้ำ ที่")
     เว้นที่ด้านบน + line-height สูงพอ ให้สระอยู่ในกล่องของหน้า 2 ทั้งหมด */
  .print-book-page2 { padding-top: 2.5mm; }
  .print-book-cont { font-size: 9.5pt; line-height: 1.6; font-weight: 700; text-align: center; color: #1240a8; border-bottom: 1pt solid #1a56db; padding-bottom: 1.8mm; margin-bottom: 3mm; }
  .print-book-cont span { font-weight: 400; color: #555; }
  /* line-height ของ body (1.55) ทำให้แถวสูงถึง 6mm → 40 แถวสูง 244mm เกินพื้นที่ที่เหลือหลังหัวเอกสาร (213mm)
     คุมเหลือ 1.15 ได้แถวละ ~4.5mm → หน้าแรกรวม ~246mm พอดีหน้า A4 (ใช้ได้ 273mm) */
  table.print-book { font-size: 8.4pt; line-height: 1.15; break-inside: avoid; page-break-inside: avoid; }
  table.print-book th, table.print-book td { padding: .55mm 1.4mm; }
  table.print-book th { line-height: 1.25; }
  .print-note { font-size: 9pt; color: #333; margin: 2.5mm 0 0; }
  .print-closing { break-inside: avoid; page-break-inside: avoid; }
  /* บล็อกลงนามแบบเอกสารราชการ — จัดด้วย grid 3 คอลัมน์ให้เส้นประทุกบรรทัดตรงแนวเดียวกัน
     (เดิมใช้ text-align:right ทำให้แต่ละบรรทัดยาวไม่เท่ากันแล้วเหลื่อมกัน)
       คอลัมน์ 1 = คำนำหน้า "ลงชื่อ" · คอลัมน์ 2 = เส้นประ (แกนกลางที่ทุกบรรทัดยึด) · คอลัมน์ 3 = "ผู้จัดทำ"
     บรรทัดชื่อในวงเล็บและบรรทัดวันที่วางกึ่งกลางคอลัมน์ 2 → ตรงใต้เส้นลงนามพอดี */
  .print-sign {
    display: grid; grid-template-columns: auto 62mm auto; column-gap: 2mm; row-gap: 3.4mm;
    width: max-content; margin: 8mm 0 0 auto; font-size: 10pt; line-height: 1.5; break-inside: avoid;
  }
  .print-sign .ps-l { grid-area: 1 / 1; align-self: end; }
  .print-sign .ps-r { grid-area: 1 / 3; align-self: end; }
  .print-sign .ps-line { grid-area: 1 / 2; border-bottom: .5pt dotted #333; }
  .print-sign .ps-name { grid-area: 2 / 2; text-align: center; white-space: nowrap; }
  .print-sign .ps-date { grid-area: 3 / 2; text-align: center; white-space: nowrap; }
  .print-sign .ps-blank { display: inline-block; width: 46mm; border-bottom: .5pt dotted #333; margin: 0 1mm; }
  .print-sign .ps-d { display: inline-block; width: 13mm; border-bottom: .5pt dotted #333; margin: 0 1.2mm; }
  .print-foot { margin-top: 4mm; font-size: 8.5pt; color: #555; border-top: .5pt solid #ccc; padding-top: 2mm; break-inside: avoid; }
  tr { break-inside: avoid; }
}
