/* ============================================================
   EZIM GENERAL TRADING — Global Stylesheet (Rewritten)
   Professional · Responsive · Accessible · v2.1
   ============================================================ */

/* ── Bootstrap Icons Font ───────────────────────────────────── */
@import url("bootstrap-icons.css");
/* ── Metropolis Font Family ─────────────────────────────────── */
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Thin.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-ThinItalic.otf') format('opentype');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-ExtraLight.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-ExtraLightItalic.otf') format('opentype');
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-LightItalic.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-RegularItalic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-MediumItalic.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-SemiBoldItalic.otf') format('opentype');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-BoldItalic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-ExtraBold.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-ExtraBoldItalic.otf') format('opentype');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/Metropolis-BlackItalic.otf') format('opentype');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-primary:    #083F77;
  --brand-dark:       #052D56;
  --brand-mid:        #0d5299;
  --brand-accent:     #04AA6D;
  --brand-accent-dk:  #038A57;
  --brand-accent-lt:  rgba(4, 170, 109, 0.10);

  /* Neutrals */
  --white:       #ffffff;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-150:    #eaf0f6;
  --gray-200:    #e2e8f0;
  --gray-300:    #cbd5e1;
  --gray-400:    #94a3b8;
  --gray-500:    #64748b;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-800:    #1e293b;
  --gray-900:    #0f172a;

  /* Semantic */
  --text-primary:    var(--gray-800);
  --text-secondary:  var(--gray-500);
  --text-muted:      var(--gray-400);
  --border:          var(--gray-200);
  --border-strong:   var(--gray-300);
  --bg-page:         #f0f4f8;
  --bg-card:         var(--white);
  --bg-hover:        var(--gray-50);

  /* Status */
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --success:   var(--brand-accent);
  --info:      #3b82f6;

  /* Layout */
  --header-h:     68px;
  --sidebar-w:    272px;
  --sidebar-min:  64px;

  /* Shape */
  --radius-sm:  6px;
  --radius:     8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 20px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.18);
  --shadow-header: 0 2px 12px rgba(8,63,119,.28);
  --shadow-sidebar: 2px 0 16px rgba(0,0,0,.07);

  /* Motion */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:      cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:      0.15s;
  --dur:           0.22s;
  --dur-slow:      0.35s;
  --transition:    var(--dur) var(--ease);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; user-select: none;
  -webkit-user-select: none; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  width: 100%;
  font-family: 'Metropolis', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-page);
  color: var(--text-primary);
  overflow-x: hidden;
  overflow-y: auto;          /* was hidden — blocked mobile page scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout Shell ───────────────────────────────────────────── */
.wrapper      { display: flex; flex-direction: column; height: 100vh; width: 100%; }
.main-wrapper { display: flex; flex: 1; width: 100%; overflow: hidden; position: relative; min-height: 0; }

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  min-width: 0;
}

.content-wrapper { padding: 28px 32px; flex: 1; min-width: 0; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--brand-primary);
  height: var(--header-h);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 1200;
  box-shadow: var(--shadow-header);
  position: relative;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.04) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255,255,255,.04) 25%, transparent 25%);
  background-size: 60px 60px;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 24px 0 20px;
  gap: 16px;
}

/* Header left */
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.header-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), transform var(--dur-fast);
  flex-shrink: 0;
  z-index: 1201;
}
.header-toggle:hover  { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.25); }
.header-toggle:active { transform: scale(.93); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: background var(--dur);
}
.header-brand:hover .brand-logo-wrap { background: rgba(255,255,255,.20); }

.brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tagline {
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .8px;
  line-height: 1;
}

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(255,255,255,.80);
  font-size: 18px;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
  position: relative;
  text-decoration: none;
}
.header-icon-btn:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.16);
  color: var(--white);
}

.header-badge {
  position: absolute;
  top: 5px; right: 5px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: var(--white);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--brand-primary);
  line-height: 1;
}

/* User button */
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-lg);
  color: rgba(255,255,255,.90);
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
  max-width: 220px;
}
.header-user-btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.25); }

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.25);
  flex-shrink: 0;
}
.header-user-btn:hover .header-avatar { border-color: var(--brand-accent); }

.header-user-info { display: flex; flex-direction: column; text-align: left; min-width: 0; }

.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  line-height: 1.2;
}

.header-user-role { font-size: 10.5px; color: rgba(255,255,255,.55); line-height: 1; }

.header-user-caret {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  transition: transform var(--dur);
  flex-shrink: 0;
}
.header-user-btn[aria-expanded="true"] .header-user-caret { transform: rotate(180deg); }

/* Dropdowns */
.header-dropdown-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 0;
  overflow: hidden;
  min-width: 300px;
  animation: panelIn var(--dur-fast) var(--ease-out);
  margin-top: 8px !important;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--gray-100);
}

.dropdown-panel-title { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.dropdown-panel-link  { font-size: 12px; color: var(--brand-accent); text-decoration: none; font-weight: 500; }
.dropdown-panel-link:hover { text-decoration: underline; }

.dropdown-panel-body { max-height: 300px; overflow-y: auto; }

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  text-decoration: none;
  transition: background var(--dur);
  border-bottom: 1px solid var(--gray-50);
}
.notification-item:hover { background: var(--gray-50); }

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-accent);
  margin-top: 5px;
  flex-shrink: 0;
}
.notification-content { min-width: 0; }
.notification-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notification-time { font-size: 11px; color: var(--text-muted); }

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 18px;
  color: var(--text-muted);
  font-size: 13px;
}
.notification-empty i { font-size: 28px; opacity: .4; }

.user-panel { min-width: 240px !important; }
.user-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
}
.user-panel-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--brand-accent); }
.user-panel-name   { font-size: 14px; font-weight: 700; color: var(--gray-800); margin: 0 0 2px; }
.user-panel-email  { font-size: 11.5px; color: var(--text-muted); margin: 0; }

.user-panel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px !important;
  font-size: 13px !important;
  color: var(--gray-700) !important;
  transition: background var(--dur), color var(--dur);
  border-radius: 0 !important;
}
.user-panel-item i { font-size: 16px; width: 20px; text-align: center; color: var(--gray-400); }
.user-panel-item:hover { background: var(--gray-50) !important; color: var(--gray-900) !important; }
.user-panel-item:hover i { color: var(--brand-accent); }

.user-panel-logout {
  color: var(--danger) !important;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.user-panel-logout:hover { background: #fff5f5 !important; color: var(--danger) !important; }
.user-panel-logout i { color: var(--danger) !important; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  height: 100%;
  position: relative;
  transition: width var(--dur-slow) var(--ease), min-width var(--dur-slow) var(--ease), transform var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

.sidebar-brand-mini {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mini-logo { height: 32px; width: auto; object-fit: contain; }

.sidebar.collapsed {
  width: var(--sidebar-min) !important;
  min-width: var(--sidebar-min) !important;
}
.sidebar.collapsed .sidebar-brand-mini { display: flex; }

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-badge:not(.side-badge),
.sidebar.collapsed .nav-ext-icon,
.sidebar.collapsed .nav-soon,
.sidebar.collapsed .nav-submenu { display: none !important; }

.sidebar.collapsed .nav-link,
.sidebar.collapsed .nav-toggle {
  justify-content: center !important;
  padding: 12px 0 !important;
  gap: 0 !important;
}

.sidebar.collapsed .nav-icon {
  width: auto !important;
  min-width: auto !important;
  font-size: 20px !important;
}

.sidebar.collapsed .nav-link.active {
  border-left: none !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  border-bottom: 2px solid var(--brand-accent);
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .nav-section { padding: 0 8px; }
.sidebar.collapsed .nav-link,
.sidebar.collapsed .nav-toggle { border-radius: var(--radius) !important; }

/* Drag handle */
.sidebar-drag-handle {
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  cursor: col-resize;
  z-index: 5;
  background: transparent;
  transition: background var(--dur);
}
.sidebar-drag-handle:hover { background: var(--brand-accent); opacity: .6; }

/* Collapse toggle pill */
.sidebar-collapse-btn {
  position: fixed;
  top: calc(var(--header-h) + 50%);
  transform: translateY(-50%);
  width: 20px;
  height: 40px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: none;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1100;
  color: var(--gray-400);
  font-size: 10px;
  transition: background var(--dur), color var(--dur), left var(--dur-slow) var(--ease), border-color var(--dur);
  left: var(--sidebar-w);
}
.sidebar-collapse-btn:hover {
  background: var(--brand-accent);
  color: var(--white);
  border-color: var(--brand-accent);
}

/* Mobile overlay — fixed to avoid blocking header/toggle */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.50);
  z-index: 998;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur);
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Flyout */
.sidebar-flyout {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: var(--shadow-lg);
  z-index: 1300;
  min-width: 220px;
  padding: 6px 0 10px;
  pointer-events: auto;
  animation: flyoutIn var(--dur-fast) var(--ease-out);
  overflow: hidden;
}
@keyframes flyoutIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.sidebar-flyout .flyout-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-primary);
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
}
.sidebar-flyout .flyout-icon {
  font-size: 16px;
  color: var(--brand-accent);
  display: flex;
  align-items: center;
}

.sidebar-flyout a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
}
.sidebar-flyout a:hover { background: var(--gray-50); color: var(--gray-900); }
.sidebar-flyout a.active { background: var(--brand-accent-lt); color: var(--brand-accent); font-weight: 600; }

/* Nav */
.sidebar-nav { padding: 10px 0 20px; flex: 1; }

.nav-item, .nav-section { padding: 1px 10px; }

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 18px 20px 6px;
  pointer-events: none;
  user-select: none;
}

.nav-link,
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
  position: relative;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  font-size: 17px;
  color: var(--gray-400);
  flex-shrink: 0;
  transition: color var(--dur-fast);
}

.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-arrow {
  display: flex;
  align-items: center;
  margin-left: auto;
  font-size: 11px;
  color: var(--gray-300);
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease), color var(--dur-fast);
}
.nav-toggle.open .nav-arrow { transform: rotate(180deg); color: var(--brand-accent); }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--danger);
  color: var(--white);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-badge.pulse { animation: badgePulse 2s infinite; }
@keyframes badgePulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  70%  { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.nav-soon {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  background: var(--gray-100);
  border-radius: 4px;
  padding: 2px 5px;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-ext-icon { font-size: 10px; color: var(--gray-300); flex-shrink: 0; }

.nav-link:hover,
.nav-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}
.nav-link:hover .nav-icon,
.nav-toggle:hover .nav-icon { color: var(--brand-accent); }

.nav-link.active {
  background: var(--brand-accent-lt);
  color: var(--brand-accent);
  font-weight: 600;
}
.nav-link.active .nav-icon { color: var(--brand-accent); }

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand-accent);
  border-radius: 0 3px 3px 0;
  margin-left: -12px;
}

.nav-toggle.open { color: var(--brand-accent); background: var(--brand-accent-lt); }
.nav-toggle.open .nav-icon { color: var(--brand-accent); }

.nav-submenu { padding: 4px 0 6px; }

.nav-link.sub {
  padding: 8px 12px 8px 46px;
  font-size: 13px;
  color: var(--gray-500);
  border-radius: var(--radius);
}
.nav-link.sub .nav-icon { font-size: 14px; width: 18px; min-width: 18px; }
.nav-link.sub:hover { color: var(--gray-800); background: var(--gray-100); }
.nav-link.sub.active {
  color: var(--brand-accent);
  background: var(--brand-accent-lt);
  font-weight: 600;
}
.nav-link.sub.active::before {
  top: 22%; bottom: 22%;
  margin-left: -12px;
}

/* ============================================================
   CARDS / TABLES / BUTTONS / FORMS / UTILS
   ============================================================ */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xs) !important;
  transition: box-shadow var(--dur), transform var(--dur);
  background: var(--bg-card);
}
.card:hover { box-shadow: var(--shadow) !important; }
.card-header {
  background: var(--white) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 14px 20px !important;
}

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.kpi-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  color: var(--white);
  transition: transform var(--dur), box-shadow var(--dur);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.kpi-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; opacity: .8; margin-bottom: 10px; }
.kpi-card-value { font-size: 28px; font-weight: 700; margin-bottom: 6px; line-height: 1; }
.kpi-card-desc  { font-size: 12px; opacity: .7; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin-bottom: 28px; }
.chart-card { background: var(--white); padding: 22px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.chart-card h3 { color: var(--gray-800); font-weight: 700; margin-bottom: 18px; font-size: 14px; letter-spacing: -.1px; }
.chart-container { position: relative; height: 300px; }

.table-responsive {
  border-radius: var(--radius-lg);
  overflow-x: auto;            /* was hidden — clipped table on mobile */
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* smooth momentum scroll on iOS */
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.table {
  font-size: 13.5px;
  margin-bottom: 0 !important;
  width: 100% !important;
  border-collapse: collapse !important;
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: transparent;
  --bs-table-border-color: transparent;
}

.table > thead > tr > th {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-mid) 100%) !important;
  color: var(--white) !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  letter-spacing: .2px !important;
  padding: 13px 16px !important;
  border: none !important;
  white-space: nowrap;
  vertical-align: middle !important;
}

/* Minimum column widths so table scrolls instead of overflowing */
.table > thead > tr > th:first-child { min-width: 40px; }
.table > thead > tr > th { min-width: 80px; }

.table > tbody > tr > td {
  padding: 11px 16px !important;
  vertical-align: middle !important;
  border-top: none !important;
  border-bottom: 1px solid var(--gray-100) !important;
  color: var(--gray-700) !important;
  background: var(--white) !important;
  font-size: 13.5px;
  transition: background var(--dur-fast);
}

.table > tbody > tr > td:first-child { font-weight: 600 !important; color: var(--gray-800) !important; }
.table > tbody > tr:nth-child(even) > td { background: var(--gray-50) !important; }
.table > tbody > tr:hover > td { background: #edf6ff !important; }
.table > tbody > tr:last-child > td { border-bottom: none !important; }
.table > tbody > tr > td:last-child { white-space: nowrap; }

.btn { font-size: 13px; font-weight: 500; border-radius: var(--radius); padding: 8px 18px; transition: all var(--dur); }
.btn-success { background: var(--brand-accent); border-color: var(--brand-accent); }
.btn-success:hover { background: var(--brand-accent-dk); border-color: var(--brand-accent-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(4,170,109,.30); }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(8,63,119,.30); }

.form-control,
.form-select {
  font-size: 13.5px;
  border-color: var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: border-color var(--dur), box-shadow var(--dur);
  background-color: var(--white);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(4,170,109,.15);
  outline: none;
}
.form-label { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }

.analytics-header { margin-bottom: 24px; }
.analytics-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); letter-spacing: -.3px; margin-bottom: 4px; }
.analytics-header p  { font-size: 13.5px; color: var(--text-secondary); margin: 0; }

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
.main-content::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

.chat-btn {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-mid));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur), box-shadow var(--dur);
  z-index: 50;
  text-decoration: none;
}
.chat-btn:hover { transform: scale(1.08) translateY(-2px); box-shadow: var(--shadow-xl); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1280px) {
  .brand-name { max-width: 160px; font-size: 14px; }
}

@media (max-width: 1024px) {
  .content-wrapper { padding: 20px 24px; }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: 280px !important;
    min-width: 280px !important;
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: 999;
  }
  .sidebar.active { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }

  .sidebar-overlay { display: block; }
  .sidebar-collapse-btn { display: none; }
  .sidebar-drag-handle { display: none; }

  .main-content { width: 100%; }
  .content-wrapper { padding: 14px 16px; }

  .header-inner { padding: 0 16px; }
  .brand-tagline { display: none; }
  .brand-name { font-size: 14px; }
  .brand-logo-wrap { width: 38px; height: 38px; }
  .brand-logo { height: 28px; }

  .header-user-info,
  .header-user-caret { display: none; }

  .header-user-btn {
    padding: 4px;
    background: rgba(255,255,255,.10);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.16);
  }
  .header-avatar { width: 36px; height: 36px; border: none; }
}

@media (max-width: 576px) {
  .header-inner { padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .header-toggle { width: 36px; height: 36px; font-size: 18px; }
  .header-icon-btn { width: 36px; height: 36px; font-size: 16px; }

  .content-wrapper { padding: 10px 12px; }

  .kpi-cards { grid-template-columns: 1fr; gap: 12px; }
  .charts-grid { grid-template-columns: 1fr; }

  #headerSearchBtn { display: none; }
}

@media (max-width: 360px) {
  .brand-logo-wrap { display: none; }
}


/* ── Mobile Table Responsiveness ─────────────────────────── */
@media (max-width: 768px) {

  /* Wrapper must scroll, not clip */
  .wrapper      { height: auto; min-height: 100vh; }
  .main-wrapper { overflow: visible; height: auto; }

  .main-content {
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
  }

  /* Table container: horizontal scroll with momentum */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    /* Visual scroll hint on mobile */
    background:
      linear-gradient(to right, white 30%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
      radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)) 0 100%;
    background-repeat: no-repeat;
    background-color: white;
    background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Make table body text slightly smaller to fit more on screen */
  .table > thead > tr > th {
    font-size: 11.5px !important;
    padding: 10px 12px !important;
    white-space: nowrap;
  }

  .table > tbody > tr > td {
    font-size: 12.5px;
    padding: 9px 12px !important;
    white-space: nowrap;
  }

  /* Action buttons in table — compact on mobile */
  .table .btn { padding: 4px 8px; font-size: 12px; }
  .table .btn-sm { padding: 3px 7px; font-size: 11px; }

  /* Card padding tighter on mobile */
  .card-body { padding: 12px !important; }
  .card-header { padding: 10px 14px !important; }

  /* Page title smaller on mobile */
  h2 { font-size: 18px !important; }
}

@media (max-width: 576px) {
  .table > thead > tr > th {
    font-size: 11px !important;
    padding: 8px 10px !important;
  }
  .table > tbody > tr > td {
    font-size: 12px;
    padding: 8px 10px !important;
  }
  /* Stack page header on very small screens */
  .d-flex.justify-content-between.align-items-center {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }
}

/* ============================================================
   Utility + Accessibility
   ============================================================ */
.text-brand { color: var(--brand-accent); }
.text-primary-brand { color: var(--brand-primary); }
.bg-brand-lt { background: var(--brand-accent-lt); }

:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}