/* CSS Variables and Theming - Emerald Glass */
:root {
  /* Typograpy */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Shared values */
  --roundness-sm: 10px;
  --roundness-md: 14px;
  --roundness-lg: 20px;
  --roundness-xl: 28px;
  --roundness-full: 9999px;

  /* Theme: Light (default base, overridden by dark) */
  --primary: #45D884;      /* Vibrant Emerald Green */
  --primary-hover: #3CC274;
  --on-primary: #ffffff;
  
  --secondary: #FF6B6B;    /* Vibrant Coral Red */
  --secondary-hover: #F05555;
  --on-secondary: #ffffff;
  
  --background: #F4F7FB;
  --on-background: #0F172A;
  
  --surface: rgba(255, 255, 255, 0.7);
  --surface-solid: #ffffff;
  --on-surface: #1E293B;
  --on-surface-variant: #64748B;
  
  --outline: rgba(15, 23, 42, 0.18);
  --shadow-color: rgba(15, 23, 42, 0.08);
  
  --glass-blur: blur(32px);
  --glass-border: 1px solid rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
  --background: #0D0E12;
  --on-background: #F1F5F9;
  
  --surface: rgba(30, 32, 40, 0.55);
  --surface-solid: #15171E;
  --on-surface: #F8FAFC;
  --on-surface-variant: #94A3B8;
  
  --outline: rgba(255, 255, 255, 0.06);
  --shadow-color: rgba(0, 0, 0, 0.4);
  
  --glass-border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button, input, select, textarea, a {
  touch-action: manipulation;
}

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--on-background);
  transition: background-color 0.3s ease, color 0.3s ease;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: pan-x pan-y; /* Disables pinch-zoom on most browsers */
  /* background gradient for extra premium feel */
  background-image: 
    radial-gradient(circle at 80% -10%, rgba(69, 216, 132, 0.12) 0%, transparent 45%),
    radial-gradient(circle at -10% 110%, rgba(255, 107, 107, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 40%);
}

body.no-scroll, html.no-scroll {
  overflow: hidden !important;
  height: 100vh !important;
  overscroll-behavior: none;
}

html {
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  touch-action: pan-x pan-y;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

/* Layout */
#app-container {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 260px;
  max-width: 100%;
  background: var(--surface-solid);
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 100;
}
.sidebar.hidden {
  display: none !important;
}

.sidebar-header {
  min-height: 72px;
  height: auto;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--outline);
}

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--on-surface-variant);
  border-radius: var(--roundness-md);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--outline);
  color: var(--on-surface);
}

.nav-link.active {
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: 0 4px 12px var(--shadow-color);
  border: 1px solid var(--outline);
}

.nav-link svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--outline);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: 32px;
}
.main-content.no-padding {
  padding: 0;
}

/* Kiosk Specific UI */
.kiosk-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.kiosk-container.monolith-bg {
  background: #e2e4e9; /* Light cool grey background */
  transition: background-color 0.3s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  overflow: hidden;
  touch-action: none; /* Prevents scrolling and pinch-zooming completely */
  user-select: none;
}
[data-theme="dark"] .kiosk-container.monolith-bg {
  background: #0f1115;
  color: #f8fafc;
}

.kiosk-controls {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
  z-index: 50;
}

.kiosk-controls.hidden {
  display: none;
}

.icon-only {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--on-surface);
  border: var(--glass-border);
  backdrop-filter: var(--glass-blur);
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 12px var(--shadow-color);
}
.icon-only:hover {
  transform: translateY(-2px);
  background: var(--outline);
}

.kiosk-controls .icon-only {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--on-surface-variant);
  transition: color 0.2s, transform 0.2s;
  width: 64px; /* Much larger */
  height: 64px;
}
.kiosk-controls .icon-only svg {
  width: 32px !important; /* Much larger */
  height: 32px !important;
}
.kiosk-controls .icon-only:hover {
  color: var(--on-surface);
  background: transparent;
  transform: scale(1.15);
}
.icon-only svg {
  width: 22px;
  height: 22px;
}

/* Theme Toggle Details */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: 100%;
  color: var(--on-surface-variant);
  border-radius: var(--roundness-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.sidebar-footer .theme-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
}
.sidebar-footer .theme-toggle-btn:hover {
  background: var(--outline);
  color: var(--on-surface);
}
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: none; }

/* Dashboard & Cards */
.page-header {
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.page-header p {
  color: var(--on-surface-variant);
}

.header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.reports-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 16px;
  width: 100%;
}

.glass-card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--roundness-xl);
  padding: 36px;
  box-shadow: 0 16px 48px var(--shadow-color), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 100%;
}

/* Kiosk Specific Card elements */
.kiosk-card {
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.5s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kiosk-card.monolith {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 60px 40px;
  border-radius: 32px;
}
[data-theme="dark"] .kiosk-card.monolith {
  background: rgba(20, 22, 26, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.logo-blend {
  mix-blend-mode: multiply;
  filter: contrast(1.1);
}
[data-theme="dark"] .logo-blend {
  mix-blend-mode: normal;
  background: rgba(255,255,255,0.9);
  padding: 8px;
  border-radius: 8px;
}

.kiosk-logo {
  height: 60px;
  border-radius: 8px;
  margin-bottom: 12px;
  object-fit: contain;
}

.company-name {
  margin-top: 0;
  margin-bottom: 24px;
}

.kiosk-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 8px;
  margin-bottom: 24px;
}

[data-theme="dark"] .sidebar {
  background: rgba(30, 30, 35, 0.98);
  backdrop-filter: blur(10px);
}

.clock-display {
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 8px;
  color: var(--on-surface);
}
.date-display {
  color: var(--on-surface-variant);
  font-size: 1.25rem;
  margin-bottom: 40px;
}

.pin-input-container {
  margin-bottom: 40px;
  padding: 0 24px;
}
.pin-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--outline);
  font-size: 3.5rem;
  font-weight: 300;
  text-align: center;
  letter-spacing: 20px;
  color: var(--primary);
  padding: 8px 0;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s;
}
.pin-input:focus {
  outline: none;
  border-color: var(--primary);
  letter-spacing: 28px;
}

.pin-input.minimal-pin {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 200;
  color: #1e293b;
  letter-spacing: 30px;
}
.pin-input.minimal-pin:focus {
  border-color: #1e293b;
}
[data-theme="dark"] .pin-input.minimal-pin {
  color: #f8fafc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .pin-input.minimal-pin:focus {
  border-color: #f8fafc;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.keypad-btn {
  aspect-ratio: 1;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  color: var(--on-surface);
  font-size: 2.25rem;
  font-weight: 300;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 8px 24px var(--shadow-color);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: manipulation;
  user-select: none;
}

.keypad-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 16px 32px var(--shadow-color);
  background: var(--outline);
}

.keypad-btn:active {
  transform: scale(0.9) translateY(0);
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 8px 16px rgba(80, 200, 120, 0.4);
}

.keypad-btn.minimal {
  background: transparent;
  backdrop-filter: none;
  border: none;
  box-shadow: none;
  font-weight: 300;
  color: #334155;
  font-size: 2rem;
  transition: all 0.2s ease;
}
[data-theme="dark"] .keypad-btn.minimal {
  color: #cbd5e1;
}
.keypad-btn.minimal:hover {
  transform: none;
  background: rgba(0, 0, 0, 0.04);
  border-color: transparent;
}
[data-theme="dark"] .keypad-btn.minimal:hover {
  background: rgba(255, 255, 255, 0.05);
}
.keypad-btn.minimal:active {
  transform: scale(0.95);
  background: rgba(0, 0, 0, 0.08);
  color: #0f172a;
}
[data-theme="dark"] .keypad-btn.minimal:active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.action-buttons {
  display: flex;
  gap: 16px;
}

.btn {
  flex: 1;
  padding: 16px 28px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: var(--roundness-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  color: white;
}

.btn-primary {
  background: var(--primary);
  box-shadow: 0 8px 24px rgba(69, 216, 132, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(69, 216, 132, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-secondary {
  background: var(--secondary);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-secondary:hover {
  background: var(--secondary-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(255, 107, 107, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

.monolith-btn.btn-primary {
  background: transparent;
  color: #63986a;
  border: 1px solid #63986a;
  box-shadow: none;
  border-radius: 9999px; /* Pill shape */
  font-weight: 600;
}
.monolith-btn.btn-primary:hover {
  background: rgba(99, 152, 106, 0.1);
  transform: translateY(-2px);
  box-shadow: none;
}
[data-theme="dark"] .monolith-btn.btn-primary {
  color: #86c48e;
  border-color: #86c48e;
}
[data-theme="dark"] .monolith-btn.btn-primary:hover {
  background: rgba(134, 196, 142, 0.1);
}

.monolith-btn.btn-secondary {
  background: #5a626f;
  color: #ffffff;
  border: none;
  box-shadow: none;
  border-radius: 9999px; /* Pill shape */
  font-weight: 600;
}
.monolith-btn.btn-secondary:hover {
  background: #4a515c;
  transform: translateY(-2px);
}
[data-theme="dark"] .monolith-btn.btn-secondary {
  background: #3b424e;
  color: #f8fafc;
}
[data-theme="dark"] .monolith-btn.btn-secondary:hover {
  background: #4a515c;
}

.btn-simple {
  background: var(--background);
  color: var(--on-surface);
  font-size: 1rem;
  padding: 12px 24px;
  border: 1px solid var(--outline);
  border-radius: var(--roundness-md);
  box-shadow: 0 2px 8px var(--shadow-color);
  font-weight: 500;
}
.btn-simple:hover {
  background: var(--surface-solid);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow-color);
}

/* Forms and Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  text-align: left;
}
.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--on-surface-variant);
}
.form-control {
  background: var(--surface-solid);
  border: 1px solid var(--outline);
  color: var(--on-surface);
  padding: 14px 18px;
  border-radius: var(--roundness-md);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
[data-theme="dark"] .form-control {
  background: rgba(0,0,0,0.15);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}
.form-control:hover {
  border-color: rgba(69, 216, 132, 0.4);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(69, 216, 132, 0.15), inset 0 2px 4px rgba(0,0,0,0.02);
}

input[type="file"] {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Settings Layout */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 992px) {
  .settings-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    max-width: 1200px;
  }
  .settings-card {
    max-width: 100% !important;
  }
}

.settings-card {
  max-width: 600px;
}

.settings-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-logo-preview {
  height: 48px;
  border-radius: 4px;
  object-fit: contain;
}

.settings-time-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.settings-time-row .form-control {
  flex: 1;
  min-width: 0;
}

.settings-separator {
  color: var(--on-surface-variant);
  flex-shrink: 0;
}

/* Compact Forms (2-column rows) */
.form-row-2col {
  display: flex;
  gap: 12px;
}

.form-row-2col .form-group {
  flex: 1;
  min-width: 0;
}

.compact-form .form-group {
  margin-bottom: 10px;
}

.compact-form .form-group label {
  font-size: 0.82rem;
  margin-bottom: 4px;
}

/* Mobile Header - Hidden on desktop, shown via media query on mobile */
.mobile-header {
  display: none !important; /* Always hidden on desktop */
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6) !important;
  backdrop-filter: blur(4px);
  z-index: 1900 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: block !important;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {

  /* ================================================
   * CORE LAYOUT - Fix the main app container
   * ================================================ */
  #app-container {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Hide sidebar by default on mobile - slides in from left */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    z-index: 2000;
    transform: translateX(-110%);
    box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  /* Keep sidebar completely hidden in Kiosk mode */
  .sidebar.hidden {
    display: none !important;
  }

  /* Show sidebar when hamburger menu is opened */
  .sidebar.mobile-active {
    transform: translateX(0);
    display: flex !important;
  }

  /* Fix sidebar icons */
  .sidebar .theme-toggle-btn svg,
  .sidebar .sun-icon, 
  .sidebar .moon-icon {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
  }
  .sidebar .theme-toggle-btn {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  /* Main content takes full width */
  .main-content {
    width: 100%;
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ================================================
   * MOBILE HEADER - Show on mobile (override desktop !important)
   * ================================================ */
  .mobile-header {
    display: flex !important;
    position: relative;
    height: 60px;
    flex-shrink: 0;
    background: var(--surface-solid);
    border-bottom: 1px solid var(--outline);
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }

  /* Keep hidden class working - this is used in kiosk mode */
  .mobile-header.hidden {
    display: none !important;
  }

  #mobile-menu-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  #mobile-menu-btn svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* ================================================
   * KIOSK VIEW - Complete redesign for mobile
   * ================================================ */
  .kiosk-container {
    min-height: calc(100vh - 0px);
    justify-content: flex-start;
    padding-top: 16px;
    overflow-y: auto;
  }

  .kiosk-card {
    padding: 20px 16px 24px;
    margin: 0 8px;
    width: calc(100% - 16px);
    max-width: 100%;
    border-radius: 16px;
  }

  .kiosk-header {
    gap: 6px;
    margin-bottom: 16px;
  }

  .kiosk-logo {
    height: 40px;
    margin-bottom: 4px;
  }

  .company-name {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }

  .clock-display {
    font-size: 3rem !important;
    letter-spacing: -1px;
    margin-bottom: 4px;
  }

  .date-display {
    font-size: 0.8rem !important;
    margin-bottom: 16px;
  }

  .pin-input-container {
    margin-bottom: 16px;
    padding: 0 8px;
  }

  .pin-input {
    font-size: 2rem !important;
    letter-spacing: 10px;
    padding: 4px 0;
  }
  .pin-input:focus {
    letter-spacing: 14px;
  }

  .keypad {
    gap: 10px !important;
    max-width: 220px !important;
    margin-bottom: 20px;
  }

  .keypad-btn {
    font-size: 1.4rem !important;
  }

  /* Stack entry/exit buttons vertically */
  .action-buttons {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  
  .form-row-2col {
    flex-direction: column;
    gap: 16px;
  }
  
  .form-row-sidebyside {
    display: flex;
    flex-direction: row !important;
    gap: 8px;
  }
  
  .form-row-sidebyside .form-group {
    flex: 1;
    min-width: 0;
  }
  }
  
  .form-control, input, select, textarea {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    max-width: 100%;
  }

  .action-buttons .btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
    flex: none;
  }

  /* Kiosk controls (theme, lang, admin buttons) */
  .kiosk-controls {
    top: 6px;
    right: 6px;
    gap: 2px;
  }

  .icon-only, .kiosk-controls .icon-only {
    width: 38px !important;
    height: 38px !important;
    padding: 0;
  }

  .icon-only svg, .kiosk-controls .icon-only svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* ================================================
   * DASHBOARD - KPI Cards
   * ================================================ */
  .page-header {
    margin-bottom: 20px;
  }

  .page-header h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
  }

  .page-header p {
    font-size: 0.9rem;
  }

  .header-with-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .header-actions > * {
    width: 100%;
  }

  .reports-toolbar {
    flex-direction: row;
    gap: 12px;
  }
  
  .reports-toolbar select {
    flex: 1;
    min-width: 0;
  }
  
  .reports-toolbar button {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.85rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }

  .kpi-card {
    padding: 16px;
    border-radius: var(--roundness-md);
  }

  .kpi-card h3 {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }

  .kpi-card .value {
    font-size: 1.8rem;
  }

  .glass-card {
    padding: 24px 20px;
    border-radius: var(--roundness-lg);
  }

  /* ================================================
   * DATA TABLES → MOBILE CARDS
   * ================================================ */
  .data-table-container {
    overflow: visible;
  }

  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    background: var(--surface-solid);
    border-radius: 20px;
    margin-bottom: 24px;
    padding: 24px 20px;
    box-shadow: 0 8px 24px var(--shadow-color);
    border: 1px solid var(--outline);
  }

  .data-table td {
    padding: 12px 0;
    border-bottom: 1px solid rgba(150, 150, 150, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    font-size: 1rem;
    min-height: 44px;
  }
  
  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    flex-shrink: 0;
    margin-right: 12px;
  }

  .data-table td:first-child {
    justify-content: flex-start;
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 2px dashed var(--outline);
    flex-wrap: wrap;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
  }

  .data-table td:first-child::before {
    display: none;
  }

  .worker-cell {
    gap: 8px;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  /* ================================================
   * MODAL & SETTINGS - Ultra-compact, NO SCROLL
   * ================================================ */
  .modal-overlay {
    align-items: center;
    padding: 4px;
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 16px 14px;
    border-radius: var(--roundness-lg);
    max-height: calc(100vh - 8px);
    overflow-y: auto; /* ALLOW SCROLLING */
    box-shadow: 0 16px 32px rgba(0,0,0,0.3);
  }

  .modal-header {
    margin-bottom: 8px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .settings-card {
    max-width: 100%;
    padding: 16px 14px;
    height: auto;
  }

  .settings-logo-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .settings-logo-preview {
    height: 32px;
  }

  .settings-time-row {
    gap: 6px;
  }

  .form-control {
    font-size: 16px; /* 16px prevents iOS auto-zoom */
    padding: 10px 12px;
    border-radius: var(--roundness-md);
    touch-action: manipulation;
  }

  .form-group {
    margin-bottom: 6px;
    gap: 2px;
  }

  .form-group label {
    font-size: 0.75rem;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.95rem;
    border-radius: var(--roundness-md);
  }
  
  .form-row-2col {
    gap: 6px;
  }
  
  .form-row-4col {
    gap: 4px !important;
  }
  
  /* Make time inputs smaller on mobile */
  input[type="time"] {
    padding: 4px 2px;
    font-size: 0.75rem;
  }
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.toast {
  padding: 16px 24px;
  background: var(--surface-solid);
  color: var(--on-surface);
  border-radius: var(--roundness-lg);
  box-shadow: 0 8px 32px var(--shadow-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.3s ease-out;
  border-left: 4px solid var(--primary);
}
.toast.error {
  border-left-color: var(--secondary);
}
.toast.warning {
  border-left-color: #f59e0b;
}

.persistent-alert-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(245, 158, 11, 0.95);
  backdrop-filter: blur(10px);
  color: white;
  padding: 14px 24px;
  text-align: center;
  z-index: 3000;
  font-weight: 600;
  font-size: 0.95rem;
  display: none;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-top: 1px solid rgba(255,255,255,0.2);
}
.persistent-alert-bar.active {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.persistent-alert-bar svg {
  flex-shrink: 0;
}

/* Grid Dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card {
  padding: 24px;
  border-radius: var(--roundness-lg);
  background: var(--surface-solid);
  border: 1px solid var(--outline);
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}
.kpi-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 24px var(--shadow-color);
}
.kpi-card h3 {
  color: var(--on-surface-variant);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}
.kpi-card .value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--on-surface);
  background: linear-gradient(135deg, var(--on-surface), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Data Table */
.data-table-container {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th, .data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--outline);
}
.data-table th {
  color: var(--on-surface-variant);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table tbody tr {
  transition: background 0.2s;
}
.data-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
[data-theme="dark"] .data-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.worker-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--outline);
}

.status-badge {
  padding: 6px 12px;
  border-radius: var(--roundness-full);
  font-size: 0.85rem;
  font-weight: 600;
}
.status-in {
  background: rgba(80, 200, 120, 0.1);
  color: var(--primary);
}
.status-out {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* Computed Statuses */
.status-onTime { background: rgba(34,197,94,0.1); color: #22c55e; }
.status-late { background: rgba(239,68,68,0.1); color: #ef4444; }
.status-earlyOut { background: rgba(245,158,11,0.1); color: #f59e0b; }
.status-overtime { background: rgba(168,85,247,0.1); color: #a855f7; }
.status-regular { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* Kiosk Specific */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: var(--surface-solid);
  width: 100%;
  max-width: 520px;
  border-radius: var(--roundness-xl);
  padding: 36px;
  border: 1px solid var(--outline);
  box-shadow: 0 24px 64px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 {
  font-size: 1.5rem;
}
.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.close-modal:hover {
  color: var(--on-surface);
}

/* ==========================================================================
   Monolith Kiosk Typography & Responsiveness
   ========================================================================== */
.monolith-clock {
  font-weight: 300;
  font-size: 5.5rem;
  letter-spacing: -3px;
  margin-bottom: 0px;
}
.monolith-date {
  font-weight: 300;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.monolith-pin-container {
  margin-bottom: 20px;
  width: 100%;
}
.monolith-keypad {
  gap: 12px 24px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 20px;
}
.monolith-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 16px;
  align-self: stretch; /* Instead of width 100% to respect parent padding perfectly */
  width: auto;
  margin: 0 auto;
  box-sizing: border-box;
}
.monolith-btn {
  flex: 1;
  min-width: 0; /* Prevents flex items from overflowing if content is too large */
  font-weight: 600;
  font-size: 1rem;
  padding: 12px;
  border-radius: 9999px;
  text-transform: uppercase;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .kiosk-card.monolith {
    padding: 32px 16px 24px;
    border-radius: 24px;
    max-width: 95%;
    max-height: 98vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-top: 20px; /* Give space for top icons */
  }
  .kiosk-controls {
    top: 10px;
    right: 10px;
    gap: 4px;
  }
  .kiosk-controls .icon-only {
    width: 44px !important;
    height: 44px !important;
  }
  .kiosk-controls .icon-only svg {
    width: 20px !important;
    height: 20px !important;
  }
  .kiosk-header {
    margin-bottom: 8px;
  }
  .kiosk-logo {
    height: 48px;
    margin-bottom: 12px;
  }
  .monolith-clock {
    font-size: 3.8rem;
    letter-spacing: -2px;
    line-height: 1;
  }
  .monolith-date {
    font-size: 0.85rem;
    margin-bottom: 12px;
  }
  .monolith-pin-container {
    margin-bottom: 12px;
  }
  .pin-input.minimal-pin {
    font-size: 2.2rem;
    letter-spacing: 12px;
    padding: 4px 0;
  }
  .monolith-keypad {
    gap: 8px 16px;
    max-width: 320px; /* Make keypad larger on mobile */
    margin-bottom: 16px;
  }
  .keypad-btn.minimal {
    font-size: 2.2rem; /* Larger numbers */
    padding: 4px;
    height: auto;
    aspect-ratio: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .monolith-actions {
    gap: 12px;
    width: 100%;
  }
  .monolith-actions .monolith-btn {
    width: auto; /* Override .action-buttons .btn width: 100% */
    padding: 14px 4px;
    font-size: 0.95rem;
    flex: 1;
    white-space: nowrap;
  }
}
