/* ==========================================================================
   CyberDine SmartPOS & Management System - Master Design System
   Architecture: Lead UI/UX Engineer Standard (Linear / Stripe Craftsmanship)
   Grid: Strict 8-Point Geometric Scale
   Typography: Regular (400), Medium (500), Bold (700)
   Default Theme: Dark Mode (#0B0F19 Canvas, #1E293B Elevated Surface)
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS & ROOT VARIABLES
   ========================================================================== */
:root {
  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-brand: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Typography Scale */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.8125rem;  /* 13px */
  --font-size-base: 0.875rem; /* 14px */
  --font-size-md: 0.9375rem;  /* 15px */
  --font-size-lg: 1rem;       /* 16px */
  --font-size-xl: 1.125rem;   /* 18px */
  --font-size-2xl: 1.25rem;   /* 20px */
  --font-size-3xl: 1.5rem;    /* 24px */
  --font-size-4xl: 1.75rem;   /* 28px */
  --font-size-5xl: 2rem;      /* 32px */

  /* Strict Font Weights (Only 3 Deliberate Weights) */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;

  /* Leading / Line Heights */
  --leading-tight: 1.15;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  /* Strict 8-Point Spacing Grid Scale */
  --space-1: 4px;   /* micro offset */
  --space-2: 8px;   /* 1 unit */
  --space-3: 12px;  /* 1.5 units */
  --space-4: 16px;  /* 2 units */
  --space-5: 20px;  /* 2.5 units */
  --space-6: 24px;  /* 3 units */
  --space-8: 32px;  /* 4 units */
  --space-10: 40px; /* 5 units */
  --space-12: 48px; /* 6 units */
  --space-16: 64px; /* 8 units */
  --space-20: 80px; /* 10 units */

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout Sizing */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
  --touch-target-min: 44px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Required Brand Constants */
  --gold-brand: #D4AF37;       /* Metallic Gold for Brand & Crown Accents */
  --gold-hover: #E5C058;
  --navy-loading: #040273;     /* Deep Navy for Global Progress Bar */

  /* ========================================================================
     DARK THEME PALETTE (DEFAULT)
     ======================================================================== */
  --bg-app: #0B0F19;              /* Deep canvas background */
  --bg-sidebar: #0F172A;          /* Slate dark sidebar */
  --bg-topbar: rgba(15, 23, 42, 0.85); /* Frosted topbar */
  --bg-surface: #1E293B;          /* Elevated surface card */
  --bg-surface-elevated: #243248; /* Highlighted card / Popover */
  --bg-surface-sunken: #0F172A;   /* Input wells / Deep recessed */
  --bg-surface-active: #334155;   /* Active selection background */

  /* Translucent Borders for Layered Dark Mode Depth */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: #334155;
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #6366F1;

  /* Text Contrast Hierarchy (Strict 4.5:1+ Contrast) */
  --text-primary: #F8FAFC;        /* Soft off-white (never pure #fff) */
  --text-secondary: #94A3B8;      /* Slate gray */
  --text-muted: #64748B;          /* Subdued helper text */
  --text-inverse: #0B0F19;        /* Contrast on bright elements */

  /* Modern Primary Brand Colors (Indigo Azure) */
  --color-primary: #6366F1;
  --color-primary-hover: #4F46E5;
  --color-primary-active: #4338CA;
  --color-primary-subtle: rgba(99, 102, 241, 0.15);
  --color-primary-border: rgba(99, 102, 241, 0.35);

  /* Semantic Discipline */
  --color-success: #10B981;
  --color-success-hover: #059669;
  --color-success-bg: rgba(16, 185, 129, 0.14);
  --color-success-border: rgba(16, 185, 129, 0.3);

  --color-danger: #EF4444;
  --color-danger-hover: #DC2626;
  --color-danger-bg: rgba(239, 68, 68, 0.14);
  --color-danger-border: rgba(239, 68, 68, 0.3);

  --color-warning: #F59E0B;
  --color-warning-hover: #D97706;
  --color-warning-bg: rgba(245, 158, 11, 0.14);
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-info: #0EA5E9;
  --color-info-hover: #0284C7;
  --color-info-bg: rgba(14, 165, 233, 0.14);
  --color-info-border: rgba(14, 165, 233, 0.3);

  /* Multi-layered Ambient Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.45), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.55), 0 4px 12px -2px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  --shadow-gold-glow: 0 0 20px rgba(212, 175, 55, 0.25);
}

/* ==========================================================================
   LIGHT THEME PALETTE (ACCESSIBLE FALLBACK)
   ========================================================================== */
[data-theme="light"] {
  --bg-app: #F8FAFC;
  --bg-sidebar: #0F172A; /* Retain executive dark sidebar for high contrast */
  --bg-topbar: rgba(255, 255, 255, 0.9);
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-sunken: #F8FAFC;
  --bg-surface-active: #E2E8F0;

  --border-subtle: #E2E8F0;
  --border-default: #CBD5E1;
  --border-strong: #94A3B8;
  --border-focus: #4F46E5;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;

  --color-primary: #4F46E5;
  --color-primary-hover: #4338CA;
  --color-primary-subtle: rgba(79, 70, 229, 0.1);
  --color-primary-border: rgba(79, 70, 229, 0.3);

  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-info-bg: rgba(14, 165, 233, 0.1);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 35px -8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow: hidden;
  touch-action: manipulation;
}

/* Accessible Focus Rings */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--border-focus);
}

/* Scrollbar Aesthetics */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Global Progress Bar */
#global-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--navy-loading);
  box-shadow: 0 0 12px var(--navy-loading), 0 0 4px var(--color-primary);
  z-index: 99999;
  transition: width var(--transition-smooth), opacity var(--transition-fast);
  opacity: 0;
  pointer-events: none;
}
#global-progress-bar.active {
  opacity: 1;
}

/* ==========================================================================
   3. FLUID LAYOUT & SIDEBAR ARCHITECTURE
   ========================================================================== */
#app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-app);
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* --- Master Left Sidebar --- */
#app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: width var(--transition-smooth), min-width var(--transition-smooth), transform var(--transition-smooth);
  user-select: none;
}

/* Desktop Collapsed Mode (Slim Icon-only) */
body.sidebar-collapsed #app-sidebar {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .shift-text,
body.sidebar-collapsed .badge {
  display: none !important;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: var(--space-3) 0;
  margin: 0 var(--space-2);
}

body.sidebar-collapsed .nav-item i {
  margin: 0;
  font-size: var(--font-size-xl);
}

body.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  padding: var(--space-3) var(--space-2);
  gap: var(--space-2);
}

/* Sidebar Header */
.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--gold-brand) 0%, #8C6D13 100%);
  color: #0B0F19;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-title {
  font-family: var(--font-brand);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: 0.3px;
}

.sidebar-brand-subtitle {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--gold-brand);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  line-height: var(--leading-tight);
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-section-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--space-4) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item i {
  font-size: var(--font-size-md);
  width: 20px;
  text-align: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item:hover i {
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-sm);
}

.nav-item.active i {
  color: var(--gold-brand);
}

.nav-item .badge {
  margin-left: auto;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-sunken);
  gap: var(--space-2);
}

.shift-status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.status-dot.active {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* --- Right Side Main Container --- */
#app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
  min-width: 0; /* Prevents flex children from blowing out container */
}

/* --- Fixed Topbar --- */
#app-topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background-color: var(--bg-topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 100;
  gap: var(--space-4);
}

/* Brand Title: Metallic Gold (#D4AF37) */
.topbar-business-title {
  font-family: var(--font-brand);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.5px;
  color: var(--gold-brand) !important;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}

.topbar-business-title i {
  color: var(--gold-brand) !important;
  font-size: var(--font-size-xl);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.live-clock-pill {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface-sunken);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.topbar-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-md);
}

.topbar-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.user-profile-dropdown {
  position: relative;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  min-height: var(--touch-target-min);
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: inherit;
  font-family: inherit;
}

.user-profile-pill:hover {
  background: var(--bg-surface);
  border-color: var(--border-default);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-brand), #8C6D13);
  color: #0B0F19;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xs);
}

.user-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.user-role-badge {
  font-size: 0.6875rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: var(--leading-tight);
}

/* Dropdown Menu (Smooth Animation) */
.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: var(--space-1) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  z-index: 200;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 40px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.dropdown-item i {
  font-size: var(--font-size-base);
  color: var(--text-muted);
}

/* --- Dynamic Right Content Pane --- */
#app-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  position: relative;
  width: 100%;
}

/* ==========================================================================
   4. UI COMPONENTS (BUTTONS, CARDS, BADGES, STATS, FORMS)
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  padding: 0 var(--space-4);
  min-height: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-gold {
  background-color: var(--gold-brand);
  color: #0B0F19;
  font-weight: var(--font-weight-bold);
  border-color: #B89528;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.25);
}
.btn-gold:hover {
  background-color: var(--gold-hover);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.btn-success {
  background-color: var(--color-success);
  color: #FFFFFF;
}
.btn-success:hover {
  background-color: var(--color-success-hover);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #FFFFFF;
}
.btn-danger:hover {
  background-color: var(--color-danger-hover);
}

.btn-sm {
  min-height: 32px;
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-xs);
}

.btn-lg {
  min-height: 48px;
  height: 48px;
  padding: 0 var(--space-6);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-sunken);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: var(--space-1);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.badge-primary { background: var(--color-primary-subtle); color: #818CF8; border: 1px solid var(--color-primary-border); }
.badge-gold { background: rgba(212, 175, 55, 0.15); color: var(--gold-brand); border: 1px solid rgba(212, 175, 55, 0.3); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); border: 1px solid var(--color-info-border); }

/* Cards & Surfaces */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Stat Widgets */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
}

.stat-icon.primary { background: var(--color-primary-subtle); color: #818CF8; border: 1px solid var(--color-primary-border); }
.stat-icon.gold { background: rgba(212, 175, 55, 0.15); color: var(--gold-brand); border: 1px solid rgba(212, 175, 55, 0.3); }
.stat-icon.success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.stat-icon.warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.stat-icon.danger { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 0 var(--space-3);
  min-height: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--color-primary-subtle);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: var(--space-2) var(--space-3);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* Inline Form Error Styles */
.form-group.has-error .form-control {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--color-danger-bg) !important;
}

.form-error-text {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   5. DATA TABLES (HIGH-LEGIBILITY & STICKY HEADER/COLUMN)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.data-table th {
  background: var(--bg-surface-sunken);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover td {
  background-color: var(--bg-surface-elevated);
}

.data-table tbody tr.selected td {
  background-color: var(--color-primary-subtle) !important;
}

/* Sticky first column in wide data grids */
.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  background-color: var(--bg-surface);
  z-index: 5;
}

.data-table th:first-child {
  background-color: var(--bg-surface-sunken);
  z-index: 15;
}

.col-idx {
  width: 44px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.sku-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-xs);
  background: var(--color-primary-subtle);
  color: #818CF8;
  border: 1px solid var(--color-primary-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}
.status-pill.success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.status-pill.danger { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.status-pill.warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.status-pill.info { background: var(--color-info-bg); color: var(--color-info); border: 1px solid var(--color-info-border); }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==========================================================================
   6. MODERN SKELETON LOADERS & EMPTY STATES (THE "PRO" TOUCH)
   ========================================================================== */

/* Shimmer Animation */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface-sunken) 25%,
    var(--bg-surface-elevated) 37%,
    var(--bg-surface-sunken) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-xs);
}

.skeleton-title {
  height: 24px;
  width: 240px;
  border-radius: var(--radius-sm);
}

.skeleton-btn {
  height: 40px;
  width: 120px;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.skeleton-table-block {
  height: 360px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.skeleton-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
}

.skeleton-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

/* Empty State Component */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px dashed var(--border-default);
  margin: var(--space-4) 0;
  width: 100%;
}

.empty-state-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary-subtle);
  color: #818CF8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.empty-state-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 380px;
  margin-bottom: var(--space-5);
  line-height: var(--leading-normal);
}

/* Loading Overlay (Modal / Pane fallback) */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: 500;
  border-radius: inherit;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
.spinner-navy { border-color: rgba(4, 2, 115, 0.2); border-top-color: var(--navy-loading) !important; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. TOUCH POS INTERFACE (DYNAMIC FLUID GRID & CARDS)
   ========================================================================== */
.pos-wrapper {
  width: 100%;
}

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-4);
  height: calc(100vh - var(--topbar-height) - 48px);
}

.pos-catalog-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow: hidden;
}

.pos-category-bar {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) 0 var(--space-2);
  scrollbar-width: thin;
}

.pos-cat-btn {
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-4);
  min-height: 38px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}

.pos-cat-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.pos-cat-btn.active {
  background: var(--color-primary) !important;
  color: #FFFFFF !important;
  border-color: var(--color-primary-border) !important;
  box-shadow: var(--shadow-sm);
}

/* Food Cards Grid */
.pos-food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: var(--space-3);
  overflow-y: auto;
  padding-right: var(--space-1);
}

.pos-food-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  box-shadow: var(--shadow-xs);
  user-select: none;
}

.pos-food-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.pos-food-card:active {
  transform: scale(0.97);
}

.pos-food-img-wrap {
  height: 115px;
  position: relative;
  background: var(--bg-surface-sunken);
  overflow: hidden;
}

.pos-food-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.pos-food-card:hover .pos-food-img {
  transform: scale(1.08);
}

.pos-food-img-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-4xl);
  color: var(--text-muted);
  opacity: 0.4;
}

.pos-food-prep-tag {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: rgba(11, 15, 25, 0.75);
  color: #FFFFFF;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

.pos-food-info {
  padding: var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  background: var(--bg-surface);
}

.pos-food-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
  line-height: var(--leading-tight);
}

.pos-food-price-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface-sunken);
  border-top: 1px solid var(--border-subtle);
}

.pos-food-code {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.pos-food-price-val {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--gold-brand);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pos-food-add-icon {
  font-size: var(--font-size-xs);
  background: var(--color-primary-subtle);
  color: #818CF8;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* POS Cart / Bill Panel */
.pos-cart-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cart-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-sunken);
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cart-item {
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--transition-fast);
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-item-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.cart-item-price {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--gold-brand);
}

.qty-control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.qty-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.cart-summary {
  padding: var(--space-4);
  background: var(--bg-surface-sunken);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.summary-row.total {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  border-top: 1px dashed var(--border-default);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
}

.summary-row.total .total-val {
  color: var(--gold-brand);
}

/* ==========================================================================
   8. TABLE FLOOR PLAN (DYNAMIC CARDS & STATUS TAGS)
   ========================================================================== */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  overflow: hidden;
  position: relative;
}

.table-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.table-card.available { border-top: 4px solid var(--color-success); }
.table-card.occupied { border-top: 4px solid var(--color-danger); }
.table-card.reserved { border-top: 4px solid var(--color-warning); }
.table-card.cleaning { border-top: 4px solid var(--color-info); }

.table-card-header {
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.table-num {
  font-family: var(--font-brand);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.table-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.table-waiter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-surface-sunken);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.table-waiter-chip:hover {
  border-color: var(--gold-brand);
  color: var(--gold-brand);
}

.table-active-order-box {
  background: var(--bg-surface-sunken);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.table-card-footer {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface-sunken);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* ==========================================================================
   9. KITCHEN DISPLAY SYSTEM (KDS)
   ========================================================================== */
.kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.kds-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kds-card.pending { border-left: 5px solid var(--color-warning); }
.kds-card.kitchen { border-left: 5px solid var(--color-info); }
.kds-card.ready { border-left: 5px solid var(--color-success); }

.kds-header {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-sunken);
}

.kds-order-no {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.kds-timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
}
.kds-timer.normal { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.kds-timer.warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
.kds-timer.danger { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); animation: pulse-danger 1.5s infinite; }

@keyframes pulse-danger {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.03); }
}

.kds-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 380px;
  overflow-y: auto;
}

.kds-item-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.kds-item-card:hover {
  background: var(--bg-surface-elevated);
}

.kds-item-card.item-done {
  opacity: 0.4;
  text-decoration: line-through;
}

.kds-qty-badge {
  background: var(--color-primary-subtle);
  color: #818CF8;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  padding: 2px var(--space-2);
  border-radius: var(--radius-xs);
  min-width: 28px;
  text-align: center;
}

.kds-actions {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-sunken);
}

/* ==========================================================================
   10. MODALS & TOAST NOTIFICATIONS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(16px) scale(0.96);
  transition: transform var(--transition-smooth);
  overflow: hidden;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog.modal-lg { max-width: 760px; }
.modal-dialog.modal-xl { max-width: 960px; }

.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-sunken);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-xl);
  cursor: pointer;
  padding: var(--space-2);
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  background: var(--bg-surface-sunken);
}

/* Toast Container */
#toast-container {
  position: fixed;
  bottom: max(var(--space-6), env(safe-area-inset-bottom));
  right: max(var(--space-6), env(safe-area-inset-right));
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  opacity: 0;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-danger); }
.toast.warning { border-left: 4px solid var(--color-warning); }
.toast.info { border-left: 4px solid var(--color-info); }

.toast-icon { font-size: var(--font-size-xl); }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-msg {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  line-height: var(--leading-normal);
}

/* ==========================================================================
   11. MOBILE RESPONSIVENESS & OFF-CANVAS DRAWER MECHANICS
   ========================================================================== */
@media (max-width: 840px) {
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

@media (max-width: 768px) {
  /* Off-canvas Mobile Sidebar */
  #app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    z-index: 2050;
    transform: translateX(-100%);
    box-shadow: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  body.sidebar-open #app-sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  #app-topbar {
    padding: 0 var(--space-4);
    padding-top: env(safe-area-inset-top);
  }

  .topbar-business-title span {
    display: none; /* Icon-only on mobile */
  }

  #app-content {
    padding: var(--space-4);
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  }

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

  .modal-dialog {
    max-height: 95vh;
    margin: var(--space-2);
  }
}

/* ==========================================================================
   12. PRINT THERMAL RECEIPT ENGINE
   ========================================================================== */
@media print {
  body * {
    visibility: hidden !important;
  }
  #printable-receipt, #printable-receipt * {
    visibility: visible !important;
  }
  #printable-receipt {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    color: #000000 !important;
    background: #FFFFFF !important;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px;
    display: block !important;
  }
}
