/* ============================================================
   Leave Management System — Enhanced UI Stylesheet
   โทนสี: ขาว + น้ำเงิน — Modern & Professional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:        #1a3a6b;
  --primary-dark:   #0f2347;
  --primary-light:  #2457a0;
  --primary-xlight: #3b72c4;
  --accent:         #2979d8;
  --accent-hover:   #1d63c0;
  --accent-light:   #e8f1fd;
  --white:          #ffffff;
  --bg:             #eef2f9;
  --bg-card:        #ffffff;
  --border:         #dce6f5;
  --border-light:   #eef2f9;
  --text:           #1a2744;
  --text-muted:     #6b80a3;
  --text-light:     #9aafc8;
  --success:        #0d7a4e;
  --success-bg:     #e3f5ec;
  --success-light:  #a7dfc4;
  --warning:        #b45309;
  --warning-bg:     #fef6e4;
  --warning-light:  #fcd083;
  --danger:         #c0152b;
  --danger-bg:      #fde8eb;
  --danger-light:   #f5a3ae;
  --info:           #0369a1;
  --info-bg:        #e0f2fe;
  --sidebar-width:  260px;
  --navbar-height:  64px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      20px;
  --shadow-sm:      0 1px 4px rgba(26,58,107,0.08);
  --shadow:         0 4px 16px rgba(26,58,107,0.10);
  --shadow-md:      0 8px 28px rgba(26,58,107,0.14);
  --shadow-lg:      0 16px 48px rgba(26,58,107,0.18);
  --font:           'Sarabun', 'TH SarabunPSK', sans-serif;
  --gradient-primary: linear-gradient(135deg, #0f2347 0%, #1a3a6b 50%, #2457a0 100%);
  --gradient-accent:  linear-gradient(135deg, #1d63c0 0%, #2979d8 100%);
  --gradient-card:    linear-gradient(145deg, #ffffff 0%, #f5f8ff 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: var(--accent); transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #b8c9e4; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ════════════════════════════════════════
   NAVBAR
════════════════════════════════════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--gradient-primary);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(10,20,60,0.25);
}
.navbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}
.navbar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--white);
  font-size: 1.1rem; font-weight: 700;
  flex: 1;
}
.navbar-brand-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}
.navbar-brand-icon i { color: #7ec8f8; }
.navbar-brand-text { line-height: 1.2; }
.navbar-brand-text .main { font-size: 1rem; font-weight: 700; }
.navbar-brand-text .sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); font-weight: 400; }
.navbar-toggle {
  display: none;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: var(--white); font-size: 1.1rem;
  cursor: pointer; padding: 0.4rem 0.65rem;
  border-radius: 8px; transition: background 0.2s;
}
.navbar-toggle:hover { background: rgba(255,255,255,0.2); }
.navbar-user {
  display: flex; align-items: center; gap: 0.6rem;
}
.navbar-user-info {
  text-align: right;
}
.navbar-user-info .name { color: var(--white); font-size: 0.92rem; font-weight: 600; }
.navbar-user-info .role { color: rgba(255,255,255,0.55); font-size: 0.72rem; }
.navbar-avatar {
  width: 36px; height: 36px;
  background: var(--gradient-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.btn-logout {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85) !important;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.18);
  transition: all 0.2s;
  display: flex; align-items: center; gap: 0.4rem;
  margin-left: 0.5rem;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.2);
  color: white !important;
  transform: translateY(-1px);
}

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.layout {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--navbar-height); bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 900;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 4px 0 24px rgba(26,58,107,0.07);
}
.sidebar-inner { padding: 1rem 0 2rem; }
.sidebar-menu { list-style: none; }
.sidebar-menu li a {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.72rem 1.4rem;
  color: var(--text-muted);
  font-size: 0.95rem; font-weight: 500;
  transition: all 0.18s;
  border-left: 3px solid transparent;
  margin: 1px 0.75rem;
  border-radius: var(--radius);
}
.sidebar-menu li a:hover {
  background: var(--accent-light);
  color: var(--primary);
  border-left-color: transparent;
}
.sidebar-menu li a.active {
  background: linear-gradient(135deg, #e0ecfa 0%, #d4e6f8 100%);
  color: var(--primary);
  font-weight: 700;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-left: 0;
  padding-left: calc(1.4rem - 0px);
  box-shadow: inset 0 1px 3px rgba(26,58,107,0.08);
}
.sidebar-menu li a .icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  background: var(--border-light);
  transition: all 0.18s;
  flex-shrink: 0;
}
.sidebar-menu li a:hover .icon-wrap,
.sidebar-menu li a.active .icon-wrap {
  background: var(--primary);
  color: white;
}
.sidebar-menu li a .icon-wrap i { color: var(--text-muted); transition: color 0.18s; }
.sidebar-menu li a:hover .icon-wrap i,
.sidebar-menu li a.active .icon-wrap i { color: white; }
.menu-section {
  padding: 1.1rem 1.4rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  display: flex; align-items: center; gap: 0.5rem;
}
.menu-section::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border);
}

/* ════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════ */
.page-header {
  margin-bottom: 1.75rem;
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}
.page-header-left h1 {
  font-size: 1.6rem; font-weight: 800;
  color: var(--primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.page-header-left h1 i {
  width: 40px; height: 40px;
  background: var(--gradient-accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white;
  flex-shrink: 0;
}
.page-header-left p { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.25rem; }
.breadcrumb {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }

/* ════════════════════════════════════════
   CARDS
════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #f8faff 0%, #f0f5ff 100%);
}
.card-header h2 {
  font-size: 1.05rem; font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 0.6rem;
}
.card-header h2 .h2-icon {
  width: 30px; height: 30px;
  background: var(--gradient-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: white;
  flex-shrink: 0;
}
.card-body { padding: 1.5rem; }

/* ════════════════════════════════════════
   STAT CARDS
════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.4rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
}
.stat-card.blue::before  { background: var(--gradient-accent); }
.stat-card.green::before { background: linear-gradient(90deg, #0d7a4e, #14a96b); }
.stat-card.yellow::before{ background: linear-gradient(90deg, #b45309, #d97706); }
.stat-card.red::before   { background: linear-gradient(90deg, #c0152b, #e11d48); }
.stat-card-inner { display: flex; align-items: center; gap: 1rem; }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card.blue  .stat-icon { background: linear-gradient(135deg,#d4e8fd,#bfd8fb); color: var(--primary); }
.stat-card.green .stat-icon { background: linear-gradient(135deg,#c8f0df,#a7dfc4); color: var(--success); }
.stat-card.yellow.stat-icon,
.stat-card.yellow .stat-icon { background: linear-gradient(135deg,#fde9c0,#fcd083); color: var(--warning); }
.stat-card.red   .stat-icon { background: linear-gradient(135deg,#fdd4d9,#f5a3ae); color: var(--danger);  }
.stat-info .label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.stat-info .value {
  font-size: 2rem; font-weight: 800;
  color: var(--primary); line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-info .unit  { font-size: 0.8rem; color: var(--text-light); }
.stat-card-bg-icon {
  position: absolute; right: 1rem; bottom: 0.5rem;
  font-size: 3.5rem;
  color: rgba(26,58,107,0.04);
  pointer-events: none;
}

/* ════════════════════════════════════════
   TABLE
════════════════════════════════════════ */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
thead tr {
  background: var(--gradient-primary);
}
thead th {
  padding: 0.9rem 1.1rem;
  text-align: left;
  font-weight: 600; font-size: 0.88rem;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius) 0 0; }
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s;
}
tbody tr:hover { background: #f3f7ff; }
tbody td { padding: 0.8rem 1.1rem; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
}
.badge-pending   { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-light); }
.badge-approved  { background: var(--success-bg);  color: var(--success);  border: 1px solid var(--success-light); }
.badge-rejected  { background: var(--danger-bg);   color: var(--danger);   border: 1px solid var(--danger-light);  }
.badge-cancelled { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.badge-info      { background: var(--info-bg);     color: var(--info);     border: 1px solid #7dd3fc; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.92rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: var(--font);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(26,58,107,0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(26,58,107,0.4);
  transform: translateY(-1px);
  color: white;
}
.btn-accent {
  background: var(--gradient-accent);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(41,121,216,0.35);
}
.btn-accent:hover {
  box-shadow: 0 6px 18px rgba(41,121,216,0.45);
  transform: translateY(-1px);
  color: white;
}
.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}
.btn-success {
  background: linear-gradient(135deg, #0d7a4e, #14a96b);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(13,122,78,0.3);
}
.btn-success:hover { box-shadow: 0 6px 18px rgba(13,122,78,0.4); transform: translateY(-1px); color: white; }
.btn-danger {
  background: linear-gradient(135deg, #c0152b, #e11d48);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(192,21,43,0.3);
}
.btn-danger:hover  { box-shadow: 0 6px 18px rgba(192,21,43,0.4); transform: translateY(-1px); color: white; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 0.38rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.75rem 1.6rem; font-size: 1rem; }

/* ════════════════════════════════════════
   FORMS
════════════════════════════════════════ */
.form-group { margin-bottom: 1.2rem; }
.form-label {
  display: block;
  font-size: 0.9rem; font-weight: 600;
  color: var(--text); margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 0.62rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem; font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: all 0.18s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,121,216,0.12);
}
.form-control:disabled { background: #f5f7fb; color: var(--text-muted); cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 95px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.form-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.invalid-feedback { font-size: 0.82rem; color: var(--danger); margin-top: 0.3rem; }
.form-control.is-invalid { border-color: var(--danger); }

/* ════════════════════════════════════════
   ALERTS
════════════════════════════════════════ */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  display: flex; align-items: flex-start; gap: 0.65rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert i { flex-shrink: 0; margin-top: 2px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger);  }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info);    }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed;
  inset: 0; background: rgba(5,15,40,0.55);
  z-index: 2000; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 92%; max-width: 580px;
  max-height: 92vh; overflow-y: auto;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity:0; transform: scale(0.95) translateY(10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #f8faff, #eef5ff);
}
.modal-header h3 {
  font-size: 1.05rem; font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-muted);
  transition: all 0.15s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body  { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 0.65rem;
  background: #fafbff;
}

/* ════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -200px; right: -150px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  bottom: -150px; left: -100px;
  pointer-events: none;
}
.login-box {
  background: rgba(255,255,255,0.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  padding: 2.75rem 2.25rem;
  width: 100%; max-width: 440px;
  position: relative; z-index: 1;
  border: 1px solid rgba(255,255,255,0.5);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
  width: 72px; height: 72px;
  background: var(--gradient-accent);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: white;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(41,121,216,0.4);
}
.login-logo h1 {
  font-size: 1.3rem; font-weight: 800;
  color: var(--primary); margin-bottom: 0.3rem;
}
.login-logo p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.login-divider {
  height: 1px; background: var(--border);
  margin: 1.5rem 0; position: relative;
}
.login-divider span {
  position: absolute; top: -0.6rem; left: 50%; transform: translateX(-50%);
  background: white; padding: 0 0.75rem;
  font-size: 0.8rem; color: var(--text-muted); font-weight: 500;
}
.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 1rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light); font-size: 0.95rem;
}
.input-icon .form-control { padding-left: 2.75rem; }
.btn-login {
  width: 100%; padding: 0.8rem;
  font-size: 1rem; font-weight: 700;
  background: var(--gradient-primary);
  color: var(--white);
  border: none; border-radius: var(--radius);
  cursor: pointer; margin-top: 0.75rem;
  transition: all 0.2s;
  font-family: var(--font);
  box-shadow: 0 6px 20px rgba(26,58,107,0.35);
  letter-spacing: 0.02em;
}
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(26,58,107,0.45);
}
.btn-login:active { transform: translateY(0); }
.login-footer {
  text-align: center; margin-top: 1.5rem;
  font-size: 0.8rem; color: var(--text-light);
}

/* ════════════════════════════════════════
   TIMELINE
════════════════════════════════════════ */
.timeline { padding: 0.5rem 0; }
.timeline-step {
  display: flex; gap: 1rem; margin-bottom: 1.5rem; position: relative;
}
.timeline-step::before {
  content: '';
  position: absolute; left: 15px; top: 34px; bottom: -18px;
  width: 2px; background: var(--border);
}
.timeline-step:last-child::before { display: none; }
.step-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.78rem; margin-top: 4px;
}
.step-icon.pending  { background: var(--warning-bg);  color: var(--warning);  border: 2px solid var(--warning-light); }
.step-icon.approved { background: var(--success-bg);  color: var(--success);  border: 2px solid var(--success-light); }
.step-icon.rejected { background: var(--danger-bg);   color: var(--danger);   border: 2px solid var(--danger-light);  }
.step-body { flex: 1; background: var(--bg); border-radius: var(--radius); padding: 0.75rem 1rem; }
.step-body .step-title { font-weight: 700; font-size: 0.93rem; color: var(--text); }
.step-body .step-meta  { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }
.step-body .step-remark {
  font-size: 0.85rem; color: var(--danger);
  background: var(--danger-bg); padding: 0.4rem 0.7rem;
  border-radius: 6px; margin-top: 0.5rem;
  border-left: 3px solid var(--danger);
}

/* ════════════════════════════════════════
   PAGINATION
════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; gap: 0.3rem;
  justify-content: flex-end; margin-top: 1.25rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 0.4rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem; color: var(--text-muted);
  transition: all 0.15s;
}
.pagination a:hover { background: var(--accent-light); color: var(--primary); border-color: var(--accent); }
.pagination .active span {
  background: var(--gradient-accent); color: var(--white);
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(41,121,216,0.3);
}

/* ════════════════════════════════════════
   WELCOME BANNER
════════════════════════════════════════ */
.welcome-banner {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  position: relative; overflow: hidden;
  color: white;
}
.welcome-banner::before {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}
.welcome-banner::after {
  content: '';
  position: absolute; right: 60px; bottom: -80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.welcome-banner h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.3rem; }
.welcome-banner p  { color: rgba(255,255,255,0.7); font-size: 0.92rem; }
.welcome-banner .year-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  margin-top: 0.5rem;
  backdrop-filter: blur(4px);
}

/* ════════════════════════════════════════
   SECTION TITLE
════════════════════════════════════════ */
.section-title {
  font-size: 1rem; font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.section-title::after {
  content: '';
  flex: 1; height: 2px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.15); }
  .navbar-toggle { display: flex; }
  .main-content  { margin-left: 0; padding: 1.25rem; }
  .navbar-user-info { display: none; }
}
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row  { grid-template-columns: 1fr; }
  .main-content { padding: 1rem; }
  .card-body { padding: 1.1rem; }
  table { font-size: 0.88rem; }
  thead th, tbody td { padding: 0.65rem 0.85rem; }
  .page-header { flex-direction: column; }
  .welcome-banner { padding: 1.25rem 1.4rem; }
  .welcome-banner h2 { font-size: 1.25rem; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-box { padding: 2rem 1.4rem; }
  .navbar-brand-text .sub { display: none; }
  html { font-size: 15px; }
}

/* ════════════════════════════════════════
   RESPONSIVE UTILITIES
════════════════════════════════════════ */

/* 2-column grid ที่ใช้ในหน้าต่างๆ */
@media (max-width: 900px) {
  /* leave_request, leave_detail: sidebar ซ้อนล่าง */
  [style*="grid-template-columns: minmax(0,1fr) 340px"],
  [style*="grid-template-columns: minmax(0,1fr) 320px"] {
    grid-template-columns: 1fr !important;
  }
  /* profile: sidebar ซ้อนล่าง */
  [style*="grid-template-columns: 300px minmax(0,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  /* welcome banner */
  .welcome-banner h2 { font-size: 1.2rem; }
  .welcome-banner p  { font-size: 0.85rem; }

  /* page header stack */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* table overflow scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* card body padding ลดบนมือถือ */
  .card-body { padding: 1rem; }
  .card-header { padding: 0.9rem 1rem; }

  /* modal full width บนมือถือ */
  .modal { width: 96%; max-width: 96%; border-radius: var(--radius-lg); }
  .modal-body { padding: 1rem; }
  .modal-footer { padding: 0.75rem 1rem; }

  /* pagination wrap */
  .pagination { justify-content: center; }

  /* button full width บางปุ่ม */
  .btn-block-mobile { width: 100%; justify-content: center; }

  /* stat card value เล็กลง */
  .stat-info .value { font-size: 1.6rem; }

  /* timeline */
  .timeline-step { gap: 0.75rem; }
  .step-body { padding: 0.6rem 0.75rem; }
}

@media (max-width: 480px) {
  /* navbar brand ย่อ */
  .navbar-brand-text .main { font-size: 0.88rem; }

  /* main content padding */
  .main-content { padding: 0.85rem; }

  /* stat grid 1 col */
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* form row 1 col */
  .form-row { grid-template-columns: 1fr; }

  /* leave balance grid */
  [style*="grid-template-columns: repeat(auto-fill, minmax(280px,1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* welcome banner */
  .welcome-banner { padding: 1rem 1.1rem; }
  .welcome-banner h2 { font-size: 1.05rem; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
  html { font-size: 14px; }
}

/* Sidebar overlay (mobile) */
#sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(5,15,40,0.45);
  z-index: 850;
  backdrop-filter: blur(2px);
  transition: opacity 0.25s;
}
#sidebar-overlay.open { display: block !important; }
@media (min-width: 993px) {
  #sidebar-overlay { display: none !important; }
}

/* ════════════════════════════════════════
   INLINE GRID RESPONSIVE OVERRIDES
   ครอบคลุมทุกหน้าที่ใช้ inline style grid
════════════════════════════════════════ */

/* 2-col layout: content + sidebar */
@media (max-width: 960px) {
  /* leave_request, leave_detail, approve_action: sidebar drops below */
  [style*="grid-template-columns: minmax(0,1fr) 340px"],
  [style*="grid-template-columns: minmax(0,1fr) 320px"],
  [style*="grid-template-columns:minmax(0,1fr) 320px"],
  [style*="grid-template-columns:minmax(0,1fr) 360px"] {
    grid-template-columns: 1fr !important;
  }
  /* profile: left panel drops below */
  [style*="grid-template-columns: 300px minmax(0,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* approve_action sticky sidebar */
  [style*="position:sticky"] {
    position: static !important;
  }
}

/* Card body แบบ 2 col inline */
@media (max-width: 768px) {
  /* stat cards จาก 4 → 2 col */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* ตารางใน modal */
  .modal { width: 96% !important; }
  /* form row ทั่วไป */
  .form-row { grid-template-columns: 1fr !important; }
  /* leave balance grid */
  [style*="grid-template-columns: repeat(auto-fill, minmax(280px,1fr))"] {
    grid-template-columns: 1fr !important;
  }
  /* info grid ใน profile, approve */
  [style*="grid-template-columns: repeat(auto-fill, minmax(160px,1fr))"],
  [style*="grid-template-columns:repeat(auto-fill,minmax(160px,1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* quick links ใน sub_admin */
  [style*="grid-template-columns: repeat(2,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* page header action buttons */
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  /* welcome banner */
  .welcome-banner { padding: 1.1rem 1.25rem !important; }
  /* status steps horizontal → vertical */
  .status-steps { flex-direction: column !important; }
  .status-connector {
    width: 3px !important; height: 20px !important;
    min-width: unset !important;
    margin: 0 0 0 17px !important;
    flex: none !important;
  }
  .status-step {
    flex-direction: row !important;
    text-align: left !important;
    max-width: 100% !important;
    min-width: unset !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }
  .status-step-circle { margin-bottom: 0 !important; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  /* ซ่อน text บางส่วนใน navbar */
  .navbar-brand-text .sub { display: none; }
  /* main content padding */
  .main-content { padding: 0.85rem !important; }
  /* table font เล็กลง */
  table { font-size: 0.82rem; }
  thead th, tbody td { padding: 0.55rem 0.65rem !important; }
  /* card padding */
  .card-body { padding: 0.9rem !important; }
  .card-header { padding: 0.8rem 0.9rem !important; }
  /* modal full screen */
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    margin-top: auto !important;
  }
  .modal-overlay { align-items: flex-end !important; }
  /* approve action buttons */
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr !important; }
  html { font-size: 13px !important; }
  .btn { padding: 0.45rem 0.85rem !important; font-size: 0.85rem !important; }
}

/* ── Touch & Mobile UX ────────────────── */
@media (hover: none) {
  /* ปุ่มบน touch device ใหญ่ขึ้นนิดนึง */
  .btn { min-height: 40px; }
  .sidebar-menu li a { padding: 0.85rem 1.25rem; min-height: 48px; }
  .form-control { min-height: 44px; }
  select.form-control { min-height: 44px; }
}
/* ── Footer ── */
.site-footer{background:var(--gradient-primary);width:100%;box-shadow:0 -3px 12px rgba(10,20,60,.15)}
.footer-inner{display:flex;align-items:center;gap:.85rem;padding:.7rem 1.75rem;flex-wrap:wrap}
.footer-logo{width:26px;height:26px;background:rgba(255,255,255,.15);border-radius:6px;border:1px solid rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;color:#fff;font-size:.8rem;flex-shrink:0}
.footer-content{flex:1;min-width:0}
.footer-title{font-size:.78rem;font-weight:700;color:#fff}
.footer-sub{font-size:.68rem;color:rgba(255,255,255,.6);margin-top:.05rem}
.footer-dot{margin:0 .3rem;color:rgba(255,255,255,.3)}
.footer-copy{font-size:.68rem;color:rgba(255,255,255,.45);white-space:nowrap}
@media(max-width:992px){.footer-inner{padding:.55rem 1rem}.footer-logo{display:none}.footer-sub{display:none}}
@media(max-width:480px){.footer-inner{padding:.4rem .75rem}.footer-title{font-size:.7rem}}

/* ── Navbar Mobile Fix ── */
@media (max-width: 992px) {
  .navbar-brand-text .sub { display: none; }
  .navbar-brand-text .main { font-size: 0.85rem; }
  .navbar-brand-icon { width: 30px; height: 30px; font-size: 0.9rem; }
  .navbar-brand { gap: 0.4rem; }
  .navbar-user-info { display: none; }
  .navbar-avatar { width: 30px; height: 30px; font-size: 0.82rem; }
  .btn-logout { padding: 0.3rem 0.55rem; font-size: 0.78rem; margin-left: 0.2rem; }
  .btn-logout .logout-text { display: none; }
  .navbar { padding: 0 0.75rem; gap: 0.4rem; }
}
@media (max-width: 400px) {
  .navbar-brand-text .main { font-size: 0.75rem; }
}

/* ── Footer Always Bottom Fix ── */
html { height: 100%; }
body { min-height: 100%; display: flex; flex-direction: column; }
.layout { flex: 1; }
.site-footer { flex-shrink: 0; margin-left: var(--sidebar-width, 260px); }
@media (max-width: 992px) { .site-footer { margin-left: 0; } }

/* ── Responsive Info Grids ── */
.user-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1.5rem;
  font-size: 0.9rem;
}
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}
@media (max-width: 600px) {
  .user-info-grid  { grid-template-columns: 1fr; }
  .profile-form-grid { grid-template-columns: 1fr; }
}
/* ── Role Badge Sidebar ── */
.role-badge-sidebar {
  margin: 0.5rem 0.8rem 0.25rem;
  background: var(--accent-light);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  display: flex; align-items: center; gap: 0.4rem;
}
.role-badge-sidebar i   { color: var(--accent); font-size: 0.8rem; }
.role-badge-sidebar span{ font-size: 0.76rem; font-weight: 700; color: var(--primary); }

/* ── Footer ── */
.site-footer { background: var(--gradient-primary); width: 100%; box-shadow: 0 -3px 12px rgba(10,20,60,.15); flex-shrink: 0; }
.footer-inner { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.75rem; flex-wrap: wrap; }
.footer-logo  { width:26px; height:26px; background:rgba(255,255,255,.15); border-radius:6px; border:1px solid rgba(255,255,255,.2); display:flex; align-items:center; justify-content:center; color:#fff; font-size:.8rem; flex-shrink:0; }
.footer-content { flex:1; min-width:0; }
.footer-title { font-size:.78rem; font-weight:700; color:#fff; }
.footer-sub   { font-size:.68rem; color:rgba(255,255,255,.6); margin-top:.05rem; }
.footer-dot   { margin:0 .3rem; color:rgba(255,255,255,.3); }
.footer-copy  { font-size:.68rem; color:rgba(255,255,255,.45); white-space:nowrap; }

/* ── Footer Always Bottom ── */
html { height: 100%; }
body { min-height: 100%; display: flex; flex-direction: column; }
.layout { flex: 1; }
.site-footer { margin-left: var(--sidebar-width, 260px); }

/* ── Responsive Info Grids ── */
.user-info-grid { display:grid; grid-template-columns:1fr 1fr; gap:.35rem 1.5rem; font-size:.9rem; }
.profile-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem 1.5rem; }

/* ── Navbar Mobile ── */
@media (max-width: 992px) {
  .navbar-brand-text .sub { display: none; }
  .navbar-brand-text .main { font-size: 0.85rem; }
  .navbar-brand-icon { width: 30px; height: 30px; font-size: 0.9rem; }
  .navbar-user-info { display: none; }
  .navbar-avatar { width: 30px; height: 30px; font-size: 0.82rem; }
  .btn-logout { padding: 0.3rem 0.55rem; font-size: 0.78rem; }
  .btn-logout .logout-text { display: none; }
  .navbar { padding: 0 0.75rem; gap: 0.4rem; }
  .site-footer { margin-left: 0; }
}
@media (max-width: 600px) {
  .user-info-grid    { grid-template-columns: 1fr; }
  .profile-form-grid { grid-template-columns: 1fr; }
  .footer-logo { display: none; }
  .footer-sub  { display: none; }
}