/* ============================================
   مسلى · نظام إدارة المخزون الاحترافي
   Design System v3.0 — Thmanyah Sans Exclusive
   ============================================ */

/* ---------- Thmanyah Sans @font-face ---------- */
@font-face {
  font-family: 'ThmanyahSans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/thmanyah/thmanyahsans-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'ThmanyahSans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/thmanyah/thmanyahsans-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'ThmanyahSans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/thmanyah/thmanyahsans-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'ThmanyahSans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/thmanyah/thmanyahsans-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'ThmanyahSans';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/thmanyah/thmanyahsans-Black.woff2') format('woff2');
}

/* ---------- Design Tokens ---------- */
:root {
  --font-sans: 'ThmanyahSans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Brand Colors */
  --primary-50:  #f7f1eb;
  --primary-100: #eadccf;
  --primary-200: #d8c0ac;
  --primary-300: #bf9f82;
  --primary-400: #a87955;
  --primary-500: #93603a;
  --primary-600: #7e4924;
  --primary-700: #683b1d;
  --primary-800: #4f2d16;
  --primary-900: #38200f;

  /* Neutral */
  --neutral-0:   #ffffff;
  --neutral-50:  #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #ebebeb;
  --neutral-300: #d6d6d6;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #3d3d3d;
  --neutral-800: #262626;
  --neutral-900: #111111;
  --neutral-950: #080808;

  /* Semantic */
  --green-50:  #eef8f2;
  --green-100: #d7efe0;
  --green-500: #2f7a52;
  --green-600: #236342;
  --red-50:    #fff1f1;
  --red-500:   #b64646;
  --red-600:   #943636;
  --amber-50:  #fff7eb;
  --amber-500: #b67a2c;
  --amber-600: #955f1d;
  --blue-50:   #eef5fb;
  --blue-500:  #3e678f;
  --blue-600:  #2f5476;
  --purple-50: #f5f1fb;
  --purple-500:#7859a6;
  --purple-600:#61448d;

  /* Surface — White only */
  --bg:                #f6f4f1;
  --bg-card:           #ffffff;
  --bg-surface:        #f0ebe6;
  --bg-sidebar:        #7e4924;
  --bg-sidebar-hover:  rgba(255,255,255,0.09);
  --bg-sidebar-active: rgba(255,255,255,0.14);
  --bg-topbar:         #ffffff;
  --bg-modal-overlay:  rgba(107,114,128,0.16);

  /* Border */
  --border:       #dfd6ce;
  --border-light: #ece5dd;
  --border-focus: #7e4924;

  /* Text */
  --text:                #1f1a17;
  --text-secondary:      #5f5650;
  --text-muted:          #8a7d73;
  --text-inverse:        #ffffff;
  --text-sidebar:        rgba(255,255,255,0.45);
  --text-sidebar-active: #ffffff;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(126,73,36,0.06);
  --shadow-sm:   0 8px 20px rgba(126,73,36,0.08);
  --shadow-md:   0 16px 34px rgba(126,73,36,0.12);
  --shadow-lg:   0 20px 42px rgba(126,73,36,0.16);
  --shadow-xl:   0 28px 64px rgba(126,73,36,0.18);
  --shadow-card: 0 18px 40px rgba(126,73,36,0.09), 0 0 0 1px rgba(126,73,36,0.04);
  --shadow-glow: 0 0 30px rgba(126,73,36,0.18);

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 9999px;

  /* Sizing */
  --sidebar-width:    272px;
  --topbar-height:    64px;
  --mobile-nav-height:62px;

  /* Transitions */
  --transition-fast: 140ms cubic-bezier(0.4,0,0.2,1);
  --transition-base: 220ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 360ms cubic-bezier(0.4,0,0.2,1);
}

/* Dark mode removed — single white + #7e4924 theme only */

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans) !important;
}
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--font-sans) !important;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-500); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--primary-600); }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select, button { font-family: var(--font-sans) !important; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-400); }

/* ---------- Browser Autofill Override ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  border-color: var(--border) !important;
  transition: background-color 9999s ease-in-out 0s;
}
input:-moz-autofill {
  background-color: #ffffff !important;
  color: var(--text) !important;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  right: 0;
  background: #ffffff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-slow);
  overflow: hidden;
  border-left: 1px solid var(--border);
  box-shadow: 2px 0 20px rgba(126,73,36,0.06);
}
[dir="ltr"] .sidebar {
  right: auto;
  left: 0;
}

/* Sidebar Date/Time */
.sidebar-datetime {
  padding: 16px 20px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  border-bottom: 1px solid var(--border-light);
  user-select: none;
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 22px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.sidebar-brand::after { display: none; }
.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: #ffffff;
  padding: 7px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}
.sidebar-title {
  font-size: 21px;
  font-weight: 900;
  color: var(--primary-700);
  letter-spacing: -0.3px;
  line-height: 1;
}
.sidebar-title span { color: var(--primary-400); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 24px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 16px 14px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 18px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 700;
  transition: all var(--transition-fast);
  text-decoration: none !important;
  position: relative;
  cursor: pointer;
  border: 1px solid transparent;
}
.sidebar-link:hover {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: rgba(126,73,36,0.08);
  transform: translateX(-3px);
}
.sidebar-link.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 800;
  border-color: rgba(126,73,36,0.12);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--primary-600);
  border-radius: 999px;
  box-shadow: none;
}
[dir="ltr"] .sidebar-link.active::before {
  left: auto;
  right: 8px;
}
.sidebar-link svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.sidebar-link:hover svg,
.sidebar-link.active svg { opacity: 1; transform: scale(1.06); }

/* Sidebar footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-light);
  background: transparent;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  transition: background var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}
.sidebar-user:hover {
  background: var(--primary-50);
  border-color: rgba(126,73,36,0.08);
  transform: translateY(-1px);
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.sidebar-logout-link {
  margin: 6px 14px 14px !important;
  color: var(--red-500) !important;
  background: var(--red-50) !important;
  border-color: rgba(182,70,70,0.12) !important;
}
.sidebar-logout-link:hover {
  color: var(--red-600) !important;
  background: #ffe4e4 !important;
  border-color: rgba(182,70,70,0.2) !important;
  transform: none !important;
}
.sidebar-logout-link svg {
  opacity: 1 !important;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ---------- Main Content ---------- */
.main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  transition: margin var(--transition-slow);
  position: relative;
}
[dir="ltr"] .main-content {
  margin-right: 0;
  margin-left: var(--sidebar-width);
}

/* ---------- Topbar ---------- */
.topbar {
  height: calc(var(--topbar-height) + 6px);
  background: var(--bg-topbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 16px;
  z-index: 100;
  margin: 18px 18px 0;
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Page Content ---------- */
.page-content {
  padding: 24px 28px 30px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  animation: fadeSlideIn 0.3s ease both;
}

/* =============================================
   COMPONENTS
   ============================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  border-radius: 16px;
  font-family: var(--font-sans) !important;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none !important;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 2px; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary-600);
  color: #fff;
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: none;
  transform: translateY(-2px);
  color: #fff;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  background: #ffffff;
  border-color: var(--primary-600);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.btn-danger {
  background: var(--red-500);
  color: #fff;
}
.btn-danger:hover {
  background: var(--red-600);
  box-shadow: none;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green-500);
  color: #fff;
}
.btn-success:hover {
  background: var(--green-600);
  box-shadow: none;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--amber-500);
  color: #fff;
}

.btn-sm  { padding: 6px 13px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg  { padding: 12px 26px; font-size: 15px; }
.btn-lg svg { width: 19px; height: 19px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 14px;
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid rgba(126,73,36,0.08);
}
.btn-icon:hover {
  background: rgba(126,73,36,0.08);
  color: var(--text);
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon-sm { width: 30px; height: 30px; border-radius: var(--radius-sm); }
.btn-icon-sm svg { width: 15px; height: 15px; }

.btn-group { display: flex; gap: 4px; align-items: center; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  font-family: var(--font-sans) !important;
  font-size: 13.5px;
  background: rgba(255,255,255,0.84);
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
  line-height: 1.5;
}
.form-control:hover { border-color: var(--neutral-300); }
.form-control:focus {
  border-color: #7e4924;
  box-shadow: 0 0 0 4px rgba(126,73,36,0.1);
  background: #fffdfa;
}
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  padding-left: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans) !important;
  font-size: 13.5px;
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}
[dir="rtl"] .form-select {
  padding-left: 14px;
  padding-right: 36px;
  background-position: right 12px center;
}
.form-select:hover { border-color: var(--neutral-300); }
.form-select:focus {
  border-color: #7e4924;
  box-shadow: 0 0 0 3px rgba(126,73,36,0.12);
}

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

/* Checkbox / Toggle */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  user-select: none;
}
.checkbox-label:hover { background: var(--bg-surface); }
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-500);
  cursor: pointer;
}

/* ---------- Password Eye Toggle ---------- */
.input-with-icon {
  position: relative;
}
.input-with-icon .input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}
[dir="ltr"] .input-with-icon .input-icon {
  right: auto;
  left: 14px;
}
.input-with-icon .form-control {
  padding-right: 44px;
}
[dir="ltr"] .input-with-icon .form-control {
  padding-right: 14px;
  padding-left: 44px;
}
.input-with-icon .form-control:focus ~ .input-icon {
  color: var(--primary-500);
}

/* Password toggle button (eye icon) */
/* When input-with-icon also has pw-toggle, pad both sides */
.input-with-icon:has(.pw-toggle) .form-control {
  padding-left: 44px;
}
[dir="rtl"] .input-with-icon:has(.pw-toggle) .form-control {
  padding-right: 44px;
  padding-left: 44px;
}
[dir="ltr"] .input-with-icon:has(.pw-toggle) .form-control {
  padding-right: 44px;
  padding-left: 44px;
}
.pw-toggle {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  pointer-events: auto;
  z-index: 2;
  line-height: 0;
}
[dir="rtl"] .pw-toggle {
  left: 10px;
  right: auto;
}
[dir="ltr"] .pw-toggle {
  left: auto;
  right: 10px;
}
.pw-toggle:hover {
  color: var(--primary-500);
  background: rgba(126,73,36,0.08);
}
.pw-toggle svg { width: 17px; height: 17px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  min-width: 0;
  max-width: 100%;
}
.card::before {
  display: none;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 22px; }

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  cursor: default;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  transform: translateY(-5px) rotate(-0.4deg);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.ic-primary { background: var(--primary-50); color: var(--primary-600); }
.stat-icon.ic-green   { background: var(--green-50); color: var(--green-600); }
.stat-icon.ic-amber   { background: var(--amber-50); color: var(--amber-600); }
.stat-icon.ic-red     { background: var(--red-50); color: var(--red-600); }
.stat-icon.ic-blue    { background: var(--blue-50); color: var(--blue-600); }
.stat-icon.ic-purple  { background: var(--purple-50); color: var(--purple-600); }

/* dark stat-icon overrides removed */

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 900; color: var(--text); line-height: 1.1; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }

/* ---------- Tables ---------- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  overflow: hidden;
}
.table th {
  padding: 12px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(126,73,36,0.06);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
[dir="ltr"] .table th { text-align: left; }
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
  background: #ffffff;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover td { background: rgba(126,73,36,0.04); }
.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr.row-warning { background: var(--amber-50); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-success { background: var(--green-50);  color: var(--green-600); }
.badge-danger  { background: var(--red-50);    color: var(--red-600); }
.badge-warning { background: var(--amber-50);  color: var(--amber-600); }
.badge-info    { background: var(--blue-50);   color: var(--blue-600); }
.badge-purple  { background: var(--purple-50); color: var(--purple-600); }
.badge-neutral { background: var(--bg-surface); color: var(--text-secondary); }

/* dark badge overrides removed */

/* ---------- Page Toolbar ---------- */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding: 16px 18px;
  border: 1px solid rgba(126,73,36,0.08);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(12px);
  min-width: 0;
  max-width: 100%;
}
.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  right: 12px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}
[dir="ltr"] .search-box .search-icon {
  right: auto;
  left: 12px;
}
.search-box .form-control {
  padding-right: 40px;
  width: 220px;
  transition: all var(--transition-fast);
}
[dir="ltr"] .search-box .form-control {
  padding-right: 14px;
  padding-left: 40px;
}
.search-box .form-control:focus {
  width: 280px;
  border-color: var(--primary-400);
}
.search-box .form-control:focus ~ .search-icon { color: var(--primary-500); }

/* ---------- Tooltip ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: var(--neutral-900);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ---------- Product Thumb ---------- */
.product-thumb-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-light);
}
.product-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.product-thumb-placeholder svg { width: 19px; height: 19px; }

/* ---------- Product Cards View ---------- */
.products-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.product-card.card-warning { border-color: var(--amber-500); }
.product-card-image {
  height: 170px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-image svg { width: 44px; height: 44px; color: var(--text-muted); opacity: 0.4; }
.product-card-body { padding: 18px; }
.product-card-body h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.product-card-category { font-size: 12px; color: var(--text-secondary); }
.product-card-status {
  margin-top: 12px;
}
.product-card-stats {
  display: flex;
  gap: 24px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.product-card-stats .stat { display: flex; flex-direction: column; }
.product-card-stats .stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.product-card-stats .stat-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}
.product-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.products-surface-card {
  border-radius: 28px;
  box-shadow: var(--shadow-xs);
}
.products-surface-card .products-table-wrap {
  padding: 2px 0;
}
.admins-table-card {
  max-width: 100%;
  overflow: hidden;
}
.admins-table-wrap {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.admins-table .category-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--primary-600);
  font-weight: 800;
}

/* ---------- Image Upload ---------- */
.image-upload { text-align: center; }
.image-upload input[type="file"] { display: none; }
.image-preview {
  width: 130px;
  height: 130px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin: 0 auto;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  overflow: hidden;
}
.image-preview:hover {
  border-color: #7e4924;
  background: rgba(126,73,36,0.04);
}
.image-preview svg { width: 30px; height: 30px; }
.image-preview span { font-size: 12px; font-weight: 500; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Modal ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* Allow scrolling of the modal itself on very small screens */
  overflow-y: auto;
}
.modal.active { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 28px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 540px;
  /* Use flex column so body scrolls while header/footer stay fixed */
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 88dvh);
  animation: modalSlideUp 0.32s cubic-bezier(0.16,1,0.3,1);
}
.modal-content.modal-sm { max-width: 440px; }
.modal-content.modal-lg { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Form inside modal-content must also be flex column so modal-body scrolls
   and modal-footer stays pinned at the bottom */
.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: auto;
  max-width: 420px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.16,1,0.3,1);
  min-width: 300px;
  backdrop-filter: blur(10px);
}
.toast svg { width: 19px; height: 19px; flex-shrink: 0; }
.toast-success { background: var(--green-600); color: #fff; }
.toast-error   { background: var(--red-600); color: #fff; }
.toast-info    { background: var(--blue-600); color: #fff; }

/* ---------- Loading ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
/* dark loading overlay removed */
.loading-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- Toggle Buttons (Settings) ---------- */
.toggle-group {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  width: fit-content;
  border: 1px solid var(--border);
}
.toggle-group-btn {
  padding: 8px 18px;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans) !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle-group-btn:hover { color: var(--text); }
.toggle-group-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ---------- Permissions Grid ---------- */
.permissions-grid {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-card);
}
.permissions-section {
  display: grid;
  gap: 8px;
}
.permissions-section-title {
  margin: 0;
  padding: 0 2px;
}
.permissions-section-pages {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.permission-page-item {
  position: relative;
  min-height: 48px;
  justify-content: flex-start;
  padding: 10px 14px;
  border: 1px solid rgba(126,73,36,0.12);
  border-radius: 14px;
  background: #ffffff;
  font-weight: 600;
  box-shadow: none;
}
.permission-page-item:hover {
  background: var(--bg-surface);
  border-color: rgba(126,73,36,0.2);
}
.permission-page-item input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.permission-page-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
}
.permission-page-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--primary-600);
  border: 1px solid rgba(126,73,36,0.1);
  box-shadow: none;
  flex-shrink: 0;
}
.permission-page-icon svg {
  width: 16px;
  height: 16px;
}
.permission-page-label {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}
.permission-page-item:has(input:checked) {
  background: var(--bg-surface);
  border-color: var(--primary-400);
}
.permission-page-item:has(input:checked) .permission-page-icon {
  background: #ffffff;
  border-color: rgba(126,73,36,0.18);
}

/* ---------- Settings Grid ---------- */
.settings-grid {
  display: grid;
  gap: 20px;
  max-width: 720px;
  margin-inline: auto;
  width: 100%;
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid { display: grid; gap: 24px; }

/* Dashboard Charts Row */
.dashboard-charts {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.chart-body {
  padding: 16px 20px 20px;
  height: 260px;
  position: relative;
}
.chart-body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Dashboard List (stacked) */
.dashboard-list {
  margin-bottom: 18px;
}
.dashboard-list .card {
  border-radius: 22px;
}
.dashboard-list .card-header h3 {
  font-size: 14px;
}

/* Categories */
.categories-table .category-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--primary-600);
  font-weight: 800;
}
.categories-table .category-name {
  display: inline-block;
}
.categories-table .category-meta-badge {
  min-width: 78px;
  justify-content: center;
}
.categories-table .category-actions {
  flex-wrap: wrap;
}
.product-quantity-badge {
  min-width: 54px;
  justify-content: center;
  font-weight: 700;
}
.product-quantity-low {
  background: var(--amber-50);
  color: var(--amber-700);
}
.products-table .category-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--bg-surface) !important;
  color: var(--primary-600) !important;
  font-weight: 800;
}
.reports-table .category-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--bg-surface) !important;
  color: var(--primary-600) !important;
  font-weight: 800;
}
.recent-movements-card .card-header {
  padding-bottom: 16px;
}
.recent-movements-table td:first-child,
.recent-movements-table th:first-child {
  width: 56px;
}
.recent-movements-table td:nth-child(4),
.recent-movements-table th:nth-child(4) {
  width: 96px;
}
.recent-movements-table td:nth-child(6),
.recent-movements-table th:nth-child(6) {
  min-width: 150px;
}
.recent-movements-table td {
  vertical-align: middle;
}
.recent-movements-table .movement-cell-value {
  display: inline-block;
  width: 100%;
  text-align: right;
}
.recent-movements-table .movement-index {
  font-weight: 800;
}
.recent-movements-table .badge {
  min-width: 92px;
  justify-content: center;
}

/* Top Products */
.top-product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.top-product-item:last-child { border-bottom: none; }
.top-product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.top-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-product-cat {
  font-size: 11px;
  color: var(--text-muted);
}
.top-product-qty {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
  margin-right: 12px;
}
.top-product-qty.qty-low {
  color: var(--red-500);
}

/* ---------- Avatar ---------- */
.admin-avatar-wrap { position: relative; }
.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
  border: 2px solid var(--border);
}
.admin-avatar:hover { box-shadow: 0 10px 18px rgba(126,73,36,0.18); }

.admin-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.admin-avatar-sm svg {
  width: 15px;
  height: 15px;
}

/* =============================================
   LOGIN PAGE — Single-Window, White + #7e4924
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

/* Subtle warm background orbs */
.login-page::before,
.login-page::after { display: none; }

/* Dot grid */
.login-page .login-bg-grid {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  padding: 24px;
}

/* Login Card — White card */
.login-card {
  background: #ffffff;
  border: 2px solid rgba(126,73,36,0.75);
  border-radius: var(--radius-2xl);
  padding: 48px 44px;
  box-shadow: 0 24px 48px rgba(126,73,36,0.1), 0 1px 3px rgba(126,73,36,0.04);
  animation: loginCardIn 0.5s cubic-bezier(0.16,1,0.3,1);
  position: relative;
  overflow: hidden;
}
.login-language-switch {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
/* Form header — centered */
.login-form-header {
  margin-bottom: 28px;
  text-align: center;
}
.login-form-header h2 {
  font-size: 28px;
  font-weight: 800;
  color: #1a0f0a;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.login-form-header p {
  color: #8f705c;
  font-size: 14px;
  font-weight: 400;
}
/* Login form controls — normal white style */
.login-card .form-group label {
  color: #1a0f0a;
  font-size: 13px;
  font-weight: 600;
}
.login-card .form-control {
  background: #ffffff;
  border-color: rgba(126,73,36,0.18);
  color: #7e4924;
  font-size: 14px;
}
.login-card .form-control::placeholder { color: rgba(126,73,36,0.55); }
.login-card .form-control:hover { border-color: #7e4924; }
.login-card .form-control:focus {
  border-color: #7e4924;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(126,73,36,0.1);
  color: #7e4924;
}
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1a0f0a !important;
}

.login-card .input-with-icon .input-icon { color: rgba(126,73,36,0.55); }
.login-card .form-control:focus ~ .input-icon { color: #7e4924; }
.login-card .pw-toggle { color: rgba(126,73,36,0.55); }
.login-card .pw-toggle:hover { color: #7e4924; background: rgba(126,73,36,0.07); }

.login-form-btn {
  width: 100%;
  padding: 15px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 18px;
  margin-top: 8px;
  background: #7e4924;
  box-shadow: none;
  letter-spacing: 0.02em;
  color: #ffffff;
}
.login-form-btn:hover {
  background: #7e4924;
  box-shadow: none;
  transform: translateY(-2px);
  color: #ffffff;
}

.login-error {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--red-50);
  border: 1px solid rgba(182,70,70,0.18);
  border-radius: var(--radius-md);
  color: var(--red-600);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}
.login-error span {
  display: inline-block;
  text-align: center;
}
.login-error svg { width: 17px; height: 17px; flex-shrink: 0; }

.login-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 260px;
  gap: 12px;
  padding: 24px 20px;
  border-radius: 24px;
  background: #ffffff;
}
.login-loading-logo {
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.login-loading-logo img {
  width: 240px;
  height: 240px;
  object-fit: contain;
}
.login-loading-indicator {
  position: relative;
  width: 96px;
  height: 96px;
}
.login-loading-ring,
.login-loading-check {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-loading-ring {
  border: 3px solid rgba(126,73,36,0.14);
  border-top-color: var(--primary-600);
  animation: spin 0.8s linear infinite;
}
.login-loading-check {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #155a33;
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.login-loading-check svg {
  width: 92px;
  height: 92px;
}
.login-loading-state.completed .login-loading-ring {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.login-loading-state.completed .login-loading-check {
  opacity: 1;
  transform: scale(1);
}
.login-loading-state h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.3px;
}
.login-loading-state p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0;
  opacity: 0.75;
}


/* Hide old two-column layout elements */
.login-brand { display: none !important; }
.login-form-wrap {
  flex: unset;
  display: block;
  padding: 0;
}

/* =============================================
   MOBILE BOTTOM NAV
   ============================================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 998;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  text-decoration: none !important;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-weight: 500;
}
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item span { display: none; }
.mobile-nav-item.active { color: var(--primary-600); }
.mobile-nav-item:hover { color: var(--text); background: var(--bg-surface); }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.97); }
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.animate-in { animation: fadeSlideIn 0.3s ease both; }

/* =============================================
   UTILITY
   ============================================= */
.flex           { display: flex; }
.items-center   { align-items: center; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.text-center   { text-align: center !important; }
.text-right    { text-align: right !important; }
.text-left     { text-align: left !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-secondary{ color: var(--text-secondary) !important; }
.text-danger   { color: var(--red-600) !important; }
.text-warning  { color: var(--amber-600) !important; }
.text-success  { color: var(--green-600) !important; }
.fw-bold       { font-weight: 700 !important; }
.fw-semibold   { font-weight: 600 !important; }
.p-0  { padding: 0 !important; }
.p-4  { padding: 16px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-4 { margin-bottom: 16px !important; }
.w-full { width: 100%; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* ---------- Tablet & Mobile Tables as Cards ---------- */
@media (max-width: 1100px) {
  .dashboard-list table,
  .dashboard-list thead,
  .dashboard-list tbody,
  .dashboard-list th,
  .dashboard-list td,
  .dashboard-list tr {
    display: block;
  }
  .dashboard-list thead { display: none; }
  .dashboard-list .table-responsive { overflow: visible; }
  .dashboard-list td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--border-light);
    white-space: normal !important;
    gap: 10px;
  }
  .dashboard-list td:last-child { border-bottom: none; }
  .dashboard-list td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .dashboard-list td:empty { display: none; }
  .dashboard-list tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    background: #ffffff;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }
  .dashboard-list tr:last-child { margin-bottom: 0; }
  .dashboard-list .table { border-collapse: separate; border-spacing: 0; }

  .recent-movements-table-wrap {
    padding: 0 14px 14px;
  }
  .recent-movements-table,
  .recent-movements-table tbody {
    display: grid;
    gap: 12px;
  }
  .recent-movements-table tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border-radius: 22px !important;
    background: #ffffff;
  }
  .recent-movements-table td {
    min-height: 0;
    border-bottom: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    text-align: right;
    gap: 6px;
    padding: 0 !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light);
    border-radius: 16px;
  }
  .recent-movements-table td:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
    align-items: flex-end;
  }
  .recent-movements-table td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .recent-movements-table td:nth-child(3) {
    grid-column: 1;
    grid-row: 1;
  }
  .recent-movements-table td:nth-child(4) {
    grid-column: 1;
    grid-row: 3;
  }
  .recent-movements-table td:nth-child(5) {
    grid-column: 2;
    grid-row: 3;
  }
  .recent-movements-table td:nth-child(6) {
    grid-column: 1 / -1;
    grid-row: 4;
  }
  .recent-movements-table td:nth-child(5),
  .recent-movements-table td:nth-child(6) {
    justify-content: flex-end;
  }
  .recent-movements-table td::before {
    font-size: 10px;
    letter-spacing: 0.02em;
    width: auto;
    text-align: inherit;
    opacity: 0.9;
  }
  .recent-movements-table td[data-label="#"] {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-600);
  }
  .recent-movements-table td:nth-child(2) {
    align-items: flex-end;
  }
  .recent-movements-table td:nth-child(2) span {
    font-size: 15px;
    line-height: 1.7;
    font-weight: 700;
  }
  .recent-movements-table td:nth-child(6) {
    color: var(--text-secondary);
  }
  .recent-movements-table td > * {
    width: auto;
    text-align: inherit;
  }
  .recent-movements-table td:nth-child(4) > *,
  .recent-movements-table td:nth-child(5) > *,
  .recent-movements-table td:nth-child(6) > * {
    width: 100%;
  }
  .recent-movements-table .badge {
    width: auto;
    align-self: flex-start;
    margin-inline-start: 0;
    padding: 6px 14px;
  }
  [dir="ltr"] .recent-movements-table td,
  [dir="ltr"] .recent-movements-table td::before,
  [dir="ltr"] .recent-movements-table td > *,
  [dir="ltr"] .recent-movements-table .movement-cell-value {
    text-align: left;
  }
  [dir="ltr"] .recent-movements-table td:nth-child(1) {
    align-items: flex-start;
  }
  [dir="ltr"] .recent-movements-table td:nth-child(2) {
    align-items: flex-start;
  }
  [dir="ltr"] .recent-movements-table td:nth-child(3) {
    align-items: flex-end;
  }
  [dir="ltr"] .recent-movements-table .badge {
    align-self: flex-end;
  }

  .categories-card {
    max-width: 100%;
    overflow: hidden;
  }
  .categories-card .table-responsive {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .categories-card thead {
    display: table-header-group !important;
  }
  .categories-card tbody {
    display: table-row-group !important;
  }
  .categories-card tr {
    display: table-row !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .categories-card th,
  .categories-card td {
    display: table-cell !important;
    white-space: nowrap !important;
    vertical-align: middle;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--border-light);
    background: transparent !important;
  }
  .categories-card td::before {
    content: none !important;
  }
  .categories-card .categories-table {
    min-width: 760px;
    border-collapse: collapse !important;
    table-layout: fixed;
  }
  .categories-card .categories-table th:nth-child(1),
  .categories-card .categories-table td:nth-child(1) { width: 50px; }
  .categories-card .categories-table th:nth-child(2),
  .categories-card .categories-table td:nth-child(2) { width: 190px; }
  .categories-card .categories-table th:nth-child(3),
  .categories-card .categories-table td:nth-child(3) { width: 90px; }
  .categories-card .categories-table th:nth-child(4),
  .categories-card .categories-table td:nth-child(4) { width: 90px; }
  .categories-card .categories-table th:nth-child(5),
  .categories-card .categories-table td:nth-child(5) { width: 170px; }
  .categories-card .categories-table th:nth-child(6),
  .categories-card .categories-table td:nth-child(6) { width: 130px; }
  .categories-card .category-name,
  .categories-card .category-date,
  .categories-card .category-meta-badge {
    white-space: nowrap !important;
  }
  .categories-card .category-name,
  .categories-card .category-date {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }
  .categories-card .category-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .products-table-card,
  .reports-table-card,
  .admins-table-card {
    max-width: 100%;
    overflow: hidden;
  }
  .products-table-wrap,
  .reports-table-wrap,
  .admins-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 10px 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .products-table,
  .reports-table,
  .admins-table {
    border-collapse: collapse !important;
    table-layout: fixed;
  }
  .products-table {
    min-width: 860px;
  }
  .products-table th:nth-child(1),
  .products-table td:nth-child(1) {
    width: 58px;
    padding-inline: 10px !important;
  }
  .products-table th:nth-child(2),
  .products-table td:nth-child(2) {
    width: 64px;
    padding-inline: 8px !important;
  }
  .products-table th:nth-child(3),
  .products-table td:nth-child(3) {
    width: 190px;
  }
  .products-table th:nth-child(4),
  .products-table td:nth-child(4) {
    width: 130px;
  }
  .products-table th:nth-child(5),
  .products-table td:nth-child(5) {
    width: 92px;
  }
  .products-table th:nth-child(6),
  .products-table td:nth-child(6) {
    width: 102px;
  }
  .products-table th:nth-child(7),
  .products-table td:nth-child(7) {
    width: 114px;
  }
  .products-table th:nth-child(8),
  .products-table td:nth-child(8) {
    width: 150px;
  }
  .reports-table {
    min-width: 860px;
  }
  .reports-table th:nth-child(1),
  .reports-table td:nth-child(1) {
    width: 56px;
    padding-inline: 10px !important;
  }
  .reports-table th:nth-child(2),
  .reports-table td:nth-child(2) {
    width: 64px;
    padding-inline: 8px !important;
  }
  .reports-table th:nth-child(3),
  .reports-table td:nth-child(3) {
    width: 132px;
  }
  .reports-table th:nth-child(4),
  .reports-table td:nth-child(4) {
    width: 118px;
  }
  .reports-table th:nth-child(5),
  .reports-table td:nth-child(5) {
    width: 108px;
  }
  .reports-table th:nth-child(6),
  .reports-table td:nth-child(6) {
    width: 86px;
  }
  .reports-table th:nth-child(7),
  .reports-table td:nth-child(7) {
    width: 118px;
  }
  .reports-table th:nth-child(8),
  .reports-table td:nth-child(8) {
    width: 138px;
  }
  .reports-table th:nth-child(9),
  .reports-table td:nth-child(9) {
    width: 142px;
    padding-inline-end: 16px !important;
  }
  .admins-table {
    min-width: 860px;
  }
  .products-table th,
  .products-table td,
  .admins-table th,
  .admins-table td,
  .reports-table th,
  .reports-table td {
    white-space: nowrap !important;
    vertical-align: middle;
  }
  .admins-table th:nth-child(1),
  .admins-table td:nth-child(1) {
    width: 58px;
    padding-inline: 10px !important;
  }
  .admins-table th:nth-child(2),
  .admins-table td:nth-child(2) {
    width: 180px;
  }
  .admins-table th:nth-child(3),
  .admins-table td:nth-child(3) {
    width: 210px;
  }
  .admins-table th:nth-child(4),
  .admins-table td:nth-child(4) {
    width: 110px;
  }
  .admins-table th:nth-child(5),
  .admins-table td:nth-child(5) {
    width: 130px;
  }
  .admins-table th:nth-child(6),
  .admins-table td:nth-child(6) {
    width: 150px;
  }
  .admins-table th:nth-child(7),
  .admins-table td:nth-child(7) {
    width: 130px;
  }
  .product-table-name,
  .product-table-category,
  .report-table-product,
  .report-table-category,
  .report-table-admin,
  .report-table-notes,
  .report-table-date {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    vertical-align: middle;
  }
  .report-table-notes {
    max-width: 170px;
  }
  .product-table-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .products-table .category-index {
    margin-inline: auto;
  }
  .reports-table .category-index {
    margin-inline: auto;
  }
  .reports-table .product-thumb,
  .reports-table .product-thumb-placeholder {
    width: 34px;
    height: 34px;
  }
  .admins-table .category-index {
    margin-inline: auto;
  }
}

/* ---------- Tablet & Mobile Sidebar ---------- */
@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(100%);
    width: 320px;
  }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.show { display: block; }
  .main-content { margin-right: 0 !important; }
  [dir="ltr"] .main-content { margin-left: 0 !important; }
}

@media (min-width: 1101px) {
  .sidebar {
    transform: none !important;
  }
  [dir="ltr"] .sidebar { transform: none !important; }
  .sidebar.open { transform: none !important; }

  .main-content { margin-right: var(--sidebar-width); }
  [dir="ltr"] .main-content { margin-left: var(--sidebar-width); margin-right: 0; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) and (min-width: 769px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .stat-card  { padding: 16px; }
  .stat-value { font-size: 22px; }
  .dashboard-charts { grid-template-columns: 1fr; }
  .chart-body { height: 220px; }
  .form-row   { grid-template-columns: 1fr; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 10px 8px; }
  .products-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .login-container { max-width: 100%; }
  .login-card { padding: 40px 36px; }
  .permissions-grid,
  .permissions-section,
  .permissions-section-pages {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  .permissions-section-title,
  .permission-page-item {
    width: 100% !important;
  }
  .reports-table-wrap {
    margin: 0 !important;
    padding: 0 10px 0 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .reports-table {
    min-width: 820px !important;
    width: auto !important;
    table-layout: fixed !important;
  }
  .reports-table th,
  .reports-table td {
    white-space: nowrap !important;
    padding: 10px 10px !important;
    font-size: 11px !important;
  }
  .report-table-product,
  .report-table-category,
  .report-table-admin,
  .report-table-notes,
  .report-table-date {
    display: inline-block;
    max-width: 120px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .form-control,
  .form-select,
  .login-card .form-control {
    font-size: 16px;
  }

  .sidebar {
    width: 280px;
  }
  .mobile-bottom-nav { display: flex; }

  .page-content {
    padding: 16px;
    padding-bottom: calc(var(--mobile-nav-height) + 16px);
  }

  .topbar {
    padding: 0 16px;
    height: 58px;
    top: 10px;
    margin: 10px 10px 0;
    border-radius: 20px;
  }
  .page-title { font-size: 16px; }
  .topbar-actions .btn-icon { width: 34px; height: 34px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card  { padding: 14px 16px; gap: 12px; }
  .stat-icon  { width: 40px; height: 40px; }
  .stat-icon svg { width: 19px; height: 19px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }
  .dashboard-charts { grid-template-columns: 1fr; }
  .chart-body { height: 200px; }

  .page-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    flex-wrap: nowrap;
  }
  .toolbar-right { justify-content: flex-start; }
  .search-box { width: 100%; }
  .search-box .form-control { width: 100%; }
  .search-box .form-control:focus { width: 100%; }
  #dateSortSelect,
  #countSortSelect,
  #quantitySortSelect,
  #statusFilter,
  #adminTypeFilter,
  #filterCategory,
  #filterStatus,
  #filterProduct,
  #filterType,
  #filterAdmin,
  #dateFrom,
  #dateTo {
    width: 100% !important;
    min-width: 0 !important;
  }
  .checkbox-label {
    width: 100%;
  }
  .toolbar-left > div[style*="display:flex"] {
    width: 100%;
  }
  .toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .modal {
    /* Center modal above the bottom nav bar */
    align-items: center;
    padding: 12px 8px calc(var(--mobile-nav-height) + 12px);
  }
  .modal-content {
    margin: 0 auto;
    width: 100%;
    border-radius: var(--radius-lg);
    /* Shorter max-height so it is centered and scrollable inside */
    max-height: 70vh;
    max-height: 70dvh;
  }
  .modal-header { padding: 14px 18px; }
  .modal-body   { padding: 18px; }
  .modal-footer { padding: 14px 18px; }

  .table { font-size: 11.5px; }
  .table th, .table td { padding: 8px 6px; white-space: nowrap; }
  .table-responsive { margin: 0 -4px; border-radius: 0; }

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

  .recent-movements-table-wrap {
    padding: 0 12px 12px;
  }
  .recent-movements-table tr {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 12px;
    border-radius: 18px !important;
  }
  .recent-movements-table td {
    padding: 10px 12px !important;
    border-radius: 14px;
  }
  .recent-movements-table td:nth-child(1) {
    grid-column: auto;
    grid-row: auto;
    align-items: flex-end;
  }
  .recent-movements-table td:nth-child(2) {
    grid-column: auto;
    grid-row: auto;
  }
  .recent-movements-table td:nth-child(3),
  .recent-movements-table td:nth-child(4),
  .recent-movements-table td:nth-child(5),
  .recent-movements-table td:nth-child(6) {
    grid-column: auto;
    grid-row: auto;
    background: var(--bg-card) !important;
  }
  .recent-movements-table td:nth-child(2) span {
    font-size: 14px;
  }
  .recent-movements-table .badge {
    min-width: 90px;
  }
  .recent-movements-table td::before {
    width: 100%;
  }
  .recent-movements-table td > * {
    width: 100%;
  }
  [dir="ltr"] .recent-movements-table td:nth-child(1) {
    align-items: flex-start;
  }

  .categories-card .categories-table {
    min-width: 620px;
  }
  .categories-card {
    max-width: 100%;
    overflow: hidden;
  }
  .categories-card .table-responsive {
    margin: 0 !important;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  .categories-card th,
  .categories-card td {
    font-size: 11.5px;
    padding: 10px 12px !important;
  }
  .categories-card .category-name,
  .categories-card .category-date {
    max-width: 130px;
  }
  .categories-card .category-index {
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
  }
  .categories-card .category-actions .btn-icon {
    width: 32px;
    height: 32px;
  }

  .products-table,
  .reports-table,
  .admins-table {
    min-width: 860px;
  }
  .reports-table {
    min-width: 780px !important;
    width: auto !important;
    table-layout: fixed !important;
  }
  .products-table-card,
  .reports-table-card,
  .admins-table-card {
    max-width: 100%;
    overflow: hidden;
  }
  .products-table-wrap,
  .reports-table-wrap,
  .admins-table-wrap {
    margin: 0 !important;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-inline: 2px 12px;
    box-sizing: border-box;
  }
  .reports-table-wrap {
    margin: 0 !important;
    padding: 0 10px 0 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .products-table th,
  .products-table td,
  .admins-table th,
  .admins-table td,
  .reports-table th,
  .reports-table td {
    font-size: 11.5px;
    padding: 10px 12px !important;
  }
  .reports-table th,
  .reports-table td {
    white-space: nowrap !important;
    padding: 10px 8px !important;
    font-size: 10.5px !important;
  }
  .product-table-name,
  .product-table-category,
  .report-table-product,
  .report-table-category,
  .report-table-admin,
  .report-table-notes,
  .report-table-date {
    max-width: 120px;
  }
  .report-table-product,
  .report-table-category,
  .report-table-admin,
  .report-table-notes,
  .report-table-date {
    display: inline-block;
    max-width: 110px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .reports-table .product-thumb,
  .reports-table .product-thumb-placeholder {
    width: 32px;
    height: 32px;
  }
  .products-table .product-thumb,
  .products-table .product-thumb-placeholder {
    width: 34px;
    height: 34px;
  }
  .products-table th:nth-child(6),
  .products-table td:nth-child(6) {
    width: 96px;
  }
  .products-table th:nth-child(7),
  .products-table td:nth-child(7) {
    width: 112px;
  }
  .products-table .badge,
  .categories-card .badge,
  .reports-table .badge,
  .admins-table .badge {
    line-height: 1.35;
  }
  .product-table-actions .btn-icon {
    width: 32px;
    height: 32px;
  }
  .products-table .category-index {
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
  }
  .reports-table .category-index {
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
  }
  .admins-table .category-index {
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
  }
  .permissions-grid,
  .permissions-section,
  .permissions-section-pages {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  .permissions-section-title,
  .permission-page-item {
    width: 100% !important;
  }
  .product-quantity-badge {
    min-width: 48px;
    padding-inline: 10px;
  }

  /* Login mobile */
  .login-container { padding: 16px; }
  .login-card { padding: 32px 24px; border-radius: var(--radius-xl); }
  .login-card::before { height: 3px; }
  .login-loading-state { min-height: 280px; gap: 16px; }
  .login-loading-logo {
    width: 180px;
    height: 180px;
  }
  .login-loading-logo img {
    width: 180px;
    height: 180px;
  }
}

/* ---------- Small Mobile ---------- */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card  { padding: 12px; gap: 10px; }
  .stat-icon  { width: 36px; height: 36px; border-radius: var(--radius-sm); }
  .stat-value { font-size: 18px; }
  .permissions-grid { grid-template-columns: 1fr; }
  .mobile-nav-item svg { width: 20px; height: 20px; }
  .btn { padding: 8px 14px; font-size: 12.5px; }
  .login-card { padding: 28px 18px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .mobile-bottom-nav, .btn, .page-toolbar,
  .sidebar-overlay, .toast-container, .loading-overlay { display: none !important; }
  .main-content { margin: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { border: none; box-shadow: none; background: transparent; }
  .table th { background: #f0f0f0 !important; color: #000 !important; }
  .table th, .table td { border-color: #ccc !important; }
  .stat-card { break-inside: avoid; }
}
