/* ============================================
   ROOM SERVICE — HOST DESIGN SYSTEM v3.0
   Hospitality-grade SaaS Dashboard
   ============================================ */

/* ---- GOOGLE FONTS ---- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES — LIGHT THEME
   ============================================ */
:root {
  /* === BRAND COLORS === */
  --color-brand-primary: #1A1A2E;       /* Warm dark navy */
  --color-brand-secondary: #16213E;     /* Deeper navy */
  --color-brand-accent: #FF6B35;        /* Warm orange - hospitality */
  --color-brand-accent-hover: #E85D2C;  /* Darker orange */
  --color-brand-accent-light: #FFF0EB;  /* Accent tint */
  --color-brand-accent-muted: #FFD4C2;  /* Accent muted */

  /* === SEMANTIC COLORS === */
  --color-success: #10B981;
  --color-success-bg: #D1FAE5;
  --color-success-border: #A7F3D0;
  --color-warning: #F59E0B;
  --color-warning-bg: #FEF3C7;
  --color-warning-border: #FDE68A;
  --color-danger: #EF4444;
  --color-danger-bg: #FEE2E2;
  --color-danger-border: #FECACA;
  --color-info: #3B82F6;
  --color-info-bg: #DBEAFE;
  --color-info-border: #BFDBFE;

  /* === NEUTRAL SCALE === */
  --color-neutral-50:  #F8FAFC;
  --color-neutral-100: #F1F5F9;
  --color-neutral-200: #E2E8F0;
  --color-neutral-300: #CBD5E1;
  --color-neutral-400: #94A3B8;
  --color-neutral-500: #64748B;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1E293B;
  --color-neutral-900: #0F172A;

  /* === SURFACE & BACKGROUND === */
  --color-bg-body:    #F4F6FB;
  --color-bg-card:    #FFFFFF;
  --color-bg-sidebar: #1A1A2E;
  --color-bg-header:  rgba(255,255,255,0.92);
  --color-bg-overlay: rgba(15,23,42,0.6);
  --color-bg-input:   #F8FAFC;

  /* === TEXT === */
  --color-text-primary:   #1A1A2E;
  --color-text-secondary: #475569;
  --color-text-muted:     #94A3B8;
  --color-text-inverse:   #FFFFFF;
  --color-text-accent:    #FF6B35;
  --color-text-link:      #3B82F6;

  /* === BORDER === */
  --color-border:        #E2E8F0;
  --color-border-strong: #CBD5E1;
  --color-border-focus:  #FF6B35;

  /* ============================================
     TYPOGRAPHY
     ============================================ */
  --font-display: 'DM Serif Display', 'Georgia', serif;
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --font-size-xs:   0.75rem;   /* 12px */
  --font-size-sm:   0.875rem;  /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg:   1.125rem;  /* 18px */
  --font-size-xl:   1.25rem;   /* 20px */
  --font-size-2xl:  1.5rem;    /* 24px */
  --font-size-3xl:  1.875rem;  /* 30px */
  --font-size-4xl:  2.25rem;   /* 36px */

  --font-weight-regular: 400;
  --font-weight-medium:  500;
  --font-weight-semibold: 600;
  --font-weight-bold:    700;

  --line-height-tight:  1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* ============================================
     SPACING SCALE (base 4px)
     ============================================ */
  --space-0:  0;
  --space-1:  0.25rem;  /* 4px  */
  --space-2:  0.5rem;   /* 8px  */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* ============================================
     BORDER RADIUS
     ============================================ */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;      /* inputs, badges */
  --radius-lg: 12px;     /* cards */
  --radius-xl: 16px;     /* large cards */
  --radius-2xl: 20px;    /* modals */
  --radius-full: 9999px; /* pills */

  /* ============================================
     SHADOWS — 3 levels
     ============================================ */
  --shadow-xs: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 8px -1px rgba(0,0,0,0.08), 0 1px 3px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px -4px rgba(0,0,0,0.10), 0 2px 8px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.14), 0 4px 12px -4px rgba(0,0,0,0.08);
  --shadow-accent: 0 4px 16px -4px rgba(255,107,53,0.35);

  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast:   150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow:   300ms cubic-bezier(0.16,1,0.3,1);

  /* ============================================
     LAYOUT
     ============================================ */
  --sidebar-width-expanded:  240px;
  --sidebar-width-collapsed: 64px;
  --header-height: 64px;
  --content-max-width: 1200px;
  --mobile-tab-height: 60px;
  --z-sidebar:  100;
  --z-header:   200;
  --z-drawer:   300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
  --color-bg-body:    #0F172A;
  --color-bg-card:    #1E293B;
  --color-bg-sidebar: #0F172A;
  --color-bg-header:  rgba(15,23,42,0.95);
  --color-bg-input:   #1E293B;
  --color-border:     #334155;
  --color-border-strong: #475569;
  --color-text-primary:   #F1F5F9;
  --color-text-secondary: #94A3B8;
  --color-text-muted:     #64748B;
  --color-neutral-50:  #1E293B;
  --color-neutral-100: #334155;
  --color-neutral-200: #475569;
  --shadow-sm: 0 2px 8px -1px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px -4px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.5);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */
.font-display { font-family: var(--font-display); }
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-base{ font-size: var(--font-size-base); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-muted   { color: var(--color-text-muted); }
.text-accent  { color: var(--color-text-accent); }
.font-medium  { font-weight: var(--font-weight-medium); }
.font-semibold{ font-weight: var(--font-weight-semibold); }
.font-bold    { font-weight: var(--font-weight-bold); }

/* ============================================
   PAGE TITLE (replaces old .page-title)
   ============================================ */
.page-title {
  font-family: var(--font-display);
  font-size: var(--font-size-3xl);
  font-weight: 400;
  color: var(--color-text-primary);
  margin-bottom: var(--space-6);
  letter-spacing: -0.02em;
  line-height: var(--line-height-tight);
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  margin-bottom: var(--space-6);
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   SIDEBAR — Collapsible Dark
   ============================================ */
.sidebar {
  width: var(--sidebar-width-expanded);
  background: var(--color-bg-sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  transition: width var(--transition-slow);
  overflow: hidden;
  position: relative;
  z-index: var(--z-sidebar);
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: var(--header-height);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  box-shadow: var(--shadow-accent);
}

.sidebar-logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: white;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition-fast);
  letter-spacing: -0.3px;
}

.sidebar.collapsed .sidebar-logo-text { opacity: 0; pointer-events: none; }

/* Sidebar Toggle */
.sidebar-toggle {
  position: absolute;
  top: var(--space-4);
  right: -14px;
  width: 28px;
  height: 28px;
  background: var(--color-brand-accent);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  z-index: 10;
}
.sidebar-toggle:hover { background: var(--color-brand-accent-hover); transform: scale(1.1); }
.sidebar.collapsed .sidebar-toggle { right: -14px; }

/* Nav Sections */
.nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) var(--space-3);
  scrollbar-width: none;
}
.nav-scroll::-webkit-scrollbar { display: none; }

.nav-section {
  margin-bottom: var(--space-6);
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-fast);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

/* Nav Items */
.nav-menu { display: flex; flex-direction: column; gap: var(--space-1); }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  transition: all var(--transition-normal);
  white-space: nowrap;
  overflow: hidden;
  min-height: 40px;
  position: relative;
}

.nav-item i {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  transition: color var(--transition-fast);
}

.nav-item span {
  opacity: 1;
  transition: opacity var(--transition-fast);
  flex: 1;
}
.sidebar.collapsed .nav-item span { opacity: 0; pointer-events: none; }
.sidebar.collapsed .nav-info-icon { display: none; }

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: rgba(255,107,53,0.15);
  color: #FF6B35;
  font-weight: var(--font-weight-semibold);
}
.nav-item.active i { color: #FF6B35; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--color-brand-accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

/* Nav badge (for unread orders) */
.nav-badge {
  background: var(--color-brand-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: auto;
  flex-shrink: 0;
  animation: pulseBadge 2s ease infinite;
}
@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,53,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(255,107,53,0); }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* Setup Checklist in Sidebar */
.setup-checklist {
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  transition: all var(--transition-normal);
}
.sidebar.collapsed .setup-checklist { display: none; }

.setup-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  cursor: pointer;
}

.setup-checklist-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setup-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.setup-progress-fill {
  height: 100%;
  background: var(--color-brand-accent);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.setup-checklist-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.setup-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: color var(--transition-fast);
}
.setup-item:hover { color: rgba(255,255,255,0.8); }
.setup-item.done { color: var(--color-success); text-decoration: line-through; opacity: 0.6; }
.setup-item i { font-size: 0.9rem; flex-shrink: 0; }

/* ============================================
   HEADER — Top Bar
   ============================================ */
.top-bar {
  height: var(--header-height);
  background: var(--color-bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  gap: var(--space-4);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
  min-width: 0;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.breadcrumb-sep { color: var(--color-neutral-300); }

.property-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.property-select {
  background: var(--color-neutral-100);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  max-width: 200px;
}
.property-select:hover { border-color: var(--color-brand-accent); }
.property-select:focus { outline: none; border-color: var(--color-brand-accent); box-shadow: 0 0 0 3px rgba(255,107,53,0.15); }

/* Real-time indicator */
.realtime-dot {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}
.realtime-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.4);
  animation: realtimePulse 2s ease infinite;
}
.realtime-dot.offline::before {
  background: var(--color-danger);
  animation: none;
  box-shadow: none;
}
@keyframes realtimePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-brand-accent), #FF9A6C);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-sm);
}
.avatar:hover { transform: scale(1.05); }

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
  border: none;
  background: transparent;
}
.user-profile:hover { background: var(--color-neutral-100); }

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg-body);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.view-section {
  display: none;
  padding: var(--space-8);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  animation: viewFadeIn var(--transition-slow) forwards;
}
.view-section.active { display: block; }

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   BUTTONS — Unified System
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  min-height: 40px;
  min-width: 40px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--color-brand-accent);
  color: white;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--color-brand-accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px -4px rgba(255,107,53,0.5); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--color-brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--color-brand-secondary); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-secondary);
}
.btn-outline:hover { border-color: var(--color-brand-accent); color: var(--color-brand-accent); background: var(--color-brand-accent-light); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover { background: var(--color-neutral-100); color: var(--color-text-primary); }

.btn-danger {
  background: var(--color-danger);
  color: white;
  box-shadow: 0 4px 12px -4px rgba(239,68,68,0.4);
}
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }

.btn-success {
  background: var(--color-success);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-white {
  background: white;
  color: var(--color-brand-primary);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--color-border);
}
.btn-white:hover { border-color: var(--color-brand-accent); color: var(--color-brand-accent); }

.btn-sm  { padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); min-height: 32px; border-radius: var(--radius-sm); }
.btn-lg  { padding: var(--space-3) var(--space-6); font-size: var(--font-size-base); min-height: 48px; border-radius: var(--radius-lg); }
.btn-icon { padding: var(--space-2); width: 40px; height: 40px; border-radius: var(--radius-md); }
.btn-link { background: none; border: none; color: var(--color-brand-accent); font-weight: var(--font-weight-semibold); cursor: pointer; font-size: var(--font-size-sm); padding: 0; font-family: var(--font-body); }
.btn-link:hover { text-decoration: underline; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}
.badge-green   { background: var(--color-success-bg); color: #065F46; }
.badge-orange  { background: var(--color-brand-accent-light); color: #9A3412; }
.badge-blue    { background: var(--color-info-bg); color: #1E40AF; }
.badge-yellow  { background: var(--color-warning-bg); color: #92400E; }
.badge-red     { background: var(--color-danger-bg); color: #991B1B; }
.badge-gray    { background: var(--color-neutral-100); color: var(--color-neutral-600); }
.badge-navy    { background: rgba(26,26,46,0.08); color: var(--color-brand-primary); }
.badge-pill    { border-radius: var(--radius-full); }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: all var(--transition-normal);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-brand-accent-muted);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  line-height: var(--line-height-tight);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ============================================
   KPI / STAT CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .stats-grid { grid-template-columns: 1fr; gap: var(--space-4); } }

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-brand-accent-muted);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--color-brand-accent));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.stat-card:hover::before { opacity: 1; }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(5deg); }

.icon-bookings  { background: rgba(16,185,129,0.1); color: var(--color-success); }
.icon-revenue   { background: rgba(255,107,53,0.1); color: var(--color-brand-accent); }
.icon-orders    { background: rgba(59,130,246,0.1); color: var(--color-info); }
.icon-analytics { background: rgba(139,92,246,0.1); color: #7C3AED; }

.stat-delta {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}
.stat-delta.positive { background: var(--color-success-bg); color: #065F46; }
.stat-delta.negative { background: var(--color-danger-bg); color: #991B1B; }
.stat-delta.neutral  { background: var(--color-neutral-100); color: var(--color-text-muted); }

.stat-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-1);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

/* Mini spark chart */
.stat-spark {
  height: 36px;
  margin-top: var(--space-3);
  opacity: 0.6;
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}
.form-label .required { color: var(--color-danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  transition: all var(--transition-normal);
  appearance: none;
  min-height: 44px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  background: var(--color-bg-card);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.12);
}

input::placeholder, textarea::placeholder { color: var(--color-text-muted); }
textarea { min-height: 100px; resize: vertical; }

.responsive-grid-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: var(--space-3);
  align-items: end;
}
@media (max-width: 900px) { .responsive-grid-form { grid-template-columns: 1fr 1fr; } .responsive-grid-form button { grid-column: span 2; } }
@media (max-width: 600px) { .responsive-grid-form { grid-template-columns: 1fr; } .responsive-grid-form button { grid-column: 1; } }

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-neutral-300);
  transition: var(--transition-normal);
}
.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-xs);
}
input:checked + .slider { background: var(--color-brand-accent); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: var(--radius-full); }
.slider.round:before { border-radius: var(--radius-full); }

/* ============================================
   DATA TABLE
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-neutral-50);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
}
.data-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-neutral-50); }
.data-table th:nth-child(n+2), .data-table td:nth-child(n+2) { text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th:last-child, .data-table td:last-child { text-align: center; }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-modal);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: overlayFadeIn 150ms ease;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--color-bg-card);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp var(--transition-slow) forwards;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   TOAST NOTIFICATION SYSTEM
   ============================================ */
#toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 360px;
}

.toast {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  pointer-events: all;
  animation: toastSlideIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards;
  border-left: 4px solid transparent;
  min-width: 300px;
  position: relative;
}

.toast.exiting { animation: toastSlideOut 0.2s ease forwards; }

@keyframes toastSlideIn  { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastSlideOut { from { opacity: 1; transform: translateX(0); }   to { opacity: 0; transform: translateX(120%); } }

.toast-success { border-color: var(--color-success); }
.toast-error   { border-color: var(--color-danger); }
.toast-warning { border-color: var(--color-warning); }
.toast-info    { border-color: var(--color-info); }

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.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-body { flex: 1; }
.toast-title { font-weight: var(--font-weight-semibold); font-size: var(--font-size-sm); color: var(--color-text-primary); margin-bottom: 2px; }
.toast-message { font-size: var(--font-size-xs); color: var(--color-text-muted); line-height: var(--line-height-relaxed); }

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--color-text-primary); }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: currentColor;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastProgress linear forwards;
  opacity: 0.3;
}
@keyframes toastProgress { from { width: 100%; } to { width: 0%; } }

/* ============================================
   SKELETON LOADERS
   ============================================ */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-100) 25%, var(--color-neutral-200) 50%, var(--color-neutral-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-md);
}

.skeleton-text  { height: 16px; width: 100%; margin-bottom: var(--space-2); }
.skeleton-title { height: 24px; width: 60%; margin-bottom: var(--space-3); }
.skeleton-value { height: 40px; width: 40%; }
.skeleton-rect  { height: 80px; width: 100%; }
.skeleton-card  { height: 120px; width: 100%; border-radius: var(--radius-xl); }

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-5);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 320px;
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-6);
}

/* ============================================
   SUBSCRIPTION STATUS BAR
   ============================================ */
.subscription-status-bar {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xs);
  gap: var(--space-4);
  flex-wrap: wrap;
}
.sub-info { display: flex; gap: var(--space-6); align-items: center; flex-wrap: wrap; }
.sub-item { display: flex; flex-direction: column; gap: 2px; }
.sub-label { font-size: var(--font-size-xs); color: var(--color-text-muted); font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; }
.sub-value { font-weight: var(--font-weight-semibold); color: var(--color-text-primary); font-size: var(--font-size-sm); }
.sub-status-badge { padding: 3px var(--space-3); border-radius: var(--radius-full); font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); }
.status-active  { background: var(--color-success-bg); color: #065F46; }
.status-expired { background: var(--color-danger-bg); color: #991B1B; }
.status-warning { background: var(--color-warning-bg); color: #92400E; }

/* ============================================
   GUEST PREVIEW MODAL
   ============================================ */
.guest-preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-5);
}
.phone-frame { position: relative; width: 375px; height: 667px; background: #1A1A2E; border-radius: 36px; padding: 12px; box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05); }
.phone-notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 150px; height: 24px; background: #1A1A2E; border-radius: 0 0 16px 16px; z-index: 10; }
.phone-screen { width: 100%; height: 100%; background: white; border-radius: 28px; overflow: hidden; }
.phone-screen iframe { width: 100%; height: 100%; border: none; }
.close-preview { position: absolute; top: -44px; right: 0; background: white; border: none; width: 36px; height: 36px; border-radius: var(--radius-full); cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); transition: background var(--transition-fast); }
.close-preview:hover { background: var(--color-neutral-100); }

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.analytics-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
@media (min-width: 1024px) { .analytics-grid { grid-template-columns: 2fr 1fr; } }

/* ============================================
   AUTOMATION CARDS
   ============================================ */
.automation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-5); }
.automation-card { background: var(--color-bg-card); border-radius: var(--radius-xl); padding: var(--space-6); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); transition: all var(--transition-normal); }
.automation-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-brand-accent-muted); }
.auto-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.auto-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.auto-stats { display: flex; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.auto-stats span { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* ============================================
   TOUR SPOTLIGHT (preserved from original)
   ============================================ */
#tour-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 2147483640; transition: opacity 0.3s ease; opacity: 0; pointer-events: none; }
#tour-overlay.visible { opacity: 1; pointer-events: auto; }
.tour-highlight { position: fixed !important; z-index: 2147483647 !important; box-shadow: 0 0 0 4px var(--color-brand-accent), 0 0 0 5000px rgba(0,0,0,0.75), 0 0 30px 5px rgba(255,255,255,0.6) !important; border-radius: var(--radius-md); pointer-events: none; transition: box-shadow 0.3s ease; }
#tour-popover { position: fixed; z-index: 2147483647 !important; background: white; padding: var(--space-6); border-radius: var(--radius-xl); width: 320px; box-shadow: var(--shadow-lg); transition: all var(--transition-slow); opacity: 0; visibility: hidden; }
#tour-popover.visible { opacity: 1; visibility: visible; }
#tour-popover h3 { margin-bottom: var(--space-2); color: var(--color-text-primary); font-size: var(--font-size-xl); }
#tour-popover p { color: var(--color-text-muted); line-height: var(--line-height-relaxed); margin-bottom: var(--space-5); }
#tour-popover .tour-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.tour-btn { padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); font-weight: var(--font-weight-medium); cursor: pointer; font-family: var(--font-body); transition: all var(--transition-fast); }
.tour-btn-primary { background: var(--color-brand-accent); color: white; border: none; }
.tour-btn-outline { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ============================================
   GLOBAL TOOLTIP
   ============================================ */
.global-tooltip { position: fixed; background: rgba(15,23,42,0.96); color: white; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--font-size-xs); width: 200px; white-space: normal; box-shadow: var(--shadow-lg); z-index: var(--z-tooltip); pointer-events: none; line-height: var(--line-height-relaxed); opacity: 0; transform: translateX(8px); transition: opacity 0.2s, transform 0.2s; }
.global-tooltip.visible { opacity: 1; transform: translateX(0); }
.nav-info-icon { margin-left: auto; font-size: 0.85rem; color: rgba(255,255,255,0.3); opacity: 0; transition: all var(--transition-fast); cursor: help; padding: var(--space-1); }
.nav-item:hover .nav-info-icon { opacity: 1; }

/* ============================================
   MOBILE BOTTOM TAB BAR
   ============================================ */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-tab-height);
  background: white;
  border-top: 1px solid var(--color-border);
  z-index: var(--z-header);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding: 0 var(--space-2);
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-tab-bar nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
}

.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  font-weight: var(--font-weight-medium);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 44px;
  position: relative;
}

.mobile-tab-item i { font-size: 1.3rem; }
.mobile-tab-item span { font-size: 0.65rem; }

.mobile-tab-item.active {
  color: var(--color-brand-accent);
}

.mobile-tab-item.active i {
  transform: scale(1.1);
}

.mobile-tab-item.tab-more {
  background: var(--color-brand-accent);
  color: white;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  margin: auto;
  font-size: 1.4rem;
  padding: 0;
}

/* Mobile Drawer Overlay */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-drawer) - 1);
}
.mobile-drawer-overlay.open { display: block; }

/* ============================================
   RESPONSIVE — MOBILE FIRST
   ============================================ */
@media (max-width: 768px) {
  .sidebar { display: none; }

  .mobile-tab-bar { display: block; }

  .main-content {
    overflow-y: auto;
    height: 100vh;
    padding-bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
  }

  .top-bar {
    padding: 0 var(--space-4);
    height: 56px;
  }
  .top-bar-left .breadcrumbs { display: none; }
  .realtime-dot span { display: none; }

  .view-section { padding: var(--space-4); }

  .page-title { font-size: var(--font-size-2xl); }

  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: var(--space-2); width: 40px; height: 40px; }

  body { overflow: auto; }
  .app-container { flex-direction: column; height: auto; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: var(--sidebar-width-collapsed); }
  .sidebar .sidebar-logo-text,
  .sidebar .nav-item span,
  .sidebar .nav-section-label,
  .sidebar .setup-checklist { display: none; }
}

/* ============================================
   MISC UTILITIES
   ============================================ */
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ============================================
   QR SIDEBAR AREA
   ============================================ */
#sidebar-qr { text-align: center; padding: var(--space-4); }
#sidebar-qr p { font-size: var(--font-size-xs); color: rgba(255,255,255,0.3); margin-bottom: var(--space-2); }
#sidebar-qr-canvas { background: white; padding: var(--space-2); border-radius: var(--radius-md); display: inline-block; cursor: pointer; transition: transform var(--transition-normal); }
#sidebar-qr-canvas:hover { transform: scale(1.05); }
.sidebar.collapsed #sidebar-qr { display: none !important; }

/* ============================================
   LOADING OVERLAY
   ============================================ */
#app-loader {
  position: fixed;
  inset: 0;
  background: var(--color-neutral-50);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.loader-logo {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-5);
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.loader-logo img { width: 100%; height: 100%; object-fit: cover; }

.loader-name {
  font-family: var(--font-display);
  font-size: var(--font-size-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-6);
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-neutral-200);
  border-top-color: var(--color-brand-accent);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
