/* ==========================================================================
   Milky Bar Central Database & Management Portal
   Comprehensive Enterprise Design System & Responsive Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  /* Milky Bar Enterprise Brand Palette - High Contrast */
  --brand-red: #B91C1C;            /* Refined, high-contrast ruby crimson (WCAG AAA 7:1) */
  --brand-red-dark: #881337;       /* Deep rich cherry maroon */
  --brand-red-light: #DC2626;      /* Vivid punchy red hover */
  --brand-red-subtle: #FEF2F2;     /* Clean, delicate rose tint for badges & tags */
  --brand-red-border: #FECACA;     /* Crisp rose border */
  
  --brand-gold: #B45309;           /* Deep readable warm amber (WCAG AA 4.7:1) */
  --brand-gold-dark: #92400E;      /* Rich dark amber */
  --brand-gold-light: #FDE68A;     /* Soft buttery yellow */
  --brand-gold-subtle: #FFFBEB;    /* Warm cream alert tint */
  --brand-gold-border: #FDE68A;    /* Crisp amber border */
  
  --brand-cream: #FAF7F2;          /* Authentic Milky Bar rich warm cream canvas */
  --brand-cream-subtle: #FDFBF7;   /* Delicate ultra-light milky cream */
  --brand-cream-light: #FFFFFF;    /* Pure crisp white card surface */
  --brand-cream-border: #EFE8DD;   /* Warm soft cream border */
  
  --brand-charcoal: #0F172A;       /* High-contrast deep slate black (15:1 WCAG AAA) */
  --brand-charcoal-muted: #475569; /* Readable secondary slate (4.8:1 WCAG AA) */
  --brand-surface: #FFFFFF;
  
  --success: #047857;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  --warning: #B45309;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --danger: #B91C1C;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --info: #1D4ED8;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 14px 32px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);
  --shadow-brand: 0 8px 24px rgba(185, 28, 28, 0.22);
  
  /* Modern Humanized Typography - Plus Jakarta Sans */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  --font-brand: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-numbers: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --sidebar-width: 235px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Master Font Theme */
body,
body.font-montserrat,
body.font-poppins,
body.font-inter,
body.font-dmsans,
body.font-editorial {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  font-family: var(--font-sans);
}

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

body {
  font-family: var(--font-sans);
  background: var(--brand-cream);
  color: var(--brand-charcoal);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--brand-cream);
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: #FFFFFF;
  border-right: 1px solid var(--brand-cream-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
}

.sidebar-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--brand-cream-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  flex-shrink: 0;
}

.sidebar-logo-badge {
  background: linear-gradient(135deg, #B91C1C 0%, #881337 100%);
  padding: 5px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(185, 28, 28, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-logo-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(185, 28, 28, 0.3);
}

.sidebar-logo-badge .sidebar-logo {
  height: 26px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 800;
  color: #991B1B;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand .sidebar-role-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #9A3412;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  padding: 1.5px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: fit-content;
  white-space: nowrap;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.nav-category {
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.06em;
  padding: 8px 10px 2px 10px;
  border-top: 1px solid #F1F5F9;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.nav-category:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6.5px 10px;
  border-radius: 6px;
  color: #1E293B;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  line-height: 1.25;
}

.nav-item:hover {
  background: #FEF2F2;
  color: #B91C1C;
}

.nav-item.active {
  background: #FEF2F2;
  color: #B91C1C;
  font-weight: 700;
  box-shadow: none;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-red);
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-item:hover .icon {
  color: var(--brand-red);
}

.nav-item.active .icon {
  color: var(--brand-red);
}

.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn .svg-icon {
  margin-right: 6px;
  vertical-align: -2px;
}

.btn-icon .svg-icon {
  margin-right: 0;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--brand-red-subtle);
  color: var(--brand-red);
  border: 1px solid rgba(185, 28, 28, 0.15);
}

.nav-item.active .badge {
  background: var(--brand-red);
  color: #FFFFFF;
  border-color: var(--brand-red);
}

/* User Account Profile Box in Sidebar */
.sidebar-user {
  padding: 8px 12px;
  border-top: 1px solid var(--brand-cream-border);
  background: #FAFAF9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.user-flex {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-red-subtle);
  border: 1px solid var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.user-details {
  min-width: 0;
  overflow: hidden;
}

.user-details h4 {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--brand-charcoal);
  line-height: 1.2;
}

.user-details p {
  font-size: 0.66rem;
  color: var(--brand-charcoal-muted);
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background: var(--brand-cream);
  overflow-x: hidden;
}

/* Top Navbar */
.topbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--brand-cream-border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.page-title h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand-charcoal);
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cutoff-pill {
  background: var(--brand-cream);
  border: 1px solid var(--brand-cream-border);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-charcoal);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cutoff-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

/* Demo Role Switcher Dropdown (Header Helper) */
.demo-role-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFF8EE;
  border: 1px solid var(--brand-gold-light);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 700;
}

.demo-role-switcher select {
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-gold-dark);
  outline: none;
  cursor: pointer;
}

/* Font Theme Switcher Dropdown (Removed) */
.font-theme-switcher {
  display: none !important;
}

.font-theme-switcher select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-red);
  outline: none;
  cursor: pointer;
}

/* Authentic Milky Bar Slide & Product Hero Banner */
.brand-hero-showcase {
  background:
    radial-gradient(ellipse at 88% 25%, rgba(245, 158, 11, 0.20) 0%, transparent 48%),
    radial-gradient(ellipse at 15% 75%, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #7A1228 0%, #8E1530 45%, #580818 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 26px 32px;
  margin-bottom: 24px;
  box-shadow: 0 12px 32px rgba(88, 8, 24, 0.22), 0 2px 6px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-hero-showcase::before,
.brand-hero-showcase::after {
  display: none;
}

.brand-hero-content {
  position: relative;
  z-index: 2;
  max-width: 650px;
}

.brand-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(253, 230, 138, 0.18);
  border: 1px solid rgba(253, 230, 138, 0.38);
  color: #FDE68A;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.brand-hero-title {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1.15;
  color: #FFFFFF;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.brand-hero-tagline {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 700;
  color: #FDE68A;
  margin-bottom: 8px;
}

.brand-hero-lead {
  font-size: 0.90rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 14px;
  line-height: 1.4;
}

.brand-hero-flavors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* High-contrast, pristine flavor pills */
.flavor-pill {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.95);
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.flavor-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.brand-hero-locations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-loc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  color: #FFFFFF;
}

.hero-loc-icon {
  color: #F59E0B;
  display: inline-flex;
  align-items: center;
}

.hero-loc-label {
  font-weight: 800;
  color: #FDE68A;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-loc-cities {
  font-weight: 600;
  color: #FFFFFF;
}

.hero-loc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #A7F3D0;
  background: rgba(4, 120, 87, 0.28);
  border: 1px solid rgba(167, 243, 208, 0.35);
  padding: 5px 12px;
  border-radius: 8px;
}

.hero-loc-status .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
  animation: pulse-live 2s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.brand-hero-media {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-hero-card {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 220px;
}

.hero-logo-wrapper {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.hero-card-badge {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: #FDE68A;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hero-card-sub {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  margin-bottom: 10px;
}

.hero-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-stat-item .stat-num {
  font-size: 0.90rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
}

.hero-stat-item .stat-lbl {
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(253, 230, 138, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.hero-stat-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 900px) {
  .brand-hero-showcase {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 20px;
  }
  .brand-hero-media {
    width: 100%;
    justify-content: center;
  }
}

/* Content Container */
.content-body {
  padding: 16px 20px 48px 20px;
  flex: 1;
  background: var(--brand-cream);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Metric Cards */
.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.metric-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.metric-card.accent-red {
  border-left: 4px solid var(--brand-red);
}

.metric-card.accent-gold {
  border-left: 4px solid var(--brand-gold);
}

.metric-card.accent-green {
  border-left: 4px solid var(--success);
}

.metric-card.accent-blue {
  border-left: 4px solid var(--info);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.metric-header .title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: #FFFDF9;
  border: 1px solid var(--brand-cream-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.95rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 4px;
}

.metric-sub {
  font-size: 0.78rem;
  color: #64748B;
  font-weight: 500;
}

/* Action Center / Alert Banners */
.alert-card {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.alert-card.danger {
  background: #FEF2F2;
  border-color: #FECACA;
}

.alert-card.info {
  background: #EFF6FF;
  border-color: #BFDBFE;
}

.alert-info-flex {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-info-flex .icon {
  font-size: 1.4rem;
}

.alert-info-flex h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1F2937;
}

.alert-info-flex p {
  font-size: 0.82rem;
  color: #4B5563;
}

/* Card Section Containers */
.panel-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--brand-cream-border);
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h2, .panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.01em;
}

.panel-header p {
  font-size: 0.80rem;
  color: #64748B;
  margin-top: 2px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-cream-border);
  background: #FFFFFF;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  text-align: left;
}

.data-table th {
  background: #FAF7F2;
  color: #475569;
  font-family: var(--font-sans);
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 1px solid var(--brand-cream-border);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--brand-cream-border);
  color: #1E293B;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #FDFBF7;
}

/* Optimized Inventory Table & Metrics Grid */
.inventory-metrics-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

@media (max-width: 1260px) {
  .inventory-metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .inventory-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.inventory-metrics-grid .metric-card {
  padding: 12px 14px;
}

.inventory-metrics-grid .metric-card .title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inventory-metrics-grid .metric-card .metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 3px 0 1px 0;
  line-height: 1.15;
}

.inventory-metrics-grid .metric-card .metric-sub {
  font-size: 0.68rem;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.inventory-table {
  width: 100%;
  font-size: 0.81rem;
}

.inventory-table th {
  padding: 8px 6px;
  font-size: 0.70rem;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
}

.inventory-table th:first-child,
.inventory-table td:first-child {
  text-align: left;
  padding-left: 10px;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  text-align: left;
}

.inventory-table th:last-child,
.inventory-table td:last-child {
  text-align: right;
  padding-right: 10px;
}

.inventory-table td {
  padding: 8px 6px;
  text-align: center;
}

.inventory-table tfoot td {
  padding: 9px 6px;
}

/* Badges & Tags */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-tag.approved, .status-tag.active, .status-tag.delivered, .status-tag.paid {
  background: var(--success-bg);
  color: var(--success);
}

.status-tag.pending, .status-tag.under-review, .status-tag.draft {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-tag.rejected, .status-tag.cancelled, .status-tag.unpaid {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-tag.dispatched, .status-tag.completed {
  background: var(--info-bg);
  color: var(--info);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-red);
  color: #FFFFFF;
  border-color: var(--brand-red);
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.2);
}

.btn-primary:hover {
  background: var(--brand-red-dark);
  border-color: var(--brand-red-dark);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #FFFFFF;
  color: #334155;
  border: 1px solid var(--brand-cream-border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: #FAF7F2;
  border-color: #E2D9CB;
  color: #0F172A;
}

.btn-gold {
  background: var(--brand-gold);
  color: #FFFFFF;
  border-color: var(--brand-gold);
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.2);
}

.btn-gold:hover {
  background: var(--brand-gold-dark);
  border-color: var(--brand-gold-dark);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--brand-red);
  border: 1.5px solid var(--brand-red);
}

.btn-outline:hover {
  background: var(--brand-red-subtle);
  color: var(--brand-red-dark);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-charcoal);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
  background: #FFFFFF;
}

.form-control:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(139, 30, 46, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Pair Selling Cards */
.pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .pair-grid {
    grid-template-columns: 1fr;
  }
}

.pair-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.pair-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--brand-cream-border);
  padding-bottom: 12px;
}

.pair-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-red);
}

.pair-partners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.partner-box {
  background: var(--brand-cream-light);
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.partner-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
}

.partner-box p {
  font-size: 0.74rem;
  color: var(--brand-charcoal-muted);
}

/* Modal Windows */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--brand-cream-border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--brand-cream-border);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-content-area {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  background: #FAF7F2;
  border-top: 1px solid var(--brand-cream-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Container */
.toast-shelf {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-msg {
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--brand-gold);
  pointer-events: auto;
  animation: slideToast 0.25s ease;
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Login Screen Styles */
.login-backdrop {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, #FAF7F2 0%, #F3ECE2 100%);
}

.login-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  height: 68px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(196, 13, 46, 0.25);
}

.login-card h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand-red);
}

.login-card p {
  font-size: 0.86rem;
  color: var(--brand-charcoal-muted);
  margin-bottom: 24px;
}

.demo-account-pills {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--brand-cream-border);
}

.demo-account-pills h5 {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--brand-charcoal-muted);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.demo-buttons-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.demo-btn {
  background: var(--brand-cream);
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.demo-btn:hover {
  background: var(--brand-red);
  color: #FFFFFF;
  border-color: var(--brand-red);
}

/* Printable Payslip Specifics */
@media print {
  body {
    background: #FFFFFF !important;
  }
  .sidebar, .topbar, .modal-header, .modal-footer, .btn, .toast-shelf {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
  }
  .payslip-sheet {
    border: 1px solid #9CA3AF !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Simplified Dashboard & 4-Person Selling Team Specific Styles
   ========================================================================== */

/* Locked Document Badge */
.status-tag.locked {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #34D399;
  font-weight: 800;
}

/* 4-Person Selling Team Grid */
.grid-team-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.team-member-card {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-member-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.team-member-card .member-avatar {
  font-size: 2.2rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--brand-red-subtle);
  border: 2px solid var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.team-member-card h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--brand-charcoal);
  margin-bottom: 2px;
}

.team-member-card .member-role {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--brand-charcoal-muted);
  margin-bottom: 8px;
}

.team-member-card .member-stats {
  width: 100%;
  background: var(--brand-cream);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 8px;
  display: flex;
  justify-content: space-around;
  font-size: 0.78rem;
}

.team-member-card .member-stats strong {
  display: block;
  font-size: 1.1rem;
  color: var(--brand-red);
}

/* Tab Pills inside Individual & Paired Views */
.tab-pill-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--brand-cream-border);
  padding-bottom: 12px;
  margin-bottom: 22px;
  overflow-x: auto;
}

.tab-pill-btn {
  background: #FFFFFF;
  border: 1px solid var(--brand-cream-border);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-charcoal);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-pill-btn:hover {
  background: var(--brand-cream);
  color: var(--brand-red);
}

.tab-pill-btn.active {
  background: var(--brand-red);
  color: #FFFFFF;
  border-color: var(--brand-red);
  box-shadow: 0 4px 12px rgba(196, 18, 48, 0.25);
}

/* Sub-Account Permission Tags */
.perm-tag {
  display: inline-block;
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  margin: 2px;
}

/* ==========================================================================
   Employee Overview Dashboard & Individual Tab Clean Design System
   ========================================================================== */

.overview-banner-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.overview-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.overview-stat-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.overview-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.overview-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overview-stat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overview-stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.overview-stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
}

.overview-stat-sub {
  font-size: 0.76rem;
  color: #64748B;
}

.overview-two-col {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .overview-two-col {
    grid-template-columns: 1fr;
  }
}

.overview-delivery-item {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  transition: border-color 0.15s ease;
}

.overview-delivery-item:hover {
  border-color: #CBD5E1;
}

.overview-delivery-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.overview-delivery-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #FEF3C7;
  color: #B45309;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.overview-action-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.overview-action-card:hover {
  border-color: var(--brand-red);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(185, 28, 28, 0.12);
}

/* Flavor Table in Shift Modal */
.flavor-stock-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1.5px solid var(--brand-cream-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  font-size: 0.82rem;
}

.flavor-stock-table th {
  background: #FAF7F2;
  color: #334155;
  font-weight: 800;
  padding: 9px 10px;
  text-align: center;
  border-bottom: 1.5px solid var(--brand-cream-border);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flavor-stock-table th:first-child {
  text-align: left;
}

.flavor-stock-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--brand-cream-border);
  text-align: center;
  vertical-align: middle;
}

.flavor-stock-table td:first-child {
  text-align: left;
}

.flavor-stock-table tbody tr:hover {
  background: #FDFBF7;
}

.flavor-stock-table tfoot tr {
  background: #FFFDF9;
  font-weight: 800;
  border-top: 2px solid var(--brand-cream-border);
}

.flavor-stock-table tfoot td {
  padding: 10px 10px;
  border-top: 2px solid #E2E8F0;
}

.flavor-input-cell {
  width: 58px;
  padding: 5px 6px;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 0.84rem;
  color: #0F172A;
  outline: none;
  background: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.flavor-input-cell:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.15);
}

.flavor-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #1E293B;
}

.flavor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Responsive Viewport Height Rules (All menu items fit on screen without vertical scrolling) */
@media (max-height: 800px) {
  .sidebar-header {
    padding: 8px 12px;
  }
  .sidebar-logo-badge {
    padding: 4px 7px;
  }
  .sidebar-logo-badge .sidebar-logo {
    height: 23px;
  }
  .sidebar-brand h2 {
    font-size: 1.05rem;
  }
  .sidebar-menu {
    padding: 4px 6px;
    gap: 1px;
  }
  .nav-category {
    padding: 6px 8px 1px 8px;
    margin-top: 2px;
    font-size: 0.60rem;
  }
  .nav-item {
    padding: 5.5px 8px;
    font-size: 0.78rem;
    gap: 8px;
  }
  .nav-item .icon {
    width: 16px;
    height: 16px;
  }
  .sidebar-user {
    padding: 6px 10px;
  }
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
}

@media (max-height: 650px) {
  .sidebar-header {
    padding: 6px 10px;
  }
  .sidebar-logo-badge {
    padding: 3px 6px;
  }
  .sidebar-logo-badge .sidebar-logo {
    height: 20px;
  }
  .sidebar-brand h2 {
    font-size: 0.95rem;
  }
  .sidebar-brand .sidebar-role-pill {
    display: none;
  }
  .sidebar-menu {
    padding: 2px 4px;
    gap: 0.5px;
  }
  .nav-category {
    padding: 4px 6px 1px 6px;
    margin-top: 1px;
    font-size: 0.58rem;
  }
  .nav-item {
    padding: 4.5px 7px;
    font-size: 0.75rem;
    gap: 7px;
  }
  .sidebar-user {
    padding: 5px 8px;
  }
}

/* Responsive Viewport Width Rules (Prevent Edge-Cutting) */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--brand-cream);
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

@media (max-width: 1200px) {
  .topbar-user-chip .user-chip-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .content-body {
    padding: 16px 18px 50px 18px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 280px;
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 9999;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100%;
  }
  .btn-mobile-sidebar-toggle {
    display: inline-flex !important;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9998;
  }
  .sidebar-backdrop.active {
    display: block;
  }
}

/* Loading Spinner & Active Button States */
.svg-spin {
  animation: svgSpin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes svgSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
button:disabled, .btn:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
}

/* Store Picture Upload & Thumbnail Styles */
.store-photo-dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.store-photo-dropzone:hover {
  border-color: var(--brand-red);
  background: #FFFBF7;
}

.store-photo-dropzone.has-photo {
  border: 1.5px solid #BBF7D0;
  background: #F0FDF4;
}

.store-photo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.store-photo-preview-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid #E2E8F0;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.store-thumb-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.15s ease;
}

.store-thumb-img:hover {
  transform: scale(1.08);
}

.store-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #F1F5F9;
  border: 1px dashed #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  flex-shrink: 0;
}

.store-photo-viewer-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}



/* =========================================================================
   PWA & MULTI-GADGET RESPONSIVE DESIGN SYSTEM
   Optimized for Phones (320px-480px), Phablets (481px-768px), Tablets (769px-1024px), Laptops & Desktops
   ========================================================================= */

/* Safe Area Insets for Modern Gadgets (iOS Dynamic Island, Notches, Android Gesture Bars) */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Standalone PWA Window Adjustments */
@media all and (display-mode: standalone) {
  .topbar {
    padding-top: calc(10px + var(--safe-top));
  }
  .sidebar {
    padding-top: calc(16px + var(--safe-top));
    padding-bottom: calc(16px + var(--safe-bottom));
  }
}

/* Tablet & Smaller Screens (<= 1024px) */
@media (max-width: 1024px) {
  .topbar {
    padding: 10px 16px !important;
  }
  .content-body {
    padding: 14px 16px 40px 16px !important;
  }
  .panel-card {
    padding: 18px 16px !important;
  }
}

/* Mobile Devices & Phablets (<= 768px) */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zoom when tapping inputs (font-size >= 16px) */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .flavor-input-cell {
    font-size: 16px !important;
    height: 38px !important;
    min-width: 48px !important;
    padding: 4px 6px !important;
  }

  /* Compact Topbar on Mobile */
  .topbar {
    padding: 8px 12px !important;
    min-height: 52px !important;
  }
  .topbar-pill-dropdown {
    display: none !important;
  }
  .topbar-right {
    gap: 8px !important;
  }
  .topbar-user-chip .user-chip-name,
  .topbar-user-chip span {
    display: none !important;
  }

  /* Mobile Content Padding */
  .content-body {
    padding: 12px 12px 60px 12px !important;
  }
  .panel-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .panel-header button,
  .panel-header .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Responsive Form Rows: Single Column Stacking */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Responsive Grids on Mobile */
  .grid-metrics {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 12px !important;
  }
  .inventory-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .pair-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .overview-two-col {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Touch-Friendly Table Containers */
  .table-container {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--brand-cream-border) !important;
    -webkit-overflow-scrolling: touch !important;
    box-shadow: inset -6px 0 8px -4px rgba(0,0,0,0.06);
  }
  .data-table th,
  .data-table td {
    padding: 10px 10px !important;
    font-size: 0.78rem !important;
  }

  /* Full-Width Mobile Modal Adaptations */
  .modal-overlay {
    padding: 8px !important;
    align-items: flex-end !important;
  }
  .modal-box {
    max-height: 94vh !important;
    max-width: 100% !important;
    border-radius: 18px 18px 8px 8px !important;
    margin: 0 !important;
  }
  .modal-header {
    padding: 14px 16px !important;
  }
  .modal-header h3 {
    font-size: 1rem !important;
  }
  .modal-content-area {
    padding: 14px 14px !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .modal-footer {
    padding: 12px 14px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
  }
  .modal-footer .btn {
    flex: 1 1 calc(50% - 8px) !important;
    min-height: 42px !important;
    font-size: 0.85rem !important;
    justify-content: center !important;
  }

  /* Toast Shelf on Mobile */
  .toast-shelf {
    bottom: calc(16px + var(--safe-bottom)) !important;
    right: 12px !important;
    left: 12px !important;
  }
  .toast-msg {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Small Phones (<= 480px) */
@media (max-width: 480px) {
  .page-title h1, #topbar-title {
    font-size: 0.95rem !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .grid-metrics {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .metric-card {
    padding: 14px 16px !important;
  }
  .metric-card .value {
    font-size: 1.4rem !important;
  }
  .inventory-metrics-grid .metric-card .metric-value {
    font-size: 1.15rem !important;
  }
  .filter-presets-wrap .btn {
    flex: 1 1 calc(50% - 6px) !important;
  }
  .modal-footer .btn {
    flex: 1 1 100% !important;
  }
}

/* Touch Device Target Sizing */
@media (pointer: coarse) {
  button, .btn, .nav-item, select, .flavor-input-cell {
    min-height: 40px;
  }
  .nav-item {
    padding: 10px 14px !important;
  }
}
