/**
 * 📱 GAMEE STUDIO EMPLOYEE PORTAL (ESS) - RESPONSIVE STYLES
 * Theme: Enterprise Red & White (#DC2626 / #FFFFFF)
 * Multi-device support: 6" Phones, 8" Mini-Tablets/Foldables, 10" Tablets & Desktops
 */

:root {
  --brand-primary: #DC2626;
  --brand-hover: #B91C1C;
  --brand-light: #FEF2F2;
  --brand-border: #FCA5A5;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --border-focus: #DC2626;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #EA580C;
  --warning-light: #FFEDD5;
  --danger: #DC2626;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Safe Area Insets for Mobile Notches & Bars */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 14px;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + var(--safe-bottom));
  overflow-x: hidden;
}

/* ======================================================== */
/* 📱 1. BREAKPOINTS & ADAPTIVE LAYOUT ARCHITECTURE         */
/* ======================================================== */

/* 📱 PHONE: 6-INCH (360px - 599px) */
@media (max-width: 599px) {
  html { font-size: 13.5px; }
  .desktop-nav-menu { display: none !important; }
  .desktop-user-info { display: none !important; }
  .logout-text { display: none; }
  .form-row-2 { grid-template-columns: 1fr !important; }
}

/* 📲 PHABLET / FOLDABLE / MINI TABLET: 8-INCH (600px - 899px) */
@media (min-width: 600px) and (max-width: 899px) {
  html { font-size: 14.5px; }
  .desktop-nav-menu { display: none !important; }
  .desktop-user-info { display: flex !important; flex-direction: column; }
  .logout-text { display: inline; }

  .dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    align-items: start;
  }

  .requests-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* 💻 TABLET: 10-INCH & DESKTOP (>= 900px) */
@media (min-width: 900px) {
  html { font-size: 15px; }
  body {
    padding-bottom: 0; /* No bottom nav needed */
  }

  /* Show Desktop Top Navigation Menu */
  .desktop-nav-menu {
    display: flex !important;
    align-items: center;
    gap: 4px;
    margin-left: 20px;
    flex: 1;
  }

  /* Hide Mobile Bottom Nav */
  .bottom-nav {
    display: none !important;
  }

  .desktop-user-info {
    display: flex !important;
    flex-direction: column;
  }

  .logout-text {
    display: inline;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: start;
  }

  .requests-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .assets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .payslip-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 20px;
    align-items: start;
  }
}

/* ======================================================== */
/* 🎮 2. APP HEADER & USER BADGE                            */
/* ======================================================== */
.app-header {
  background: #FFFFFF;
  border-bottom: 2px solid var(--brand-primary);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, var(--safe-left)) 0 max(16px, var(--safe-right));
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 24px;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 9.5px;
  color: var(--brand-primary);
  font-weight: 700;
  letter-spacing: 0.6px;
}

/* Desktop Navigation Menu in Header */
.desktop-nav-menu {
  display: none;
}

.desktop-nav-menu .nav-item {
  flex-direction: row;
  font-size: 13px;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.desktop-nav-menu .nav-item.active {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
}

/* User Area */
.user-quick-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-badge-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.user-badge-mini:hover {
  background: var(--brand-light);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.desktop-user-info {
  display: none;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-logout {
  padding: 6px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ======================================================== */
/* 📱 3. CONTAINER & CARDS                                  */
/* ======================================================== */
.app-container {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 14px;
  flex: 1;
}

@media (min-width: 600px) {
  .app-container {
    padding: 18px;
  }
}

@media (min-width: 900px) {
  .app-container {
    padding: 24px 20px;
  }
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-pane.active {
  display: flex;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ======================================================== */
/* 📊 4. STATS GRID & METRICS                               */
/* ======================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.stat-box {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-value {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
  line-height: 1.1;
}

.stat-value.highlight-red { color: var(--brand-primary); }
.stat-value.highlight-green { color: var(--success); }
.stat-value.highlight-orange { color: var(--warning); }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--brand-light); color: var(--brand-primary); }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-neutral { background: #F1F5F9; color: #475569; }

/* Buttons with Touch-ergonomics */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--brand-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-outline {
  background: #FFFFFF;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-full {
  width: 100%;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ======================================================== */
/* 📱 5. MOBILE & TABLET BOTTOM NAVIGATION DOCK             */
/* ======================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(58px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

@media (min-width: 600px) and (max-width: 899px) {
  .bottom-nav {
    height: calc(62px + var(--safe-bottom));
    padding: 0 16px var(--safe-bottom) 16px;
    justify-content: center;
    gap: 16px;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  min-width: 48px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease-in-out;
  flex: 1;
  max-width: 84px;
}

@media (min-width: 600px) {
  .nav-item {
    font-size: 11.5px;
    max-width: 110px;
  }
}

.nav-item-icon {
  font-size: 19px;
  line-height: 1;
}

.nav-item.active {
  color: var(--brand-primary);
  font-weight: 700;
}

.nav-item.active .nav-item-icon {
  transform: scale(1.08);
}

/* ======================================================== */
/* 📅 6. RESPONSIVE ATTENDANCE TABLE (1..31)                */
/* ======================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 8px;
}

.table-responsive table {
  width: 100%;
  min-width: 540px; /* Ensures columns stay readable on 6" phones */
  border-collapse: collapse;
  font-size: 12.5px;
}

/* Sticky first column on mobile so the date is always pinned */
.table-responsive th:first-child,
.table-responsive td:first-child {
  position: sticky;
  left: 0;
  background: #FFFFFF;
  z-index: 2;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}

.table-responsive thead th:first-child {
  background: #F1F5F9;
  z-index: 3;
}

/* ======================================================== */
/* 🪟 7. MODALS & PIN PAD                                   */
/* ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-large {
  max-width: 560px;
}

.modal-pin-box {
  max-width: 320px;
  text-align: center;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-primary);
}

.modal-title-sm {
  font-size: 13.5px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Form Controls (Prevent iOS Safari Auto-zoom with 16px) */
.form-group {
  margin-bottom: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  font-size: 16px; /* Crucial: 16px prevents iOS Safari from zooming viewport */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  background: #FFFFFF;
  transition: border-color 0.2s, box-shadow 0.2s;
}

@media (min-width: 768px) {
  .form-control {
    font-size: 13.5px;
  }
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.sla-notice-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 12px;
}

.emergency-flag-box {
  margin-bottom: 16px;
  background: #FEF2F2;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--brand-border);
}

.emergency-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary);
  cursor: pointer;
}

/* PIN Keypad for Payslip */
.pin-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.pin-dots-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #E2E8F0;
  transition: background 0.15s, transform 0.15s;
}

.pin-pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 250px;
  margin: 0 auto;
}

.pin-btn {
  aspect-ratio: 1;
  font-size: 20px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.pin-btn:active {
  background: var(--brand-light);
  border-color: var(--brand-primary);
  transform: scale(0.94);
}

.pin-btn-util {
  font-size: 14px;
  color: var(--text-muted);
}

/* ======================================================== */
/* 🔑 8. LOGIN SCREEN (RESPONSIVE)                          */
/* ======================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #FEF2F2 0%, #FFFFFF 100%);
}

.login-card {
  position: relative;
  max-width: 410px;
  width: 100%;
  padding: 28px 22px;
  box-shadow: var(--shadow-lg);
}

.server-config-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--brand-primary, #DC2626);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  z-index: 10;
}

.server-config-btn:hover {
  background: var(--brand-primary, #DC2626);
  color: #fff;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 22px;
}

.brand-avatar-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  background: var(--brand-light);
  border-radius: 50%;
  border: 2px solid var(--brand-primary);
  margin-bottom: 12px;
}

.login-brand-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.login-brand-sub {
  font-size: 13px;
  color: var(--brand-primary);
  font-weight: 700;
}

.login-brand-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 12px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.forgot-link {
  color: var(--brand-primary);
  text-decoration: none;
}

.login-btn {
  padding: 12px;
  font-size: 14.5px;
  min-height: 46px;
}

/* ======================================================== */
/* 🔔 9. TOAST NOTIFICATIONS                                */
/* ======================================================== */
.toast-container {
  position: fixed;
  top: max(16px, var(--safe-top));
  right: max(16px, var(--safe-right));
  left: max(16px, var(--safe-left));
  max-width: 380px;
  margin-left: auto;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #1E293B;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease-out;
}

.toast.success { background: #16A34A; }
.toast.error { background: #DC2626; }

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========================================== */
/* 🔍 COMMAND PALETTE (CTRL + K) STYLES       */
/* ========================================== */
.btn-search-palette {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-search-palette:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: #FEF2F2;
}

.search-key-badge {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 20px;
  animation: fadeIn 0.15s ease-out;
}

.palette-box {
  background: #FFFFFF;
  width: 100%;
  max-width: 580px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popIn 0.2s ease-out;
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  background: #FAFAFA;
}

.palette-icon {
  font-size: 18px;
  color: var(--brand-primary);
}

.palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 500;
  background: transparent;
  color: var(--text-main);
}

.palette-input::placeholder {
  color: #94A3B8;
}

.palette-esc-badge {
  background: #E2E8F0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-main);
}

.palette-item:hover, .palette-item.active {
  background: #FEF2F2;
  color: var(--brand-primary);
}

.palette-item-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.palette-item-content {
  flex: 1;
}

.palette-item-title {
  font-weight: 600;
  font-size: 14px;
}

.palette-item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.palette-item-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #F1F5F9;
  color: #64748B;
  font-weight: 600;
}

.palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: #64748B;
}

.palette-footer kbd {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
}

.palette-brand {
  font-weight: 700;
  color: var(--brand-primary);
}

@keyframes popIn {
  from { transform: scale(0.96) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================== */
/* 🌴 SỔ CÁI NGÀY PHÉP & THỐNG KÊ CÔNG        */
/* ========================================== */
.leave-policy-alert {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #991B1B;
  line-height: 1.5;
}

.leave-policy-alert strong {
  color: var(--brand-primary);
}

.stat-progress-bar {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.stat-progress-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}


/* ==========================================
   Đơn từ: lưới thẻ loại đơn, luồng duyệt, CC, đính kèm, stepper
   ========================================== */
.rt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rt-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 14px 8px 10px; background: var(--bg-card); border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.rt-card:hover:not(.disabled) { border-color: var(--brand-border); box-shadow: var(--shadow-md); }
.rt-card:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.rt-card.selected { border-color: var(--brand-primary); box-shadow: 0 0 0 1px var(--brand-primary); }
.rt-card.disabled { cursor: not-allowed; opacity: .6; background: #F8FAFC; }
.rt-icon {
  width: 44px; height: 44px; border-radius: 50%; background: #FEF2F2; color: #DC2626;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.rt-name { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.rt-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.badge-unavailable { background: #E2E8F0; color: #64748B; }
.rt-check {
  display: none; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-primary); color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center;
}
.rt-card.selected .rt-check { display: flex; }

.route-box { background: var(--brand-light); border: 1px solid var(--brand-border); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 14px; font-size: 12.5px; }
.route-title { font-weight: 800; font-size: 11.5px; letter-spacing: .4px; color: var(--brand-hover); margin-bottom: 6px; }
.route-row { display: flex; gap: 8px; padding: 3px 0; }
.route-level { flex: none; font-weight: 700; color: var(--brand-primary); min-width: 42px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #F1F5F9; border-radius: 999px; font-size: 12px; }
.chip-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 11px; padding: 0; }
.chip-x:hover { color: var(--brand-primary); }
/* CC mặc định theo luồng đơn: nền đỏ nhạt + nhãn nhỏ, không có nút gỡ */
.chip-auto { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; }
.chip-tag { font-size: 10px; font-weight: 700; color: var(--brand-primary); background: #FFFFFF; border: 1px solid #FECACA; border-radius: 999px; padding: 1px 6px; }
/* Ô nhập số có nút −/+ (chạm được trên điện thoại) */
.num-stepper { display: flex; align-items: stretch; gap: 8px; }
.num-stepper .form-control { text-align: center; flex: 1; min-width: 0; }
.num-stepper-btn { width: 44px; flex: none; border: 1px solid var(--border, #E2E8F0); background: #FFFFFF; border-radius: 8px; font-size: 20px; font-weight: 700; color: var(--brand-primary); cursor: pointer; }
.num-stepper-btn:hover { background: #FEF2F2; }
.num-stepper-unit { align-self: center; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Danh sách chọn người theo dõi: nằm trong form (không dùng popup <select> gốc, tránh tràn màn hình điện thoại) */
.follower-list { display: none; }
.follower-list.open {
  display: block;
  margin-top: 6px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: #FFFFFF;
}
.follower-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 0; border-bottom: 1px solid #F1F5F9; background: transparent; text-align: left; cursor: pointer;
  font-family: inherit; overflow-wrap: anywhere;
}
.follower-item:last-child { border-bottom: 0; }
.follower-item:hover, .follower-item:active { background: #FEF2F2; }
.follower-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.follower-meta { font-size: 12px; color: var(--text-muted); }
.follower-empty { padding: 12px; font-size: 13px; color: var(--text-muted); text-align: center; }

.upload-zone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; cursor: pointer;
  border: 2px dashed var(--brand-border); border-radius: var(--radius-md); background: #FFFAFA; font-size: 12.5px; color: var(--text-muted);
}
.upload-zone:hover { border-color: var(--brand-primary); }
.upload-zone-icon { font-size: 22px; }
.attach-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.attach-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.attach-thumb-lg { width: 84px; height: 84px; }
.attach-meta { flex: 1; min-width: 0; }
.attach-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 11px; color: var(--text-muted); }
.attach-del { padding: 4px 10px; font-size: 11.5px; color: var(--danger); border-color: var(--brand-border); }
.attach-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.stepper { display: flex; align-items: flex-start; margin: 4px 0 12px; }
.step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; padding: 0 2px; }
.step::before { content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--border-color); z-index: 0; }
.step:first-child::before { display: none; }
.step-dot {
  position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #E2E8F0; color: #64748B; font-size: 12px; font-weight: 700;
}
.step-label { margin-top: 4px; font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.step-state { font-size: 10.5px; color: var(--text-muted); }
.step-actor { font-size: 11px; margin-top: 2px; }
.step-time { font-size: 10.5px; color: var(--text-muted); }
.step-comment { font-size: 11px; font-style: italic; margin-top: 2px; }
.step-completed .step-dot { background: var(--success); color: #fff; }
.step-completed::before { background: var(--success); }
.step-current_pending .step-dot { background: #FEF3C7; color: #B45309; box-shadow: 0 0 0 2px #FCD34D; }
.step-current_pending .step-label { color: #B45309; }
.step-rejected .step-dot { background: var(--brand-primary); color: #fff; }
.step-rejected .step-label { color: var(--brand-primary); }
.stepper-compact { margin: 2px 0 8px; }
.stepper-compact .step-label { font-size: 10.5px; font-weight: 600; }
.stepper-compact .step-dot { width: 20px; height: 20px; font-size: 10px; }
.stepper-compact .step::before { top: 9px; }

/* ==========================================
   Quản lý đơn từ: Bộ lọc trạng thái (Status Filter Tabs)
   ========================================== */
.requests-header-block {
  margin-bottom: 14px;
}
.requests-status-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin-bottom: 12px;
  border-bottom: 1.5px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}
.requests-status-tabs::-webkit-scrollbar {
  height: 4px;
}
.requests-status-tabs::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.status-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.status-tab-btn:hover {
  background: #F8FAFC;
  color: var(--text-color);
}
.status-tab-btn.active {
  background: #FEF2F2;
  color: var(--brand-primary);
  border-color: var(--brand-border);
  font-weight: 700;
}
.status-tab-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #E2E8F0;
  color: #475569;
  transition: all .15s ease;
}
.status-tab-btn.active .status-tab-badge {
  background: var(--brand-primary);
  color: #FFFFFF;
}
.badge-pending { background: #FEF3C7; color: #B45309; }
.badge-approved { background: #DCFCE7; color: #166534; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-cc { background: #E0E7FF; color: #3730A3; }
.badge-cancelled { background: #F1F5F9; color: #64748B; }

/* ==========================================
   Tạo đơn 2 bước chuẩn HappyTime (2-Step Wizard)
   ========================================== */
.step-guide-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.step-badge {
  padding: 3px 9px;
  background: var(--brand-primary);
  color: #FFFFFF;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}
.step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
}
.rt-filter-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.rt-search-wrap {
  position: relative;
  width: 100%;
}
.rt-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
}
.rt-search-wrap .form-control {
  padding-left: 36px;
}
.rt-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.category-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s ease;
}
.category-pill:hover {
  border-color: var(--brand-border);
  color: var(--brand-primary);
}
.category-pill.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #FFFFFF;
}

/* Selected Type Banner (Step 2 Header) */
.selected-type-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #FFF5F5;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.btn-back-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--brand-primary);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  white-space: nowrap;
  cursor: pointer;
}
.btn-back-type:hover {
  background: #FEF2F2;
  border-color: var(--brand-primary);
}
.selected-type-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.selected-type-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #FEF2F2;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.selected-type-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.3;
}
.selected-type-category {
  font-size: 11.5px;
  color: var(--text-muted);
}

