@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #06b6d4;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-card: #131b2e;
  --bg-surface: #1e293b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #26334d;
  --border-dark: #3b4d6b;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #172554;
  --primary-border: #2563eb;

  --success: #10b981;
  --success-light: #064e3b;
  --warning: #f59e0b;
  --warning-light: #78350f;
  --danger: #ef4444;
  --danger-light: #7f1d1d;
  --info: #06b6d4;
  
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.6), 0 2px 4px -2px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.7), 0 4px 6px -4px rgb(0 0 0 / 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP HEADER & NAVBAR
   ========================================================================== */
.app-navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 0.5rem;
}

.navbar-brand-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  white-space: nowrap;
}

.navbar-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

#loginButton {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  font-weight: 700;
  padding: 0.35rem 0.75rem !important;
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.025em;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white;
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Interactive Author Credit Pill */
.author-credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.author-credit-pill:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

.author-credit-pill .credit-short {
  display: inline;
}

.author-credit-pill .credit-full {
  display: none;
}

@media (min-width: 992px) {
  .author-credit-pill .credit-short {
    display: none;
  }
  .author-credit-pill .credit-full {
    display: inline;
  }
}

/* ==========================================================================
   KPI CARDS & SUMMARY
   ========================================================================== */
.kpi-card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.kpi-info {
  flex-grow: 1;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.kpi-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* ==========================================================================
   COMPACT UNIFIED TOOLBAR & MICRO-KPI STRIP
   ========================================================================== */
.header-control-bar {
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.week-select-compact {
  font-weight: 600;
  font-size: 0.825rem;
  border-radius: 0.375rem;
  border-color: var(--border-dark);
  padding: 0.35rem 2.2rem 0.35rem 0.65rem !important;
  background-color: var(--bg-card);
  color: #1e293b;
  min-width: 320px;
  width: auto;
}

.search-compact-wrap {
  position: relative;
  width: 220px;
  min-width: 180px;
  max-width: 240px;
  flex: 0 0 auto;
}

.search-compact-wrap .search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.search-input-compact {
  padding-left: 1.85rem !important;
  border-radius: 0.375rem !important;
  font-size: 0.8rem !important;
  height: 31px;
}

.btn-action-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.55rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border-radius: 0.45rem !important;
  min-width: 32px;
  height: 32px;
  transition: all 0.2s ease;
  line-height: 1 !important;
}

/* Icon-Only Toolbar Buttons: Perfect 32x32 Square Centered */
.btn-action-compact:not(#export-excel) {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

.btn-action-compact:not(#export-excel) i {
  font-size: 0.85rem !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.btn-action-compact#export-excel {
  height: 32px !important;
  padding: 0 0.75rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  line-height: 1 !important;
}

/* View Mode Buttons (Icon-only by default, Expand on Hover or Active, Spaced Out) */
.view-switcher-group {
  display: flex;
  align-items: center;
  gap: 0.35rem !important;
}

.btn-view-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.55rem !important;
  font-size: 0.775rem !important;
  font-weight: 600 !important;
  border-radius: 0.45rem !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  min-width: 33px;
  height: 31px;
}

.btn-view-mode .view-btn-text {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  display: inline-block;
  white-space: nowrap;
  transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.2s ease;
  margin-left: 0;
}

.btn-view-mode:hover .view-btn-text,
.btn-view-mode.active .view-btn-text {
  max-width: 80px;
  opacity: 1;
  margin-left: 0.35rem;
}

.micro-kpi-strip {
  background-color: #f8fafc;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.75rem;
}

/* ==========================================================================
   FULL-HEIGHT WORKSPACE LAYOUT (SCHEDULER PAGE)
   ========================================================================== */
html.scheduler-page,
body.scheduler-page {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* No outer browser scrollbar */
}

body.scheduler-page {
  display: flex;
  flex-direction: column;
}

.scheduler-page .app-navbar {
  flex: 0 0 auto;
}

.scheduler-page .main-workspace-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.5rem !important;
}

.scheduler-page .header-control-bar {
  flex: 0 0 auto;
}

.scheduler-page .schedule-view-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.scheduler-page .table-schedule-wrapper {
  flex: 1 1 auto;
  overflow: auto; /* The single primary scrollbar for the table */
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.scheduler-page #scheduleDayView,
.scheduler-page #scheduleStaffView {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.scheduler-page .app-footer {
  display: none !important;
}

/* ==========================================================================
   2-WAY STICKY SCHEDULE TABLE
   ========================================================================== */
.table-schedule-wrapper {
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.table-schedule {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
}

.table-schedule th,
.table-schedule td {
  border: 1px solid var(--border-color);
  padding: 2px 3px !important;
  vertical-align: middle;
}

.table-schedule tr.row-nhansu {
  min-height: 42px;
  height: auto;
}

.table-schedule tr.row-nhansu td {
  min-height: 42px;
  padding: 3px 3px !important;
  vertical-align: middle !important;
  box-sizing: border-box;
}

/* Sticky Header */
.table-schedule thead tr:first-child th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 20;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  height: 34px;
  padding: 0.2rem 0.3rem !important;
  box-sizing: border-box;
}

.table-schedule thead tr:nth-child(2) th {
  position: sticky;
  top: 34px;
  background: #e2e8f0;
  z-index: 20;
  font-weight: 600;
  color: #475569;
  text-align: center;
  font-size: 0.775rem;
  height: 28px;
  padding: 0.15rem 0.3rem !important;
  box-sizing: border-box;
}

/* Sticky Frozen Columns (Optimized Widths & Multi-line Support) */
.freeze-col-1 {
  position: sticky;
  left: 0;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
  background-color: var(--bg-card);
  z-index: 10;
  padding: 2px 2px !important;
  font-size: 0.8rem;
  font-weight: 700;
  box-sizing: border-box;
}

.freeze-col-2 {
  position: sticky;
  left: 38px;
  width: 145px;
  min-width: 145px;
  max-width: 145px;
  font-weight: 600;
  color: #1e293b;
  background-color: var(--bg-card);
  z-index: 10;
  padding: 2px 4px !important;
  font-size: 0.825rem;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.25;
  box-sizing: border-box;
}

.freeze-col-3 {
  position: sticky;
  left: 183px; /* 38 + 145 = 183px */
  width: 115px;
  min-width: 115px;
  max-width: 115px;
  background-color: var(--bg-card);
  z-index: 10;
  font-size: 0.775rem;
  color: var(--text-muted);
  padding: 2px 3px !important;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.25;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 2px 0 4px -1px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

/* Corner Header intersections get highest z-index */
.table-schedule thead th.freeze-col-1,
.table-schedule thead th.freeze-col-2,
.table-schedule thead th.freeze-col-3 {
  z-index: 30 !important;
  background: #f1f5f9;
  height: 62px;
  box-sizing: border-box;
}

.table-schedule thead th.col-total {
  z-index: 25 !important;
  background: #f1f5f9;
  height: 62px;
  box-sizing: border-box;
}

.table-schedule thead th.freeze-col-3 {
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 2px 0 4px -1px rgba(0, 0, 0, 0.05);
}

/* Day columns */
.table-schedule th.col-day,
.table-schedule td.col-day {
  min-width: 135px !important;
  width: 135px !important;
  max-width: 135px !important;
  text-align: center;
  box-sizing: border-box;
}

.table-schedule td.col-day .select2-container {
  width: 100% !important;
  min-height: 34px !important;
  height: auto !important;
  display: block !important;
}

.table-schedule th.col-total,
.table-schedule td.col-total {
  min-width: 70px !important;
  width: 70px !important;
  max-width: 70px !important;
  text-align: center;
  box-sizing: border-box;
}

/* Management Level Header Row */
.row-capquanly td {
  position: sticky;
  top: 62px;
  z-index: 15;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem !important;
  letter-spacing: 0.025em;
  color: #0f172a;
  height: 38px !important;
  vertical-align: middle;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.sticky-group-title {
  position: sticky;
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: fit-content;
}

/* Row Hover */
.table-schedule tbody tr:hover td {
  background-color: #f8fafc;
}

.table-schedule tbody tr:hover td.freeze-col-1,
.table-schedule tbody tr:hover td.freeze-col-2,
.table-schedule tbody tr:hover td.freeze-col-3 {
  background-color: #f1f5f9;
}

/* ==========================================================================
   ĐỊNH BIÊN REAL-TIME & EDITABLE {SÁNG}/{CHIỀU}
   ========================================================================== */
.row-dinhbien {
  background-color: #f8fafc;
  font-weight: 600;
  border-top: 1px solid var(--border-color);
}

.row-dinhbien td {
  height: 38px !important;
  padding: 2px 3px !important;
  vertical-align: middle;
}

.dinhbien-input,
.dinhbien {
  width: 100%;
  text-align: center;
  font-weight: 700;
  border-radius: 0.35rem;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: #1d4ed8;
  background-color: #eff6ff !important;
  border: 1px dashed #93c5fd;
  transition: all 0.2s ease;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  height: 28px;
}

.dinhbien-input:focus,
.dinhbien:focus {
  background-color: #ffffff !important;
  border: 1px solid var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
  outline: none;
}

.dinhbien-custom-input {
  background-color: #fefce8 !important;
  border: 1px solid #f59e0b !important;
  color: #b45309 !important;
  font-weight: 800;
}

.dinhbien-status-deficit {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
  border-color: #f87171 !important;
  font-weight: 800;
}

.dinhbien-status-match {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #34d399 !important;
  font-weight: 800;
}

.dinhbien-status-surplus {
  background-color: #fffbeb !important;
  color: #b45309 !important;
  border-color: #fbbf24 !important;
  font-weight: 800;
}

/* ==========================================================================
   SELECT2 PILL / BADGE STYLING (SEAMLESS BORDERLESS SPREADSHEET STYLE)
   ========================================================================== */
.select2-container--default .select2-selection--multiple {
  border: none !important;
  border-radius: 0.25rem;
  min-height: 34px !important;
  height: 100% !important;
  padding: 3px 6px !important;
  font-size: 0.775rem;
  background: transparent !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 3px !important;
  box-sizing: border-box;
  box-shadow: none !important;
  transition: background-color 0.15s ease;
}

.table-schedule td:hover .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--multiple {
  background-color: rgba(239, 246, 255, 0.45) !important;
  border: none !important;
  box-shadow: none !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: contents !important;
  padding: 0 !important;
  margin: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #1d4ed8 !important;
  border-radius: 0.25rem !important;
  padding: 0 4px !important;
  font-size: 0.725rem !important;
  font-weight: 600 !important;
  margin: 1px 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  position: relative !important;
  float: none !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  height: 22px !important;
  box-sizing: border-box !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  order: 1 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  position: static !important;
  border: none !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: #ef4444 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  font-family: Arial, sans-serif !important;
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 13px !important;
  height: 13px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  order: 2 !important;
  transform: translateY(-0.5px);
  transition: all 0.15s ease;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #b91c1c !important;
  background-color: rgba(239, 68, 68, 0.12) !important;
  transform: translateY(-0.5px) scale(1.15);
}

.select2-container--default .select2-selection--multiple .select2-selection__clear {
  display: none !important; /* Hide stray clear-all cross on table cells */
}

.select2-container--default .select2-search--inline {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  float: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  height: 24px !important;
  flex: 0 1 auto !important;
}

.select2-container--default .select2-search--inline .select2-search__field {
  margin: 0 !important;
  padding: 0 2px !important;
  height: 24px !important;
  line-height: 24px !important;
  font-size: 0.75rem !important;
  text-align: left !important;
  color: var(--text-main) !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* When empty: Expand search input to fill full width and left align placeholder */
.select2-container--default .select2-selection__rendered:not(:has(.select2-selection__choice)) .select2-search--inline,
.select2-container--default .select2-selection__rendered > .select2-search--inline:only-child {
  flex: 1 1 100% !important;
  width: 100% !important;
}

.select2-container--default .select2-selection__rendered:not(:has(.select2-selection__choice)) .select2-search__field,
.select2-container--default .select2-selection__rendered > .select2-search--inline:only-child .select2-search__field {
  width: 100% !important;
  text-align: left !important;
}

/* When choices ARE present: Lock search field to tiny size on same line */
.select2-container--default .select2-selection__rendered:has(.select2-selection__choice) .select2-search--inline {
  flex: 0 1 auto !important;
  width: auto !important;
  max-width: 25px !important;
}
.select2-container--default .select2-selection__rendered:has(.select2-selection__choice) .select2-search__field {
  width: auto !important;
  max-width: 25px !important;
  text-align: left !important;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
  text-align: left !important;
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
}

.select2-dropdown {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  z-index: 99999;
}

/* Shift badge rendering inside select options */
.shift-option-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Total column input */
.tong-cong-ngay {
  text-align: center;
  font-weight: 700;
  color: var(--primary);
  background: #f8fafc !important;
  border: 1px solid var(--border-color);
  border-radius: 0.35rem;
  padding: 2px 4px;
  font-size: 0.85rem;
  height: 32px;
}

/* Row Action button */
.btn-row-action {
  opacity: 0.3;
  transition: opacity 0.2s ease;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 0.35rem;
}

tr:hover .btn-row-action {
  opacity: 1;
}

/* ==========================================================================
   MANAGEMENT TABS (manage.html)
   ========================================================================== */
.nav-tabs-custom {
  border-bottom: 2px solid var(--border-color);
  gap: 0.5rem;
}

.nav-tabs-custom .nav-link {
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem 0.5rem 0 0;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-tabs-custom .nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-tabs-custom .nav-link.active {
  color: var(--primary);
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--primary);
  font-weight: 700;
}

.tab-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 0.875rem 0.875rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MANAGE PAGE SEARCH INPUT & STICKY TABLE HEADER
   ========================================================================== */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrap i,
.search-input-wrap .fa-magnifying-glass {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 5;
  transition: color 0.2s ease;
}

.search-input-wrap .table-search,
.search-input-wrap input.form-control {
  padding-left: 2.3rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.825rem !important;
  height: 36px !important;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap .table-search:focus,
.search-input-wrap input.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
  background-color: var(--bg-card);
  outline: none;
}

.search-input-wrap:focus-within i {
  color: var(--primary) !important;
}

/* ==========================================================================
   MANAGE PAGE FULL-HEIGHT WORKSPACE LAYOUT (Single Table Scrollbar & Sticky Header)
   ========================================================================== */
html.manage-page-html,
body.manage-page {
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Triệt tiêu hoàn toàn thanh cuộn trình duyệt ngoài cùng */
}

body.manage-page {
  display: flex;
  flex-direction: column;
}

body.manage-page .app-navbar {
  flex: 0 0 auto;
  margin-bottom: 0.75rem !important;
}

body.manage-page .manage-main-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.5rem !important;
}

body.manage-page .manage-header-title {
  flex: 0 0 auto;
  margin-bottom: 0.5rem !important;
}

body.manage-page .nav-tabs-custom,
body.manage-page .mobile-category-selector-wrap {
  flex: 0 0 auto;
}

body.manage-page .tab-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body.manage-page .tab-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

body.manage-page .tab-pane:not(.active) {
  display: none !important;
}

body.manage-page .tab-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 1.25rem !important;
}

body.manage-page .tab-card > .d-flex:first-child {
  flex: 0 0 auto;
  margin-bottom: 0.75rem !important;
}

body.manage-page .tab-card .table-responsive {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: auto !important;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  scrollbar-width: thin;
}

.data-table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

body.manage-page .data-table-modern thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background-color: var(--bg-main) !important;
  color: var(--text-muted) !important;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.data-table-modern td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table-modern tbody tr:hover td {
  background-color: #f8fafc;
}

/* ==========================================================================
   LOADING OVERLAY & SPINNER (Centered in the viewport)
   ========================================================================== */
.loading-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  display: none;
  z-index: 999999 !important;
}

.loading-overlay[style*="display: block"],
.loading-overlay[style*="display: flex"],
.loading-overlay.active {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.loading-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

.modern-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PRINT / PDF STYLES (A4 Landscape)
   ========================================================================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 6mm;
  }

  body {
    background: white !important;
    font-size: 9pt !important;
    color: black !important;
  }

  .app-navbar,
  .toolbar-container,
  .kpi-section,
  .btn,
  .no-print,
  .btn-row-action {
    display: none !important;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 8px;
  }

  .table-schedule-wrapper {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
  }

  .table-schedule {
    font-size: 8pt !important;
    border: 1px solid #333 !important;
  }

  .table-schedule th,
  .table-schedule td {
    border: 1px solid #333 !important;
    padding: 3px 4px !important;
  }

  .table-schedule thead tr:first-child th,
  .table-schedule thead tr:nth-child(2) th,
  .freeze-col-1,
  .freeze-col-2,
  .freeze-col-3 {
    position: static !important;
    background: transparent !important;
  }

  .select2-container {
    display: none !important;
  }

  .print-shift-text {
    display: block !important;
    font-weight: 600;
  }

  .app-footer {
    display: none !important;
  }

  html.scheduler-page,
  body.scheduler-page {
    overflow: visible !important;
    height: auto !important;
  }

  .scheduler-page .table-schedule-wrapper {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
}

.print-shift-text {
  display: none;
}

/* ==========================================================================
   HEADER TOOLBAR & RESPONSIVE COLLAPSIBLE PANEL
   ========================================================================== */
.header-unified-toolbar {
  width: 100%;
}

.collapsible-tools-panel {
  transition: all 0.25s ease-in-out;
}

@media (min-width: 992px) {
  .header-unified-toolbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.65rem !important;
  }

  .week-nav-group {
    flex: 0 0 auto !important;
    max-width: none !important;
  }

  .search-compact-wrap {
    min-width: 180px !important;
    max-width: 230px !important;
    width: 210px !important;
    flex: 0 0 210px !important;
    margin: 0 !important;
  }

  .view-switcher-group {
    flex: 0 0 auto !important;
  }

  .desktop-actions-group {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  .collapsible-tools-panel {
    display: block !important;
  }
}

@media (max-width: 991.98px) {
  .header-control-bar {
    padding: 0.5rem 0.65rem !important;
  }

  .header-unified-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }
  
  .week-nav-group {
    width: 100%;
    order: 1;
  }

  .week-select-compact {
    min-width: 0 !important;
    width: 100% !important;
  }

  .view-switcher-group {
    flex: 1 1 auto;
    order: 2;
    justify-content: space-between;
  }

  .view-switcher-group .btn-view-mode {
    flex: 1 1 0;
    justify-content: center;
  }

  #btnToggleMobileTools {
    order: 3;
  }

  .search-compact-wrap {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    order: 4;
  }

  /* Collapsible panel on mobile */
  .collapsible-tools-panel {
    display: none;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
  }

  .collapsible-tools-panel.show {
    display: block !important;
  }

  .mobile-action-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
  }

  .mobile-action-grid .btn {
    padding: 0.45rem 0.6rem !important;
    font-size: 0.8rem !important;
    border-radius: 0.5rem;
  }
}

@media (max-width: 768px) {
  /* Navbar */
  .app-navbar {
    padding: 0.45rem 0.75rem !important;
  }
  .brand-title {
    font-size: 1.05rem;
    gap: 0.35rem;
  }
  .brand-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
  }
  #currentUserEmail {
    display: none !important;
  }

  /* Control bar */
  .header-control-bar {
    padding: 0.45rem 0.6rem !important;
    border-radius: 0.5rem;
  }
  .btn-action-compact {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.75rem !important;
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
    display: inline-flex;
    align-items: center;
  }
  
  /* Micro KPI */
  .micro-kpi-strip {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  /* Table Schedule Wrapper */
  .table-schedule-wrapper {
    max-height: calc(100vh - 210px);
    border-radius: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  /* Table Schedule Columns on Mobile */
  .table-schedule {
    font-size: 0.75rem;
  }
  .table-schedule th,
  .table-schedule td {
    padding: 0.25rem 0.3rem;
  }

  /* Compact Frozen Columns on Mobile */
  .freeze-col-1 {
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.1rem !important;
  }
  .freeze-col-2 {
    left: 28px !important;
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.3rem !important;
  }
  .freeze-col-3 {
    left: 133px !important; /* 28 + 105 */
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    font-size: 0.7rem !important;
    padding: 0.25rem 0.25rem !important;
  }

  /* Day columns on mobile */
  .table-schedule th.col-day,
  .table-schedule td.col-day {
    min-width: 110px !important;
    width: 110px !important;
  }
  .table-schedule th.col-total,
  .table-schedule td.col-total {
    min-width: 65px !important;
    width: 65px !important;
  }

  /* Select2 Mobile Touch Targets */
  .select2-container--default .select2-selection--multiple {
    min-height: 34px !important;
    padding: 2px !important;
  }
  .select2-container--default .select2-selection--multiple .select2-selection__choice {
    font-size: 0.725rem !important;
    padding: 2px 5px !important;
  }
  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    font-size: 14px !important;
    padding: 0 3px !important;
  }

  /* Management tabs on mobile */
  .nav-tabs-custom {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 0.25rem;
  }
  .nav-tabs-custom .nav-link {
    font-size: 0.825rem !important;
    padding: 0.5rem 0.75rem !important;
    white-space: nowrap !important;
    flex-shrink: 0;
  }
  .tab-card {
    padding: 0.85rem !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: 0.75rem !important;
  }
  .data-table-modern {
    font-size: 0.8rem !important;
  }
  .data-table-modern th,
  .data-table-modern td {
    padding: 0.5rem 0.6rem !important;
  }
  .mobile-category-selector-wrap .form-select {
    font-size: 0.95rem;
    height: 44px;
    border-radius: 0 0.5rem 0.5rem 0;
  }
  .mobile-category-selector-wrap .input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .actions-nav-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    width: 100%;
  }
  .view-switcher-group {
    width: 100%;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    gap: 0.35rem !important;
  }
  .view-switcher-group .btn-view-mode {
    flex: 1 1 0;
  }
  .actions-nav-group .btn-action-compact {
    flex: 1 1 calc(50% - 0.35rem);
    text-align: center;
    justify-content: center;
  }
  .freeze-col-1 {
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
  }
  .freeze-col-2 {
    left: 26px !important;
    width: 95px !important;
    min-width: 95px !important;
    max-width: 95px !important;
  }
  .freeze-col-3 {
    left: 121px !important;
    width: 75px !important;
    min-width: 75px !important;
    max-width: 75px !important;
  }
  .day-staff-info {
    width: 95px !important;
    min-width: 85px !important;
    max-width: 100px !important;
    flex: 0 0 95px !important;
  }
  .day-staff-name {
    font-size: 0.775rem !important;
  }
  .day-staff-role {
    font-size: 0.685rem !important;
  }
  .day-staff-item {
    padding: 0.5rem 0.65rem !important;
    gap: 0.5rem !important;
  }
}

/* ==========================================================================
   MULTI-VIEW SCHEDULER (DAY VIEW & STAFF CARD VIEW)
   ========================================================================== */
/* Day Switcher Strip */
.day-switcher-strip {
  flex: 0 0 auto !important;
  display: flex !important;
  gap: 0.5rem !important;
  overflow-x: auto !important;
  padding: 0.25rem 0.15rem 0.5rem 0.15rem !important;
  margin-bottom: 0.75rem !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.day-pill-btn {
  flex: 1 1 0 !important;
  min-width: 85px !important;
  height: 54px !important;
  min-height: 54px !important;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.65rem;
  padding: 0.35rem 0.5rem !important;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

.day-pill-btn:hover {
  border-color: var(--primary-border);
  background-color: var(--primary-light);
}

.day-pill-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.day-pill-btn.active .day-pill-name,
.day-pill-btn.active .day-pill-date {
  color: #ffffff !important;
}

.day-pill-name {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2 !important;
  margin-bottom: 2px !important;
}

.day-pill-date {
  font-size: 0.925rem !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  line-height: 1.2 !important;
}

/* Day View & Staff View Container */
.day-view-container,
.staff-view-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Day View Group Container */
.day-group-card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  overflow: hidden;
}

.day-group-header {
  padding: 0.65rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.day-staff-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: background-color 0.15s ease;
}

.day-staff-item:last-child {
  border-bottom: none;
}

.day-staff-item:hover {
  background-color: #f8fafc;
}

.day-staff-info {
  width: 115px;
  min-width: 100px;
  max-width: 125px;
  flex: 0 0 115px;
}

.day-staff-name {
  font-weight: 700;
  font-size: 0.825rem;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.25;
}

.day-staff-role {
  font-size: 0.725rem;
  color: var(--text-muted);
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.2;
}

.day-staff-selector {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

/* Staff Weekly Card View */
.staff-card-item {
  background: var(--bg-card);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.staff-card-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
  transition: background-color 0.15s ease;
}

.staff-card-header:hover {
  background-color: #f8fafc;
}

.staff-card-body {
  padding: 0.5rem 1rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background-color: #f8fafc;
}

.staff-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px dashed #e2e8f0;
  gap: 0.5rem;
}

.staff-day-row:last-child {
  border-bottom: none;
}

.staff-day-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  min-width: 85px;
}

/* Quota Summary Strip for Staff View */
.quota-summary-card {
  background: var(--bg-card);
  border-radius: 0.65rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
}

.quota-day-chip {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  min-width: 58px;
}

.quota-day-chip:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
}

/* App Footer */
.app-footer {
  border-top: 1px solid var(--border-color) !important;
  color: var(--text-muted);
}

.app-footer p {
  letter-spacing: 0.015em;
}

/* KBD Badge Style */
kbd {
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.775rem;
  font-weight: 600;
  display: inline-block;
  line-height: 1;
}

/* ==========================================================================
   FULL-SCREEN DEMO NOTICE & STICKY TOP BANNER
   ========================================================================== */
.demo-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: demoFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-modal-container {
  position: relative;
  max-width: 500px;
  width: 100%;
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(226, 232, 240, 0.9);
  overflow: hidden;
  animation: demoScaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-modal-glow {
  height: 6px;
  width: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444, #6366f1);
}

.demo-icon-float {
  animation: demoFloat 3.5s ease-in-out infinite;
  display: inline-block;
}

.demo-floating-badge {
  animation: demoBadgePulse 2s ease-in-out infinite;
}

.demo-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: #fef3c7;
  color: #b45309;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: demoPulse 1.8s infinite;
}

.demo-sub-copy {
  color: #1e293b;
}

.demo-warning-callout {
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.demo-warning-desc {
  color: #991b1b;
}

.demo-footer-note {
  color: #64748b;
}

[data-theme="dark"] .demo-modal-container {
  background: #1e293b;
  border-color: rgba(51, 65, 85, 0.9);
  color: #f1f5f9;
}

[data-theme="dark"] .demo-sub-copy {
  color: #f8fafc !important;
}

[data-theme="dark"] .demo-warning-callout {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

[data-theme="dark"] .demo-warning-desc {
  color: #fecdd3 !important;
}

[data-theme="dark"] .demo-footer-note {
  color: #cbd5e1 !important;
}

.btn-go-official {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  text-decoration: none;
  box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-go-official:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -4px rgba(37, 99, 235, 0.5);
  color: #ffffff !important;
}

.btn-stay-demo {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: color 0.15s ease;
  cursor: pointer;
}

.btn-stay-demo:hover {
  color: #0f172a;
  text-decoration: underline;
}

/* Sticky top banner when user dismisses modal to test demo */
.demo-top-sticky-banner {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 9999;
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border-bottom: 1px solid #fde68a;
  padding: 0.35rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #92400e;
}

[data-theme="dark"] .demo-top-sticky-banner {
  background: linear-gradient(90deg, #1e293b, #172136) !important;
  border-bottom: 1px solid #334155 !important;
  color: #fde68a !important;
}

[data-theme="dark"] .demo-banner-text {
  color: #e2e8f0 !important;
}

.demo-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.demo-banner-badge {
  background: #f59e0b;
  color: #ffffff;
  padding: 0.1rem 0.45rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.demo-banner-btn {
  background: #2563eb;
  color: #ffffff !important;
  text-decoration: none;
  padding: 0.15rem 0.65rem;
  border-radius: 0.35rem;
  font-weight: 600;
  font-size: 0.75rem;
  transition: background 0.15s ease;
}

.demo-banner-btn:hover {
  background: #1d4ed8;
}

.demo-overlay-closing {
  animation: demoFadeOut 0.25s forwards ease-in;
}

@keyframes demoFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes demoFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

@keyframes demoScaleUp {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes demoFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes demoBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes demoPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* ==========================================================================
   THEME TOGGLE BUTTON (Light / Dark Mode Switcher)
   ========================================================================== */
.btn-theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-theme-toggle:hover {
  transform: rotate(25deg) scale(1.08);
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-theme-toggle i {
  font-size: 0.95rem;
  transition: transform 0.3s ease;
  pointer-events: none;
}

/* ==========================================================================
   DARK MODE COMPONENT OVERRIDES
   ========================================================================== */
[data-theme="dark"] body {
  background-color: var(--bg-main) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .app-navbar {
  background: var(--bg-card) !important;
  border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .brand-title {
  color: #ffffff !important;
}

[data-theme="dark"] .tab-card,
[data-theme="dark"] .card,
[data-theme="dark"] .scheduler-container,
[data-theme="dark"] .schedule-view-pane {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .data-table-modern thead th,
[data-theme="dark"] #lich-lam-viec thead th,
[data-theme="dark"] .ngay-lamviec th {
  background-color: #172136 !important;
  color: #cbd5e1 !important;
  border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .data-table-modern td,
[data-theme="dark"] #lich-lam-viec td {
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .data-table-modern tbody tr:hover td {
  background-color: rgba(59, 130, 246, 0.08) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text {
  background-color: #1a2438 !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
}

[data-theme="dark"] .modal-content {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  background-color: #172136 !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Select2 Dark Mode */
[data-theme="dark"] .select2-container--default .select2-selection--multiple,
[data-theme="dark"] .select2-container--default .select2-selection--single {
  background-color: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .table-schedule td:hover .select2-selection--multiple,
[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple,
[data-theme="dark"] .select2-container--default.select2-container--open .select2-selection--multiple {
  background-color: #172136 !important;
  border: 1px solid #3b82f6 !important;
  box-shadow: 0 0 0 1px #3b82f6 !important;
}

[data-theme="dark"] .select2-dropdown {
  background-color: #172136 !important;
  border-color: #3b82f6 !important;
  color: var(--text-main) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

/* Standalone / dropdown search field in dark mode */
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
  background-color: #1a2438 !important;
  color: #ffffff !important;
  border: 1px solid var(--border-color) !important;
}

/* Inline search field inside multi-select chips in dark mode */
[data-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text-main) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Dark mode for Scheduler matrix & cells (Fixes white background on Bootstrap 5) */
[data-theme="dark"] .table-schedule,
[data-theme="dark"] #lich-lam-viec,
[data-theme="dark"] .table {
  --bs-table-bg: var(--bg-card) !important;
  --bs-table-color: var(--text-main) !important;
  --bs-table-border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .table-schedule th,
[data-theme="dark"] .table-schedule td:not(.capquanly),
[data-theme="dark"] #lich-lam-viec th,
[data-theme="dark"] #lich-lam-viec td:not(.capquanly) {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .table-schedule thead tr:first-child th,
[data-theme="dark"] .table-schedule thead tr:nth-child(2) th,
[data-theme="dark"] .table-schedule thead th.freeze-col-1,
[data-theme="dark"] .table-schedule thead th.freeze-col-2,
[data-theme="dark"] .table-schedule thead th.freeze-col-3,
[data-theme="dark"] .table-schedule thead th.col-total {
  background-color: #172136 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .freeze-col-1,
[data-theme="dark"] .freeze-col-2,
[data-theme="dark"] .freeze-col-3 {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-right-color: var(--border-color) !important;
}

[data-theme="dark"] .freeze-col-2,
[data-theme="dark"] .staff-name-cell {
  color: var(--text-main) !important;
}

[data-theme="dark"] .freeze-col-3 {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .row-nhansu td {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .row-nhansu:hover td,
[data-theme="dark"] .table-schedule tbody tr:not(.row-capquanly):hover td,
[data-theme="dark"] .table-schedule tbody tr:hover td.freeze-col-1,
[data-theme="dark"] .table-schedule tbody tr:hover td.freeze-col-2,
[data-theme="dark"] .table-schedule tbody tr:hover td.freeze-col-3 {
  background-color: #1e293b !important;
}

[data-theme="dark"] .row-capquanly td {
  border-top-color: var(--border-color) !important;
  border-bottom-color: var(--border-color) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.table-schedule tbody tr.row-capquanly:hover td.capquanly,
[data-theme="dark"] .table-schedule tbody tr.row-capquanly:hover td.capquanly {
  background-color: inherit;
  filter: brightness(0.96);
}

[data-theme="dark"] .text-dark {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .bg-light {
  background-color: #172136 !important;
  color: #f1f5f9 !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .row-dinhbien td {
  background-color: #111827 !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .dinhbien-input,
[data-theme="dark"] .dinhbien {
  background-color: #1e293b !important;
  color: #60a5fa !important;
  border-color: #3b82f6 !important;
}

[data-theme="dark"] .staff-total-credits {
  color: #4ade80 !important;
}

[data-theme="dark"] .staff-note {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .app-footer {
  border-top-color: var(--border-color) !important;
  background-color: var(--bg-card) !important;
}

/* ==========================================================================
   METRIC STATS BAR (manage.html)
   ========================================================================== */
.manage-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex: 0 0 auto;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none !important;
  color: inherit !important;
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.stats-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.stats-card.active::before {
  background-color: var(--primary);
}

.stats-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stats-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stats-number {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
}

.stats-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   EMPTY STATE COMPONENT
   ========================================================================== */
.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   STAFF AVATAR PILL & MOBILE CARDS (manage.html)
   ========================================================================== */
.avatar-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3b82f6;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* Mobile Cards Container (Shown only < 768px) */
.manage-mobile-cards {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.25rem 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.mobile-data-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-data-card:active {
  transform: scale(0.99);
}

.mobile-data-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-data-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
}

.mobile-data-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mobile-data-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
}

.mobile-data-card-actions .btn {
  min-height: 36px;
  padding: 0.25rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Responsive adjustments for Stats Bar and Mobile Cards */
@media (max-width: 991.98px) {
  .manage-stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767.98px) {
  .manage-main-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .manage-header-title {
    margin-bottom: 0.35rem !important;
  }

  .manage-header-title h5 {
    font-size: 0.95rem !important;
  }

  /* Compact 1-Row Horizontal Swipe Strip for Stats Bar (~40px height) */
  .manage-stats-bar {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
    grid-template-columns: none;
  }
  .manage-stats-bar::-webkit-scrollbar {
    display: none;
  }

  .stats-card {
    flex: 0 0 auto;
    min-width: 108px;
    padding: 0.35rem 0.6rem;
    gap: 0.45rem;
    border-radius: 0.5rem;
    scroll-snap-align: start;
  }

  .stats-icon-wrap {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    border-radius: 0.35rem;
  }

  .stats-number {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.1;
  }

  .stats-label {
    font-size: 0.65rem;
    line-height: 1;
  }

  .tab-card {
    padding: 0.65rem 0.75rem !important;
    border-radius: 0.65rem;
  }

  /* Switch Table to Mobile Card List */
  .table-responsive.manage-table-wrap {
    display: none !important;
  }

  .manage-mobile-cards {
    display: flex !important;
  }
}

/* ==========================================================================
   DAY VIEW & STAFF CARD VIEW DARK MODE OVERRIDES & STICKY QUOTA
   ========================================================================== */
.row-dinhbien td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: var(--bg-card);
}

[data-theme="dark"] .row-dinhbien td:first-child {
  background-color: #111827 !important;
}

/* Day Pills Dark Mode (Crisp high-contrast day & date) */
[data-theme="dark"] .day-pill-btn {
  background-color: #172136 !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .day-pill-btn:hover {
  background-color: #1e293b !important;
  border-color: var(--primary) !important;
}

[data-theme="dark"] .day-pill-btn .day-pill-name {
  color: #94a3b8 !important;
}

[data-theme="dark"] .day-pill-btn .day-pill-date {
  color: #f8fafc !important;
}

[data-theme="dark"] .day-pill-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

[data-theme="dark"] .day-pill-btn.active .day-pill-name,
[data-theme="dark"] .day-pill-btn.active .day-pill-date {
  color: #ffffff !important;
}

[data-theme="dark"] .day-group-card {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .day-group-header {
  background-color: #172136 !important;
  color: #f1f5f9 !important;
  border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .day-staff-item {
  border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .day-staff-item:hover {
  background-color: #1a2438 !important;
}

[data-theme="dark"] .day-staff-name {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .quota-summary-card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .quota-day-chip {
  background-color: #172136 !important;
  border: 1px solid var(--border-color);
  border-radius: 0.35rem;
}

[data-theme="dark"] .staff-card-item {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .staff-card-header {
  background-color: var(--bg-card) !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .staff-card-header:hover {
  background-color: #1a2438 !important;
}

[data-theme="dark"] .staff-card-body {
  background-color: #111827 !important;
  border-top-color: var(--border-color) !important;
}

[data-theme="dark"] .staff-day-row {
  border-bottom-color: var(--border-color) !important;
}

/* Micro-KPI Strip in Dark Mode */
[data-theme="dark"] .micro-kpi-strip {
  background-color: #131b2e !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .micro-kpi-strip .text-secondary {
  color: #94a3b8 !important;
}

[data-theme="dark"] .micro-kpi-strip strong.text-dark,
[data-theme="dark"] .micro-kpi-strip #kpiTotalStaff {
  color: #f1f5f9 !important;
}

/* Author credit pill in Dark Mode */
[data-theme="dark"] .author-credit-pill {
  background: #172136 !important;
  border-color: var(--border-color) !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .author-credit-pill:hover {
  background: #1e293b !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* Total credits cell in Dark Mode */
[data-theme="dark"] .tong-cong-ngay {
  background-color: #172136 !important;
  color: #4ade80 !important;
  border-color: var(--border-color) !important;
}

/* Dark Mode Quota Status Indicators */
[data-theme="dark"] .dinhbien-custom-input {
  background-color: rgba(245, 158, 11, 0.2) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] .dinhbien-status-deficit {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border-color: #ef4444 !important;
}

[data-theme="dark"] .dinhbien-status-match {
  background-color: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border-color: #10b981 !important;
}

[data-theme="dark"] .dinhbien-status-surplus {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border-color: #f59e0b !important;
}

/* SweetAlert2 Modal Dark Mode */
[data-theme="dark"] .swal2-popup {
  background: #131b2e !important;
  color: #f1f5f9 !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .swal2-title {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .swal2-html-container {
  color: #94a3b8 !important;
}

[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-file,
[data-theme="dark"] .swal2-textarea {
  background: #172136 !important;
  color: #f1f5f9 !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .swal2-close {
  color: #94a3b8 !important;
}

/* Demo modal banner in Dark Mode */
[data-theme="dark"] .demo-modal-container {
  background: #131b2e !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .demo-modal-body h4 {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-stay-demo {
  color: #94a3b8 !important;
}

[data-theme="dark"] .btn-stay-demo:hover {
  color: #f1f5f9 !important;
}

/* Hotkey badges in Dark Mode */
[data-theme="dark"] kbd {
  background-color: #0f172a !important;
  color: #93c5fd !important;
  border: 1px solid #3b82f6 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Select options in Dark Mode */
[data-theme="dark"] option {
  background-color: #131b2e;
  color: #f1f5f9;
}

/* Loading Overlay in Dark Mode */
[data-theme="dark"] .loading-overlay {
  background: rgba(9, 13, 22, 0.82) !important;
}

[data-theme="dark"] .loading-overlay-content {
  background: #131b2e !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .loading-overlay-content .text-secondary {
  color: #94a3b8 !important;
}

[data-theme="dark"] .modern-spinner {
  border-color: #1e293b !important;
  border-top-color: var(--primary) !important;
}

/* ==========================================================================
   UNDO FLOATING NOTIFICATION BADGE
   ========================================================================== */
.undo-floating-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  line-height: 14px;
  border-radius: 9999px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.4);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}

[data-theme="dark"] .undo-floating-badge {
  background: #3b82f6;
  border-color: #131b2e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.undo-badge-mobile {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
  line-height: 1.1;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .undo-badge-mobile {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* --- Real-time Lock Styles --- */
.cell-locked-by-other {
  border: 2px solid #f59e0b !important; /* amber-500 */
  animation: pulse-border 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  position: relative;
  pointer-events: none; /* prevent click if someone else is editing */
  opacity: 0.8;
}

.cell-locked-by-me {
  border: 2px solid #3b82f6 !important; /* blue-500 */
  position: relative;
  box-shadow: inset 0 0 5px rgba(59, 130, 246, 0.3);
}

.cell-lock-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #f59e0b;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  pointer-events: none;
}

[data-theme="dark"] .cell-locked-by-other {
  border-color: #d97706 !important; /* amber-600 */
}

[data-theme="dark"] .cell-lock-badge {
  background-color: #d97706;
}

@keyframes pulse-border {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

/* --- Micro-KPI Strip Department Pills --- */
.kpi-dept-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background-color: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kpi-dept-pill .kpi-dept-val {
  color: #2563eb;
  font-weight: 700;
}

[data-theme="dark"] .kpi-dept-pill {
  background-color: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .kpi-dept-pill .kpi-dept-val {
  color: #60a5fa !important;
}

/* ==========================================================================
   KEYBOARD NAVIGATION & ACTIVE CELL HIGHLIGHT (Hotkeys)
   ========================================================================== */
.cell-shift.cell-active-hotkey,
.cell-dinhbien.cell-active-hotkey {
  outline: 2px solid var(--primary) !important;
  outline-offset: -2px !important;
  background-color: var(--primary-light) !important;
  position: relative;
  z-index: 5;
  transition: background-color 150ms ease, outline 150ms ease;
}

[data-theme="dark"] .cell-shift.cell-active-hotkey,
[data-theme="dark"] .cell-dinhbien.cell-active-hotkey {
  outline: 2px solid var(--primary) !important;
  outline-offset: -2px !important;
  background-color: rgba(59, 130, 246, 0.18) !important;
}


/* ==========================================================================
   FAST SCHEDULE (HOTKEYS) TOGGLE SWITCH & ACCESSIBILITY
   ========================================================================== */
.cursor-pointer {
  cursor: pointer;
}

.fast-schedule-toggle-pill {
  height: 31px;
  background-color: var(--bg-card);
  border-color: var(--border-color) !important;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.fast-schedule-toggle-pill:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.fast-schedule-mobile-toggle {
  background-color: var(--bg-card);
  border-color: var(--border-color) !important;
  transition: background-color 150ms ease;
}

[data-theme="dark"] .fast-schedule-toggle-pill,
[data-theme="dark"] .fast-schedule-mobile-toggle {
  background-color: var(--bg-card);
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .fast-schedule-toggle-pill:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] #keyboardHelpModal .card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] #keyboardHelpModal .bg-light {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
}
