/* ================= SMC Office — screen ================= */
:root {
  --navy: #1b2559; --navy-2: #2b3a8c; --ink: #1d2233; --muted: #6b7286; --line: #e4e7ef;
  --bg: #f4f6fb; --card: #fff; --accent: #2f6bff; --red: #d64545; --green: #1f9d6b; --amber: #c98a12; --violet: #6a4fd8;
  --r: 12px; --shadow: 0 1px 2px rgba(20,30,70,.06), 0 4px 16px rgba(20,30,70,.05);
  --font: 'IBM Plex Sans Thai', 'Sarabun', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-2); text-decoration: none; }
svg { width: 20px; height: 20px; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
code { background: #eef1f8; padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.no-scroll { overflow: hidden; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: 500 14px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9cfdf; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.primary.outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger.ghost { background: #fff; color: var(--red); border-color: #f1c9c9; }
.btn.sm { height: 34px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #eef1f8; color: var(--ink); }
input, select, textarea { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font: 15px var(--font); color: var(--ink); outline: none; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
input[type=file] { height: auto; padding: 8px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline select { width: auto; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: 18px; height: 18px; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill.gray { background: #eef0f5; color: #555c70; } .pill.blue { background: #e6eeff; color: #2551c4; }
.pill.green { background: #e2f5ec; color: #157552; } .pill.navy { background: #e3e6f3; color: var(--navy); }
.pill.red { background: #fde8e8; color: #b23131; } .pill.violet { background: #eeeafd; color: #5036b8; }
.pill.amber { background: #fdf1dc; color: #8f600a; }

/* layout */
.boot { height: 100vh; display: grid; place-items: center; gap: 16px; align-content: center; color: var(--navy); }
.boot img { width: 72px; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; }
.brand img { width: 44px; height: 44px; }
.brand b { display: block; color: var(--navy); font-size: 17px; }
.brand small { color: var(--muted); font-size: 12px; }
.new-btn { margin-bottom: 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #3d4459; font-weight: 500; }
.sidebar nav a:hover { background: #f1f3f9; }
.sidebar nav a.active { background: #e8ecf8; color: var(--navy); }
.side-foot { margin-top: auto; display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
.demo-badge { background: #fff6e0; color: #8f600a; font-size: 12px; padding: 8px 10px; border-radius: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); }
.me > div:nth-child(2) { flex: 1; min-width: 0; }
.me b, .me small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.me small { color: var(--muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.avatar.lg { width: 46px; height: 46px; font-size: 18px; background: #e8ecf8; color: var(--navy); }
.main { flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 14px 28px; background: rgba(244,246,251,.9); backdrop-filter: blur(8px); }
.topbar h1 { font-size: 22px; flex: 1; }
.top-actions { display: flex; gap: 8px; }
.content { padding: 4px 28px 40px; display: grid; gap: 18px; max-width: 1280px; }
.only-mobile, .bottom-nav, .scrim { display: none; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; }

.month-pick { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 3px; }
.month-pick input { border: 0; height: 34px; width: 170px; box-shadow: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: #fff; border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.stat small { color: var(--muted); font-size: 13px; }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.accent { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.stat.accent small, .stat.accent span { color: #c9d1f5; }
.alerts { display: grid; gap: 8px; }
.alert { background: #fff6e0; color: #7a520a; padding: 10px 14px; border-radius: 10px; font-weight: 500; }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick.big { grid-template-columns: repeat(2, 1fr); max-width: 900px; }
.q-card { background: #fff; border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 4px; color: var(--ink); border: 1px solid transparent; transition: .15s; }
.q-card:hover { border-color: #c9d2ef; transform: translateY(-1px); }
.q-card svg { width: 30px; height: 30px; color: var(--navy-2); margin-bottom: 6px; }
.q-card small { color: var(--muted); }

/* table */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip { margin-left: 6px; font-size: 12px; }
.row-actions { white-space: nowrap; text-align: right; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; }
.seg { display: flex; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 3px; }
.seg a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
.seg a.on { background: var(--navy); color: #fff; }
.search { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding-left: 10px; flex: 1; min-width: 200px; color: var(--muted); }
.search input { border: 0; box-shadow: none !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 6px 12px; background: #fff; border-radius: 99px; color: #3d4459; font-size: 13.5px; box-shadow: var(--shadow); }
.chips a i { font-style: normal; color: var(--muted); margin-left: 3px; }
.chips a.on { background: var(--navy); color: #fff; } .chips a.on i { color: #c9d1f5; }

/* forms */
.form-grid { display: grid; gap: 18px; max-width: 980px; padding-bottom: 70px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: span 2; }
.with-btn { display: flex; gap: 8px; } .with-btn .btn { height: 42px; }
.docno { font-weight: 700; color: var(--navy); background: #e8ecf8; padding: 4px 10px; border-radius: 8px; }
.idcard-status { display: flex; align-items: end; padding-bottom: 8px; }
.item-row { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.item-row.e { grid-template-columns: 26px 1.1fr 1.2fr 140px 36px; }
.item-row.r { grid-template-columns: 26px 1fr 160px 36px; }
.item-row .no { color: var(--muted); text-align: center; font-size: 13px; }
.totals { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.sum-lines { margin-left: auto; text-align: right; display: grid; gap: 2px; min-width: 240px; }
.sum-lines div { display: flex; justify-content: space-between; gap: 20px; }
.sum-lines .grand { font-size: 18px; color: var(--navy); }
.sum-lines small { color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafbfd; aspect-ratio: 3/4; display: flex; flex-direction: column; }
.thumb img { width: 100%; flex: 1; object-fit: cover; min-height: 0; }
.thumb.loading { display: grid; place-items: center; color: var(--navy); }
.t-name { font-size: 11.5px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
.t-rm { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); width: 28px; height: 28px; }
.fileicon { flex: 1; display: grid; place-items: center; align-content: center; color: var(--muted); gap: 4px; }
.fileicon svg { width: 36px; height: 36px; }
.drop-hint { grid-column: 1/-1; padding: 18px; border: 1.5px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); }
.sticky-actions { position: fixed; bottom: 0; left: 250px; right: 0; display: flex; gap: 8px; padding: 12px 28px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); z-index: 6; backdrop-filter: blur(6px); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.idcard-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.idcard-prev { width: 200px; height: 126px; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; text-align: center; overflow: hidden; background: #fafbfd; }
.idcard-prev img { width: 100%; height: 100%; object-fit: cover; }
.idcard-prev svg { width: 34px; height: 34px; }

/* persons / docs */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.p-card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: flex; gap: 12px; align-items: center; }
.p-card.inactive { opacity: .55; }
.p-info { flex: 1; min-width: 0; display: grid; gap: 3px; justify-items: start; }
.p-info small { color: var(--muted); }
.p-act { display: flex; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.d-card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.d-thumb { aspect-ratio: 4/3; background: #f0f2f8; display: flex; }
.d-thumb img { width: 100%; height: 100%; object-fit: cover; }
.d-info { padding: 10px 12px 4px; display: grid; gap: 3px; justify-items: start; }
.d-info b { font-size: 14px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-info small { color: var(--muted); font-size: 12px; }
.d-act { display: flex; justify-content: flex-end; padding: 0 6px 6px; }

/* report */
.steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.bar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; margin-bottom: 8px; }
.bar div { height: 8px; background: #eef1f8; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--navy-2); border-radius: 99px; }
.bar b { font-variant-numeric: tabular-nums; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #e3e8fb, transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 30px; display: grid; gap: 14px; text-align: center; }
.login-card img { width: 80px; margin: 0 auto; }
.login-card h1 { color: var(--navy); }
.login-card p { margin: 0; color: var(--muted); }
.login-card label { text-align: left; }
.notice { background: #fff6e0; color: #7a520a; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; text-align: left; }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,20,45,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 640px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal-body { padding: 18px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 99; font-weight: 500; }
.toast.err { background: var(--red); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* print preview overlay */
#print-root { display: none; }
body.printing #print-root { display: block; position: fixed; inset: 0; z-index: 80; background: #5b6273; overflow: auto; }
.print-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--ink); color: #fff; z-index: 2; }
.print-bar .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print-pages { padding: 24px 0; display: grid; justify-content: center; gap: 24px; }
.print-pages .page { box-shadow: 0 6px 30px rgba(0,0,0,.35); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body { font-size: 15px; }
  .only-mobile { display: inline-grid; }
  .hide-sm { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-105%); transition: transform .22s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .scrim.show { display: block; }
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar h1 { font-size: 18px; }
  .content { padding: 4px 14px 100px; gap: 14px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff;
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
  .bottom-nav a.active { color: var(--navy); }
  .bottom-nav .fab { width: 52px; height: 52px; margin: -22px auto 0; border-radius: 50%; background: var(--navy); color: #fff; place-items: center; box-shadow: 0 6px 18px rgba(27,37,89,.4); }
  .bottom-nav .fab svg { width: 26px; height: 26px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; } .stat b { font-size: 19px; }
  .quick, .quick.big { grid-template-columns: 1fr; }
  .q-card { grid-template-columns: 36px 1fr; column-gap: 12px; } .q-card svg { grid-row: span 2; margin: 0; }
  .fields { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .item-row.e { grid-template-columns: 1fr 120px 32px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .item-row.e .no { display: none; } .item-row.e [data-k=vendor] { grid-column: 1 / -1; }
  .item-row.r { grid-template-columns: 1fr 120px 32px; } .item-row.r .no { display: none; }
  .sticky-actions { left: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 35; }
  .form-grid { padding-bottom: 90px; }
  .month-pick input { width: 140px; }
  .search { min-width: 100%; }
  .seg { overflow-x: auto; max-width: 100%; }
  /* table → card list */
  .table-wrap { margin: 0; }
  .tbl thead { display: none; }
  .tbl tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 2px 10px; }
  .tbl td { border: 0; padding: 0; }
  .tbl td[data-l="เลขที่"] { order: -2; } .tbl td[data-l="ยอดสุทธิ"] { order: -1; }
  .tbl td[data-l="วันที่"], .tbl td[data-l="ประเภท"] { font-size: 12.5px; }
  .tbl td[data-l="รายการ"] { grid-column: 1 / -1; max-width: none; }
  .row-actions { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
  .cards { grid-template-columns: 1fr; }
  .d-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .modal-wrap { align-items: end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94vh; }
  .print-pages { justify-content: start; overflow-x: auto; padding: 12px; }
  .print-pages .page { zoom: .45; }
  .bar { grid-template-columns: 1fr 80px auto; }
}

/* ================= A4 print pages ================= */
.page { width: 210mm; min-height: 297mm; padding: 14mm 14mm 12mm; background: #fff; color: #000; font-family: 'Sarabun', 'TH Sarabun New', serif; font-size: 15pt; line-height: 1.45; position: relative; }
.page u { text-decoration: none; border-bottom: 1px dotted #000; padding: 0 6px; }
.sig-line { display: inline-block; width: 60mm; border-bottom: 1px dotted #000; height: 1.2em; vertical-align: bottom; }
.c { text-align: center; }

/* ใบสำคัญรับเงิน */
.receipt .r-head { text-align: center; }
.receipt .r-logo { width: 26mm; margin-bottom: 4mm; }
.receipt h1 { font-size: 17pt; font-weight: 700; }
.receipt h2 { font-size: 16pt; font-weight: 700; }
.receipt .r-head p { margin: 1mm 0; font-size: 14pt; }
.receipt .r-meta { display: flex; justify-content: space-between; margin: 8mm 0 6mm; }
.receipt .r-body p { margin: 0 0 3mm; }
.r-fill .w-name { display: inline-block; min-width: 60mm; font-weight: 700; text-align: center; }
.r-fill .w-addr { display: inline-block; min-width: 70mm; }
.r-fill .w-id { display: inline-block; min-width: 55mm; text-align: center; letter-spacing: .5px; }
.r-items { margin: 6mm 0 10mm 14mm; min-height: 40mm; }
.r-line { display: grid; grid-template-columns: 1fr 22mm 34mm 14mm; align-items: baseline; margin-bottom: 3mm; }
.r-line .r-amt { text-align: right; } .r-line .r-unit { text-align: right; }
.r-total { margin-left: 14mm; }
.r-words { text-align: right; margin-top: 1mm; padding-right: 14mm; }
.r-sign { margin-top: 18mm; display: grid; gap: 3mm; }
.r-sign-name { margin-left: 26mm; width: 60mm; text-align: center; }
.r-note2 { margin-top: 10mm; font-size: 13pt; }
.r-note { position: absolute; bottom: 14mm; left: 14mm; font-size: 13pt; }

/* ใบเบิกเงิน */
.expense { font-size: 13.5pt; }
.e-head { display: grid; grid-template-columns: 24mm 1fr 24mm; align-items: center; border-bottom: 1px solid #000; padding-bottom: 2mm; }
.e-logo { width: 22mm; }
.e-title { text-align: center; }
.e-title h1 { font-size: 22pt; font-weight: 700; line-height: 1.2; }
.e-title h2 { font-size: 14pt; font-weight: 700; }
.e-meta { display: grid; grid-template-columns: 1fr 1fr; margin-top: 2mm; }
.e-meta span { margin-right: 4mm; }
.e-meta div:nth-child(2) { padding-left: 20mm; }
.w-job { display: inline-block; min-width: 60mm; }
.e-table { width: 100%; border-collapse: collapse; margin-top: 3mm; }
.e-table th, .e-table td { border: 1px solid #000; padding: .6mm 2mm; height: 7.6mm; vertical-align: middle; line-height: 1.25; }
.e-table th { font-weight: 400; font-size: 14pt; line-height: 1.2; }
.e-table td.num { text-align: right; }
.e-table tfoot td { height: 9mm; }
.e-words { text-align: center; }
.e-foot { display: grid; grid-template-columns: 1fr 72mm; border: 1px solid #000; border-top: 0; }
.e-sigs { display: grid; grid-template-columns: 1fr 1fr; }
.e-sigs .box { border-right: 1px solid #000; border-bottom: 1px solid #000; padding: 5mm 2mm 1.5mm; text-align: center; display: grid; gap: .5mm; justify-items: center; font-size: 12pt; line-height: 1.3; }
.e-sigs .box div { white-space: nowrap; overflow: hidden; max-width: 100%; }
.e-sigs .box:nth-child(n+3) { border-bottom: 0; }
.e-sigs .box .sig-line { width: 44mm; }
.e-sigs .bank { align-content: center; justify-items: start; padding-left: 6mm; }
.e-notes { padding: 2mm 3mm; font-size: 11pt; line-height: 1.3; }
.e-notes ol { margin: 1mm 0 0; padding-left: 5mm; }

/* แนบไฟล์ */
.attach { display: flex; flex-direction: column; }
.a-cap { font-size: 11pt; color: #555; border-bottom: 1px solid #ccc; padding-bottom: 2mm; margin-bottom: 4mm; }
.a-img { flex: 1; display: flex; align-items: flex-start; justify-content: center; }
.a-img img { max-width: 100%; max-height: 255mm; object-fit: contain; }
.a-img.idcard { flex: none; margin-top: 20mm; }
.a-img.idcard img { width: 120mm; max-height: 90mm; border: 1px solid #ddd; }
.a-certify { margin: 12mm auto 0; text-align: center; font-size: 15pt; line-height: 1.6; }
.a-list { font-size: 14pt; }

/* สรุปรายเดือน */
.summary { font-size: 11pt; }
.s-head { display: flex; gap: 6mm; align-items: center; margin-bottom: 5mm; }
.s-head img { width: 18mm; }
.s-head h1 { font-size: 17pt; }
.s-head p { margin: 0; }
.s-table th, .s-table td { height: auto; padding: 1.2mm 1.5mm; font-size: 10.5pt; }
.s-table th { font-weight: 700; background: #f2f2f2; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff; }
  #app, .no-print, .toast, .modal-wrap { display: none !important; }
  body.printing #print-root { position: static; display: block; background: #fff; overflow: visible; }
  .print-pages { display: block; padding: 0; }
  .print-pages .page { box-shadow: none; zoom: 1; page-break-after: always; break-after: page; min-height: 296mm; }
  .print-pages .page:last-child { page-break-after: auto; break-after: auto; }
}
.s-table td:nth-child(2), .s-table td:nth-child(3), .s-table td.num { white-space: nowrap; }
.bottom-nav.hidden { display: none !important; }
@media (max-width: 820px) { .month-pick input { width: 150px; font-size: 14px; } }
