/* ==========================================================================
   TEE PEE'S TOASTED PASTILLAS INVENTORY MANAGEMENT SYSTEM (TPIS)
   CORE STYLESHEET (style.css)
   ==========================================================================
   TABLE OF CONTENTS:
   1.  CSS Variables & Theme Tokens (:root & html[data-theme="dark"])
   2.  Reset & Base Typography (html, body, reset)
   3.  Authentication / Login Module (.login-page, .login-left, .login-right)
   4.  Layout & Navigation (.app-layout, .sidebar, .top-header)
   5.  Shared Components & Utilities (Buttons, Modals, Badges, Tables, Forms)
   6.  Dashboard & Analytics Panels (.dashboard-panel, .stats-grid, .period-tabs)
   7.  Inventory & Warehouse Management (.inventory-grid, .stock-table)
   8.  Point of Sale Module (.pos-container, .pos-cart, .pos-grid)
   9.  Reports & Data Export Center (.report-card, .export-grid, .report-date-input)
   10. User & Role Management (.users-table, .role-badge)
   11. Notification Panel & System Status (.notif-panel, .alert-card)
   12. Responsive Design & Media Queries (@media screens)
   ========================================================================== */

:root {
  --primary: #F97316;
  --primary-dark: #EA6C0A;
  --primary-light: #FED7AA;
  --primary-bg: #FFF7ED;

  --sidebar-bg: #FFFFFF;
  --sidebar-text: #526176;
  --sidebar-active: #F97316;
  --sidebar-hover: rgba(249, 115, 22, 0.1);

  --bg-main: #F8F9FA;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;

  --text-dark: #1E293B;
  --text-medium: #475569;
  --text-light: #94A3B8;
  --text-muted: #64748B;

  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --success: #22C55E;
  --success-bg: #DCFCE7;
  --success-text: #166534;

  --warning: #F97316;
  --warning-bg: #FFF7ED;
  --warning-text: #9A3412;

  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --danger-text: #991B1B;

  --info: #3B82F6;
  --info-bg: #EFF6FF;
  --info-text: #1E40AF;

  --purple: #8B5CF6;
  --purple-bg: #F3F0FF;

  --teal: #14B8A6;
  --teal-bg: #F0FDFA;

  --sidebar-width: 260px;
  --sidebar-collapsed: 60px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --transition: all 0.2s ease;
}

html[data-theme="dark"] {
  --bg-main: #0F172A;
  --bg-white: #111827;
  --bg-card: #1E293B;
  --text-dark: #F8FAFC;
  --text-medium: #CBD5E1;
  --text-light: #94A3B8;
  --text-muted: #A8B5C7;
  --border: #334155;
  --border-light: #273449;
  --sidebar-bg: #111827;
  --sidebar-text: #CBD5E1;
  --sidebar-hover: rgba(249, 115, 22, 0.12);
  --primary-bg: #431407;
  --success-bg: #14532D;
  --success-text: #86EFAC;
  --warning-bg: #431407;
  --warning-text: #FDBA74;
  --danger-bg: #450A0A;
  --danger-text: #FCA5A5;
  --info-bg: #172554;
  --info-text: #93C5FD;
  --purple-bg: #2E1065;
  --purple-text: #C4B5FD;
  --teal-bg: #042F2E;
  --teal-text: #5EEAD4;
  --gray-bg: #334155;
  --gray-text: #CBD5E1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
  background-color: #0F172A;
}

/* Kill all transitions while switching themes so colors update instantly */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-main);
  color-scheme: light;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  outline: none;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  display: flex;
  min-height: 100vh;
  background: #fff;
}

/* Login - Left Panel */
.login-left {
  width: 45%;
  background: var(--primary);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.login-left::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -60px;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.login-brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.left-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: #fff;
}

.login-brand-name {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.login-brand-sub {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.78rem;
}

.login-hero {
  z-index: 1;
}

.login-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 14px;
}

.login-hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 340px;
}

.login-stats {
  display: flex;
  gap: 24px;
  z-index: 1;
}

.login-stat {
  color: #fff;
}

.login-stat-number {
  font-size: 1.6rem;
  font-weight: 800;
}

.login-stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}

/* Login - Right Panel */
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-wrap {
  width: 100%;
  max-width: 380px;
}

.login-form-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.form-icon {
  width: 44px;
  height: 44px;
  color: var(--primary);
  border-radius: var(--radius-md);
}

.login-form-wrap h2 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.login-form-wrap .login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.input-wrap input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-dark);
  background: #fff;
  transition: var(--transition);
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 6px 0 16px;
  font-size: 0.84rem;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-medium);
  cursor: pointer;
  user-select: none;
  font-size: 0.84rem;
}

.remember-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.login-forgot {
  padding: 2px 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.login-forgot:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  transition: var(--transition);
}

.btn-login:hover {
  background: var(--primary-dark);
}

.login-demo {
  text-align: center;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Login Validation States */

/* Toast popup */
.login-toast {
  display: none;
  padding: 10px 16px;
  margin-top: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  animation: toastSlideIn 0.3s ease;
}

.login-toast.visible {
  display: block;
}

.login-toast.toast-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger);
}

.login-toast.toast-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success);
}

.login-toast.toast-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning);
}

/* Field-level validation */
.form-group .field-error-text {
  display: none;
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 5px;
  padding-left: 2px;
  animation: toastSlideIn 0.25s ease;
}

.form-group .field-error-text.visible {
  display: block;
}

.form-group.has-error .input-wrap input {
  border-color: var(--danger);
  background: #FEF2F2;
}

.form-group.has-error .input-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
}

.form-group.has-error .input-wrap svg {
  color: var(--danger);
}

.form-group.has-error label {
  color: var(--danger);
}

/* Button loading state */
.btn-login {
  position: relative;
  overflow: hidden;
}

.btn-login.loading {
  pointer-events: none;
  opacity: 0.85;
  color: transparent;
}

.btn-login.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loginSpinner 0.65s linear infinite;
}

/* Shake animation for failed login */
@keyframes loginShake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  50%,
  90% {
    transform: translateX(-6px);
  }

  30%,
  70% {
    transform: translateX(6px);
  }
}

.login-form-wrap.shake {
  animation: loginShake 0.5s ease;
}

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

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  min-height: 64px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

/* Logo image sizing inside the sidebar brand */
.sidebar-brand-icon img,
.sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 4px;
}

.sidebar-brand-text .brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
}

.sidebar-brand-text .brand-sub {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-close {
  background: none;
  color: var(--sidebar-text);
  padding: 4px;
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  color: var(--text-dark);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--sidebar-text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  border-radius: 0;
  text-decoration: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  padding: 11px 10px;
}

.supplier-module-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.supplier-subnav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 4px 0;
  border-left: 1px solid var(--border);
}

.supplier-subnav-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.supplier-subnav-link:hover,
.supplier-subnav-link.active {
  color: var(--primary);
  background: var(--sidebar-hover);
  border-left-color: var(--primary);
}

.supplier-module-content>.supplier-module-section,
.supplier-module-content>.supplier-directory-support {
  margin-bottom: 0;
}

.purchase-order-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-icon-only {
  width: 34px;
  min-width: 34px;
  padding: 0;
  justify-content: center;
}

.btn-icon-only svg {
  width: 16px;
  height: 16px;
}

.purchase-order-menu-wrap {
  position: relative;
}

.purchase-order-menu {
  display: none;
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  min-width: 180px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.purchase-order-menu.open {
  display: grid;
  gap: 2px;
}

.purchase-order-menu button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dark);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.purchase-order-menu button:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.purchase-order-menu button.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.purchase-order-menu-empty {
  display: block;
  padding: 9px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.inventory-actions {
  display: inline-flex;
  align-items: center;
}

.action-menu-trigger svg {
  width: 16px;
  height: 16px;
}

.action-menu {
  display: none;
  position: fixed;
  z-index: 20;
  min-width: 180px;
  padding: 6px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(28, 35, 51, 0.16);
}

.action-menu.open {
  display: grid;
  gap: 2px;
}

.action-menu button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dark);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.action-menu button:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.action-menu button.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.recipe-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recipe-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.recipe-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .supplier-module-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .supplier-subnav {
    width: 220px;
  }
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-label {
  display: none;
}

.sidebar.collapsed .sidebar-brand-icon {
  margin: 0 auto;
}

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

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px;
}

.sidebar.collapsed .nav-item.active {
  margin: 2px 6px;
  padding: 11px;
  justify-content: center;
}

.sidebar.collapsed .sidebar-close {
  display: none !important;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 32px;
  transition: margin-left 0.25s ease;
  min-height: 100vh;
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed);
}

/* Page Header */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  text-decoration: none;
  color: inherit;
}

.txn-row:hover td {
  background: var(--surface);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.blue {
  background: #EFF6FF;
  color: #3B82F6;
}

.stat-icon.green {
  background: #F0FDF4;
  color: #22C55E;
}

.stat-icon.orange {
  background: #FFF7ED;
  color: #F97316;
}

.stat-icon.purple {
  background: #F3F0FF;
  color: #8B5CF6;
}

.stat-icon.red {
  background: #FEF2F2;
  color: #EF4444;
}

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

.stat-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 2px;
}

.stat-badge svg {
  width: 12px;
  height: 12px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-main);
}

tbody td {
  padding: 12px 14px;
  font-size: 0.86rem;
  color: var(--text-dark);
  white-space: nowrap;
}

.txn-id {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.txn-id:hover {
  text-decoration: underline;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-purple {
  background: var(--purple-bg);
  color: var(--purple-text, #5B21B6);
}

.badge-gray {
  background: var(--gray-bg, #F1F5F9);
  color: var(--gray-text, #475569);
}

.badge-teal {
  background: var(--teal-bg);
  color: var(--teal-text, #0F766E);
}

/* Type Badges */
.type-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.type-retail {
  background: var(--purple-bg);
  color: var(--purple-text, #5B21B6);
}

.type-wholesale {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: var(--bg-white);
  color: var(--text-dark);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 7px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
}

.btn-icon:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.btn-icon.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1800;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: clamp(280px, 22vw, 420px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-radius: 0.85rem;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.95);
  font-size: 0.95rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

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

.toast-success {
  background: #22c55e;
}

.toast-danger {
  background: #ef4444;
}

.toast-warning {
  background: #f59e0b;
}

.toast-info {
  background: #0ea5e9;
}

/* ============================================
   SEARCH & FILTER BAR
   ============================================ */
.search-bar {
  position: relative;
  flex: 1;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-light);
}

.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  background: var(--bg-white);
  color: var(--text-dark);
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-main);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
}

.filter-tab:not(.active):hover {
  color: var(--text-dark);
}

/* ============================================
   DASHBOARD MODULES
   ============================================ */
.dashboard-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

.dashboard-subnav {
  display: flex;
  flex-direction: column;
}

.dashboard-subnav-title {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.dashboard-subnav-title:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dashboard-subnav-title:last-child {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dashboard-subnav-title span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dashboard-subnav-title svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.dashboard-subnav-title.active {
  background: #FFF1E8;
  color: var(--primary);
}

.dashboard-alert-count {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #F97316;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-module-content {
  min-width: 0;
}

.dashboard-module-view {
  display: none;
}

.dashboard-module-view.active {
  display: block;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
}

.chart-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-card-title svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

/* ============================================
   LOW STOCK ALERTS
   ============================================ */
.alerts-transactions-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 16px;
  margin-bottom: 24px;
}

.alert-item {
  position: relative;
  padding: 18px 18px 16px 20px;
  border: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.alert-item:hover {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--primary);
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.alert-type-out-of-stock::before,
.alert-type-dead-stock-expired::before {
  background: var(--danger);
}

.alert-type-expiring-soon::before {
  background: #3B82F6;
}

.alert-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.alert-item-type {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(234, 88, 12, 0.15);
  color: #FB923C;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.alert-type-out-of-stock .alert-item-type,
.alert-type-dead-stock-expired .alert-item-type {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
}

.alert-type-expiring-soon .alert-item-type {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
}

.alert-item-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-dark);
}

.alert-item-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 5px 0 8px;
}

.alert-item-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
}

.alert-qty-current {
  color: var(--primary);
  font-weight: 600;
}

.alert-qty-min {
  color: var(--text-muted);
}

/* ============================================
   WAREHOUSE / INVENTORY
   ============================================ */
.warehouse-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

.warehouse-subnav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.warehouse-subnav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.warehouse-subnav-title:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.warehouse-subnav-title:last-child {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.warehouse-subnav-title>span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.warehouse-subnav-title svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.warehouse-subnav-title.active {
  background: #FFF1E8;
  color: var(--primary);
}

.warehouse-subnav-chevron,
.warehouse-recipe-count,
.warehouse-alert-count {
  color: var(--primary);
  font-weight: 700;
}

.warehouse-module-content {
  min-width: 0;
}

.warehouse-module-view {
  display: none;
  margin: 0;
}

.warehouse-module-view.active {
  display: block;
}

.warehouse-alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.warehouse-alert-row:last-child {
  border-bottom: 0;
}

.warehouse-alert-row:hover .alert-mini-label {
  color: var(--primary);
}

.warehouse-alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-light);
}

.warehouse-alert-item strong,
.warehouse-alert-item span {
  display: block;
}

.warehouse-alert-item span,
.warehouse-alert-detail {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.warehouse-alert-detail {
  margin-top: 0;
  text-align: right;
}

.warehouse-alert-empty {
  margin: 0;
  color: var(--text-muted);
  text-align: center;
}

.warehouse-category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.warehouse-category-row label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.warehouse-category-row .category-select {
  width: 220px;
}

.category-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.category-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: var(--transition);
}

.category-select:focus {
  outline: 2px solid rgba(249, 115, 22, 0.25);
  border-color: var(--primary);
}

.category-select:hover {
  border-color: var(--primary);
  color: var(--text-dark);
}

/* ============================================
   USER MANAGEMENT MODULES
   ============================================ */
.user-module-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.user-subnav {
  display: flex;
  flex-direction: column;
}

.user-subnav-title {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.user-subnav-title:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-subnav-title:last-child {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.user-subnav-title:hover,
.user-subnav-title.active {
  background: #FFF1E8;
  color: var(--primary);
}

html[data-theme="dark"] .user-subnav-title:hover,
html[data-theme="dark"] .user-subnav-title.active {
  background: #431407;
}

html[data-theme="dark"] .appearance-theme-select,
html[data-theme="dark"] .appearance-product-control select {
  color: var(--text-dark);
  background-color: var(--bg-white);
}

html[data-theme="dark"] .appearance-theme-select option,
html[data-theme="dark"] .appearance-product-control select option {
  color: var(--text-dark);
  background-color: var(--bg-white);
}

.user-module-content {
  min-width: 0;
}

.user-module-view {
  display: none;
  margin-bottom: 0;
}

.user-module-view.active {
  display: block;
}

.appearance-settings {
  padding: 24px;
}

.appearance-settings-description {
  margin: 4px 0 22px;
  color: var(--text-muted);
}

.appearance-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--border-light);
}

.appearance-setting-row h3 {
  color: var(--text-dark);
  font-size: 0.92rem;
  margin-bottom: 3px;
}

.appearance-setting-row p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.appearance-theme-select {
  width: 160px;
  color: var(--text-dark);
  background-color: var(--bg-white);
}

.appearance-theme-select option,
.appearance-product-control select option {
  color: var(--text-dark);
  background-color: var(--bg-white);
}

.appearance-logo-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.appearance-logo-preview {
  width: 52px;
  height: 52px;
  padding: 5px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.appearance-product-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.appearance-product-control select {
  width: 190px;
  color: var(--text-dark);
  background-color: var(--bg-white);
}

.appearance-product-preview {
  width: 52px;
  height: 52px;
  padding: 4px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

@media (max-width: 768px) {
  .user-module-layout {
    grid-template-columns: 1fr;
  }

  .appearance-setting-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .appearance-logo-control {
    justify-content: flex-start;
  }

  .appearance-product-control {
    justify-content: flex-start;
  }
}

.alerts-mini {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 14px;
}

.alerts-mini-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alerts-mini-title svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.alert-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.alert-mini-label {
  color: var(--text-muted);
}

.alert-mini-count {
  font-weight: 700;
  color: var(--primary);
}

/* ============================================
   POS PAGE
   ============================================ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  height: calc(100vh - 96px);
}

.pos-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pos-products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  overflow-y: auto;
}

.pos-product-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.pos-product-card.is-out-of-stock {
  opacity: 0.68;
  cursor: not-allowed !important;
}

.pos-product-card.is-out-of-stock:hover {
  border-color: var(--border);
  box-shadow: none;
}

.pos-product-emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: block;
  width: 64px;
  height: 64px;
  background: var(--primary-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.pos-product-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.pos-product-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.pos-product-availability {
  min-height: 18px;
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 700;
}

.pos-product-availability.in-stock {
  color: #15803D;
}

.pos-product-availability.low {
  color: #C2410C;
}

.pos-product-availability.out {
  color: #B91C1C;
}

.pos-product-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

/* POS Order Panel */
.order-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.order-panel-header svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.order-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.order-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  gap: 8px;
  padding: 40px 0;
}

.order-empty svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.order-empty p {
  font-size: 0.86rem;
  text-align: center;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.order-item:last-child {
  border-bottom: none;
}

.order-item-image {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.order-item-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-dark);
}

.order-item-price {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
}

.order-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dark);
  transition: var(--transition);
}

.qty-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.qty-display {
  font-size: 0.86rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.qty-input {
  width: 40px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-dark);
  -moz-appearance: textfield;
  padding: 0;
  box-sizing: border-box;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input:focus {
  border-color: var(--primary);
  outline: none;
}

.order-panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.order-totals {
  margin-bottom: 14px;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.order-total-row.grand {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1.5px solid var(--border);
}

.order-total-row.grand .total-amount {
  color: var(--primary);
  font-size: 1.1rem;
}

.btn-checkout {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}

.btn-checkout:hover {
  background: var(--primary-dark);
}

.btn-receipt {
  width: 100%;
  padding: 11px;
  background: var(--bg-card);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-receipt svg {
  width: 14px;
  height: 14px;
}

.btn-receipt:hover {
  background: var(--primary-bg);
}

/* ============================================
   ANALYTICS PAGE
   ============================================ */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-submodule {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.analytics-submodule-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 4px 0;
  color: var(--text-dark);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.analytics-submodule-title svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

.analytics-submodule-content {
  min-width: 0;
}

.analytics-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.analytics-subnav {
  display: flex;
  flex-direction: column;
}

.analytics-subnav-title {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
}

.analytics-subnav-title:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.analytics-subnav-title:last-child {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.analytics-subnav-title span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.analytics-subnav-title svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.analytics-subnav-title.active {
  background: #FFF1E8;
  color: var(--primary);
}

.analytics-module-content {
  min-width: 0;
}

.analytics-module-view {
  display: none;
}

.analytics-module-view.active {
  display: block;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
}

.kpi-card.orange {
  background: var(--primary);
}

.kpi-card.green {
  background: #16A34A;
}

.kpi-card.blue {
  background: #2563EB;
}

.kpi-label {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 8px;
}

.kpi-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Peak Sales Heatmap */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
}

.heatmap-table th {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  border: none;
  padding: 4px;
}

.heatmap-table td {
  border: none;
  padding: 2px;
}

.heatmap-table td:first-child {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 40px;
  text-align: left;
}

.heatmap-cell {
  width: 52px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: default;
}

/* ============================================
   SUPPLIERS PAGE
   ============================================ */
.supplier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.supplier-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
}

.supplier-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.supplier-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.supplier-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.supplier-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #F59E0B;
  background: #FFFBEB;
  padding: 3px 8px;
  border-radius: 20px;
}

.supplier-rating svg {
  width: 12px;
  height: 12px;
}

.supplier-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.supplier-contact-row svg {
  width: 13px;
  height: 13px;
  color: var(--primary);
  flex-shrink: 0;
}

.supplier-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}

.btn-create-po {
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  background: #fff;
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 600;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-create-po:hover {
  background: var(--primary);
  color: #fff;
}

/* ============================================
   REPORTS PAGE
   ============================================ */
.report-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.report-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.report-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-card-icon.orange {
  background: #FFF7ED;
  color: var(--primary);
}

.report-card-icon.blue {
  background: var(--info-bg);
  color: var(--info);
}

.report-card-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.report-card-icon.purple {
  background: var(--purple-bg);
  color: var(--purple);
}

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

.report-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.report-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.report-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-generate {
  flex: 1;
  padding: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 0.83rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-generate:hover {
  background: var(--primary-dark);
}

.btn-dl {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}

.btn-dl svg {
  width: 14px;
  height: 14px;
}

.btn-dl:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card);
}

/* Export Options */
.export-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-dark);
}

.export-btn svg {
  width: 18px;
  height: 18px;
}

.export-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.export-btn.pdf {
  color: #EF4444;
}

.export-btn.excel {
  color: #22C55E;
}

.export-btn.csv {
  color: #3B82F6;
}

/* Access Control */
.access-backup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.role-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.role-item:last-child {
  border-bottom: none;
}

.role-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
}

.role-perm {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.user-count-badge {
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
}

.backup-item:last-child {
  border-bottom: none;
}

.backup-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.backup-time svg {
  width: 13px;
  height: 13px;
}

.backup-size {
  font-size: 0.75rem;
  color: var(--text-light);
}

.backup-status {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 600;
}

.backup-status svg {
  width: 14px;
  height: 14px;
}

/* System Status */
.system-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.system-stat {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
}

.system-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.system-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
}

.system-stat-value.excellent {
  color: var(--success);
}

.system-stat-value.blue {
  color: var(--info);
}

.system-stat-value.purple {
  color: var(--purple);
}

.system-stat-value.orange {
  color: var(--primary);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  z-index: 1200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  justify-content: center;
  border-radius: 4px;
  display: flex;
  align-items: center;
  margin-left: auto;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.modal-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(2, 6, 23, 0.72);
}

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-dark);
  transition: var(--transition);
  background: var(--bg-white);
}

.form-control[readonly],
.form-control:disabled {
  background: var(--bg-main) !important;
  color: var(--text-dark) !important;
  opacity: 0.85;
  cursor: not-allowed;
}

#approveStatusHint.full-delivery {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

#approveStatusHint.partial-delivery {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

html[data-theme="dark"] #approveStatusHint.full-delivery {
  background: rgba(22, 101, 52, 0.25) !important;
  color: #86EFAC !important;
  border-color: #166534 !important;
}

html[data-theme="dark"] #approveStatusHint.partial-delivery {
  background: rgba(154, 52, 18, 0.25) !important;
  color: #FDBA74 !important;
  border-color: #9A3412 !important;
}

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

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ============================================
   DELIVERY MONITORING & RESTOCKING
   ============================================ */
.delivery-restock-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.delivery-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.delivery-item:last-child {
  border-bottom: none;
}

.delivery-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.delivery-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
}

.delivery-products {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.delivery-expected {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

.restock-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.restock-item:last-child {
  border-bottom: none;
}

.restock-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.restock-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
}

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

.restock-qty {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

/* ============================================
   ANALYTICS PERIOD TABS
   ============================================ */
.period-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-medium);
  transition: var(--transition);
}

.period-tab svg {
  width: 13px;
  height: 13px;
}

.period-tab.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

.period-tab:not(.active):hover {
  border-color: var(--primary);
  color: var(--primary);
}

html[data-theme="dark"] .period-tab:not(.active) {
  background: var(--bg-card);
  color: var(--text-medium);
  border-color: var(--border);
}

html[data-theme="dark"] .period-tab:not(.active):hover {
  border-color: var(--primary);
  color: #fff;
}

.report-date-input {
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dark);
  color-scheme: light dark;
}

.report-date-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ============================================
   VERIFIED ICON
   ============================================ */
.verified-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.verified-icon svg {
  width: 16px;
  height: 16px;
}

.verified-icon.yes {
  color: var(--success);
}

.verified-icon.no {
  color: var(--text-light);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

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

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .warehouse-layout {
    grid-template-columns: 1fr;
  }

  .category-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .report-cards-grid {
    grid-template-columns: 1fr;
  }

  .access-backup-grid {
    grid-template-columns: 1fr;
  }

  .delivery-restock-grid {
    grid-template-columns: 1fr;
  }

  .analytics-submodule {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .analytics-layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }

  .analytics-submodule {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .analytics-submodule-title {
    padding: 0 4px;
  }

  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .system-status-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .page-header-row {
    flex-direction: column;
    gap: 12px;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .pos-products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  color: var(--text-dark);
  position: fixed;
  top: 20px;
  left: 16px;
  z-index: 99;
  box-shadow: var(--shadow-sm);
}

.mobile-menu-btn svg {
  width: 18px;
  height: 18px;
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* Page visibility */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Section spacing */
.section-mb {
  margin-bottom: 24px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ============================================
   SCROLLBAR GLOBAL
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Tooltip */
[title] {
  position: relative;
}

/* Transition pages */
.page-transition {
  animation: pageIn 0.2s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   REALTIME INVENTORY ALERTS MODAL PREMIUM STYLING
   ============================================ */
.inventory-alerts-modal {
  max-width: 540px !important;
  border-radius: 24px !important;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-overlay {
  backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.56) !important;
}

html[data-theme="dark"] .modal,
html[data-theme="dark"] .inventory-alerts-modal {
  background: var(--bg-card);
  color: var(--text-dark);
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(2, 6, 23, 0.72) !important;
}

/* Header style modifications */
.alerts-header-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #FEF2F2;
  border: 1px solid #FEE2E2;
  color: #EF4444;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Alert Cards inside modal */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-left-width: 5px !important;
  /* Thick left vertical border */
  position: relative;
  transition: box-shadow 0.2s ease;
  text-align: left;
}

.inventory-notification-stack {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1800;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(420px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  pointer-events: none;
}

.inventory-notification {
  margin: 0;
  padding-right: 42px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: pan-y;
  opacity: 1;
  transform: translate3d(var(--swipe-x, 0px), 0, 0) rotate(var(--swipe-rotation, 0deg));
  animation: inventoryNotificationIn 0.24s ease-out both;
  transition: opacity 0.2s ease, transform 0.22s ease, box-shadow 0.2s ease;
}

.inventory-notification-dismissed {
  opacity: 0;
  transform: translate3d(var(--swipe-x, 110%), 0, 0) rotate(var(--swipe-rotation, 0deg));
}

@keyframes inventoryNotificationIn {
  from {
    opacity: 0;
    transform: translate3d(28px, 0, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.inventory-notification-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748B;
  cursor: pointer;
}

.inventory-notification-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #1E293B;
}

.inventory-notification-close svg {
  width: 16px;
  height: 16px;
}

.alert-card:not(.inventory-notification):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.inventory-notification:hover {
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.dashboard-alerts-more-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: #1E293B;
  color: #E2E8F0;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 9999px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease, opacity 0.2s ease, transform 0.22s ease;
  align-self: flex-end;
  animation: inventoryNotificationIn 0.24s ease-out both;
}

.dashboard-alerts-more-pill:hover {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #3B82F6;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.dashboard-alerts-more-pill svg {
  flex-shrink: 0;
}

/* Alert Severities */
.alert-card.severity-red {
  border-left-color: #EF4444 !important;
  background: #FFF1F2;
  border-color: #FECDD3;
}

.alert-card.severity-orange {
  border-left-color: #F97316 !important;
  background: #FFF7ED;
  border-color: #FED7AA;
}

.alert-card.severity-blue {
  border-left-color: #3B82F6 !important;
  background: #EFF6FF;
  border-color: #BFDBFE;
}

/* Icons inside alert cards */
.alert-card-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.severity-red .alert-card-icon-wrap {
  background: #FEE2E2;
  color: #EF4444;
}

.severity-orange .alert-card-icon-wrap {
  background: #FFEDD5;
  color: #F97316;
}

.severity-blue .alert-card-icon-wrap {
  background: #DBEAFE;
  color: #3B82F6;
}

/* Content Layout inside card */
.alert-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alert-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0;
}

.alert-card-date {
  flex-shrink: 0;
  color: #64748B;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.alert-card-product {
  color: #334155;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.alert-card-message {
  font-size: 0.8rem;
  color: #64748B;
  font-weight: 500;
  line-height: 1.45;
  margin: 0;
}

/* Type Pill Badges */
.alert-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 2px;
}

.severity-red .alert-card-badge {
  background: #FEE2E2;
  color: #991B1B;
}

.severity-orange .alert-card-badge {
  background: #FFEDD5;
  color: #9A3412;
}

.severity-blue .alert-card-badge {
  background: #DBEAFE;
  color: #1E40AF;
}

/* Acknowledge Button Footer style */
.btn-acknowledge {
  width: 100%;
  padding: 14px !important;
  background: #F97316 !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-acknowledge:hover {
  background: #EA6C0A !important;
}

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

/* ============================================
   PEAK SALES PERIOD ANALYSIS STYLING
   ============================================ */
.peak-period-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.peak-period-tab.active {
  background: #F97316;
  color: #ffffff;
}

.peak-period-tab:not(.active):hover {
  background: #E2E8F0;
  color: var(--text-dark);
}

/* Tooltip Slate Popover */
.heatmap-tooltip {
  position: absolute;
  z-index: 1000;
  background: #1E293B;
  /* Slate 800 */
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  font-family: inherit;
  pointer-events: none;
  /* Let pointer events pass through to prevent flicker */
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.heatmap-tooltip-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.heatmap-tooltip-day {
  font-weight: 700;
  font-size: 0.85rem;
}

.heatmap-tooltip-badge {
  background: #F97316;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.heatmap-tooltip-count {
  font-size: 0.8rem;
  color: #CBD5E1;
  font-weight: 600;
  margin: 0;
}

.heatmap-tooltip-list {
  max-height: 120px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Custom Scrollbar for list */
.heatmap-tooltip-list::-webkit-scrollbar {
  width: 4px;
}

.heatmap-tooltip-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.heatmap-tooltip-item {
  font-size: 0.78rem;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.heatmap-tooltip-bullet {
  width: 5px;
  height: 5px;
  background: #F97316;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Heatmap Table Cell styling */
.heatmap-cell {
  width: 44px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 10;
}

.kpi-card-white {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card-white:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
}

/* Heptagon Demand Heatmap Styling */
.heptagon-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #FFFFFF;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  transform: translate(-50%, -110%);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.heptagon-tooltip .tooltip-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.heptagon-tooltip .tooltip-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demand-heatmap-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--bg-hover);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.heat-scale-box {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.heat-scale-labels {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demand-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dark);
  transition: background-color 0.15s ease;
}

.demand-legend-item:hover,
.demand-legend-item.active {
  background: var(--bg-hover);
}

/* ============================================
   RESPONSIVE LAYOUT & MOBILE DRAWER STYLES
   ============================================ */

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Hamburger Menu Toggle Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 990;
  background: var(--sidebar-bg);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.mobile-menu-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

/* Table Responsiveness */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

/* Tablet & Mobile Viewports (max-width: 992px) */
@media (max-width: 992px) {
  .inventory-notification-stack {
    top: 16px;
    right: 16px;
    width: min(400px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    z-index: 1000 !important;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .sidebar-close {
    display: flex !important;
    cursor: pointer;
  }

  .main-content,
  .main-content.expanded {
    margin-left: 0 !important;
    padding: 70px 16px 24px 16px !important;
    width: 100% !important;
  }

  /* Grid Responsive Adjustments */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px !important;
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* POS Responsive Layout */
  .pos-container,
  .pos-layout {
    flex-direction: column !important;
    gap: 16px !important;
  }

  .pos-left,
  .pos-right,
  .pos-cart-panel,
  .order-panel {
    width: 100% !important;
  }

  .pos-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 12px !important;
  }

  /* Login Page Responsive */
  .login-page {
    flex-direction: column !important;
  }

  .login-left {
    width: 100% !important;
    padding: 30px 20px !important;
    min-height: auto !important;
  }

  .login-right {
    width: 100% !important;
    padding: 30px 20px !important;
  }

  .login-hero h1 {
    font-size: 1.6rem !important;
  }

  .login-stats {
    flex-wrap: wrap !important;
    gap: 16px !important;
  }

  /* Modal Dialog Responsiveness */
  .modal-content {
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Small Mobile Phones (max-width: 576px) */
@media (max-width: 576px) {
  .inventory-notification-stack {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .inventory-notification {
    gap: 12px;
    padding: 14px 42px 14px 14px;
  }

  .alert-card-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

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

  .page-header-row,
  .filter-bar,
  .actions-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .page-header h1 {
    font-size: 1.35rem !important;
  }

  .stat-card {
    padding: 16px !important;
  }

  table {
    min-width: 550px;
  }

  .pos-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}


/* ============================================
   NOTIFICATION BELL + PANEL
   ============================================ */
.notif-bell-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: center;
}

.notif-bell-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  color: var(--text-medium);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
  box-shadow: var(--shadow-sm);
}

.notif-bell-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.notif-bell-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.notif-bell-btn[aria-expanded="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
}

.notif-bell-btn[aria-expanded="true"] svg {
  transform: rotate(-10deg) scale(1.05);
}

/* Animated badge count */
.notif-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-main);
  animation: notifBadgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: none;
}

@keyframes notifBadgePop {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Dropdown panel */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  width: min(380px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: top right;
  animation: none;
}

.notif-panel--open {
  display: flex;
  animation: notifPanelIn 0.2s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes notifPanelIn {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(-8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.notif-panel-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.notif-panel-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.notif-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  max-height: 480px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-panel-body::-webkit-scrollbar {
  width: 4px;
}

.notif-panel-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Cards inside the panel — no swipe animation, slightly smaller */
.notif-panel-card {
  animation: notifCardIn 0.18s ease both;
  cursor: pointer;
  pointer-events: auto;
}

.notif-panel-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

@keyframes notifCardIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dismiss button inside panel card */
.notif-panel-card-dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.notif-panel-card-dismiss:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-dark);
}

.notif-panel-card-dismiss svg {
  width: 14px;
  height: 14px;
}

/* Empty state */
.notif-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

.notif-panel-empty svg {
  width: 36px;
  height: 36px;
  opacity: 0.4;
}

/* Dark theme overrides for panel */
html[data-theme="dark"] .notif-panel {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .notif-panel-card-dismiss:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .alert-card.severity-red {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

html[data-theme="dark"] .alert-card.severity-orange {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
}

html[data-theme="dark"] .alert-card.severity-blue {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

html[data-theme="dark"] .alert-card-title {
  color: var(--text-dark);
}

html[data-theme="dark"] .alert-card-product {
  color: var(--text-medium);
}

html[data-theme="dark"] .alert-card-message {
  color: var(--text-muted);
}

/* Responsive: on mobile, bell panel goes full-width */
@media (max-width: 480px) {
  .notif-panel {
    right: -16px;
    width: calc(100vw - 16px);
  }
}

/* ============================================
   RESPONSIVE REFINEMENTS
   Keep the desktop information hierarchy while
   giving smaller screens room to breathe.
   ============================================ */
@media (min-width: 769px) and (max-width: 1100px) {

  .main-content,
  .main-content.expanded {
    padding: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-layout,
  .analytics-submodule {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    background: var(--bg-card);
    color: var(--text-dark);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .mobile-menu-btn:hover {
    background: var(--primary);
    color: #fff;
  }

  .main-content,
  .main-content.expanded {
    padding: 72px 20px 28px !important;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .page-header-row {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-header h1 {
    font-size: clamp(1.35rem, 4vw, 1.65rem);
  }

  .page-header p {
    max-width: 60ch;
  }

  .stats-grid,
  .analytics-kpi-grid,
  .system-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .card-body {
    padding: 16px;
  }

  .toolbar,
  .filter-bar,
  .actions-bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .supplier-module-layout {
    grid-template-columns: 1fr;
  }

  .supplier-subnav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    scrollbar-width: thin;
  }

  .supplier-subnav-link {
    width: auto;
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 9px 12px;
  }

  .supplier-subnav-link:hover,
  .supplier-subnav-link.active {
    border-bottom-color: var(--primary);
  }

  .table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: 16px;
  }

  .table-wrap table {
    margin-bottom: 0;
  }

  .modal-content {
    width: min(640px, calc(100vw - 32px));
  }
}

@media (max-width: 576px) {

  .main-content,
  .main-content.expanded {
    padding: 68px 14px 22px !important;
  }

  .mobile-menu-btn {
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
  }

  .page-header,
  .page-header-row {
    gap: 10px;
    margin-bottom: 18px;
  }

  .page-header h1 {
    font-size: 1.35rem !important;
  }

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

  .page-header-row>*,
  .toolbar>.search-bar,
  .toolbar>.filter-tabs {
    max-width: 100%;
  }

  .stats-grid,
  .analytics-kpi-grid,
  .system-status-grid,
  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .stat-card {
    padding: 15px 16px !important;
  }

  .card-body {
    padding: 14px;
  }

  .card-title {
    margin-bottom: 12px;
  }

  .toolbar,
  .filter-bar,
  .actions-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar>*,
  .filter-bar>*,
  .actions-bar>*,
  .toolbar .search-bar,
  .search-bar {
    width: 100%;
    max-width: none;
  }

  .filter-tabs {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  .table-wrap {
    overflow-x: auto;
    max-width: calc(100vw - 28px);
  }

  .table-wrap table {
    min-width: 600px;
  }

  .table-wrap .heatmap-table {
    min-width: max-content;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-content {
    width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 24px);
    margin: 12px auto !important;
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: 14px !important;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer>button {
    flex: 1 1 130px;
  }

  .login-page {
    min-height: 100dvh;
  }

  .login-left {
    padding: 24px 20px !important;
    gap: 24px;
  }

  .login-hero h1 {
    font-size: 1.5rem !important;
  }

  .login-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .login-stat-number {
    font-size: 1.25rem;
  }

  .login-stat-label {
    font-size: 0.68rem;
  }

  .login-right {
    padding: 28px 20px !important;
  }

  .login-form-wrap .login-subtitle {
    margin-bottom: 24px;
  }
}

@media (max-width: 360px) {

  .main-content,
  .main-content.expanded {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

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

  .login-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
}

/* Mobile and tablet sign-in: compact, branded, and touch friendly. */
@media (max-width: 992px) {
  .login-page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column !important;
    justify-content: flex-start;
    overflow: hidden;
    background-color: #fbefe2;
    background-image: linear-gradient(180deg, rgba(255, 248, 239, 0.82) 0%, rgba(255, 248, 239, 0.42) 44%, rgba(255, 248, 239, 0.02) 100%), url('../images/mobile-login-bg.png');
    background-position: center, center bottom;
    background-size: cover;
    background-repeat: no-repeat;
  }

  .login-left {
    width: 100% !important;
    min-height: 220px !important;
    padding: 22px 20px 26px !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    background: transparent;
    text-align: center;
  }

  .login-left::before,
  .login-left::after {
    display: none;
  }

  .login-brand {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    white-space: normal;
  }

  .login-brand-icon {
    width: 64px;
    height: 64px;
    overflow: hidden;
    border: 2px solid rgba(174, 91, 34, 0.25);
    border-radius: 50%;
    background: #fffaf3;
    box-shadow: 0 5px 16px rgba(110, 62, 24, 0.12);
  }

  .left-logo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
  }

  .login-brand-name {
    color: #853b19;
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .login-brand-sub {
    margin-top: 1px;
    color: #b65a22;
    font-size: 0.8rem;
  }

  .login-hero {
    margin-top: 1px;
  }

  .login-hero h1 {
    display: none;
  }

  .login-hero p {
    color: #66574c;
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .mobile-copy-break {
    display: none;
  }

  .login-stats {
    display: none !important;
  }

  .login-right {
    width: 100% !important;
    flex: 1 0 auto;
    align-items: flex-start;
    padding: 0 16px 24px !important;
  }

  .login-form-wrap {
    width: 100%;
    max-width: 500px;
    margin: -12px auto 0;
    padding: 20px 20px 18px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 44px rgba(72, 45, 25, 0.16);
    backdrop-filter: blur(14px);
  }

  .login-form-icon {
    display: none;
  }

  .login-form-wrap h2 {
    margin-bottom: 2px;
    color: #17283e;
    font-size: 1.16rem;
  }

  .login-form-wrap .login-subtitle {
    margin-bottom: 16px;
    color: #667085;
    font-size: 0.76rem;
  }

  .login-form-wrap .form-group {
    position: relative;
    margin-bottom: 9px;
  }

  .login-form-wrap .form-group label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .login-form-wrap .input-wrap input {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
    border-width: 1px;
    border-radius: 9px;
    background: rgba(249, 250, 251, 0.92);
    font-size: 0.82rem;
  }

  .login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 12px;
    font-size: 0.7rem;
  }

  .remember-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #596579;
  }

  .remember-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
  }

  .login-forgot {
    padding: 3px 0;
    background: transparent;
    color: var(--primary-dark);
    font-size: inherit;
    font-weight: 600;
  }

  .login-forgot:hover {
    text-decoration: underline;
  }

  .login-form-wrap .btn-login {
    min-height: 46px;
    margin-top: 0;
    border-radius: 9px;
    background: linear-gradient(100deg, #ff7818, #ff5d0b);
    box-shadow: 0 5px 12px rgba(240, 99, 13, 0.18);
  }

  .login-demo {
    display: none;
  }
}

@media (min-width: 993px) {
  .login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 12px;
    font-size: 0.75rem;
  }

  .remember-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
  }

  .remember-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
  }

  .login-forgot {
    padding: 3px 0;
    background: transparent;
    color: var(--primary-dark);
    font-size: inherit;
    font-weight: 600;
  }
}

@media (max-width: 576px) {
  .login-left {
    min-height: 210px !important;
    padding: 18px 18px 24px !important;
  }

  .login-right {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .login-form-wrap {
    padding: 18px 15px 16px;
    border-radius: 22px;
  }
}

@media (max-height: 700px) and (max-width: 992px) {
  .login-left {
    min-height: 184px !important;
    padding-top: 12px !important;
    padding-bottom: 19px !important;
  }

  .login-brand-icon {
    width: 54px;
    height: 54px;
  }

  .left-logo {
    width: 50px;
    height: 50px;
  }

  .login-form-wrap {
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .login-form-wrap .login-subtitle {
    margin-bottom: 11px;
  }
}

/* Dashboard visual system: compact metric cards and an always-visible panel grid. */
#statsGrid .stat-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(25, 42, 70, 0.045);
}

#statsGrid .stat-card:hover {
  transform: translateY(-1px);
}

#statsGrid .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

#statsGrid .stat-icon.blue {
  background: #eaf4ff;
  color: #2687f5;
}

#statsGrid .stat-icon.green {
  background: #e8fbf2;
  color: #13b76c;
}

#statsGrid .stat-icon.orange {
  background: #fff2e5;
  color: #ff831b;
}

#statsGrid .stat-icon.purple {
  background: #f4edff;
  color: #9753e9;
}

html[data-theme="dark"] #statsGrid .stat-icon.blue {
  background: rgba(38, 135, 245, 0.16);
  color: #60a5fa;
}

html[data-theme="dark"] #statsGrid .stat-icon.green {
  background: rgba(19, 183, 108, 0.16);
  color: #4ade80;
}

html[data-theme="dark"] #statsGrid .stat-icon.orange {
  background: rgba(255, 131, 27, 0.16);
  color: #fb923c;
}

html[data-theme="dark"] #statsGrid .stat-icon.purple {
  background: rgba(151, 83, 233, 0.16);
  color: #c084fc;
}

#statsGrid .stat-card-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#statsGrid .stat-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

#statsGrid .stat-value {
  color: var(--text-dark);
  font-size: 1.12rem;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(25, 42, 70, 0.045);
}

.dashboard-panel.chart-card {
  padding: 18px;
}

.dashboard-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin-bottom: 12px;
}

.dashboard-panel-heading .chart-card-title,
.dashboard-panel-heading .card-title {
  margin: 0;
}

.dashboard-panel-heading .chart-card-title {
  color: var(--text-dark);
  font-size: 0.94rem;
}

.dashboard-panel-heading .card-title {
  font-size: 0.94rem;
}

.dashboard-chart-area {
  position: relative;
  height: 220px;
}

.dashboard-inventory-content {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 220px;
}

.dashboard-donut-area {
  position: relative;
  flex: 1 1 55%;
  min-width: 0;
  height: 210px;
}

.dashboard-inventory-legend {
  display: grid;
  gap: 12px;
  min-width: 125px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.inventory-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
}

.legend-dot.in-stock {
  background: #22c55e;
}

.legend-dot.out-stock {
  background: #ef4444;
}

.legend-dot.low-stock {
  background: #f97316;
}

.dashboard-view-all {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 600;
}

.dashboard-view-all:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

.dashboard-panel.card {
  padding-top: 16px;
}

.dashboard-panel.card .card-panel-heading {
  padding: 0 18px;
}

.dashboard-alert-count {
  margin-left: 0;
}

.dashboard-low-stock .dashboard-panel-heading {
  flex-wrap: wrap;
}

.dashboard-low-stock .dashboard-panel-heading .dashboard-view-all {
  margin-left: auto;
}

.dashboard-low-stock #lowStockAlerts {
  max-height: 310px;
  overflow-y: auto;
}

.dashboard-low-stock .alert-item {
  padding: 12px 14px 11px 16px;
}

.dashboard-low-stock .alert-item-type {
  margin-bottom: 4px;
  font-size: 0.68rem;
}

.dashboard-low-stock .alert-item-name {
  font-size: 0.82rem;
}

.dashboard-low-stock .alert-item-id,
.dashboard-low-stock .alert-item-message,
.dashboard-low-stock .alert-item-qty {
  font-size: 0.72rem;
}

.dashboard-recent .table-wrap {
  margin: 0;
}

.dashboard-recent table {
  min-width: 0;
}

.dashboard-recent th,
.dashboard-recent td {
  padding: 11px 10px;
  font-size: 0.76rem;
}

.dashboard-recent th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-recent td {
  color: var(--text-medium);
}

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

  .dashboard-panel.chart-card {
    padding: 15px;
  }

  .dashboard-chart-area {
    height: 200px;
  }

  .dashboard-inventory-content {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 0;
  }

  .dashboard-donut-area {
    flex: 0 0 auto;
    width: 100%;
    height: 175px;
  }

  .dashboard-inventory-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    min-width: 0;
    font-size: 0.68rem;
  }

  .inventory-legend-item {
    align-items: flex-start;
    gap: 5px;
  }

  .dashboard-panel.card .card-panel-heading {
    padding: 0 14px;
  }

  .dashboard-recent th,
  .dashboard-recent td {
    padding: 9px 7px;
    font-size: 0.7rem;
  }
}

@media (max-width: 576px) {
  .dashboard-content>.page-header p {
    display: none;
  }

  .dashboard-content>.page-header {
    margin-bottom: 16px;
  }

  #statsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-bottom: 16px;
  }

  #statsGrid .stat-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 68px;
    padding: 10px 9px !important;
  }

  #statsGrid .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  #statsGrid .stat-icon svg {
    width: 17px;
    height: 17px;
  }

  #statsGrid .stat-label {
    font-size: 0.64rem;
  }

  #statsGrid .stat-value {
    font-size: 0.96rem;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .dashboard-panel.chart-card {
    padding: 15px;
  }

  .dashboard-chart-area {
    height: 190px;
  }

  .dashboard-inventory-content {
    flex-direction: row;
    gap: 10px;
    min-height: 175px;
  }

  .dashboard-donut-area {
    flex: 1 1 52%;
    width: auto;
    height: 165px;
  }

  .dashboard-inventory-legend {
    grid-template-columns: 1fr;
    gap: 9px;
    width: auto;
    min-width: 112px;
    font-size: 0.7rem;
  }

  .dashboard-panel-heading {
    margin-bottom: 9px;
  }

  .dashboard-panel.card .card-panel-heading {
    padding: 0 14px;
  }

  .dashboard-recent .table-wrap {
    max-width: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .dashboard-recent table {
    display: block;
    width: 100%;
  }

  .dashboard-recent thead {
    display: none;
  }

  .dashboard-recent tbody {
    display: grid;
    gap: 8px;
    padding: 0 12px 12px;
  }

  .dashboard-recent tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "customer amount" "identifier status" "date status";
    align-items: center;
    gap: 3px 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-card);
  }

  .dashboard-recent tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    font-size: 0.72rem;
  }

  .dashboard-recent tbody td:nth-child(1) {
    grid-area: identifier;
    font-size: 0.66rem;
  }

  .dashboard-recent tbody td:nth-child(2) {
    grid-area: date;
    color: var(--text-muted);
    font-size: 0.66rem;
  }

  .dashboard-recent tbody td:nth-child(3) {
    grid-area: customer;
    color: var(--text-dark);
    font-size: 0.76rem;
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .dashboard-recent tbody td:nth-child(4) {
    grid-area: amount;
    color: var(--text-dark);
    text-align: right;
    font-weight: 700;
  }

  .dashboard-recent tbody td:nth-child(5) {
    grid-area: status;
    justify-self: end;
    align-self: end;
  }
}

/* Shared responsive system for the remaining application modules. */
@media (min-width: 769px) and (max-width: 1100px) {

  .main-content,
  .main-content.expanded {
    padding: 24px;
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .warehouse-layout,
  .supplier-module-layout,
  .user-module-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 993px) and (max-width: 1100px) {
  #statsGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {

  .main-content,
  .main-content.expanded {
    width: 100%;
    min-width: 0;
    padding: 72px 20px 28px !important;
  }

  .page-header,
  .page-header-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .page-header-row>div:last-child {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .stats-grid:not(#statsGrid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
  }

  .stats-grid:not(#statsGrid) .stat-card {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 74px;
    padding: 12px;
  }

  .stats-grid:not(#statsGrid) .stat-card-top {
    grid-row: span 2;
    margin: 0;
  }

  .stats-grid:not(#statsGrid) .stat-icon {
    width: 40px;
    height: 40px;
  }

  .stats-grid:not(#statsGrid) .stat-label {
    align-self: end;
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .stats-grid:not(#statsGrid) .stat-value {
    align-self: start;
    font-size: 1.08rem;
    overflow-wrap: anywhere;
  }

  #warehouseStats .stat-card {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
  }

  .warehouse-layout,
  .supplier-module-layout,
  .user-module-layout,
  .analytics-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .warehouse-subnav,
  .supplier-subnav,
  .user-subnav,
  .analytics-subnav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    padding: 2px 1px 9px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .warehouse-subnav-title,
  .user-subnav-title,
  .analytics-subnav-title,
  .supplier-subnav-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px !important;
    white-space: nowrap;
  }

  .supplier-subnav-link {
    padding: 10px 13px;
    border-bottom-width: 1px;
  }

  .analytics-subnav-title {
    display: inline-flex;
    align-items: center;
  }

  .analytics-subnav-title span {
    white-space: nowrap;
  }

  .supplier-module-content,
  .warehouse-module-content,
  .user-module-content,
  .analytics-module-content {
    min-width: 0;
    width: 100%;
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    min-width: 0;
    padding: 16px;
  }

  .kpi-title {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .kpi-value {
    font-size: 1.65rem;
  }

  .analytics-submodule {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .analytics-submodule-title {
    padding: 4px 2px 0;
  }

  .warehouse-category-row {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .warehouse-category-row .category-select {
    width: 100%;
  }

  .category-sidebar {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .supplier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .appearance-settings {
    padding: 18px;
  }

  .appearance-setting-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .appearance-theme-select {
    width: min(100%, 260px);
  }

  .appearance-logo-control,
  .appearance-product-control {
    justify-content: flex-start;
    max-width: 100%;
  }

  .appearance-product-control select {
    max-width: min(190px, calc(100vw - 150px));
  }

  .toolbar {
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .filter-tabs,
  .period-tabs,
  .peak-period-tabs {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tabs>*,
  .period-tabs>*,
  .peak-period-tabs>* {
    flex: 0 0 auto;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    width: max-content;
    min-width: 100%;
  }

  .table-wrap th,
  .table-wrap td {
    white-space: nowrap;
  }

  .heatmap-table {
    min-width: max-content;
  }

  .dashboard-recent table {
    width: 100%;
    min-width: 0;
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .modal-overlay {
    padding: 16px;
    align-items: center;
    overflow-y: auto;
  }

  .modal {
    width: min(680px, 100%);
    max-width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .modal-body {
    max-height: none;
  }
}

@media (max-width: 576px) {

  .main-content,
  .main-content.expanded {
    padding: 68px 14px 22px !important;
  }

  .page-header h1 {
    font-size: 1.34rem;
  }

  .page-header p {
    max-width: 58ch;
    font-size: 0.8rem;
  }

  .page-header-row>div:last-child {
    width: 100%;
  }

  .page-header-row>div:last-child>.btn,
  .page-header-row>button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .stats-grid:not(#statsGrid) {
    gap: 9px;
  }

  .stats-grid:not(#statsGrid) .stat-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 68px;
    padding: 9px;
  }

  .stats-grid:not(#statsGrid) .stat-icon {
    width: 34px;
    height: 34px;
  }

  .stats-grid:not(#statsGrid) .stat-label {
    font-size: 0.63rem;
  }

  .stats-grid:not(#statsGrid) .stat-value {
    font-size: 0.96rem;
  }

  .charts-grid,
  .analytics-grid,
  .warehouse-grid,
  .reports-grid,
  .report-cards-grid,
  .delivery-restock-grid,
  .access-backup-grid,
  .supplier-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .kpi-card {
    padding: 13px;
  }

  .kpi-label {
    font-size: 0.66rem;
  }

  .kpi-title {
    font-size: 0.95rem;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .kpi-sub {
    font-size: 0.68rem;
  }

  .toolbar,
  .filter-bar,
  .actions-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar>*,
  .filter-bar>*,
  .actions-bar>*,
  .toolbar .search-bar,
  .search-bar {
    width: 100%;
    max-width: none;
  }

  .toolbar .filter-tabs,
  .toolbar .period-tabs {
    width: 100%;
  }

  .filter-tabs,
  .period-tabs {
    padding: 3px;
    border-radius: 9px;
  }

  .filter-tab,
  .period-tab {
    min-height: 38px;
    padding: 7px 11px;
  }

  .category-sidebar {
    gap: 6px;
  }

  .category-sidebar>* {
    flex: 0 0 auto;
  }

  .supplier-contact-row,
  .warehouse-alert-item {
    align-items: flex-start;
  }

  .warehouse-alert-item {
    flex-direction: column;
    gap: 4px;
  }

  .warehouse-alert-detail {
    text-align: left;
  }

  .pos-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: auto;
  }

  .pos-left,
  .order-panel {
    width: 100%;
    min-width: 0;
  }

  .pos-left {
    display: contents;
  }

  .pos-left>.card {
    order: 0;
  }

  .pos-products-grid {
    order: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
    overflow: visible;
  }

  .pos-product-card {
    min-width: 0;
    padding: 12px 9px;
  }

  .pos-product-name {
    font-size: 0.75rem;
  }

  .pos-product-emoji {
    width: 54px;
    height: 54px;
  }

  .pos-product-logo {
    width: 48px;
    height: 48px;
  }

  .order-panel {
    order: 2;
    max-height: 52vh;
    position: sticky;
    bottom: 8px;
    z-index: 5;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.16);
  }

  .order-items {
    min-height: 68px;
    overflow-y: auto;
  }

  .order-panel-footer {
    padding: 12px;
  }

  .btn-checkout,
  .btn-receipt {
    min-height: 44px;
  }

  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 20px);
    margin: 0 auto !important;
    border-radius: 18px 18px 12px 12px;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 15px 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer>button {
    flex: 1 1 120px;
    min-height: 42px;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .report-card {
    padding: 16px;
  }

  .report-card-actions {
    flex-wrap: wrap;
  }

  .report-card-actions>* {
    flex: 1 1 120px;
    justify-content: center;
  }

  .appearance-setting-row p,
  .appearance-settings-description {
    max-width: 58ch;
  }
}

@media (max-width: 360px) {

  .main-content,
  .main-content.expanded {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .analytics-kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats-grid:not(#statsGrid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .pos-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Metric cards follow the compact, icon-led reference layout at every size. */
.stats-grid .stat-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 2px 12px;
  min-width: 0;
  min-height: 84px;
  padding: 15px 16px;
  text-align: left;
  border-radius: 15px;
}

.stats-grid .stat-card-top {
  grid-row: 1 / span 2;
  margin: 0;
}

.stats-grid .stat-icon {
  width: 44px;
  height: 44px;
}

.stats-grid .stat-label {
  align-self: end;
  min-width: 0;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.25;
}

.stats-grid .stat-value {
  align-self: start;
  min-width: 0;
  font-size: 1.22rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.stats-grid .stat-card-copy {
  min-width: 0;
}

/* Analytics summary tiles use the same quiet, icon-led treatment. */
.analytics-kpi-grid>.kpi-card {
  position: relative;
  min-width: 0;
  min-height: 100px;
  padding: 16px 18px 16px 76px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg-card);
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}

.analytics-kpi-grid>.kpi-card::before {
  position: absolute;
  top: 18px;
  left: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 10px;
  content: "";
}

.analytics-kpi-grid>.kpi-card.orange::before {
  background: #fff2e5;
}

.analytics-kpi-grid>.kpi-card.green::before {
  background: #e8fbf2;
}

.analytics-kpi-grid>.kpi-card.blue::before {
  background: #eaf4ff;
}

.analytics-kpi-grid>.kpi-card .kpi-label {
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 1;
}

.analytics-kpi-grid>.kpi-card .kpi-label svg {
  position: absolute;
  top: 14px;
  left: -54px;
  width: 18px;
  height: 18px;
  margin: 0 !important;
}

.analytics-kpi-grid>.kpi-card.orange .kpi-label svg {
  color: #f97316;
}

.analytics-kpi-grid>.kpi-card.green .kpi-label svg {
  color: #16a34a;
}

.analytics-kpi-grid>.kpi-card.blue .kpi-label svg {
  color: #2563eb;
}

.analytics-kpi-grid>.kpi-card .kpi-title {
  margin-bottom: 2px;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.analytics-kpi-grid>.kpi-card .kpi-value {
  margin-bottom: 2px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.analytics-kpi-grid>.kpi-card .kpi-sub {
  color: var(--text-muted);
  opacity: 1;
}

/* The order panel stays in the desktop layout and becomes a mobile sheet. */
.pos-order-overlay {
  display: contents;
}

.mobile-cart-button,
.order-modal-close {
  display: none;
}

@media (min-width: 769px) and (max-width: 1100px) {
  #warehouseStats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .stats-grid:not(#statsGrid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #statsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 576px) {

  .stats-grid,
  .stats-grid:not(#statsGrid),
  #statsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .stats-grid .stat-card {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 2px 9px;
    min-height: 78px;
    padding: 11px 10px;
  }

  .stats-grid .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stats-grid .stat-icon svg {
    width: 17px;
    height: 17px;
  }

  .stats-grid .stat-label {
    font-size: 0.72rem;
  }

  .stats-grid .stat-value {
    font-size: 1.08rem;
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .analytics-kpi-grid>.kpi-card {
    min-height: 116px;
    padding: 11px 10px 11px 54px;
  }

  .analytics-kpi-grid>.kpi-card::before {
    top: 12px;
    left: 10px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .analytics-kpi-grid>.kpi-card .kpi-label {
    min-height: 34px;
    font-size: 0.68rem;
  }

  .analytics-kpi-grid>.kpi-card .kpi-label svg {
    top: 8px;
    left: -44px;
    width: 17px;
    height: 17px;
  }

  .analytics-kpi-grid>.kpi-card .kpi-title {
    font-size: 0.9rem;
  }

  .analytics-kpi-grid>.kpi-card .kpi-value {
    font-size: 0.98rem;
  }

  .pos-layout {
    padding-bottom: 76px;
  }

  .pos-order-overlay {
    display: none;
  }

  .pos-order-overlay.is-open {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .pos-order-overlay .order-panel {
    width: min(100%, 520px);
    min-width: 0;
    height: min(72dvh, 640px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top));
    margin: 0;
    position: relative;
    bottom: auto;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
    animation: order-sheet-in 180ms ease-out;
  }

  .pos-order-overlay .order-panel-header {
    min-height: 62px;
    padding: 14px 16px;
  }

  .pos-order-overlay .order-modal-close {
    display: grid;
    width: 38px;
    height: 38px;
    margin-left: auto;
    place-items: center;
    border: 0;
    border-radius: 11px;
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: pointer;
  }

  .pos-order-overlay .order-modal-close svg {
    width: 19px;
    height: 19px;
  }

  .pos-order-overlay .order-items {
    min-height: 0;
    overflow-y: auto;
  }

  .pos-order-overlay .order-panel-footer {
    padding: 14px 16px 16px;
  }

  .mobile-cart-button {
    position: fixed;
    z-index: 30;
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: grid;
    width: 58px;
    height: 58px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 26px rgba(249, 115, 22, 0.34);
    font: inherit;
    cursor: pointer;
  }

  .mobile-cart-icon {
    position: relative;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
  }

  .mobile-cart-icon>svg {
    width: 27px;
    height: 27px;
  }

  .mobile-cart-count {
    position: absolute;
    top: -3px;
    right: -5px;
    display: grid;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    place-items: center;
    border: 2px solid var(--primary);
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
  }
}

@keyframes order-sheet-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Inventory rows become readable product cards on narrow screens. */
@media (max-width: 576px) {
  .inventory-table-wrap {
    max-width: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .inventory-table-wrap #inventoryTable {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
  }

  .inventory-table-wrap #inventoryTable thead {
    display: none;
  }

  .inventory-table-wrap #inventoryTable tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 0 0 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
  }

  .inventory-table-wrap #inventoryTable tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 0;
    border: 0;
    color: var(--text-dark);
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .inventory-table-wrap #inventoryTable tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.2;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(1) {
    grid-column: 1;
    grid-row: 2;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 700;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
    align-items: flex-start;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(6) {
    grid-column: 1;
    grid-row: 4;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(7) {
    grid-column: 2;
    grid-row: 4;
    align-items: flex-end;
  }

  .inventory-table-wrap #inventoryTable tbody td:nth-child(7)::before {
    align-self: flex-end;
  }

  .inventory-table-wrap #inventoryTable tbody td[colspan] {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

/* All record tables use labeled cards on phones; heatmaps remain scrollable grids. */
@media (max-width: 576px) {
  .mobile-card-table-wrap {
    width: 100%;
    max-width: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .mobile-card-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 0 0 10px;
    padding: 14px;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
  }

  .mobile-card-table tbody tr:hover {
    background: var(--bg-card);
  }

  .mobile-card-table tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 0;
    border: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .mobile-card-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.2;
  }

  .mobile-card-table tbody td[colspan] {
    grid-column: 1 / -1;
    align-items: center;
    min-height: 44px;
  }

  .mobile-card-table tbody td[colspan]::before {
    content: none;
  }

  .mobile-card-table tbody td .badge {
    align-self: flex-start;
  }

  .mobile-card-table tbody td button {
    min-height: 36px;
  }
}

@media (max-width: 480px) {
  .mobile-card-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 12px;
  }

  .mobile-card-table tbody td {
    display: grid;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
    align-items: start;
    column-gap: 10px;
    overflow: visible;
  }

  .mobile-card-table tbody td::before {
    grid-column: 1;
    grid-row: 1;
    overflow-wrap: anywhere;
  }

  .mobile-card-table tbody td[colspan] {
    display: flex;
  }

  .inventory-table-wrap #inventoryTable tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .inventory-table-wrap #inventoryTable tbody td,
  .inventory-table-wrap #inventoryTable tbody td:nth-child(n) {
    display: grid;
    grid-column: 1 !important;
    grid-row: auto !important;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
    align-items: start;
    column-gap: 10px;
    overflow: visible;
  }

  .inventory-table-wrap #inventoryTable tbody td::before {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    overflow-wrap: anywhere;
  }

  .inventory-table-wrap #inventoryTable tbody td[colspan] {
    display: flex;
  }

  .mobile-card-table .verified-icon {
    display: flex;
    width: 100%;
    min-width: 0;
    height: auto;
    justify-content: flex-start;
  }

  .mobile-card-table .verified-icon.no span {
    display: block;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }
}

/* Analytics charts, controls, and heatmap on phones. */
@media (max-width: 576px) {

  .analytics-layout,
  .analytics-module-content,
  .analytics-module-view,
  .analytics-submodule-content,
  .analytics-module-view .card-body,
  .analytics-module-view .chart-card {
    width: 100%;
    min-width: 0;
  }

  .page-header-row.analytics-page-header {
    gap: 12px;
  }

  .analytics-period-controls {
    width: 100%;
  }

  .analytics-period-controls .period-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
  }

  .analytics-period-controls .period-tab {
    min-width: 0;
    min-height: 38px;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .analytics-period-controls .period-tab svg {
    width: 11px;
    height: 11px;
  }

  .analytics-kpi-grid.section-mb {
    gap: 9px;
  }

  .analytics-kpi-grid.section-mb>.kpi-card:last-child {
    grid-column: 1 / -1;
  }

  .analytics-subnav {
    margin: 0 -2px 4px;
    padding: 2px 2px 10px;
    scroll-snap-type: x proximity;
  }

  .analytics-subnav-title {
    scroll-snap-align: start;
    font-size: 0.76rem;
  }

  .analytics-subnav-title span {
    gap: 6px;
  }

  .analytics-subnav-title svg {
    flex: 0 0 14px;
  }

  .analytics-module-view .card,
  .analytics-module-view .chart-card {
    border-radius: 16px;
  }

  .analytics-module-view .card-body,
  .analytics-module-view .chart-card {
    padding: 15px;
  }

  .analytics-module-view .card-title,
  .analytics-module-view .chart-card-title {
    font-size: 0.96rem;
    line-height: 1.35;
  }

  .analytics-module-view canvas {
    display: block;
    max-width: 100%;
  }

  .analytics-module-view [style*="height: 260px"] {
    height: 230px !important;
  }

  .analytics-module-view [style*="height: 220px"] {
    height: 210px !important;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] .chart-card-title+div {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
    min-height: 0 !important;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] .chart-card-title {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 8px !important;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] .chart-card-title+div>div {
    width: 100% !important;
    max-width: 100%;
    min-height: 0 !important;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] #demandHeptagonCanvas {
    width: min(100%, 310px);
    height: auto !important;
    margin: 0 auto;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] #demandLegend {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    max-height: 190px !important;
  }

  .analytics-module-view[data-analytics-view="demand-distribution"] .demand-legend-item {
    min-width: 0;
    gap: 4px;
    font-size: 0.72rem;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .card-body>div[style*="overflow-x: auto"] {
    max-width: 100%;
    padding-bottom: 8px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .peak-period-tabs {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
    overflow: visible;
    white-space: normal;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .peak-period-tab {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    min-height: 38px;
    justify-content: center;
    padding: 6px 5px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .peak-period-tab svg {
    flex: 0 0 13px;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .analytics-kpi-grid:not(.section-mb) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .kpi-card-white {
    min-width: 0;
    padding: 13px !important;
    gap: 6px !important;
    overflow-wrap: anywhere;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .kpi-card-white [id^="kpi"] {
    font-size: 1.22rem !important;
    line-height: 1.2 !important;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] [id$="Sub"] {
    overflow-wrap: anywhere;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .card:has(ul) {
    padding: 16px !important;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .card:has(ul) li {
    align-items: flex-start !important;
    line-height: 1.5;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .card:has(ul) li>span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .analytics-period-controls .period-tab {
    font-size: 0.66rem;
  }

  .analytics-module-view[data-analytics-view="peak-sales"] .analytics-kpi-grid:not(.section-mb) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 576px) {

  /* Keep row action menus inside their card so they cannot cover adjacent rows. */
  .purchase-order-actions {
    width: 100%;
    flex-wrap: wrap;
    align-items: flex-start;
    white-space: normal;
  }

  .purchase-order-menu-wrap {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .purchase-order-menu,
  .purchase-order-menu.open {
    position: static;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: min(240px, 100%);
    min-width: 0;
    max-width: 100%;
    margin-top: 6px;
    box-sizing: border-box;
  }

  .purchase-order-menu-empty {
    overflow-wrap: anywhere;
  }

  .inventory-actions {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
  }

  .action-menu,
  .action-menu.open {
    position: fixed;
    width: min(240px, calc(100vw - 72px));
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
}

.supplier-refresh-spinner,
.supplier-inline-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  animation: supplier-refresh-spin 0.8s linear infinite;
}

.supplier-refresh-spinner {
  margin-right: 2px;
}

#supplierModuleAction.is-loading {
  cursor: wait;
  opacity: 0.86;
}

.supplier-table-loading td {
  display: flex !important;
  min-height: 76px;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 20px 12px !important;
  color: var(--text-muted) !important;
  font-size: 0.86rem !important;
}

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

/* Compact dashboard notifications on phones so they do not obscure the page. */
@media (max-width: 576px) {
  .inventory-notification-stack {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: min(360px, calc(100vw - 20px));
    max-height: none;
    padding: 2px;
    gap: 0;
    overflow: visible;
  }

  /* Present mobile alerts as a single dismissible toast. The next alert
     moves into view after the current one is dismissed. */
  .inventory-notification-stack>.inventory-notification:not(:first-child) {
    display: none;
  }

  .inventory-notification {
    align-items: flex-start;
    gap: 10px;
    padding: 11px 42px 11px 11px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  }

  .inventory-notification .alert-card-icon-wrap {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 9px;
  }

  .inventory-notification .alert-card-icon-wrap svg {
    width: 17px !important;
    height: 17px !important;
  }

  .inventory-notification .alert-card-content {
    min-width: 0;
    gap: 3px;
  }

  .inventory-notification .alert-card-title-row {
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px 8px;
  }

  .inventory-notification .alert-card-title {
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .inventory-notification .alert-card-date,
  .inventory-notification .alert-card-product {
    font-size: 0.74rem;
    line-height: 1.3;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inventory-notification .alert-card-message {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .inventory-notification .alert-card-badge {
    display: none;
  }

  .inventory-notification-close {
    top: 7px;
    right: 7px;
    width: 28px;
    height: 28px;
  }
}

/* Align the dashboard notification bell with the mobile menu control. */
@media (max-width: 768px) {
  .dashboard-content .notif-bell-wrap {
    position: fixed;
    top: 20px;
    right: 16px;
    z-index: 101;
    align-self: auto;
  }

  .dashboard-content .notif-panel {
    top: calc(100% + 10px);
    right: 0;
    width: min(380px, calc(100vw - 32px));
  }
}

@media (max-width: 576px) {
  .dashboard-content .notif-bell-wrap {
    top: 12px;
    right: 12px;
  }

  .dashboard-content .notif-bell-btn {
    width: 40px;
    height: 40px;
  }

  .dashboard-content .notif-panel {
    right: 0;
    width: min(380px, calc(100vw - 24px));
  }
}

/* Keep the four Report Center tiles in a compact 2 × 2 mobile grid. */
@media (max-width: 576px) {
  .report-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: 10px;
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .report-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px;
  }

  .report-card-header {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .report-card-header>div:last-child {
    min-width: 0;
  }

  .report-card-icon {
    width: 30px;
    height: 30px;
  }

  .report-card-title {
    font-size: 0.78rem;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .report-card-desc {
    font-size: 0.68rem;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .report-card-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
  }

  .report-card-actions>.btn-generate {
    flex: 0 0 auto;
    width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 7px 4px;
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .report-card-actions>.btn-dl {
    flex: 0 0 auto;
    width: 100%;
    height: 34px;
    min-height: 34px;
  }
}

/* Align the mobile controls at the dashboard top while letting them scroll away. */
@media (max-width: 768px) {
  .app-layout {
    position: relative;
  }

  #sidebarContainer .mobile-menu-btn {
    position: absolute !important;
    top: max(20px, env(safe-area-inset-top)) !important;
    left: 16px !important;
    z-index: 101 !important;
  }

  .dashboard-content {
    position: relative;
  }

  .dashboard-content .notif-bell-wrap {
    position: absolute !important;
    top: max(20px, env(safe-area-inset-top)) !important;
    right: 16px !important;
    z-index: 101 !important;
  }
}

@media (max-width: 576px) {
  #sidebarContainer .mobile-menu-btn {
    top: max(12px, env(safe-area-inset-top)) !important;
    left: 12px !important;
  }

  .dashboard-content .notif-bell-wrap {
    top: max(12px, env(safe-area-inset-top)) !important;
    right: 12px !important;
  }
}

/* Center modal dialogs on every screen size, including small phones. */
.modal-overlay.active {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.modal-overlay>.modal {
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (max-width: 576px) {
  .modal-overlay {
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    overflow-y: auto;
  }

  .modal {
    width: 100% !important;
    max-width: 560px !important;
    max-height: calc(100dvh - 32px) !important;
    margin: auto !important;
    border-radius: 16px !important;
    overflow-y: auto;
  }

  .modal-footer:has(> button:only-child) {
    justify-content: center !important;
  }

  .modal-footer>button:only-child {
    flex: 0 1 auto !important;
    width: auto;
    min-width: 120px;
  }
}

/* Center a modal's lone Close/action button at every viewport size. */
.modal-footer:has(> button:only-child) {
  justify-content: center !important;
}

.modal-footer>button:only-child {
  flex: 0 1 auto !important;
  width: auto;
  min-width: 120px;
  justify-content: center;
  text-align: center;
}

/* ============================================================
   SKELETON SHIMMER LOADING SYSTEM (Zero Layout Shift)
   ============================================================ */
@keyframes tpisShimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.03) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.03) 75%) !important;
  background-size: 200% 100% !important;
  animation: tpisShimmer 1.4s ease-in-out infinite !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  pointer-events: none !important;
  user-select: none !important;
}

.skeleton-box {
  display: inline-block;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.03) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: tpisShimmer 1.4s ease-in-out infinite;
}

.skeleton-card {
  min-height: 140px;
  border-radius: var(--radius-md, 12px);
  background: var(--bg-card, #141b2d);
  border: 1px solid var(--border-color, #1f293d);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ============================================
   BACKUP & TRASH MODULE STYLES
   ============================================ */

.backup-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Stat summary grid */
.backup-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.backup-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 12px);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.backup-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.backup-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.backup-stat-icon svg {
  width: 22px;
  height: 22px;
}

.trash-icon-total   { background: rgba(99, 102, 241, .15); color: #818cf8; }
.trash-icon-user    { background: rgba(59, 130, 246, .15); color: #60a5fa; }
.trash-icon-product { background: rgba(16, 185, 129, .15); color: #34d399; }
.trash-icon-supplier{ background: rgba(245, 158, 11, .15); color: #fbbf24; }

[data-theme="light"] .trash-icon-total    { background: rgba(99, 102, 241, .1);  color: #6366f1; }
[data-theme="light"] .trash-icon-user     { background: rgba(59, 130, 246, .1);  color: #3b82f6; }
[data-theme="light"] .trash-icon-product  { background: rgba(16, 185, 129, .1);  color: #059669; }
[data-theme="light"] .trash-icon-supplier { background: rgba(245, 158, 11, .1);  color: #d97706; }

.backup-stat-body { flex: 1; min-width: 0; }
.backup-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.backup-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Toolbar */
.backup-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.backup-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Badge variants used by trash types */
.badge-info      { background: rgba(59, 130, 246, .15); color: #60a5fa; }
.badge-warning   { background: rgba(245, 158, 11, .18); color: #fbbf24; }
.badge-secondary { background: rgba(148, 163, 184, .15); color: #94a3b8; }

[data-theme="light"] .badge-info      { background: rgba(59, 130, 246, .12); color: #2563eb; }
[data-theme="light"] .badge-warning   { background: rgba(245, 158, 11, .12); color: #d97706; }
[data-theme="light"] .badge-secondary { background: rgba(100, 116, 139, .12); color: #475569; }

/* Responsive */
@media (max-width: 900px) {
  .backup-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .backup-summary-grid { grid-template-columns: 1fr; }
  .backup-toolbar { flex-direction: column; }
  .backup-toolbar-actions { width: 100%; }
  .backup-stat-card { padding: 14px; }
}