:root {
    /* ธีม: เลือดหมูเข้ม (Maroon) + น้ำเงินเข้ม (Navy) */
    --utp-maroon: #7a1f2b;
    --utp-maroon-dark: #561520;
    --utp-maroon-light: #f7e9eb;
    --utp-navy: #12284b;
    --utp-navy-dark: #0a1a33;
    --utp-primary: var(--utp-maroon);
    --utp-dark: var(--utp-navy-dark);
    --utp-accent: var(--utp-maroon);
    --bs-link-color: #7a1f2b;
    --bs-link-color-rgb: 122, 31, 43;
    --bs-link-hover-color: #561520;
    --bs-link-hover-color-rgb: 86, 21, 32;
    --bs-primary: #7a1f2b;
    --bs-primary-rgb: 122, 31, 43;
}
body { font-family: 'Sarabun', system-ui, sans-serif; background: #f3f6fa; }
.utp-nav { background: var(--utp-navy-dark); border-bottom: 4px solid var(--utp-maroon); }
.btn-primary { background: var(--utp-primary); border-color: var(--utp-primary); }
.btn-primary:hover { background: var(--utp-dark); border-color: var(--utp-dark); }
.nav-pills .nav-link.active { background: var(--utp-primary); }

/* Auth */
.auth-bg { background: linear-gradient(135deg, var(--utp-navy-dark) 0%, var(--utp-navy) 55%, var(--utp-maroon) 100%); min-height: 100vh; font-family: 'Sarabun', sans-serif; }
.auth-card { width: 100%; max-width: 420px; border-radius: 16px; }
.auth-card-wide { max-width: 620px; }
.auth-logo { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: var(--utp-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; }

/* Hero / stats */
.hero-card { background: linear-gradient(120deg, var(--utp-navy-dark) 0%, var(--utp-navy) 60%, var(--utp-maroon) 100%); color: #fff; border-radius: 16px; padding: 24px 28px; }
.stat-card { background: #fff; border-radius: 14px; padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.05); border-left: 5px solid var(--utp-navy); color: #333; }
.stat-card i { font-size: 2rem; color: var(--utp-navy); }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-green { border-left-color: #198754; } .stat-green i { color: #198754; }
.stat-red { border-left-color: #dc3545; } .stat-red i { color: #dc3545; }
.stat-yellow { border-left-color: #ffc107; } .stat-yellow i { color: #e0a800; }

/* Thumbs & plates */
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: #e9eef4; }
.thumb-lg { width: 140px; height: 96px; object-fit: cover; border-radius: 10px; background: #e9eef4; }
.plate { display: inline-block; background: #fff; border: 2px solid #333; border-radius: 6px; padding: 0 8px; font-weight: 700; letter-spacing: .5px; color: #111; }
.plate-sm { font-size: .8rem; padding: 0 6px; border-width: 1.5px; }

/* Product (car) cards */
.product-card { border-radius: 14px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0,0,0,.12) !important; }
.product-img-wrap { position: relative; width: 100%; height: 0; padding-top: 75%; overflow: hidden; background: #e9eef4; }
.product-img { position: absolute; inset: 0; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.product-status { position: absolute; top: 10px; left: 10px; font-size: .8rem; }
.spec-row { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .85rem; color: #555; }
/* รูปหน้ารายละเอียดรถ: กรอบ 4:3 ตายตัวทุกคัน ไม่ว่ารูปต้นฉบับจะแนวตั้ง/แนวนอน/ขนาดใด (ใช้ padding — รองรับเบราว์เซอร์มือถือรุ่นเก่า) */
.detail-img-wrap { position: relative; width: 100%; height: 0; padding-top: 75%; overflow: hidden; background: #e9eef4; border-radius: .375rem .375rem 0 0; }
.detail-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb, .thumb-lg { flex-shrink: 0; max-width: 100%; }

/* Booking history */
.booking-card { border-left: 5px solid #ccc !important; }
.booking-card.status-pending { border-left-color: #ffc107 !important; }
.booking-card.status-approved { border-left-color: #198754 !important; }
.booking-card.status-rejected { border-left-color: #dc3545 !important; }
.booking-card.status-returned { border-left-color: #0dcaf0 !important; }

/* Upload */
.upload-box { aspect-ratio: 4/3; border: 2px dashed #b9c6d4; border-radius: 12px; overflow: hidden; background: #f8fafc; }
.upload-box img { width: 100%; height: 100%; object-fit: cover; }

/* Calendar */
.calendar td { height: 110px; width: 14.28%; vertical-align: top; padding: 4px; font-size: .75rem; }
.calendar td.today { background: #fff8e1; }
.day-num { font-weight: 700; margin-bottom: 2px; }
.cal-ev { display: inline-block; border-radius: 4px; padding: 1px 5px; margin: 1px 0; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.calendar .cal-ev { display: block; }
.ev-approved { background: #d1e7dd; color: #0f5132; }
.ev-pending { background: #fff3cd; color: #664d03; }
.ev-returned { background: #cff4fc; color: #055160; }

/* Report bars */
.bar-bg { background: #e9eef4; border-radius: 4px; height: 10px; overflow: hidden; }
.bar { background: var(--utp-primary); height: 100%; }

@media print {
    .utp-nav, footer, .d-print-none, .alert { display: none !important; }
    body { background: #fff; }
    .print-sheet { box-shadow: none !important; }
}
.list-group-item > .badge { align-self: center; }
/* รถชำรุด / รอซ่อม */
.damaged-panel { border-left: 5px solid var(--utp-maroon) !important; }
.damaged-panel .card-header { background: var(--utp-maroon-light); color: var(--utp-maroon-dark); }
.damaged-card { border-top: 4px solid var(--utp-maroon) !important; }
.utp-nav .nav-link { white-space: nowrap; }
.utp-nav .nav-link { padding-left: .55rem !important; padding-right: .55rem !important; }

/* ===== ธีม เลือดหมูเข้ม + น้ำเงินเข้ม: ปรับปุ่ม/องค์ประกอบ Bootstrap ===== */
.btn-primary {
    --bs-btn-bg: var(--utp-maroon); --bs-btn-border-color: var(--utp-maroon);
    --bs-btn-hover-bg: var(--utp-maroon-dark); --bs-btn-hover-border-color: var(--utp-maroon-dark);
    --bs-btn-active-bg: var(--utp-maroon-dark); --bs-btn-active-border-color: var(--utp-maroon-dark);
    --bs-btn-disabled-bg: #a9646d; --bs-btn-disabled-border-color: #a9646d;
}
.btn-outline-primary {
    --bs-btn-color: var(--utp-maroon); --bs-btn-border-color: var(--utp-maroon);
    --bs-btn-hover-bg: var(--utp-maroon); --bs-btn-hover-border-color: var(--utp-maroon);
    --bs-btn-active-bg: var(--utp-maroon-dark); --bs-btn-active-border-color: var(--utp-maroon-dark);
}
.btn-accent { background: var(--utp-maroon); color: #fff; border-color: var(--utp-maroon); }
.btn-accent:hover, .btn-accent:focus { background: var(--utp-maroon-dark); color: #fff; }
.badge-admin { background: var(--utp-maroon); color: #fff; }
.text-primary { color: var(--utp-maroon) !important; }
.bg-primary { background-color: var(--utp-maroon) !important; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--utp-navy); }
.nav-pills .nav-link { color: var(--utp-navy); }
.pagination { --bs-pagination-active-bg: var(--utp-navy); --bs-pagination-active-border-color: var(--utp-navy); --bs-pagination-color: var(--utp-navy); }
.form-control:focus, .form-select:focus { border-color: #b8737c; box-shadow: 0 0 0 .2rem rgba(122, 31, 43, .18); }
.form-check-input:checked { background-color: var(--utp-maroon); border-color: var(--utp-maroon); }
.auth-logo { background: var(--utp-maroon); }
.card-header h5, h3.fw-bold, h4.fw-bold { color: var(--utp-navy); }
.card-header h5.text-success, .card-header h5.text-danger { color: inherit; }
.bar { background: var(--utp-maroon); }
.utp-nav .nav-link.active { color: #fff !important; border-bottom: 2px solid #c9707b; }
.utp-nav .dropdown-item:active { background: var(--utp-maroon); }
.hero-card h3, .hero-card h3.fw-bold { color: #fff !important; }
/* ===== หน้าแรก: ค้นหา + ว่างถึงเมื่อไหร่ + รถว่างพรุ่งนี้ ===== */
.hero-search .form-label { color: #fff; opacity: .9; }
.hero-search .form-control, .hero-search .form-select { border: 0; }
.min-w-0 { min-width: 0; }
.free-long { color: #198754; font-weight: 600; }
.free-until { color: #5a6577; }
.free-soon { display: inline-block; background: #fff1e0; color: #a14a00; border: 1px solid #f4c08a; border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.text-tomorrow { color: var(--utp-navy) !important; }
.bg-tomorrow { background: var(--utp-navy) !important; color: #fff; }
/* ===== ปฏิทินรถว่าง (USER) ===== */
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; align-items: center; }
.cal-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.lg-free, .dot-free { background: #2e9d62; }
.lg-pending, .dot-pending { background: #f5b942; box-shadow: none; }
.lg-booked, .dot-booked { background: var(--utp-maroon); }
.lg-repair, .dot-repair { background: repeating-linear-gradient(45deg, #8d96a3 0 2px, #cfd5dc 2px 4px); }
.dot-past { background: #e3e7ec; }

.avail-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.avail-head { text-align: center; font-weight: 600; color: var(--utp-navy); padding: 4px 0; }
.avail-head.wkend { color: var(--utp-maroon); }
.avail-day { background: #fff; border-radius: 10px; min-height: 104px; padding: 8px; border: 1px solid #e6eaf0; border-top: 4px solid #e6eaf0; transition: transform .12s, box-shadow .12s; }
.avail-day[data-date] { cursor: pointer; }
.avail-day[data-date]:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(10, 26, 51, .12); }
.avail-day.empty { background: transparent; border: 0; }
.avail-day.lvl-good { border-top-color: #2e9d62; }
.avail-day.lvl-low { border-top-color: #f0a030; background: #fffaf2; }
.avail-day.lvl-none { border-top-color: var(--utp-maroon); background: #fbf1f2; }
.avail-day.lvl-past { background: #f4f6f9; color: #a8b0bb; }
.avail-day.is-today { box-shadow: 0 0 0 2px var(--utp-navy); }
.avail-day .dnum { font-weight: 700; color: var(--utp-navy); }
.avail-day.lvl-past .dnum { color: #a8b0bb; font-weight: 500; }
.today-tag { font-size: .65rem; background: var(--utp-navy); color: #fff; border-radius: 4px; padding: 0 5px; }
.free-count { margin: 2px 0 4px; line-height: 1; }
.free-count .big { font-size: 1.45rem; font-weight: 700; }
.lvl-good .free-count .big { color: #1f7a4a; }
.lvl-low .free-count .big { color: #b86a00; }
.lvl-none .free-count .big { color: var(--utp-maroon); }
.free-count .of { color: #8a94a3; font-size: .85rem; }
.free-count .lbl { font-size: .75rem; color: #5a6577; }
.car-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.car-dots .dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

#dayModal .day-sec { margin-bottom: 14px; }
#dayModal .day-sec-h { font-weight: 600; margin-bottom: 6px; }
#dayModal .day-car { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
#dayModal .day-car img { width: 64px; height: 46px; object-fit: cover; border-radius: 8px; background: #e9eef4; }

/* Timeline รายคัน */
.timeline-wrap { overflow-x: auto; }
.timeline { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
.timeline th, .timeline td { padding: 0; }
.timeline thead th { background: #fff; position: sticky; top: 0; z-index: 2; text-align: center; color: var(--utp-navy); padding: 6px 0; border-bottom: 2px solid #e6eaf0; line-height: 1.1; }
.timeline thead th.wkend { color: var(--utp-maroon); }
.timeline .tl-car { position: sticky; left: 0; z-index: 3; background: #fff; min-width: 210px; max-width: 210px; padding: 6px 10px; border-right: 2px solid #e6eaf0; text-align: left; }
.timeline thead .tl-car { z-index: 4; }
.timeline .tl-img { width: 40px; height: 30px; object-fit: cover; border-radius: 5px; background: #e9eef4; flex-shrink: 0; }
.timeline .tl-d { min-width: 26px; }
.timeline .tl-cell { height: 40px; border-bottom: 1px solid #f0f2f5; padding: 3px 1px; }
.timeline .tl-cell > a, .timeline .tl-cell > span { display: block; height: 100%; border-radius: 4px; }
.timeline .st-free > a { background: #2e9d62; }
.timeline .st-free > a:hover { background: #1f7a4a; outline: 2px solid var(--utp-navy); }
.timeline .st-pending > span { background: #f5b942; }
.timeline .st-booked > span { background: var(--utp-maroon); }
.timeline .st-repair > span { background: repeating-linear-gradient(45deg, #8d96a3 0 3px, #cfd5dc 3px 6px); }
.timeline .st-past > span { background: #eef1f5; }
.timeline .is-today { background: #f1f4fa; }
.timeline thead th.is-today { background: var(--utp-navy); color: #fff; border-radius: 6px 6px 0 0; }
.timeline .tl-sum { min-width: 44px; text-align: center; font-weight: 600; color: var(--utp-navy); }
.timeline .tl-group td { background: #f4f6fa; color: var(--utp-navy); font-weight: 600; padding: 5px 10px; position: sticky; left: 0; }
.timeline tfoot td { text-align: center; padding: 6px 0; border-top: 2px solid #e6eaf0; color: #1f7a4a; font-weight: 600; }
.timeline tfoot td.zero { color: var(--utp-maroon); }

@media (max-width: 767px) {
    .avail-cal { gap: 3px; }
    .avail-day { min-height: 74px; padding: 4px; }
    .free-count .big { font-size: 1.05rem; }
    .free-count .lbl, .free-count .of, .today-tag { display: none; }
    .car-dots .dot { width: 6px; height: 6px; }
    .timeline .tl-car { min-width: 130px; max-width: 130px; }
}
/* ===== อนุมัติ 2 ขั้น ===== */
.approval-steps { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.approval-steps .step { padding: 3px 10px; border-radius: 20px; background: #eef1f5; color: #5a6577; font-size: .85em; }
.approval-steps .step.active { background: var(--utp-navy); color: #fff; }
.approval-steps .step.done { background: #d9f0e3; color: #1f7a4a; }
.approval-steps .bi-chevron-right { color: #a8b0bb; }
.focus-card { box-shadow: 0 0 0 3px #06c755, 0 6px 16px rgba(0,0,0,.08) !important; }
/* ===== ประเภทการใช้งาน ===== */
.usage-work { background: #e6ecf7; color: var(--utp-navy); font-weight: 600; }
.usage-personal { background: #fbeef0; color: var(--utp-maroon); font-weight: 600; }
.usage-choice .btn { border: 2px solid #dfe4ea; background: #fff; padding: 10px 14px; line-height: 1.35; }
.usage-choice .btn small { color: #6c7684; }
.usage-choice .btn-check:checked + .btn { border-color: var(--utp-maroon); background: #fbeef0; color: var(--utp-maroon-dark); }
.usage-choice .btn-check:checked + .btn small { color: var(--utp-maroon); }
/* ===== รายงาน ===== */
.lg-work { background: var(--utp-navy); }
.lg-personal { background: #d0828c; }
.usage-card { gap: 16px; }
.donut { --p: 50; width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; position: relative;
         background: conic-gradient(var(--utp-navy) calc(var(--p) * 1%), #d0828c 0); }
.donut::after { content: ""; position: absolute; inset: 14px; background: #fff; border-radius: 50%; }
.donut span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1; font-weight: 700; font-size: .85rem; color: var(--utp-navy); }
.bar-split { display: flex; height: 100%; border-radius: 4px; overflow: hidden; min-width: 2px; }
.bar-split .w { background: var(--utp-navy); }
.bar-split .p { background: #d0828c; }
.report-table .bar-bg { height: 12px; }
.txt-work { color: var(--utp-navy); }
.txt-personal { color: var(--utp-maroon); }
.heat { font-weight: 600; min-width: 38px; }
.heat.hm0 { color: #c3c9d1; }
.heat.hm1 { background: #e6ecf7; color: var(--utp-navy); }
.heat.hm2 { background: #9fb3d6; color: #0a1a33; }
.heat.hm3 { background: var(--utp-navy); color: #fff; }
.month-col a { color: var(--utp-navy); text-decoration: none; }
.top-card .rank { width: 34px; height: 34px; border-radius: 50%; background: var(--utp-maroon); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.top-card .rank-sm { width: 24px; height: 24px; font-size: .8rem; background: #c8ced6; }
.top-card .top-num { font-size: 2.2rem; font-weight: 700; color: var(--utp-maroon); line-height: 1; }
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
/* ===== เลือกสิทธิ์ผู้ใช้ ===== */
.role-choice .btn { border: 2px solid #dfe4ea; background: #fff; padding: 10px 14px; line-height: 1.35; }
.role-choice .btn small { color: #6c7684; }
.role-choice .btn-check:checked + .btn { border-color: var(--utp-navy); background: #eef2f9; color: var(--utp-navy); }
.dest-picker .dest-filter { border-right: 0; }
/* ===== สมาชิกใหม่รออนุมัติ ===== */
.pending-members { border-left: 5px solid #f0a030 !important; }
.pending-members .card-header { background: #fff6e6; color: #8a5300; }
/* วันที่ในหัวคอลัมน์หน้าแรก (ให้แถวของทุกคอลัมน์ตรงกัน) */
.col-date { font-size: .7em; font-weight: 400; color: #6c7684; white-space: nowrap; }

/* เส้นคั่น "ภาพรวมระบบ" ใต้รายการอนุมัติ (หน้าแรกแอดมิน) */
.section-divider { display:flex; align-items:center; gap:.75rem; color:var(--utp-navy); font-weight:700; font-size:1.15rem; scroll-margin-top:80px; }
.section-divider::before, .section-divider::after { content:""; flex:1; height:2px; background:linear-gradient(90deg, transparent, var(--utp-maroon), transparent); opacity:.45; }

/* ===== ใบขอใช้ยานพาหนะส่วนกลาง (แบบฟอร์มกระดาษของบริษัท) ===== */
.paper-form-wrap { background:#fff; box-shadow:0 2px 12px rgba(0,0,0,.08); border-radius:.5rem; padding:2rem; max-width:1000px; margin:0 auto; }
.paper-form { font-size:15px; color:#111; }
.pf-meta { display:flex; justify-content:space-between; font-size:13px; margin-bottom:.35rem; color:#444; }
.pf-table { width:100%; border-collapse:collapse; border:2px solid #222; }
.pf-table th, .pf-table td { border:1.5px solid #222; }
.pf-title { background:#cfd2d6; text-align:center; font-size:1.25rem; font-weight:700; padding:.55rem; }
.pf-sub { background:#cfd2d6; text-align:center; font-weight:700; padding:.3rem; border-top:6px double #222 !important; }
.pf-note-h { font-weight:700; padding:.2rem .6rem; text-align:left; background:#fff; }
.pf-body { padding:.6rem 1.4rem .9rem; }
.pf-row { display:flex; flex-wrap:wrap; align-items:flex-end; gap:.35rem .6rem; margin:.55rem 0; }
.pf-lbl { font-weight:600; white-space:nowrap; }
.pf-opt { white-space:nowrap; margin-left:1.2rem; font-weight:600; }
.pf-fill { flex:0 1 auto; display:inline-block; border-bottom:1.5px dotted #333; min-width:6em; padding:0 .4rem; text-align:center; color:#12284b; font-weight:500; line-height:1.4; }
.pf-row > .pf-fill:last-child { flex:1 1 auto; }
.pf-box { display:inline-flex; width:1.05em; height:1.05em; border:1.5px solid #222; align-items:center; justify-content:center; font-size:.9em; line-height:1; color:#12284b; font-weight:700; vertical-align:-2px; }
.pf-sign { display:flex; }
.pf-sign-col { flex:1; padding:.6rem 1.2rem 1rem; display:flex; flex-direction:column; min-height:190px; }
.pf-sign-col + .pf-sign-col { border-left:1.5px solid #222; }
.pf-note { flex:1; font-size:13px; }
.pf-sig-line { text-align:center; margin-top:.5rem; font-weight:600; }
.pf-sig-line .pf-fill { font-weight:500; }
.pf-stamp { display:inline-block; border:2.5px solid #198754; color:#198754; font-weight:800; padding:.1rem .9rem; border-radius:.3rem; transform:rotate(-8deg); font-size:1.1rem; margin:.4rem 0 0 .5rem; }
.pf-stamp-no { border-color:#b02a37; color:#b02a37; }
.pf-row-sign { justify-content:space-around; margin-top:1.4rem; font-weight:600; }
@media print {
    @page { size:A4; margin:12mm; }
    .paper-form-wrap { box-shadow:none; padding:0; max-width:none; }
    .paper-form { font-size:13px; }
    .pf-title, .pf-sub { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}

/* รายงาน: ปลายทางที่ไปบ่อยที่สุด */
.dest-top { background:linear-gradient(90deg, rgba(122,31,43,.07), rgba(18,40,75,.04)); border-radius:.6rem; padding:.8rem 1rem; }
.dest-bar { height:.6rem; background:#eef1f5; border-radius:1rem; overflow:hidden; }
.dest-bar span { display:block; height:100%; background:linear-gradient(90deg, var(--utp-navy), var(--utp-maroon)); border-radius:1rem; }

/* pop-up ข้อตกลงการขอใช้ยานพาหนะ */
.rules-head { background: var(--utp-navy); color: #fff; }
.rules-body { font-size: .95rem; line-height: 1.7; }
.rules-list { padding-left: 1.3rem; }
.rules-list > li { margin-bottom: .55rem; }
.rules-list > li::marker { font-weight: 700; color: var(--utp-maroon); }
.rules-sub, .rules-sub2 { list-style: none; padding-left: 1.1rem; margin-top: .3rem; }
.rules-sub > li { margin-bottom: .3rem; }
.rules-h { font-weight: 700; color: var(--utp-navy); border-left: 4px solid var(--utp-maroon); padding-left: .5rem; }
.rules-table thead th { background: #dfe2e6; text-align: center; }
.rules-table { max-width: 560px; }

/* ตรวจความพร้อมระบบ */
.health-summary.is-ready { background: linear-gradient(90deg, #e7f6ee, #fff); border-left: 6px solid #198754 !important; }
.health-summary.not-ready { background: linear-gradient(90deg, #fbe9eb, #fff); border-left: 6px solid #b02a37 !important; }
.health-summary.is-ready .display-6 { color: #198754; }
.health-summary.not-ready .display-6 { color: #b02a37; }
.health-badge-ok { background: #d1e7dd; color: #0f5132; }
.health-badge-warn { background: #fff3cd; color: #664d03; }
.health-badge-fail { background: #f8d7da; color: #842029; }
.health-badge-info { background: #dbe4f3; color: var(--utp-navy); }
.health-fix { color: #5a3b00; background: #fff8e5; border-radius: .35rem; padding: .25rem .5rem; display: inline-block; }
.health-fail .health-fix { color: #842029; background: #fdecee; }
.health-manual li { margin-bottom: .35rem; }

/* ตรวจความครบถ้วนฟอร์มยืมรถ */
.fc { border-radius: .6rem; padding: .65rem .9rem; font-size: .9rem; }
.fc-todo { background: #fff8e5; border: 1px solid #f3d27a; }
.fc-ok { background: #e7f6ee; border: 1px solid #9fd8b8; color: #0f5132; font-weight: 600; }
.fc-head { font-weight: 600; }
.fc-todo .fc-head { color: #6b4e00; }
.fc-count { background: #f3d27a; border-radius: 1rem; padding: 0 .5rem; margin-left: .3rem; font-size: .8rem; }
.fc-list { list-style: none; padding: 0; margin: .4rem 0 0; columns: 2; column-gap: 1.5rem; }
.fc-list li { margin-bottom: .2rem; break-inside: avoid; }
.fc-list li.ok { color: #198754; }
.fc-list li.no { color: #6c4a00; }
@media (max-width: 576px) { .fc-list { columns: 1; } }
#borrowBtn:disabled { opacity: .45; cursor: not-allowed; }

/* ===== ใบขออนุญาต: ส่วนที่ 2/3 + หน้า 2 (ตามแบบฟอร์มบริษัท) ===== */
.pf-two { display: grid; grid-template-columns: 1fr 1fr; }
.pf-col { display: flex; flex-direction: column; }
.pf-col + .pf-col { border-left: 1.5px solid #222; }
.pf-sec-h { background: #cfd2d6; text-align: center; font-weight: 700; padding: .25rem .4rem; border-bottom: 1.5px solid #222; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pf-sec-h2 { border-top: 1.5px solid #222; font-size: .95em; }
.pf-cars { display: grid; grid-template-columns: 30% 44% 26%; border-bottom: 1.5px solid #222; }
.pf-cars > div { display: flex; align-items: center; justify-content: center; padding: 2px; }
.pf-cars > div + div { border-left: 1px solid #222; }
.pf-cars img { max-width: 100%; max-height: 112px; }
.pf-mile { display: grid; grid-template-columns: 1fr 34%; }
.pf-mile-l { padding: .3rem .6rem; display: flex; flex-direction: column; justify-content: space-between; gap: .5rem; }
.pf-mile-h { text-align: center; font-weight: 700; }
.pf-mile-r { border-left: 1px solid #222; text-align: center; font-weight: 700; font-size: .9em; padding: 2px; }
.pf-mile-r img { max-width: 100%; max-height: 62px; display: block; margin: 0 auto; }
.pf-defect { border-bottom: 1px dotted #444; padding: .12rem .45rem; min-height: 1.6em; font-size: .92em; }
.pf-defect span { color: #12284b; }
.pf-checks { padding: .35rem .6rem 0; font-size: .92em; }
.pf-ck-row { display: grid; grid-template-columns: 1fr auto auto; gap: .2rem 1rem; align-items: end; margin-bottom: .3rem; }
.pf-ck-row:nth-child(3) { grid-template-columns: auto 1fr; }
.pf-stmt { display: flex; gap: .4rem; align-items: flex-start; margin: .35rem 0; font-size: .92em; line-height: 1.35; }
.pf-stmt .pf-box { flex-shrink: 0; margin-top: 2px; }
.pf-agreed { display: block; color: #198754; font-size: .85em; }
.pf-sig2 { margin-top: auto; padding: .4rem .6rem .7rem; font-size: .92em; }
.pf-pageno { text-align: right; font-size: 12px; color: #444; margin-top: .25rem; }
.pf-page2 { margin-top: 2rem; padding-top: 1.5rem; border-top: 2px dashed #c9ced6; }
.pf-p2-title { text-align: center; font-weight: 700; font-size: 1.15rem; margin-bottom: .6rem; }
.pf-rules .rules-list { font-size: .9em; line-height: 1.5; }
.pf-rules .rules-list > li { margin-bottom: .25rem; }
.pf-p2-bottom { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.pf-p2-h { font-weight: 700; text-align: center; margin-bottom: .4rem; }
.pf-steps { font-size: .9em; padding-left: 1.4rem; line-height: 1.5; }
.pf-step-note { color: #444; font-size: .95em; }
.pf-levels { width: 100%; border-collapse: collapse; font-size: .9em; }
.pf-levels th, .pf-levels td { border: 1px solid #222; padding: .2rem .5rem; text-align: center; }
.pf-levels th { background: #cfd2d6; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pf-levels td:first-child { text-align: left; }
@media print {
    @page { size: A4; margin: 9mm 10mm; }
    main.container { max-width: none !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .paper-form-wrap { border-radius: 0; }
    .paper-form { font-size: 11px; }
    .pf-meta { margin-bottom: .15rem; font-size: 10px; }
    .pf-title { font-size: 15px; padding: .35rem; }
    .pf-sub, .pf-sec-h { padding: .15rem .4rem; }
    .pf-note-h { padding: .1rem .6rem; }
    .pf-defect { min-height: 1.45em; padding: .05rem .45rem; }
    .pf-ck-row { margin-bottom: .15rem; }
    .pf-stmt { margin: .2rem 0; }
    .pf-sig2 { padding: .3rem .6rem .5rem; }
    .pf-sig2 .mt-3 { margin-top: .6rem !important; }
    .pf-stamp { font-size: .95rem; margin-top: .2rem; }
    .pf-body { padding: .3rem 1rem .5rem; }
    .pf-row { margin: .3rem 0; }
    .pf-sign-col { min-height: 120px; padding: .4rem 1rem .6rem; }
    .pf-cars img { max-height: 92px; }
    .pf-mile-r img { max-height: 48px; }
    .pf-page2 { break-before: page; page-break-before: always; margin-top: 0; padding-top: 0; border-top: 0; }
    .pf-rules .rules-list { font-size: 1em; }
}

/* pop-up ข้อตกลง: ข้อความสงวนสิทธิ์ + รถยี่ห้อเดียวกันที่ว่าง */
.rules-reserve { margin-top: 1rem; padding: .55rem .8rem; border: 2px solid #c1121f; border-radius: .5rem; background: #fff1f2; color: #c1121f; font-weight: 700; text-align: center; }
.rules-alt { margin-top: .7rem; }
.rules-alt-h { font-size: .85rem; font-weight: 600; color: var(--utp-navy); margin-bottom: .35rem; }
.rules-alt-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.alt-car { display: flex; align-items: center; gap: .45rem; border: 1px solid #dfe3ea; border-radius: .45rem; padding: .25rem .5rem .25rem .25rem; background: #fff; font-size: .78rem; line-height: 1.25; }
.alt-car img { width: 52px; height: 39px; object-fit: cover; border-radius: .3rem; background: #e9eef4; flex-shrink: 0; }
.alt-name { font-weight: 600; }
.alt-meta { color: #6c7684; }
