/* Custom styles for FRA Attendance Management */

:root {
  --fra-primary: #2563eb;
  --fra-success: #16a34a;
  --fra-warning: #d97706;
  --fra-danger: #dc2626;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--shell-bg, #f8fafc);
  color: var(--shell-text, #1e293b);
}

/* ── TABLE UX REFERENCE GUIDE IMPLEMENTATION ──────────────────────── */

/* Sticky Table Structure */
.sticky-table {
  border-collapse: separate !important;
  border-spacing: 0;
}

/* Column 1: Action & Photos (100px) */
.sticky-col-1 {
  position: sticky !important;
  left: 0 !important;
  z-index: 2 !important;
  background-color: var(--card-bg) !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  text-align: center;
}

/* Calculated Shifts (shiftsTable), Detail Listing (facelogTable) & Staff Summary (staff-summary-table) - Column 1 is Staff Name (Sticky) */
#shiftsTable .sticky-col-1,
#facelogTable .sticky-col-1,
#staff-summary-table .sticky-col-1 {
  width: 180px !important;
  min-width: 180px !important;
  max-width: 220px !important;
  text-align: left !important;
  border-right: 1px solid var(--border-color) !important;
  box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.08);
}

/* Column 2: User Name & UID (180px) */
.sticky-col-2 {
  position: sticky !important;
  left: 100px !important;
  z-index: 2 !important;
  background-color: var(--card-bg) !important;
  width: 180px !important;
  min-width: 180px !important;
  max-width: 180px !important;
}

/* Column 3: Outlet & Date/Time (Boundary Column: 220px) */
.sticky-col-3 {
  position: sticky !important;
  left: 280px !important; /* 100px + 180px */
  z-index: 2 !important;
  background-color: var(--card-bg) !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  border-right: 1px solid var(--border-color) !important;
  box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.08);
}

/* Ensure Headers Stay Above Body Sticky Cells */
thead .sticky-col-1,
thead .sticky-col-2,
thead .sticky-col-3 {
  z-index: 4 !important;
  background-color: #f8fafc !important;
}

/* Synchronize Row Hover with Sticky Backgrounds */
#facelogTable tbody tr:hover td.sticky-col-1,
#facelogTable tbody tr:hover td.sticky-col-2,
#facelogTable tbody tr:hover td.sticky-col-3,
#shiftsTable tbody tr:hover td.sticky-col-1,
#shiftsTable tbody tr:hover td.sticky-col-2,
#shiftsTable tbody tr:hover td.sticky-col-3,
#staff-summary-table tbody tr:hover td.sticky-col-1 {
  background-color: #f1f5f9 !important;
}

#facelogTable tbody tr,
#shiftsTable tbody tr,
#staff-summary-table tbody tr {
  transition: background-color 0.15s ease;
}

#facelogTable tbody tr:hover,
#shiftsTable tbody tr:hover,
#staff-summary-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Floating Horizontal Scroll Navigation Controls */
.table-scroll-controls {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.table-scroll-controls .scroll-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: #334155;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.table-scroll-controls .scroll-btn.btn-primary {
  background-color: var(--fra-primary);
  border-color: var(--fra-primary);
  color: #ffffff;
}

.table-scroll-controls .scroll-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Photo Thumbnails */
.photo-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease-in-out;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.photo-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 5;
}

.photo-thumb-ref {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease-in-out;
}

.photo-thumb-ref:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 5;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.lightbox-box {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
}

.lightbox-img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Quick Date Pill Buttons */
.quick-date-btn {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  transition: all 0.15s ease;
}

.quick-date-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.quick-date-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 600;
}

/* ── WEEK CALENDAR & WEEK STAFF LIST (RAS2026 LOOK & FEEL) ───────────── */
:root {
  --week-bg-main: #ffffff;
  --week-bg-sidebar: #fafafa;
  --week-bg-header: #f5f5f5;
  --week-bg-row: #edf2f9;
  --week-bg-row-hover: #fafafa;
  --week-bg-block: #ffffff;
  --week-bg-today: rgba(59, 130, 246, 0.06);
  --week-border: #e0e0e0;
  --week-border-strong: #cbd5e1;
  --week-text-primary: #333333;
  --week-text-secondary: #666666;
  --week-text-muted: #999999;
  --week-accent: #2196f3;
  --week-checkin: #4caf50;
  --week-checkout: #ff9800;
  --week-calendar-shift-min-width: 40px;
  --week-calendar-shift-max-width: 60px;
}

[data-theme="dark"],
[data-bs-theme="dark"] {
  --week-bg-main: #1e1e1e;
  --week-bg-sidebar: #1e1e1e;
  --week-bg-header: #2d2d2d;
  --week-bg-row: #2d2d2d;
  --week-bg-row-hover: #353535;
  --week-bg-block: #2d2d2d;
  --week-bg-today: rgba(59, 130, 246, 0.12);
  --week-border: #3a3a3a;
  --week-border-strong: #4b5563;
  --week-text-primary: #e5e7eb;
  --week-text-secondary: #b0b0b0;
  --week-text-muted: #808080;
}

/* One scroll container: header, hours column and sidebar scroll together */
.week-scroll-wrapper {
  position: relative;
  overflow: auto;
  max-height: 650px;
  background: var(--week-bg-main);
}

.week-board {
  position: relative;
  min-width: 100%;
}

.week-board-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--week-bg-main);
  border-bottom: 1px solid var(--week-border);
}

.week-corner {
  flex: none;
  position: sticky;
  left: 0;
  z-index: 15;
  background: var(--week-bg-header);
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
}

.week-day-header {
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--week-bg-main);
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
  overflow: hidden;
}

.week-day-header.today {
  background: var(--week-bg-today);
  border-top: 3px solid var(--week-accent);
}

.week-day-header-title {
  display: flex;
  align-items: baseline;
  padding: 6px 8px 3px 8px;
  color: var(--week-text-primary);
}

.week-day-number {
  font-weight: bold;
  font-size: 18px;
  margin-left: 3px;
}

.week-day-name {
  font-weight: normal;
  font-size: 10px;
  margin-left: 10px;
}

.week-day-header-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 3px 8px;
  font-size: 9px;
  line-height: 1.3;
  color: var(--week-text-secondary);
  background: var(--week-bg-sidebar);
  border-top: 1px solid var(--week-border);
}

/* Week Calendar */
.week-calendar-body {
  display: flex;
}

.week-calendar-hours-column {
  flex: none;
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--week-bg-sidebar);
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
}

.week-calendar-track {
  position: relative;
  margin: 10px 0;
}

.week-calendar-hour-label {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--week-text-secondary);
  transform: translateY(-50%);
  pointer-events: none;
}

.week-calendar-cell {
  flex: none;
  position: relative;
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
}

.week-calendar-cell.today-cell {
  background: var(--week-bg-today);
}

.week-calendar-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--week-border);
}

.week-calendar-grid-line:nth-child(4n+1) {
  border-top-color: var(--week-border-strong);
}

.week-calendar-shift-block {
  position: absolute;
  box-sizing: border-box;
  min-height: 20px;
  min-width: var(--week-calendar-shift-min-width);
  max-width: var(--week-calendar-shift-max-width);
  margin-right: 2px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--week-accent);
  background: var(--week-bg-block);
  color: var(--week-text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s, transform 0.1s;
  z-index: 2;
}

.week-calendar-shift-block:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  z-index: 5;
}

.week-calendar-shift-block.shift-checkin {
  border-top-color: var(--week-checkin);
}

.week-calendar-shift-block.shift-checkout {
  border-top-color: var(--week-checkout);
}

.week-calendar-shift-name,
.week-calendar-shift-time,
.week-calendar-shift-duration {
  max-width: 100%;
  font-size: 9px;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-calendar-shift-name {
  font-weight: 600;
}

.week-calendar-shift-duration {
  color: var(--week-text-secondary);
}

/* Week Staff List */
.week-staff-corner {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--week-text-primary);
}

.week-staff-hour-axis {
  position: relative;
  height: 20px;
  border-top: 1px solid var(--week-border);
}

.week-staff-hour-marker {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 4px;
  font-size: 11px;
  color: var(--week-text-muted);
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
}

.week-staff-row {
  display: flex;
  height: 60px;
  border-bottom: 1px solid var(--week-border);
  background: var(--week-bg-row);
  box-sizing: border-box;
}

.week-staff-row:hover {
  background: var(--week-bg-row-hover);
}

.week-staff-sidebar {
  flex: none;
  position: sticky;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--week-bg-main);
  border-right: 1px solid var(--week-border);
  box-sizing: border-box;
}

.week-staff-row:hover .week-staff-sidebar {
  background: var(--week-bg-row-hover);
}

.staff-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--week-border);
  background-color: #e2e8f0;
  flex-shrink: 0;
}

.staff-details {
  min-width: 0;
  flex-grow: 1;
}

.staff-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--week-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-subtext {
  font-size: 9px;
  line-height: 1.3;
  color: var(--week-text-secondary);
  white-space: nowrap;
}

.week-staff-day {
  flex: none;
  position: relative;
  border-right: 1px solid var(--week-border-strong);
  box-sizing: border-box;
  /* Light vertical line every 3 hours, aligned with the hour axis */
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(var(--slot-width) * 3 - 1px), var(--week-border) calc(var(--slot-width) * 3 - 1px), var(--week-border) calc(var(--slot-width) * 3));
}

.week-staff-day.today-cell {
  background-color: var(--week-bg-today);
}

.week-staff-shift {
  position: absolute;
  top: 5px;
  height: 50px;
  box-sizing: border-box;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--week-border);
  border-left: 4px solid var(--week-accent);
  background: var(--week-bg-block);
  color: var(--week-text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s;
}

.week-staff-shift:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

.week-staff-shift.shift-checkin {
  border-left-color: var(--week-checkin);
}

.week-staff-shift.shift-checkout {
  border-left-color: var(--week-checkout);
}

.week-staff-shift-time {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-staff-shift-duration {
  font-size: 10px;
  line-height: 1.3;
  color: var(--week-text-secondary);
  white-space: nowrap;
}

/* AppShell top nav */
.appshell-nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}

.appshell-nav-item .appshell-nav-link {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  color: var(--shell-text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.appshell-nav-item.active .appshell-nav-link,
.appshell-nav-item .appshell-nav-link:hover {
  color: var(--shell-primary, #2563eb);
  background-color: rgba(37, 99, 235, 0.08);
}

/* =========================================================================
   DARK THEME SYSTEM OVERRIDES ([data-theme="dark"] & [data-bs-theme="dark"])
   ========================================================================= */

[data-theme="dark"],
[data-bs-theme="dark"] {
  --fra-bg-main: #0f172a;
  --fra-bg-card: #1e293b;
  --border-color: #334155;
}

/* Shell Cards & Form Controls */
[data-theme="dark"] .shell-card,
[data-bs-theme="dark"] .shell-card {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .shell-input,
[data-theme="dark"] .shell-select,
[data-bs-theme="dark"] .shell-input,
[data-bs-theme="dark"] .shell-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .shell-input:focus,
[data-theme="dark"] .shell-select:focus,
[data-bs-theme="dark"] .shell-input:focus,
[data-bs-theme="dark"] .shell-select:focus {
  border-color: #3b82f6 !important;
}

/* Quick Date Pill Buttons */
[data-theme="dark"] .quick-date-btn,
[data-bs-theme="dark"] .quick-date-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .quick-date-btn:hover,
[data-bs-theme="dark"] .quick-date-btn:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: #64748b !important;
  color: #ffffff !important;
}

[data-theme="dark"] .quick-date-btn.active,
[data-bs-theme="dark"] .quick-date-btn.active {
  background: #1e3a8a !important;
  border-color: #3b82f6 !important;
  color: #bfdbfe !important;
  font-weight: 600 !important;
}

/* Listing & Shifts Table & Sticky Columns */
[data-theme="dark"] #facelogTable,
[data-theme="dark"] #shiftsTable,
[data-bs-theme="dark"] #facelogTable,
[data-bs-theme="dark"] #shiftsTable {
  color: #e2e8f0 !important;
}

[data-theme="dark"] #facelogTable thead th,
[data-theme="dark"] #shiftsTable thead th,
[data-bs-theme="dark"] #facelogTable thead th,
[data-bs-theme="dark"] #shiftsTable thead th {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #facelogTable tbody td,
[data-theme="dark"] #shiftsTable tbody td,
[data-bs-theme="dark"] #facelogTable tbody td,
[data-bs-theme="dark"] #shiftsTable tbody td {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .sticky-col-1,
[data-theme="dark"] .sticky-col-2,
[data-theme="dark"] .sticky-col-3,
[data-bs-theme="dark"] .sticky-col-1,
[data-bs-theme="dark"] .sticky-col-2,
[data-bs-theme="dark"] .sticky-col-3 {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border-right-color: #334155 !important;
}

[data-theme="dark"] thead .sticky-col-1,
[data-theme="dark"] thead .sticky-col-2,
[data-theme="dark"] thead .sticky-col-3,
[data-bs-theme="dark"] thead .sticky-col-1,
[data-bs-theme="dark"] thead .sticky-col-2,
[data-bs-theme="dark"] thead .sticky-col-3 {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-right-color: #334155 !important;
}

[data-theme="dark"] #facelogTable tbody tr:hover td,
[data-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-1,
[data-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-2,
[data-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-3,
[data-theme="dark"] #shiftsTable tbody tr:hover td,
[data-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-1,
[data-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-2,
[data-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-3,
[data-theme="dark"] #staff-summary-table tbody tr:hover td.sticky-col-1,
[data-bs-theme="dark"] #facelogTable tbody tr:hover td,
[data-bs-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-1,
[data-bs-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-2,
[data-bs-theme="dark"] #facelogTable tbody tr:hover td.sticky-col-3,
[data-bs-theme="dark"] #shiftsTable tbody tr:hover td,
[data-bs-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-1,
[data-bs-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-2,
[data-bs-theme="dark"] #shiftsTable tbody tr:hover td.sticky-col-3,
[data-bs-theme="dark"] #staff-summary-table tbody tr:hover td.sticky-col-1 {
  background-color: #26334d !important;
}

/* Floating Scroll Controls */
[data-theme="dark"] .table-scroll-controls,
[data-bs-theme="dark"] .table-scroll-controls {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .table-scroll-controls .scroll-btn,
[data-bs-theme="dark"] .table-scroll-controls .scroll-btn {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .table-scroll-controls .scroll-btn.btn-primary,
[data-bs-theme="dark"] .table-scroll-controls .scroll-btn.btn-primary {
  background-color: var(--fra-primary) !important;
  border-color: var(--fra-primary) !important;
  color: #ffffff !important;
}

/* Summary Tables */
[data-theme="dark"] #outlet-summary-table,
[data-theme="dark"] #staff-summary-table,
[data-bs-theme="dark"] #outlet-summary-table,
[data-bs-theme="dark"] #staff-summary-table {
  color: #e2e8f0 !important;
}

[data-theme="dark"] #outlet-summary-table thead,
[data-theme="dark"] #staff-summary-table thead,
[data-theme="dark"] .table-light,
[data-bs-theme="dark"] #outlet-summary-table thead,
[data-bs-theme="dark"] #staff-summary-table thead,
[data-bs-theme="dark"] .table-light {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .table-light th,
[data-bs-theme="dark"] .table-light th {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #outlet-summary-table td,
[data-theme="dark"] #staff-summary-table td,
[data-bs-theme="dark"] #outlet-summary-table td,
[data-bs-theme="dark"] #staff-summary-table td {
  border-color: #334155 !important;
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] #outlet-summary-table tbody tr:hover td,
[data-theme="dark"] #staff-summary-table tbody tr:hover td,
[data-bs-theme="dark"] #outlet-summary-table tbody tr:hover td,
[data-bs-theme="dark"] #staff-summary-table tbody tr:hover td {
  background-color: #26334d !important;
}

/* DataTables Dark Controls */
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate {
  color: #94a3b8 !important;
}

[data-theme="dark"] .page-link,
[data-bs-theme="dark"] .page-link {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .page-item.disabled .page-link,
[data-bs-theme="dark"] .page-item.disabled .page-link {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

[data-theme="dark"] .page-item.active .page-link,
[data-bs-theme="dark"] .page-item.active .page-link {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

/* Lightbox Modal Dark Mode */
[data-theme="dark"] .lightbox-box,
[data-bs-theme="dark"] .lightbox-box {
  background: #1e293b !important;
  border: 1px solid #334155;
}

[data-theme="dark"] .lightbox-close,
[data-bs-theme="dark"] .lightbox-close {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* Week hover popup (shared by Week Calendar and Week Staff List) */
.week-shift-popup {
  display: none;
  position: fixed;
  z-index: 3000;
  min-width: 280px;
  max-width: 380px;
  padding: 10px 12px;
  pointer-events: none;
  border-radius: 8px;
  border: 1px solid var(--week-border-strong);
  background: var(--week-bg-main);
  color: var(--week-text-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.week-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

.week-popup-name {
  font-size: 14px;
  font-weight: 600;
}

.week-popup-sub {
  font-size: 11px;
  color: var(--week-text-secondary);
}

.week-popup-section {
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid var(--week-border);
}

.week-popup-title {
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--week-text-muted);
}

.week-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.6;
}

.week-popup-row span {
  color: var(--week-text-secondary);
}

/* Calendar Navigation */
.calendar-nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-nav-outlet select {
  min-width: 160px;
}

.calendar-nav-week-group {
  display: flex;
  align-items: center;
}

.calendar-nav-date-range {
  font-size: 0.95rem;
}

@media (max-width: 576px) {
  .calendar-nav-inner {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 6px !important;
    align-items: center;
  }

  .calendar-nav-outlet {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    min-width: 0;
  }

  .calendar-nav-outlet select {
    min-width: 0 !important;
    width: 100%;
    font-size: 0.85rem;
  }

  .calendar-nav-today-btn {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    font-size: 0.82rem;
    padding: 4px 10px !important;
  }

  .calendar-nav-week-group {
    grid-column: 1 / 3;
    grid-row: 2 / 2;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 4px !important;
  }

  .calendar-nav-week-group .btn {
    font-size: 0.78rem;
    padding: 4px 8px !important;
    flex: none;
  }

  .calendar-nav-date-range {
    font-size: 0.78rem;
    text-align: center;
    padding: 0 4px !important;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
