/* =====================================================================
   ระบบขอใช้รถราชการ — CSS เฉพาะระบบ (ต่อจาก vs-app.css + vs-themes.css)
   สีเน้นใช้ตัวแปรธีม var(--ac) var(--ac-2) var(--ac-ink) var(--ac-soft) var(--ac-line) เท่านั้น
   ===================================================================== */
.app-content { max-width: none; }                     /* เต็มจอกว้าง */
.muted { color: var(--muted, #64748b); }
.dash-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1399.98px) { .dash-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 991.98px) { .dash-grid, .dash-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .dash-grid, .dash-grid.five { grid-template-columns: 1fr; } }

/* ---------- เมนูซ้าย: ผู้ใช้ + ออกจากระบบ ---------- */
.sb-user { display: flex; align-items: center; gap: 10px; color: #fff; }
.sb-user-text { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.sb-user-text b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { display: block; font-size: .72rem; opacity: .8; }
.sb-logout { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.sb-logout:hover { background: rgba(255,255,255,.25); }
.sb-badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.22); color: #fff; font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center; }
.sb-badge.is-alert { background: #FF375F; }
.demo-switch { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--ac-soft); border: 1px solid var(--ac-line); color: var(--ac-ink); }
.demo-switch .form-select { border: 0; background-color: transparent; font-weight: 800; color: var(--ac-ink); min-height: 34px; padding-top: 2px; padding-bottom: 2px; box-shadow: none; }
@media (max-width: 575.98px) { .demo-switch > i { display: none; } .demo-switch { padding-left: 4px; } .demo-switch .form-select { max-width: 132px; } }

/* ---------- หน้าเข้าสู่ระบบ: การ์ด 2 ฝั่ง ---------- */
.login-page { background: #f3f5fb; }
.lg-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.lg-card { width: min(1040px, 100%); display: grid; grid-template-columns: 41fr 59fr; background: #fff; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 70px -30px rgba(62,35,8,.4); border: 1px solid var(--line); }
.lg-side { position: relative; padding: 40px 36px; color: #fff; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(circle at 80% 12%, rgba(255,255,255,.2), transparent 45%), linear-gradient(150deg, var(--hero-1), var(--ac) 55%, var(--ac-2)); }
.lg-side::after { content: '\f5b6'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: -30px; bottom: -40px; font-size: 13rem; opacity: .08; }
.lg-ic { width: 60px; height: 60px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); box-shadow: 0 10px 24px rgba(0,0,0,.15); }
.lg-side h1 { font-size: 1.85rem; font-weight: 800; line-height: 1.35; margin: 22px 0 10px; }
.lg-desc { opacity: .92; line-height: 1.7; margin: 0 0 26px; }
.lg-feat { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.lg-feat li { display: flex; gap: 12px; align-items: flex-start; }
.lg-feat li > span { width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); }
.lg-feat b { display: block; font-size: .98rem; } .lg-feat small { display: block; opacity: .85; font-size: .84rem; }
.lg-main { padding: 44px 44px 36px; }
.lg-main h2 { font-size: 1.9rem; font-weight: 800; margin: 0; color: var(--ink, #0f172a); }
.lg-org { color: #64748b; margin: 2px 0 22px; }
.lg-in { position: relative; margin-bottom: 18px; }
.lg-in > i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.lg-in .form-control { min-height: 50px; padding-left: 44px; padding-right: 48px; border-radius: 14px; }
.lg-in .form-control:focus { border-color: var(--ac); box-shadow: 0 0 0 4px var(--ac-soft); }
.lg-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: #94a3b8; border-radius: 10px; cursor: pointer; }
.lg-eye:hover { color: var(--ac); background: var(--ac-soft); }
.lg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 20px; font-size: .92rem; }
.lg-row .form-check-input { accent-color: var(--ac); margin-top: .3em; }
.lg-forgot { color: var(--ac-ink); font-weight: 700; }
.lg-btn { width: 100%; min-height: 54px; border: 0; border-radius: 16px; color: #fff; font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  background: linear-gradient(90deg, var(--ac), var(--ac-2)); box-shadow: 0 14px 28px -12px var(--ac); transition: transform .15s, filter .15s; }
.lg-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.demo-accts { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.demo-accts .txt-h { font-weight: 800; color: var(--ac-ink); font-size: .88rem; margin-bottom: 10px; }
.demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.demo-acct { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; text-align: left; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.demo-acct:hover { border-color: var(--ac); background: var(--ac-soft); }
.demo-acct > i { width: 34px; height: 34px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, var(--ac), var(--ac-2)); flex: 0 0 auto; }
.demo-acct b { display: block; font-size: .86rem; color: var(--ink); } .demo-acct small { display: block; font-size: .72rem; color: #64748b; }
@media (max-width: 767.98px) {
  .lg-wrap { padding: 0; place-items: stretch; }
  .lg-card { grid-template-columns: 1fr; border-radius: 0; border: 0; min-height: 100dvh; box-shadow: none; align-content: start; }
  .lg-side { padding: 22px 20px 20px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .lg-side::after { display: none; }
  .lg-side .lg-ic { width: 46px; height: 46px; font-size: 1.25rem; }
  .lg-side h1 { font-size: 1.15rem; margin: 0; flex: 1 1 200px; }
  .lg-desc, .lg-feat { display: none; }
  .lg-main { padding: 24px 20px 32px; }
  .lg-main h2 { font-size: 1.5rem; }
}
@media (max-width: 420px) { .demo-grid { grid-template-columns: 1fr; } }

/* ---------- ทั่วไป ---------- */
.hero a.hero-stat { color: #fff; text-decoration: none; }
.hero a.hero-btn { text-decoration: none; }
.veh-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 10px; font-weight: 800; font-size: .84rem; white-space: nowrap;
  color: var(--vc); background: color-mix(in srgb, var(--vc) 12%, #fff); border: 1px solid color-mix(in srgb, var(--vc) 35%, #fff); }
.veh-chip small { font-weight: 600; opacity: .8; }
.t-title b { display: block; } .t-title small { display: block; color: var(--muted, #64748b); }
.dt tr[data-href] { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--ac-line); background: var(--ac-soft); color: var(--ac-ink); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 700; min-height: 36px; cursor: pointer; text-align: left; }
.chip:hover { background: var(--ac); color: #fff; border-color: var(--ac); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted, #64748b); font-weight: 700; } .kv dd { margin: 0; font-weight: 600; }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .form-select, .filters .form-control { width: auto; min-width: 150px; }
@media (max-width: 575.98px) { .filters .form-select, .filters .form-control { flex: 1 1 100%; } }
.seg { flex-wrap: wrap; }
.seg > a { border-radius: 9px; padding: 6px 13px; color: var(--muted); font-weight: 800; font-size: .85rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.seg > a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.seg > a .cnt { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #FF375F; color: #fff; font-size: .7rem; line-height: 17px; text-align: center; }
.form-control, .form-select { min-height: 42px; }
.req-form .form-label { font-weight: 700; }

/* แถบแนวนอน */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.hb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .bar { height: 12px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.hbar-row .bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--a), color-mix(in srgb, var(--a) 55%, #fff)); }
.hb-num { font-weight: 800; min-width: 70px; text-align: right; }

/* รายการแจ้งเตือนครบกำหนด */
.due-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.due-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 1px solid #eef1f6; }
.due-list li.is-bad { background: #fff1f2; border-color: #fecdd3; } .due-list li.is-warn { background: #fffbeb; border-color: #fde68a; }
.due-list b { display: block; font-size: .88rem; } .due-list small { color: #64748b; }
.due-list .tag { margin-left: auto; }

/* รายการงานวันนี้ / การ์ดงาน */
.trip-card { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; margin-bottom: 10px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--vc, var(--ac)); }
.trip-card:hover { background: var(--ac-soft); }
.trip-time { min-width: 76px; text-align: center; font-weight: 800; color: var(--ac-ink); }
.trip-time small { display: block; font-weight: 600; color: #64748b; font-size: .74rem; }
.trip-body { flex: 1 1 auto; min-width: 0; } .trip-body b { display: block; } .trip-body small { display: block; color: #64748b; }

/* ---------- ปฏิทินรถ ---------- */
.cal-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h3 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; }
.cal-dow { padding: 8px; text-align: center; font-weight: 800; font-size: .82rem; background: var(--ac-soft); color: var(--ac-ink); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 128px; padding: 6px; border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #fafbfd; } .cal-day.out .cal-n { color: #cbd5e1; }
.cal-day.today { background: color-mix(in srgb, var(--ac-soft) 70%, #fff); box-shadow: inset 0 0 0 2px var(--ac); }
.cal-day.we { background: #fcfcfe; }
.cal-n { font-weight: 800; font-size: .86rem; display: flex; justify-content: space-between; align-items: center; }
.cal-n a { color: var(--ac-ink); font-size: .74rem; text-decoration: none; opacity: 0; }
.cal-day:hover .cal-n a { opacity: 1; }
.cal-ev { display: block; margin-top: 4px; padding: 3px 6px; border-radius: 7px; font-size: .74rem; line-height: 1.3; text-decoration: none; color: #0f172a;
  background: color-mix(in srgb, var(--vc) 14%, #fff); border-left: 4px solid var(--vc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.st-checked { border-left-style: dashed; opacity: .85; }
.cal-ev.st-pending { --vc: #94a3b8; border-left-style: dotted; }
.cal-ev b { font-weight: 800; }
@media (max-width: 991.98px) {
  .cal { grid-template-columns: 1fr; }
  .cal-dow, .cal-day.out { display: none; }
  .cal-day { min-height: 0; border-right: 0; }
  .cal-day.empty { display: none; }
  .cal-n::after { content: attr(data-dow); color: #64748b; font-weight: 600; margin-left: 8px; margin-right: auto; }
  .cal-n a { opacity: 1; }
  .cal-ev { white-space: normal; font-size: .84rem; }
}
.cal-hint { font-size: .82rem; color: #64748b; }
.veh-week { width: 100%; }
.veh-week td, .veh-week th { min-width: 110px; }

/* ตรวจรถ/คนขับว่าง ตอนจัดรถ */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pick-opt { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.pick-opt input { margin-top: 4px; accent-color: var(--ac); }
.pick-opt.is-busy { background: #fff1f2; border-color: #fecdd3; }
.pick-opt.is-off { opacity: .55; }
.pick-opt:has(input:checked) { border-color: var(--ac); background: var(--ac-soft); }
.pick-opt b { display: block; } .pick-opt small { display: block; color: #64748b; font-size: .76rem; }
.pick-opt .busy { color: #be123c; font-weight: 700; }

/* ไทม์ไลน์คำขอ */
.tl { list-style: none; margin: 0; padding: 0 0 0 6px; }
.tl li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--ac-line); }
.tl li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 0 3px var(--ac-soft); }
.tl b { display: block; font-size: .9rem; } .tl small { color: #64748b; }
.steps-x { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
.steps-x span { padding: 8px 6px; border-radius: 12px; text-align: center; font-size: .78rem; font-weight: 800; background: #eef1f6; color: #64748b; }
.steps-x span.on { background: linear-gradient(135deg, var(--ac), var(--ac-2)); color: #fff; }
.steps-x span.bad { background: #FF375F; color: #fff; }
@media (max-width: 575.98px) { .steps-x { grid-template-columns: repeat(2, 1fr); } }

/* ---------- หน้าดูเอกสาร: แบบเดียวกับต้นแบบที่ผู้ใช้อนุมัติ (vs-procure-specific) ---------- */
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; transition: border-color .15s, background .15s; }
.doc-row.active { border-color: var(--ac); background: var(--ac-soft); }
.doc-n { width: 24px; height: 24px; border-radius: 8px; background: var(--ac-soft); color: var(--ac-ink); font-weight: 800; font-size: .78rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.doc-main { flex: 1 1 auto; min-width: 0; display: flex; gap: 10px; align-items: center; background: none; border: 0; text-align: left; padding: 4px; min-height: 44px; color: var(--ink); text-decoration: none; }
.doc-main > i { color: var(--ac); width: 20px; text-align: center; }
.doc-main b { display: block; font-size: .88rem; line-height: 1.35; } .doc-main small { color: #64748b; font-size: .74rem; }
.doc-opts { margin-top: 12px; padding: 12px; border-radius: 14px; background: #f8fafc; border: 1px solid #eef1f6; }
.doc-opts .form-label { font-weight: 700; font-size: .86rem; }
.ps-preview { background: #e9edf5; border-radius: 14px; padding: 14px; overflow: auto; max-height: 1300px; }
.ps-preview .gov-page { margin: 0 auto 14px; }
.ps-preview .gov-page.landscape { zoom: .68; }
@media (max-width: 1599px) { .ps-preview .gov-page { zoom: .78; } .ps-preview .gov-page.landscape { zoom: .6; } }
@media (max-width: 1199px) { .ps-preview .gov-page { zoom: .7; } .ps-preview .gov-page.landscape { zoom: .52; } }
@media (max-width: 860px) { .ps-preview .gov-page { zoom: .44; } .ps-preview .gov-page.landscape { zoom: .32; } }
@media (max-width: 400px) { .ps-preview .gov-page { zoom: .4; } .ps-preview .gov-page.landscape { zoom: .29; } }
.gov-page { text-align: left; position: relative; }
.ps-doc p { margin: 0; }
.ps-doc .ps-c { text-align: center; } .ps-doc .ps-r { text-align: right; } .ps-doc .b { font-weight: 700; }
.ps-doc .ps-l.j { text-align: justify; }
.ps-doc .ps-title { text-align: center; font-weight: 700; font-size: 20pt; }
.ps-doc .ps-form { position: absolute; right: 20mm; top: 12mm; font-size: 16pt; }
.ps-doc .ps-sign { margin: 6mm 0 0 65mm; text-align: center; }
.ps-doc .ps-signs { display: grid; gap: 6mm; margin-top: 6mm; text-align: center; }
.ps-doc .ps-box { margin-left: 10mm !important; }
.ps-doc .ps-box .gov-box { margin-right: 2mm; }
.ps-doc .ps-dots { border-bottom: 1px dotted #000; margin: 0 0 2mm 10mm !important; height: 1.1em; }
.ps-doc .ps-approve { margin-top: 5mm; break-inside: avoid; }
.ps-doc .ps-table { font-size: 14pt; }
.ps-doc .ps-table td, .ps-doc .ps-table th { line-height: 1.05; }
.ps-doc .ps-table tr.ps-foot td { font-weight: 700; }
.ps-doc .ps-tab { display: flex; } .ps-doc .ps-tab span:first-child { flex: 0 0 auto; }
.landscape .ps-table { font-size: 13pt; }
@media print {
  .ps-doc .gov-page, .gov-page { zoom: 1 !important; }
}
