/* =========================================================
   ระบบขอใช้รถราชการออนไลน์ — Global Stylesheet
   Design direction: Apple-style Flat Modern Minimal — Blue tone
   Clean opaque cards, soft shadow, circular icon badges,
   solid-fill active states, pill controls. Calmer than a full
   glass treatment, still a little "liquid" motion on the login
   screen only. Only visual rules changed — every class name /
   selector used by the JS logic is preserved.
   ========================================================= */

:root {
  /* ---- Color tokens (blue tone — kept in sync with the hex
     literals used by SweetAlert / Chart.js in the JS files) ---- */
  --color-primary: #2F6FED;
  --color-primary-dark: #1E54C2;
  --color-primary-light: #5B93FF;
  --color-primary-soft: #E8F0FE;
  --color-bg: #F5F6FA;
  --color-card: #FFFFFF;
  --color-text: #1D1D1F;
  --color-text-secondary: #6E6E73;
  --color-border: #E5E5EA;
  --color-success: #198754;
  --color-success-soft: #E8F5EC;
  --color-warning: #B98600;
  --color-warning-soft: #FFF6DD;
  --color-danger: #DC3545;
  --color-danger-soft: #FCEBEC;
  --color-info: #0B76B7;
  --color-info-soft: #E7F3FA;
  --color-muted-soft: #F0F1F5;

  /* ---- Surface tokens — mostly flat/opaque, a light frost
     is reserved for the login screen only ---- */
  --glass-bg: rgba(255, 255, 255, 0.86);
  --glass-bg-strong: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-blur: blur(18px) saturate(160%);
  --glass-blur-soft: blur(6px);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --glass-glow-primary: 0 8px 24px rgba(47, 111, 237, 0.16);

  /* ---- Typography ---- */
  --font-th: 'Noto Sans Thai', 'Inter', sans-serif;
  --font-en: 'Inter', 'Noto Sans Thai', sans-serif;

  /* ---- Layout ---- */
  --sidebar-width: 272px;
  --topbar-height: 64px;
  --radius-card: 20px;
  --radius-control: 14px;
  --shadow-card: 0 1px 2px rgba(29,29,31,0.03), 0 8px 20px rgba(29,29,31,0.05);
  --shadow-card-hover: 0 3px 8px rgba(29,29,31,0.05), 0 14px 32px rgba(29,29,31,0.09);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-th);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-th);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text);
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-base); }
a:hover { color: var(--color-primary-dark); }

small, .text-muted-custom { color: var(--color-text-secondary); }

::selection { background: var(--color-primary-soft); }

/* Slim, Apple-style scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(110, 110, 115, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(110, 110, 115, 0.45); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(110,110,115,0.35) transparent; }

/* Focus visibility (accessibility) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-control:focus,
.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.25) !important;
  border-color: var(--color-primary) !important;
}

/* =========================================================
   Login View — soft blue-to-mint wash, frosted card, pill inputs
   ========================================================= */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EAF1FF 0%, #F3F7FC 45%, #EAFBF3 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Very soft, slow-moving colour wash behind the auth card —
   pure CSS, no markup change */
.auth-screen::before,
.auth-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}
.auth-screen::before {
  width: 380px; height: 380px;
  top: -120px; left: -100px;
  background: radial-gradient(circle, rgba(47,111,237,0.28), transparent 70%);
  animation: blobFloatA 22s ease-in-out infinite alternate;
}
.auth-screen::after {
  width: 420px; height: 420px;
  bottom: -140px; right: -120px;
  background: radial-gradient(circle, rgba(52,199,142,0.22), transparent 70%);
  animation: blobFloatB 26s ease-in-out infinite alternate;
}
@keyframes blobFloatA {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 22px) scale(1.08); }
}
@keyframes blobFloatB {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-24px, -18px) scale(1.05); }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-card-hover), var(--glass-highlight);
  padding: 44px 36px;
  position: relative;
  z-index: 1;
  animation: authCardIn 640ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-org-mark {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(150deg, var(--color-primary-light), var(--color-primary) 60%, var(--color-primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  margin: 0 auto 20px;
  box-shadow: 0 10px 24px rgba(47,111,237,0.32), var(--glass-highlight);
}

.auth-card h1 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 4px;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  margin-bottom: 30px;
}

/* Filled, borderless "pill" inputs — matches the reference login look */
.auth-card .form-control {
  background: var(--color-muted-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 11px 16px;
}
.auth-card .form-control:focus {
  background: #fff;
}
.auth-card .btn-primary,
#btnLogin {
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 15px;
}

/* =========================================================
   App Shell — Sidebar + Topbar + Content (flat, opaque)
   ========================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-card);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1030;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand .brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--color-primary-light), var(--color-primary) 60%, var(--color-primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(47,111,237,0.28);
}

.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.3;
}
.sidebar-brand .brand-text small {
  display: block;
  font-weight: 400;
  color: var(--color-text-secondary);
  font-size: 11.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  padding: 16px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  cursor: pointer;
}

.sidebar-link i { font-size: 16px; color: var(--color-text-secondary); width: 18px; text-align: center; transition: color var(--transition-base); }

.sidebar-link:hover {
  background: var(--color-muted-soft);
  color: var(--color-text);
}

/* Solid-fill active pill, matching the reference sidebar */
.sidebar-link.active {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(47,111,237,0.30);
}
.sidebar-link.active i { color: #fff; }

/* (เพิ่มใหม่) ตัวเลขแจ้งเตือน "คำขอใหม่" บนเมนู Sidebar — ดู assets/js/notifications.js */
.sidebar-badge {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.sidebar-badge.is-hidden { display: none; }
.sidebar-link.active .sidebar-badge { background: #fff; color: var(--color-primary-dark); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
}

.topbar-menu-btn {
  display: none;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--color-text);
  margin-right: 12px;
  transition: transform var(--transition-base);
}
.topbar-menu-btn:active { transform: scale(0.9); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  transition: background var(--transition-base);
}
.user-chip:hover { background: var(--color-muted-soft); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-chip .user-meta { line-height: 1.25; text-align: left; }
.user-chip .user-name { font-size: 13.5px; font-weight: 600; }
.user-chip .user-role { font-size: 11.5px; color: var(--color-text-secondary); }

/* Prominent green "refresh data" button, next to the profile chip */
.btn-refresh-global {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(150deg, #34D399, #16A34A);
  color: #fff;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(22,163,74,0.35);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  flex-shrink: 0;
}
.btn-refresh-global:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22,163,74,0.42); }
.btn-refresh-global:active { transform: scale(0.94); }
.btn-refresh-global.is-spinning i { animation: spin 0.6s linear; }

.page-content {
  padding: 28px 28px 60px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 22px;
  margin-bottom: 2px;
}
.page-header .page-subtitle {
  color: var(--color-text-secondary);
  font-size: 13.5px;
}

.dashboard-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin: 4px 0 12px;
}

.recent-request-row { transition: background var(--transition-base); }
.recent-request-row:hover { background: var(--color-muted-soft); }
.recent-request-row:last-child { border-bottom: none !important; }
.min-width-0 { min-width: 0; }

/* =========================================================
   Card — flat, opaque, soft shadow (no glass)
   ========================================================= */
.card-surface {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}
.card-surface:hover { box-shadow: var(--shadow-card-hover); }

.card-surface .card-surface-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-surface .card-surface-header h5 { font-size: 15.5px; margin: 0; }
.card-surface .card-surface-body { padding: 22px; }

/* =========================================================
   KPI Stat Cards (Dashboard) — flat card + circular icon badge
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-spring), box-shadow var(--transition-base);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }

/* soft diagonal sheen sweep on hover — pure CSS, no JS needed */
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-18deg);
  transition: left 650ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.kpi-card:hover::after { left: 130%; }

.kpi-card .kpi-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}

.kpi-card .kpi-value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-label {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.kpi-icon.tone-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.kpi-icon.tone-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.kpi-icon.tone-success { background: var(--color-success-soft); color: var(--color-success); }
.kpi-icon.tone-danger  { background: var(--color-danger-soft); color: var(--color-danger); }
.kpi-icon.tone-info    { background: var(--color-info-soft); color: var(--color-info); }
.kpi-icon.tone-muted   { background: var(--color-muted-soft); color: var(--color-text-secondary); }

/* =========================================================
   Status badges — semantic mapping per workflow status
   ========================================================= */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.st-draft        { background: var(--color-muted-soft); color: #57575c; }
.status-pill.st-submitted,
.status-pill.st-pending      { background: var(--color-warning-soft); color: var(--color-warning); }
.status-pill.st-approved,
.status-pill.st-completed    { background: var(--color-success-soft); color: var(--color-success); }
.status-pill.st-rejected,
.status-pill.st-cancelled    { background: var(--color-danger-soft); color: var(--color-danger); }
.status-pill.st-progress,
.status-pill.st-assigned     { background: var(--color-info-soft); color: var(--color-info); }
.status-pill.st-returned     { background: #FDEFE1; color: #A85B00; }

/* =========================================================
   Buttons — solid blue, soft rounded, gentle press
   ========================================================= */
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(47,111,237,0.24);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 6px 16px rgba(47,111,237,0.32);
}
.btn-outline-primary {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline-primary:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.btn, .form-control, .form-select {
  border-radius: var(--radius-control);
}
.btn {
  font-weight: 600;
  font-size: 14px;
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}
.btn:active { transform: scale(0.97); }
.form-control, .form-select {
  transition: box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}

/* Filled, borderless look for form controls app-wide (login
   inputs above override padding/radius to a fuller pill) */
.form-control, .form-select {
  background: var(--color-muted-soft);
  border: 1px solid transparent;
}
.form-control:focus, .form-select:focus {
  background: #fff;
}

/* =========================================================
   Table
   ========================================================= */
.table-surface {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-surface thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 16px;
  background: #FAFAFC;
  white-space: nowrap;
}
.table-surface thead th:first-child { border-top-left-radius: var(--radius-card); }
.table-surface thead th:last-child { border-top-right-radius: var(--radius-card); }
.table-surface tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13.8px;
  vertical-align: middle;
}
.table-surface tbody tr:last-child td { border-bottom: none; }
.table-surface tbody tr { transition: background var(--transition-base); }
.table-surface tbody tr:hover { background: rgba(47,111,237,0.045); }

.table-empty-state, .list-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}
.table-empty-state i, .list-empty-state i { font-size: 34px; color: var(--color-border); margin-bottom: 12px; display: block; }

/* Mobile card-style table */
@media (max-width: 767.98px) {
  .table-surface thead { display: none; }
  .table-surface, .table-surface tbody, .table-surface tr, .table-surface td { display: block; width: 100%; }
  .table-surface tr {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    padding: 6px 4px;
    box-shadow: var(--shadow-card);
  }
  .table-surface td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed var(--color-border);
    padding: 10px 14px;
  }
  .table-surface td:last-child { border-bottom: none; }
  .table-surface td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--color-text-secondary);
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* =========================================================
   Wizard / Stepper (Request Form) — signature UI element,
   reused by Request Detail Timeline for visual continuity
   ========================================================= */
.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 4px;
}
.stepper .step {
  flex: 1;
  text-align: center;
  position: relative;
}
.stepper .step .step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-muted-soft);
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin: 0 auto 8px;
  border: 2px solid transparent;
  transition: all var(--transition-spring);
  position: relative;
  z-index: 1;
}
.stepper .step .step-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 600;
}
.stepper .step::before {
  content: '';
  position: absolute;
  top: 16px; left: -50%; width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.stepper .step:first-child::before { display: none; }
.stepper .step.done .step-circle { background: #16A34A; color: #fff; box-shadow: 0 4px 10px rgba(22,163,74,0.35); }
.stepper .step.done::before { background: #16A34A; }
.stepper .step.active .step-circle { background: #fff; border-color: #16A34A; color: #16A34A; box-shadow: 0 0 0 4px rgba(22,163,74,0.16); }
.stepper .step.active .step-label { color: #16A34A; }
.stepper .step.done .step-label { color: var(--color-text); }

/* Timeline (Request Detail workflow history) */
.wf-timeline { list-style: none; padding: 0; margin: 0; }
.wf-timeline .wf-item {
  position: relative;
  padding: 0 0 26px 34px;
}
.wf-timeline .wf-item::before {
  content: '';
  position: absolute;
  left: 9px; top: 26px; bottom: 0;
  width: 2px;
  background: var(--color-border);
  z-index: 0;
}
.wf-timeline .wf-item:last-child::before { display: none; }
.wf-timeline .wf-dot {
  position: absolute;
  left: 0; top: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--color-muted-soft);
  border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--color-text-secondary);
  z-index: 1;
}
.wf-timeline .wf-item.done .wf-dot { background: #16A34A; border-color: #16A34A; color: #fff; box-shadow: 0 0 0 5px rgba(22,163,74,0.18); }
.wf-timeline .wf-item.rejected .wf-dot { background: var(--color-danger); border-color: var(--color-danger); color: #fff; box-shadow: 0 0 0 4px rgba(220,53,69,0.14); }
.wf-timeline .wf-item.current .wf-dot { background: var(--color-warning); border-color: var(--color-warning); color: #fff; box-shadow: 0 0 0 4px rgba(185,134,0,0.14); }
.wf-timeline .wf-title { font-weight: 700; font-size: 13.8px; }
.wf-timeline .wf-meta { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.wf-timeline .wf-note { font-size: 12.8px; margin-top: 6px; background: var(--color-muted-soft); padding: 8px 12px; border-radius: 10px; }

/* =========================================================
   Passenger rows (dynamic form)
   ========================================================= */
.passenger-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  margin-bottom: 10px;
  background: #FAFAFC;
  transition: box-shadow var(--transition-base);
}
.passenger-row:focus-within { box-shadow: 0 0 0 3px rgba(47,111,237,0.10); }
@media (max-width: 767.98px) {
  .passenger-row { grid-template-columns: 1fr; }
}

/* =========================================================
   Loading / skeleton
   ========================================================= */
.skeleton-block {
  background: linear-gradient(90deg, var(--color-muted-soft) 25%, #E9E9EC 37%, var(--color-muted-soft) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 10px;
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.spinner-inline {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Form section (wizard step body)
   ========================================================= */
.form-section-title {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.form-section-desc {
  font-size: 12.8px;
  color: var(--color-text-secondary);
  margin-bottom: 18px;
}
label.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}
.form-hint { font-size: 12px; color: var(--color-text-secondary); margin-top: 4px; }
.invalid-feedback { font-size: 12px; }

.review-block { margin-bottom: 18px; }
.review-block .review-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary); font-weight: 700; }
.review-block .review-value { font-size: 14px; margin-top: 2px; }

/* =========================================================
   Offcanvas sidebar (mobile)
   ========================================================= */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-spring);
    box-shadow: var(--shadow-card-hover);
  }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .topbar-menu-btn { display: inline-block; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(29,29,31,0.35);
    z-index: 1025;
  }
  .sidebar-backdrop.show { display: block; }
  .page-content { padding: 20px 16px 48px; }
}

/* =========================================================
   Misc
   ========================================================= */
.empty-icon-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-muted-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: var(--color-text-secondary);
  margin: 0 auto 14px;
}

.coming-soon-box {
  text-align: center;
  padding: 90px 20px;
  color: var(--color-text-secondary);
}

.divider-label {
  display: flex; align-items: center; gap: 10px;
  color: var(--color-text-secondary);
  font-size: 12px;
  margin: 22px 0 14px;
}
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }

/* =========================================================
   Vehicle photo — table thumbnail + hover-preview picker
   (ใช้ในหน้าจัดการรถ และฟอร์ม "จัดรถ" ตอนธุรการเลือกรถ)
   ========================================================= */
.vehicle-thumb {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-muted-soft);
  flex-shrink: 0;
}
.vehicle-thumb-placeholder {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-muted-soft);
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.vehicle-picker {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: start;
}
@media (max-width: 480px) {
  .vehicle-picker { grid-template-columns: 1fr; }
}
.vehicle-picker-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
}
.vehicle-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-base);
  font-size: 13px;
  text-align: left;
}
.vehicle-picker-row:last-child { border-bottom: none; }
.vehicle-picker-row:hover { background: var(--color-muted-soft); }
.vehicle-picker-row.selected { background: var(--color-primary-soft); font-weight: 700; }
.vehicle-picker-row input[type="radio"] { margin: 0; flex-shrink: 0; }

.vehicle-preview-box {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-control);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-muted-soft);
}
.vehicle-preview-box img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.vehicle-preview-box .vp-placeholder {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 0 8px;
}

/* =========================================================
   Thai date/time picker
   (แก้ไข) เปลี่ยนจาก <select> วัน/เดือน/ปี แยก 3 ช่อง + ชม./นาที แยก 2
   ช่อง (ผู้ใช้แจ้งว่าเลือกยาก) เป็น:
     - วันที่: ปุ่มเดียวแสดงวันที่แบบไทยเต็ม ๆ กดแล้วเปิดปฏิทิน Popover
     - เวลา: input[type=time] ของเบราว์เซอร์โดยตรง (นาฬิกาในตัว ใช้ง่าย)
   ดู assets/js/dateinput.js สำหรับ Logic ทั้งหมด
   ========================================================= */
.thai-date-group { position: relative; }
.thai-date-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: var(--color-card);
  cursor: pointer;
}
.thai-date-trigger i { color: var(--color-text-secondary); font-size: 15px; }
.thai-date-trigger-text { flex: 1; }
.thai-date-trigger:hover { border-color: var(--color-primary); }
.thai-date-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47,111,237,0.28); }

.thai-time-group .input-group-text { background: var(--color-card); color: var(--color-text-secondary); }

.is-invalid-group.thai-date-group .thai-date-trigger,
.is-invalid-group.thai-time-group input[type="time"] {
  border-color: var(--color-danger);
}

/* ปฏิทิน Popover (ถูกสร้างและแนบเข้า <body> ตอนกดเปิด — position: fixed
   จึงไม่ถูกครอบตัดโดย overflow ของการ์ด/คอนเทนเนอร์ใด ๆ) */
.thai-cal-popover {
  position: fixed;
  z-index: 1090;
  width: 264px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  padding: 10px;
}
.thai-cal-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.thai-cal-title { font-weight: 700; flex: 1; text-align: center; }
.thai-cal-nav {
  border: none; background: var(--color-muted-soft); color: var(--color-text);
  width: 26px; height: 26px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.thai-cal-nav:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.thai-cal-year-select {
  border: 1px solid var(--color-border); border-radius: 6px; font-size: 12.5px;
  padding: 2px 4px; background: var(--color-card); flex-shrink: 0;
}
.thai-cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11.5px; color: var(--color-text-secondary); text-align: center; margin-bottom: 4px;
}
.thai-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.thai-cal-cell {
  border: none; background: transparent; border-radius: 999px;
  aspect-ratio: 1 / 1; font-size: 13px; cursor: pointer; color: var(--color-text);
}
.thai-cal-cell:hover { background: var(--color-primary-soft); }
.thai-cal-cell.is-today { font-weight: 700; color: var(--color-primary); }
.thai-cal-cell.is-selected { background: var(--color-primary); color: #fff; font-weight: 700; }
.thai-cal-cell-empty { cursor: default; }
.thai-cal-footer { text-align: center; margin-top: 6px; border-top: 1px solid var(--color-border); padding-top: 6px; }
.thai-cal-today-btn {
  border: none; background: none; color: var(--color-primary); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.thai-cal-today-btn:hover { text-decoration: underline; }

/* Purpose quick-select chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn {
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition-base);
}
.chip-btn:hover { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary-dark); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 700; }

/* KPI cards that double as links (e.g. Dashboard -> filtered vehicle list) */
.kpi-card.kpi-card-link {
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: 1px solid var(--color-border);
  font-family: inherit;
}
.kpi-card.kpi-card-link:hover { border-color: var(--color-primary); }
.kpi-card.kpi-card-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47,111,237,0.28) !important; }

/* ติดตามสถานะ — Stepper ย่อขนาดสำหรับใส่ในการ์ด */
.track-stepper { margin-bottom: 0; }
.track-stepper .step-circle { width: 26px; height: 26px; font-size: 11px; margin-bottom: 5px; }
.track-stepper .step-label { font-size: 10.5px; }
.track-stepper .step::before { top: 13px; }

/* =========================================================
   Accessibility — respect reduced-motion preference
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .auth-screen::before,
  .auth-screen::after,
  .auth-card,
  .kpi-card::after {
    animation: none !important;
  }
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
  }
}
