:root {
  --bg-primary: #070b14;
  --bg-body: #070b14;
  --bg-secondary: #0f172a;
  --bg-surface: #131c31;
  --bg-card: rgba(17, 25, 44, 0.78);
  --border-subtle: rgba(255, 255, 255, 0.085);
  --border: rgba(255, 255, 255, 0.09);
  --border-focus: rgba(56, 189, 248, 0.55);
  
  --primary: #38bdf8;
  --accent-tg: #229ED9;
  --accent-tg-hover: #1c8ac0;
  --accent-tg-glow: rgba(34, 158, 217, 0.28);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  
  --font-main: 'Plus Jakarta Sans', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-card: 0 14px 34px -12px rgba(0, 0, 0, 0.6), 0 1px 0 0 rgba(255, 255, 255, 0.06) inset;
  --shadow-glow: 0 0 25px var(--accent-tg-glow);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(34, 158, 217, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

/* ==============================================
   Dashboard Layout with Left-Side Navigation
   ============================================== */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-body);
}

/* Sidebar (Left-Side) */
.app-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: rgba(11, 17, 32, 0.98);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.4);
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #229ED9, #0088cc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-tg-glow);
  flex-shrink: 0;
}

.store-avatar {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
  width: fit-content;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.bot-handle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0.65rem 0 0 0;
}

.bot-handle a {
  color: var(--accent-tg);
  text-decoration: none;
  font-weight: 600;
}

.bullet {
  color: var(--text-muted);
}

/* Sidebar Navigation (Tabs on Left Side) */
.sidebar-nav {
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem 0.5rem 0.65rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.95rem;
  background: none;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.nav-tab.active {
  color: #38bdf8;
  background: linear-gradient(90deg, rgba(34, 158, 217, 0.16) 0%, rgba(34, 158, 217, 0.04) 100%);
  border-color: rgba(34, 158, 217, 0.25);
  border-left-color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-tab .nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.nav-tab .nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-tab .nav-text small {
  opacity: 0.75;
  font-weight: 500;
  font-size: 0.8em;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 16, 29, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.admin-avatar {
  font-size: 0.95rem;
}

.admin-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* Content Area (Right Side) */
.content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
}

.top-navbar {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-nav-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.live-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
}

.realtime-live-pill {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  transition: all 0.3s ease;
}

.realtime-live-pill .pulse-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.realtime-live-pill.active-pulse {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
  transform: scale(1.04);
}

.realtime-live-pill.active-pulse .pulse-dot {
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
}

.bot-status-pill {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.3);
  transition: all 0.25s ease;
}

.bot-status-pill .pulse-dot {
  background: #a78bfa;
  box-shadow: 0 0 8px #a78bfa;
}

.bot-status-pill:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.55);
  transform: translateY(-1px);
}

@keyframes statGlow {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0)); }
  35% { transform: scale(1.05); filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.6)); color: #34d399; }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(16, 185, 129, 0)); }
}

.stat-value.stat-updated {
  animation: statGlow 1s ease-out;
}

.mobile-menu-btn {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Sidebar Drawer Backdrop & Close Button */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 1000;
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
  }

  .sidebar-backdrop {
    display: block;
  }

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

  .sidebar-close-btn {
    display: flex;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
  }

  .top-navbar {
    padding: 0.75rem 1rem;
  }
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeInPane 0.25s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main Layout */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Filter Bar */
.filter-card {
  padding: 1rem 1.25rem !important;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
  background: var(--accent-tg);
  border-color: var(--accent-tg);
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-tg-glow);
}

.custom-date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.65rem;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
}

.date-sep {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-blue {
  background: rgba(34, 158, 217, 0.12);
  color: var(--accent-tg);
}

.stat-icon-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
}

.stat-icon-purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}

.stat-icon-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 2px 0;
}

.stat-trend {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-trend.positive {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #229ED9, #0088cc);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-tg-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2cb2f3, #0294dc);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.tg-btn {
  color: #fff;
  background: rgba(34, 158, 217, 0.15);
  border: 1px solid rgba(34, 158, 217, 0.3);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Product Breakdown Grid */
.product-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.breakdown-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.9rem;
}

.breakdown-count {
  color: var(--accent-tg);
  font-weight: 700;
}

.breakdown-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-tg), var(--accent-emerald));
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* 3 Broadcast Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.tpl-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.tpl-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 158, 217, 0.35);
}

.tpl-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-amber);
  text-transform: uppercase;
}

.tpl-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.tpl-body {
  flex: 1;
}

.tpl-preview {
  background: #090e17;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  color: #cbd5e1;
  font-family: var(--font-main);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

.tpl-buttons-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fake-tg-btn {
  background: #2b5278;
  color: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
  text-align: center;
  font-weight: 600;
}

.use-template-btn {
  background: rgba(34, 158, 217, 0.12);
  border-color: rgba(34, 158, 217, 0.3);
  color: #60a5fa;
  font-size: 0.82rem;
}

.use-template-btn:hover {
  background: rgba(34, 158, 217, 0.25);
  color: #fff;
}

/* Button Builder */
.buttons-builder-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-builder-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 0.5rem;
  align-items: center;
}

.remove-btn-row {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
}

/* Custom Emoji Quick Buttons */
.btn-emoji-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: var(--text-primary, #fff);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-emoji-tag:hover {
  background: rgba(34, 158, 217, 0.22);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* Settings Grid Form */
.settings-grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

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

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-section.full-width {
  grid-column: 1 / -1;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-tg);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-tg);
  box-shadow: 0 0 0 3px rgba(34, 158, 217, 0.2);
}

.hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Switch & Checkbox */
.switch-container {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.switch-container input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 38px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  position: relative;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch-container input:checked + .switch-slider {
  background: var(--accent-tg);
}

.switch-container input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.stock-options-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
}

.badge-accent {
  background: rgba(34, 158, 217, 0.15);
  color: var(--accent-tg);
  border: 1px solid rgba(34, 158, 217, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Bulk Buy Discount Component */
.bulk-discount-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  transition: all 0.2s ease;
}

.bulk-discount-section:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.bulk-discount-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-optional {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: normal;
}

.bulk-rules-container {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
}

.bulk-rules-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.bulk-tiers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bulk-tier-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr 34px;
  gap: 0.65rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bulk-tier-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bulk-tier-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tier-range-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tier-range-wrap .form-input {
  text-align: center;
  padding: 0.35rem 0.3rem !important;
  font-size: 0.85rem;
  height: 34px;
  min-width: 0;
  width: 100%;
}

.tier-range-sep {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.tier-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.tier-input-wrap .form-input {
  padding: 0.4rem 2.2rem 0.4rem 1.4rem;
  font-size: 0.85rem;
  height: 34px;
}

.tier-prefix {
  position: absolute;
  left: 8px;
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 700;
  pointer-events: none;
}

.tier-suffix {
  position: absolute;
  right: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.btn-remove-tier {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 14px;
}

.btn-remove-tier:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  transform: scale(1.05);
}

/* Search Box */
.search-input {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  width: 260px;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-tg);
}

/* Admin Profile */
.admin-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.logout-btn {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-emerald);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.toast.error .toast-icon {
  background: #ef4444;
}

/* ==============================================
   Menu Builder & Telegram Phone Mockup
   ============================================== */
.menu-builder-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  margin-top: 1rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .menu-builder-layout {
    grid-template-columns: 1fr;
  }
}

.menu-table-col {
  min-width: 0;
}

.menu-preview-col {
  position: sticky;
  top: 1rem;
}

/* Telegram Phone Simulation */
.tg-phone-mockup {
  background: #17212b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.tg-phone-header {
  background: #242f3d;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.tg-header-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tg-bot-mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.tg-bot-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.tg-bot-sub {
  font-size: 0.72rem;
  color: #798b9b;
}

.tg-live-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(34, 158, 217, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(34, 158, 217, 0.35);
}

.tg-phone-body {
  padding: 1.25rem 1rem;
  background: #0e1621;
  background-image: radial-gradient(#1e2c3a 1px, transparent 1px);
  background-size: 16px 16px;
  min-height: 160px;
}

.tg-chat-bubble {
  background: #182533;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: #e4ecf2;
  font-size: 0.82rem;
  line-height: 1.45;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  max-width: 95%;
}

.tg-bubble-text {
  margin: 0 0 0.75rem 0;
}

.tg-inline-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tg-inline-btn {
  background: rgba(43, 82, 120, 0.45);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #64b5f6;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  transition: all 0.2s;
}

.tg-inline-btn:hover {
  background: rgba(43, 82, 120, 0.75);
}

.tg-keyboard-tray {
  background: #242f3d;
  padding: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tg-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #92a4b3;
  font-weight: 600;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tg-tray-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 8px;
  color: #64b5f6;
}

.tg-reply-keyboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tg-reply-btn {
  background: #17212b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #e4ecf2;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.2s;
}

.tg-reply-btn.disabled-btn {
  opacity: 0.35;
  text-decoration: line-through;
}

/* Placements Pill Badges */
.placement-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.placement-pill {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.placement-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

/* Toggle Switch in Table */
.table-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.table-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.table-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.table-toggle input:checked + .table-toggle-slider {
  background-color: var(--accent-emerald, #10b981);
  border-color: var(--accent-emerald, #10b981);
}

.table-toggle input:checked + .table-toggle-slider:before {
  transform: translateX(20px);
}

/* Delivered Keys Full View Component (Order History) */
.order-keys-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 250px;
  max-width: 360px;
}

.keys-preview-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 150px;
  overflow-y: auto;
}

.key-preview-line {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.key-preview-line:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(0, 0, 0, 0.6);
}

.key-num {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: #38bdf8;
  font-weight: 700;
  flex-shrink: 0;
}

.key-full-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
  flex-grow: 1;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.35;
}

.btn-copy-inline {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-copy-inline:hover {
  background: var(--accent-tg);
  color: #fff;
}

.btn-view-full-key {
  align-self: flex-start;
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.btn-view-full-key:hover {
  color: #7dd3fc;
}

/* Full Key Modal Styles */
.order-key-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.order-key-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.order-key-textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8;
  background: rgba(10, 15, 28, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  resize: vertical;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  box-sizing: border-box;
}

/* Product Order & Drag Reorder Styles */
.product-row {
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.product-row.drag-over-row {
  background: rgba(56, 189, 248, 0.12) !important;
  outline: 2px dashed rgba(56, 189, 248, 0.6);
  outline-offset: -2px;
}

.order-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
}

.order-num-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent-tg);
  min-width: 24px;
  text-align: center;
}

.order-btn-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-order-move {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 0.65rem;
  line-height: 1.1;
  cursor: pointer;
  transition: all 0.1s ease;
}

.btn-order-move:hover:not(:disabled) {
  background: var(--accent-tg);
  color: #fff;
  border-color: var(--accent-tg);
}

.btn-order-move:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.drag-handle-icon {
  cursor: grab;
  color: var(--text-muted);
  font-size: 0.85rem;
  user-select: none;
}

.drag-handle-icon:active {
  cursor: grabbing;
}

/* 1-Click Product Visibility & Filter Styles */
.product-row.is-invisible,
.sub-product-row.is-invisible {
  opacity: 0.62 !important;
  filter: grayscale(25%);
}

.product-row.is-invisible:hover,
.sub-product-row.is-invisible:hover {
  opacity: 0.9 !important;
}

.product-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.product-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.product-filter-btn.active {
  background: var(--accent-tg) !important;
  color: #fff !important;
  border-color: var(--accent-tg) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(34, 158, 217, 0.35);
}

.btn-visibility-toggle {
  transition: all 0.15s ease;
}

.btn-visibility-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

/* Custom Emoji Toolbars for Description & Delivery Instructions */
.custom-emoji-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 5px 8px;
  margin-top: 4px;
}

.custom-emoji-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.74rem;
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.custom-emoji-chip:hover {
  background: rgba(34, 158, 217, 0.25);
  border-color: rgba(34, 158, 217, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

.custom-emoji-chip-add {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
  font-weight: 600;
}

.custom-emoji-chip-add:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.6);
  color: #fff;
}

.textarea-with-toolbar {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* ==============================================
   Comprehensive Mobile Device Responsiveness
   ============================================== */

@media (max-width: 768px) {
  /* Prevent iOS Safari 16px auto-zoom */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Main Container & Card Spacing */
  .main-content {
    padding: 0.85rem 0.75rem;
    gap: 1rem;
  }

  .card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }

  /* Top Navigation Bar */
  .top-navbar {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }

  .top-nav-title {
    font-size: 0.95rem;
    max-width: 175px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-nav-actions {
    gap: 0.4rem;
  }

  .live-status-pill {
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  /* Card Header Stacking */
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .card-title {
    font-size: 1.1rem;
    line-height: 1.35;
  }

  .card-subtitle {
    font-size: 0.78rem;
  }

  .header-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem;
  }

  .header-actions .btn {
    flex: 1 1 auto;
    min-width: 130px;
    justify-content: center;
  }

  /* KPI Stats Grid (2 columns on mobile) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  .stat-card {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-value {
    font-size: 1.25rem;
    line-height: 1.2;
    word-break: break-all;
  }

  .stat-title {
    font-size: 0.72rem;
  }

  .stat-desc,
  .stat-trend {
    font-size: 0.68rem;
  }

  /* Filters & Date Ranges */
  .filter-card {
    padding: 0.75rem 0.85rem !important;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-buttons {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding-bottom: 4px;
    width: 100%;
    scrollbar-width: none;
  }

  .filter-buttons::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .custom-date-range {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
    align-items: center;
  }

  .custom-date-range .date-input {
    flex: 1 1 calc(50% - 1.5rem);
    min-width: 110px;
    font-size: 0.82rem;
    padding: 0.4rem 0.5rem;
  }

  .custom-date-range #apply-custom-date-btn {
    width: 100%;
    margin-top: 2px;
  }

  /* Product Filter Pills */
  .product-filter-pills {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding-bottom: 4px;
    width: 100%;
    scrollbar-width: none;
  }

  .product-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .product-filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.76rem !important;
    padding: 0.3rem 0.65rem !important;
  }

  /* Search Inputs */
  .search-filter-box,
  #order-search-input,
  #customers-search-input {
    width: 100% !important;
    min-width: 0;
  }

  /* Responsive Data Tables */
  .table-responsive,
  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    margin-bottom: 0.5rem;
  }

  .table-responsive::-webkit-scrollbar,
  .table-container::-webkit-scrollbar {
    height: 5px;
  }

  .table-responsive::-webkit-scrollbar-thumb,
  .table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
  }

  .data-table th,
  .data-table td {
    padding: 0.6rem 0.65rem;
    font-size: 0.78rem;
  }

  .data-table th {
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .data-table td .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
  }

  /* Modals as Responsive Bottom Sheets */
  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh;
    padding: 1.25rem 1rem;
    border-radius: 20px 20px 10px 10px;
    margin: 0;
  }

  .modal-header {
    margin-bottom: 0.85rem;
  }

  .modal-title {
    font-size: 1.05rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Settings and Form Grids */
  .settings-grid-form {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  /* Broadcast Targets Multi-Select Grid */
  #broadcast-form [style*="grid-template-columns: repeat(auto-fit, minmax(240px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  /* Menu Builder Layout on Mobile */
  .menu-builder-layout {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .menu-preview-col {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .tg-phone-mockup {
    max-width: 320px;
    margin: 0 auto;
    border-radius: 20px;
  }

  /* Toast notification */
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: calc(100% - 2rem);
    justify-content: center;
  }
}

@media (max-width: 480px) {
  /* Smaller screens (iPhone SE, Galaxy A series, etc.) */
  .top-nav-title {
    font-size: 0.88rem;
    max-width: 135px;
  }

  .top-nav-actions .live-status-pill:last-child {
    display: none;
  }

  .live-status-pill {
    padding: 2px 6px;
    font-size: 0.66rem;
  }

  .btn {
    padding: 0.55rem 0.9rem;
    font-size: 0.82rem;
  }

  .modal-card {
    padding: 1rem 0.75rem;
  }

  /* Make internal modal 2-col grids stack */
  .modal-card [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==============================================
   Premium WebUI Visual Polish & Modern Refinements
   ============================================== */

/* Global Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: rgba(9, 13, 22, 0.55);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

/* Enhanced Ambient Background Mesh */
body {
  background-image:
    radial-gradient(circle at 10% 8%, rgba(34, 158, 217, 0.11) 0%, transparent 38%),
    radial-gradient(circle at 88% 14%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 92%, rgba(16, 185, 129, 0.06) 0%, transparent 45%);
}

/* Sidebar & Top Navbar Glassmorphic Polish */
.app-sidebar {
  background: linear-gradient(180deg, rgba(11, 17, 32, 0.98) 0%, rgba(7, 11, 20, 0.99) 100%);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

.top-navbar {
  background: rgba(11, 17, 32, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.35);
}

/* Stacked Stat Cards (Reseller API & Overview Cards with .stat-header) */
.stat-card:has(.stat-header) {
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 1.15rem 1.35rem;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.stat-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.stat-card:has(.stat-header) .stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 1rem;
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Card & Surface Depth */
.card {
  background: linear-gradient(180deg, rgba(21, 31, 54, 0.82) 0%, rgba(13, 20, 36, 0.88) 100%);
  border: 1px solid rgba(255, 255, 255, 0.085);
  box-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.65), 0 1px 0 0 rgba(255, 255, 255, 0.07) inset;
}

/* Unified Form Controls (.form-control, .form-input, select) */
.form-control,
.form-input,
select.form-control,
select.form-input {
  background: rgba(11, 17, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  transition: all 0.2s ease;
  outline: none;
}

.form-control:hover,
.form-input:hover,
.search-input:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.form-control:focus,
.form-input:focus,
.search-input:focus {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.form-control::placeholder,
.form-input::placeholder,
.search-input::placeholder {
  color: rgba(148, 163, 184, 0.55);
}

select.form-control option,
select.form-input option {
  background: #0f172a;
  color: #f8fafc;
}

/* Table Container & Sticky Header Polish */
.table-container,
.table-responsive {
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: var(--radius-md);
  background: rgba(9, 14, 25, 0.55);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) inset;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.data-table td {
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  transition: background-color 0.15s ease;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.045);
}

/* Badges & Code Pills */
.badge {
  letter-spacing: 0.01em;
  line-height: 1.3;
  gap: 0.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Button Hover & Active Micro-Interactions */
.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #229ED9 0%, #0284c7 100%);
  box-shadow: 0 4px 14px rgba(34, 158, 217, 0.28), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.38), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Modal Card Elevation */
.modal-card {
  background: linear-gradient(180deg, #151f34 0%, #0d1424 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 28px 60px -12px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

/* ==============================================
   Out-of-Stock Red Styling & Specific Action Buttons
   ============================================== */

.badge-out-of-stock {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(252, 165, 165, 0.45) !important;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}

.product-row.is-out-of-stock td:first-child {
  border-left: 3px solid #ef4444;
}

.product-row.is-out-of-stock td,
.sub-product-row.is-out-of-stock td {
  background: rgba(239, 68, 68, 0.06);
}

.product-row.is-out-of-stock:hover td,
.sub-product-row.is-out-of-stock:hover td {
  background: rgba(239, 68, 68, 0.12) !important;
}

/* Status Toggle Buttons (Selling / Paused / Out of Stock) */
.btn-status-selling {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.28);
}

.btn-status-selling:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}

.btn-status-out {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: 1px solid rgba(252, 165, 165, 0.45);
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.35);
}

.btn-status-out:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  transform: translateY(-1px);
}

.btn-status-paused {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.btn-status-paused:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

/* Specific Row Action Button Color Styles */
.btn-action-view {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.btn-action-view:hover {
  background: rgba(16, 185, 129, 0.26);
  color: #fff;
  transform: translateY(-1px);
}

.btn-action-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-action-warn:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

.btn-action-plan {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.38);
  font-weight: 700;
}

.btn-action-plan:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
  transform: translateY(-1px);
}

.btn-action-edit {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.btn-action-edit:hover {
  background: rgba(56, 189, 248, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

.btn-action-stock {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-action-stock:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

.btn-action-delete {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.38);
}

.btn-action-delete:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}



