body { font-family: 'Sarabun', system-ui, sans-serif; background: #f1f4f9; font-size: 1rem; }
.bg-primary-subtle-dark { background: linear-gradient(90deg, #0b3d91, #1565c0); }
.card { border: 0; border-radius: .75rem; box-shadow: 0 1px 3px rgba(15, 30, 60, .08); }
.card-header { background: #fff; border-bottom: 1px solid #e9edf3; font-weight: 600; border-radius: .75rem .75rem 0 0 !important; }
.stat { border-left: 4px solid var(--bs-primary); }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat.in { border-color: #1565c0; } .stat.out { border-color: #2e7d32; } .stat.pend { border-color: #ef6c00; } .stat.done { border-color: #6a1b9a; }
.table td, .table th { vertical-align: middle; }
.table-docs td { font-size: .95rem; }
.reg-no { font-weight: 700; white-space: nowrap; color: #0b3d91; }
.subject-link { color: inherit; text-decoration: none; font-weight: 500; }
.subject-link:hover { text-decoration: underline; color: #0b3d91; }
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid #dbe3ee; margin-left: .5rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #1565c0; }
.timeline li.order::before { background: #ef6c00; }
.timeline li.done::before, .timeline li.close::before { background: #2e7d32; }
.order-box { background: #fff8e1; border-left: 4px solid #ef6c00; padding: .5rem .75rem; border-radius: .25rem; white-space: pre-wrap; }
.comment { white-space: pre-wrap; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0b3d91, #1e88e5); }
/* mobile: doc list as cards */
@media (max-width: 767.98px) {
  .table-docs thead { display: none; }
  .table-docs tr { display: block; background: #fff; border-radius: .5rem; margin-bottom: .6rem; padding: .5rem .75rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
  .table-docs td { display: block; border: 0; padding: .1rem 0; }
  .table-docs td[data-l]::before { content: attr(data-l) ': '; color: #6c757d; font-size: .85rem; }
  .table-docs td.hide-m { display: none; }
}
/* print register */
.print-page { background: #fff; padding: 1rem; }
.print-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.print-table th, .print-table td { border: 1px solid #000; padding: 4px 6px; vertical-align: top; }
.print-table th { text-align: center; background: #f2f2f2; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 14px; }
  main.container-xl { max-width: none; padding: 0; }
  .print-page { padding: 0; }
  .print-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { page-break-inside: avoid; }
}
/* ---- v1.1 ---- */
.brand-logo { height: 36px; width: auto; margin-right: .4rem; vertical-align: middle; }
.login-logo { height: 96px; width: auto; }
.next-no { background: #eef4ff; border: 1px dashed #9ab8f0; border-radius: .5rem; padding: .45rem .75rem; }
.next-no b { color: #0b3d91; font-size: 1.15rem; }
/* Thai date picker */
.tdp-input { background-color: #fff !important; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
.tdp { position: absolute; z-index: 1060; background: #fff; border: 1px solid #d6dde8; border-radius: .6rem; padding: .5rem; width: 290px; max-width: calc(100vw - 32px); }
.tdp-head { display: flex; gap: .25rem; margin-bottom: .4rem; }
.tdp-head select:first-of-type { flex: 1.4; } .tdp-head select { flex: 1; }
.tdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.tdp-dow { font-size: .8rem; font-weight: 600; color: #6c757d; padding: 2px 0; }
.tdp-day { border: 0; background: none; border-radius: .4rem; padding: .35rem 0; font-size: .95rem; }
.tdp-day:hover { background: #e7f0ff; }
.tdp-day.today { outline: 1px solid #1565c0; }
.tdp-day.sel { background: #1565c0; color: #fff; }
.tdp-foot { display: flex; gap: .4rem; justify-content: flex-end; margin-top: .4rem; }
/* combo (dropdown ค้นหาได้) */
.combo-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px; padding-right: 2.25rem; }
.combo-list { position: absolute; z-index: 1050; left: calc(var(--bs-gutter-x) * .5); right: calc(var(--bs-gutter-x) * .5); max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid #d6dde8; border-radius: .5rem; margin-top: 2px; }
.combo-item { padding: .45rem .75rem; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
.combo-item:hover, .combo-item.active { background: #e7f0ff; }
.combo-code { color: #6c757d; font-size: .85rem; white-space: nowrap; }
.combo-empty { padding: .5rem .75rem; color: #6c757d; font-size: .9rem; }
body:has(.login-wrap) > main:first-of-type { display: none; }
/* ---- v1.2 ปฏิทิน ---- */
.cal-cell { height: 92px; vertical-align: top; padding: 2px 3px !important; overflow: hidden; }
.cal-cell.today { background: #fff8e1; }
.cal-cell.sel { outline: 2px solid #1565c0; outline-offset: -2px; }
.cal-day { font-size: .85rem; font-weight: 600; text-decoration: none; color: inherit; display: block; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; background: #fff3e0; border-left: 3px solid #ef6c00; color: #5d3a00; border-radius: 3px; padding: 1px 3px; margin-bottom: 2px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { background: #ffe0b2; }
.badge-meet { background: #ef6c00; color: #fff; }
@media (max-width: 575.98px) { .cal-cell { height: 64px; } .cal-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; background: #ef6c00; } }
/* ---- v1.2.2 OCR ---- */
.ocr-box { background: #f5f9ff; border: 1px dashed #9ab8f0; border-radius: .5rem; padding: .45rem .6rem; }
.ocr-filled { background-color: #fff7cc !important; border-color: #f2c94c !important; }
.ocr-lines { max-height: 260px; overflow-y: auto; border: 1px solid #e3e8ef; border-radius: .4rem; margin-top: .25rem; }
.ocr-line { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #eef1f5; background: #fff; padding: .3rem .5rem; font-size: .9rem; }
.ocr-line:hover { background: #e7f0ff; }
.impersonate-bar { background: #ffe8a3; color: #5d4200; text-align: center; padding: .35rem; font-size: .9rem; }
@media (max-width: 991.98px) { #previewCol { display: none !important; } }
/* ---- v1.3 ---- */
.timeline li.return::before { background: #c62828; }
.acting-bar { background: #d7f0dd; color: #1b4d2b; text-align: center; padding: .35rem; font-size: .9rem; }
.timeline li.unit_order::before { background: #ef6c00; }
