:root {
  --nr-brand: #0f4c81;
  --nr-brand-dark: #0b3559;
  --nr-soft: #f3f5f8;
  --bs-body-font-family: "Sarabun", "Thonburi", system-ui, sans-serif;
  --bs-body-font-size: .95rem;
}
body { background: var(--nr-soft); }
.sidebar { width: 232px; flex-shrink: 0; min-height: 100vh; background: linear-gradient(180deg, var(--nr-brand), var(--nr-brand-dark)); }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.25rem; letter-spacing: .3px; }
.sidebar .nav-link { color: rgba(255,255,255,.82); border-radius: .5rem; padding: .45rem .75rem; display: flex; gap: .6rem; align-items: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar .nav-link.active { background: #fff; color: var(--nr-brand); font-weight: 600; }
.sidebar .section { color: rgba(255,255,255,.5); font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; padding: .75rem .75rem .25rem; }
main { min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid #e3e7ee; }
.card { border: 1px solid #e3e7ee; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; font-weight: 600; }
.table thead th { background: #eef3f8; color: #233; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-sm td, .table-sm th { padding: .35rem .5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value { font-size: 1.6rem; font-weight: 700; color: var(--nr-brand); line-height: 1.1; }
.kpi .label { color: #667085; font-size: .85rem; }
.form-label { font-size: .85rem; color: #475467; margin-bottom: .2rem; }
.form-section-title { font-weight: 600; color: var(--nr-brand); border-bottom: 2px solid var(--nr-brand); padding-bottom: .25rem; margin: 1.25rem 0 .75rem; }
.badge-status-ACTIVE, .badge-status-APPROVED, .badge-status-NORMAL { background: #dff3e8; color: #0f6b3e; }
.badge-status-PENDING, .badge-status-NEED_DOCS, .badge-status-WAIT_DISBURSE, .badge-status-APPT { background: #fbefd2; color: #8a6100; }
.badge-status-REJECTED, .badge-status-CANCELLED, .badge-status-POSTPONED { background: #fde4e1; color: #b42318; }
.badge-status-CONTRACTED, .badge-status-CLOSE, .badge-status-DONE, .badge-status-USED { background: #e7eff7; color: var(--nr-brand); }
.badge-status { font-weight: 600; padding: .3em .6em; border-radius: 1rem; font-size: .78rem; }
.row-paid td { color: #98a2b3; }
.row-overdue td { background: #fff4f2 !important; }
.ts-wrapper.form-select { padding: 0; }
@media (max-width: 991px) {
  .sidebar { width: 100%; min-height: auto; position: sticky; top: 0; z-index: 1030; padding: .6rem 1rem !important; }
  #sideMenu { max-height: calc(100vh - 60px); overflow-y: auto; }
  .topbar { flex-wrap: wrap; gap: .25rem; }
  main > .p-4 { padding: 1rem !important; }
}
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  body { background: #fff; }
  main { padding: 0 !important; }
}
#preview table, .table-compact { font-size: .82rem; }
#preview td, #preview th { white-space: nowrap; }

/* Closed contracts are shown in red (badge and whole row). */
.badge-status-CLOSED { background: #fde4e1; color: #c0161b; font-weight: 600; }
.row-closed td, .row-closed td a { color: #c0161b !important; }

/* Full-screen pages (every page): the side menu is hidden on a desktop and opens over the page from the เมนู
   button in the top bar, so lists have the whole width; the หน้าหลัก button leads home. */
@media (min-width: 992px) {
  .full-page .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 1045; overflow-y: auto;
                        transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .full-page.menu-open .sidebar { transform: none; box-shadow: .5rem 0 2rem rgba(0,0,0,.25); }
  .full-page.menu-open .menu-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(15,23,42,.35); }
}
.full-page main > .p-4 { padding: 1rem 1.25rem !important; }

