/* ============================================================
   Inosculation Hub — Training Tracker v1.1 (FIXED)
   Adfix International (adfix.in)
   ============================================================ */

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

/* ── CSS Variables ───────────────────────────────────────── */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #3b82f6;
  --secondary:     #8b5cf6;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #06b6d4;
  --pink:          #ec4899;

  --grad-blue:    linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --grad-green:   linear-gradient(135deg, #059669 0%, #10b981 100%);
  --grad-orange:  linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --grad-red:     linear-gradient(135deg, #dc2626 0%, #f43f5e 100%);
  --grad-purple:  linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --grad-cyan:    linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  --grad-pink:    linear-gradient(135deg, #db2777 0%, #ec4899 100%);

  /* Sidebar — LIGHT mode */
  --sidebar-bg:          #1e1b4b;
  --sidebar-bg-2:        #0f172a;
  --sidebar-text:        rgba(255,255,255,.65);
  --sidebar-text-active: #ffffff;
  --sidebar-hover-bg:    rgba(255,255,255,.1);
  --sidebar-active-bg:   rgba(255,255,255,.12);
  --sidebar-border:      rgba(255,255,255,.08);
  --sidebar-section:     rgba(255,255,255,.3);
  --sidebar-brand-text:  #ffffff;
  --sidebar-brand-sub:   rgba(255,255,255,.45);
  --sidebar-btn-bg:      rgba(255,255,255,.1);
  --sidebar-btn-color:   #ffffff;
  --sidebar-active-indicator: #60a5fa;

  /* App — LIGHT mode */
  --bg-body:       #f1f5f9;
  --bg-card:       #ffffff;
  --bg-header:     #ffffff;
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --border:        #e2e8f0;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg:     0 8px 30px rgba(0,0,0,.12);
  --input-bg:      #f8fafc;
  --input-border:  #cbd5e1;
  --overlay:       rgba(15,23,42,.5);

  --sidebar-w:    260px;
  --sidebar-mini: 68px;
  --header-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --transition:   .25s cubic-bezier(.4,0,.2,1);
  --font-head:    'Outfit', sans-serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;
}

/* ── DARK MODE overrides ─────────────────────────────────── */
[data-theme="dark"] {
  /* Sidebar — DARK mode (lighter/more visible) */
  --sidebar-bg:          #0f172a;
  --sidebar-bg-2:        #060d1a;
  --sidebar-text:        rgba(148,163,184,.85);
  --sidebar-text-active: #f1f5f9;
  --sidebar-hover-bg:    rgba(255,255,255,.07);
  --sidebar-active-bg:   rgba(37,99,235,.2);
  --sidebar-border:      rgba(255,255,255,.06);
  --sidebar-brand-text:  #f1f5f9;
  --sidebar-active-indicator: #3b82f6;

  /* App — DARK mode */
  --bg-body:       #070d1a;
  --bg-card:       #0f1929;
  --bg-header:     #0f1929;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --border:        #1e293b;
  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.25);
  --shadow-lg:     0 8px 30px rgba(0,0,0,.5);
  --input-bg:      #1e293b;
  --input-border:  #334155;
  --overlay:       rgba(0,0,0,.7);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

.app-wrapper { display: flex; min-height: 100vh; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); font-weight: 700; line-height: 1.3; color: var(--text-primary); }

/* ── Layout ──────────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════
   SIDEBAR — fully theme-aware
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width var(--transition), background var(--transition);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,.2);
}

.sidebar.collapsed { width: var(--sidebar-mini); }

/* ── Sidebar Brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: var(--header-h);
  border-bottom: 1px solid var(--sidebar-border);
  gap: 10px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.sidebar-logo-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  overflow: hidden;
}

.sidebar-logo-wrap img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: none; /* Hidden by default, shown if loads */
}

.sidebar-logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: .85rem;
  color: #fff;
  letter-spacing: -.5px;
}

.sidebar-brand .brand-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
  min-width: 0;
}

.sidebar-brand .brand-text h4 {
  color: var(--sidebar-brand-text);
  font-size: .88rem;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand .brand-text small {
  color: var(--sidebar-brand-sub);
  font-size: .68rem;
  display: block;
}

.sidebar.collapsed .brand-text {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

/* ── TOGGLE BUTTON — always visible, at far right of header ── */
.sidebar-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--sidebar-btn-bg);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-btn-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
  font-size: 1.1rem;
  /* Always stay accessible */
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

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

.sidebar.collapsed .sidebar-toggle-btn {
  transform: translateY(-50%) rotate(180deg);
}

/* When collapsed, center the logo */
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 0 10px;
}

.sidebar.collapsed .sidebar-brand .brand-text { display: none; }
.sidebar.collapsed .sidebar-toggle-btn {
  position: static;
  transform: rotate(180deg);
  margin: 0;
}
.sidebar.collapsed .sidebar-brand {
  gap: 0;
  flex-direction: row;
  justify-content: space-between;
  padding: 0 8px;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.nav-section-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--sidebar-section);
  text-transform: uppercase;
  padding: 14px 18px 5px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-title { opacity: 0; height: 0; padding: 0; margin: 0; }

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: var(--sidebar-text);
  font-size: .845rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item a:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-active); }
.nav-item.active a { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); }

.nav-item.active a::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--sidebar-active-indicator);
  border-radius: 0 4px 4px 0;
}

.nav-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.nav-item a span.label {
  transition: opacity var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-item a span.label { opacity: 0; width: 0; overflow: hidden; display: none; }
.sidebar.collapsed .nav-item a { padding: 9px; justify-content: center; margin: 1px 6px; }
.sidebar.collapsed .nav-item.active a::before { display: none; }

/* Icon color variants */
.icon-blue   { background: rgba(37,99,235,.2);   color: #60a5fa !important; }
.icon-green  { background: rgba(16,185,129,.2);  color: #34d399 !important; }
.icon-orange { background: rgba(245,158,11,.2);  color: #fbbf24 !important; }
.icon-red    { background: rgba(239,68,68,.2);   color: #f87171 !important; }
.icon-purple { background: rgba(139,92,246,.2);  color: #a78bfa !important; }
.icon-cyan   { background: rgba(6,182,212,.2);   color: #22d3ee !important; }
.icon-pink   { background: rgba(236,72,153,.2);  color: #f472b6 !important; }
.icon-yellow { background: rgba(234,179,8,.2);   color: #facc15 !important; }

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover-bg); }

.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}

.sidebar-user .user-info { overflow: hidden; transition: opacity var(--transition); }
.sidebar.collapsed .sidebar-user .user-info { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-user { justify-content: center; }

.sidebar-user .user-info p { color: var(--sidebar-brand-text); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.sidebar-user .user-info small { color: var(--sidebar-brand-sub); font-size: .68rem; }

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1 1 auto;
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-w));
  transition: margin-left var(--transition), max-width var(--transition);
  display: flex;
  flex-direction: column;
}
.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-mini);
  max-width: calc(100vw - var(--sidebar-mini));
}

/* ── Topbar ── */
.topbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 0 var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar-title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.topbar-user:hover { background: var(--bg-body); border-color: var(--border); }

.topbar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-purple);
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-user .info p { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.topbar-user .info small { font-size: .68rem; color: var(--text-muted); }

/* ── Page Content ── */
.page-content { padding: 20px 24px 100px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 1.4rem; font-family: var(--font-head); }
.page-header p { color: var(--text-secondary); font-size: .82rem; margin-top: 3px; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  animation: fadeSlideUp .4s ease both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:nth-child(1){animation-delay:.05s} .stat-card:nth-child(2){animation-delay:.1s}
.stat-card:nth-child(3){animation-delay:.15s} .stat-card:nth-child(4){animation-delay:.2s}
.stat-card:nth-child(5){animation-delay:.25s} .stat-card:nth-child(6){animation-delay:.3s}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .07;
}
.stat-card.blue::after   { background: var(--primary); }
.stat-card.green::after  { background: var(--success); }
.stat-card.orange::after { background: var(--warning); }
.stat-card.red::after    { background: var(--danger); }
.stat-card.purple::after { background: var(--secondary); }
.stat-card.cyan::after   { background: var(--info); }
.stat-card.pink::after   { background: var(--pink); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
}
.stat-icon.blue   { background: var(--grad-blue); }
.stat-icon.green  { background: var(--grad-green); }
.stat-icon.orange { background: var(--grad-orange); }
.stat-icon.red    { background: var(--grad-red); }
.stat-icon.purple { background: var(--grad-purple); }
.stat-icon.cyan   { background: var(--grad-cyan); }
.stat-icon.pink   { background: var(--grad-pink); }

.stat-trend { font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.stat-trend.up   { background: rgba(16,185,129,.15); color: #10b981; }
.stat-trend.down { background: rgba(239,68,68,.15);  color: #ef4444; }

.stat-card h3 { font-size: 1.8rem; font-family: var(--font-head); margin-bottom: 3px; color: var(--text-primary); }
.stat-card p  { font-size: .78rem; color: var(--text-secondary); font-weight: 500; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: fadeSlideUp .4s ease both;
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}
.card-header {
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-title {
  font-size: .95rem;
  font-family: var(--font-head);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}
.card-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
}
.card-body { padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .845rem; }
.table th {
  background: var(--bg-body);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-body); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success   { background: rgba(16,185,129,.15); color: #059669; }
.badge-warning   { background: rgba(245,158,11,.15); color: #d97706; }
.badge-danger    { background: rgba(239,68,68,.15);  color: #dc2626; }
.badge-info      { background: rgba(6,182,212,.15);  color: #0891b2; }
.badge-secondary { background: var(--bg-body); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary   { background: rgba(37,99,235,.15); color: var(--primary); }
.badge-purple    { background: rgba(139,92,246,.15); color: #7c3aed; }
[data-theme="dark"] .badge-success { color: #34d399; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }
[data-theme="dark"] .badge-danger  { color: #f87171; }
[data-theme="dark"] .badge-info    { color: #22d3ee; }
[data-theme="dark"] .badge-primary { color: #60a5fa; }
[data-theme="dark"] .badge-purple  { color: #c084fc; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .845rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  outline: none;
  -webkit-appearance: none;
}
.btn:active { transform: scale(.97); }
.btn-sm  { padding: 6px 12px; font-size: .78rem; gap: 5px; }
.btn-lg  { padding: 11px 24px; font-size: .92rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; }

.btn-primary  { background: var(--grad-blue);   color: #fff; }
.btn-success  { background: var(--grad-green);  color: #fff; }
.btn-warning  { background: var(--grad-orange); color: #fff; }
.btn-danger   { background: var(--grad-red);    color: #fff; }
.btn-purple   { background: var(--grad-purple); color: #fff; }
.btn-cyan     { background: var(--grad-cyan);   color: #fff; }

.btn-primary:hover  { box-shadow: 0 4px 15px rgba(37,99,235,.4); transform: translateY(-1px); color: #fff; }
.btn-success:hover  { box-shadow: 0 4px 15px rgba(16,185,129,.4); transform: translateY(-1px); color: #fff; }
.btn-danger:hover   { box-shadow: 0 4px 15px rgba(239,68,68,.4); transform: translateY(-1px); color: #fff; }
.btn-warning:hover  { box-shadow: 0 4px 15px rgba(245,158,11,.4); transform: translateY(-1px); color: #fff; }
.btn-purple:hover   { box-shadow: 0 4px 15px rgba(139,92,246,.4); transform: translateY(-1px); color: #fff; }
.btn-cyan:hover     { box-shadow: 0 4px 15px rgba(6,182,212,.4); transform: translateY(-1px); color: #fff; }

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

.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-label span.req { color: var(--danger); margin-left: 2px; }

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: var(--bg-card);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: .73rem; color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}
.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: pointer; }
.form-check input[type="checkbox"], .form-check input[type="radio"] {
  width: 17px; height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-section { background: var(--bg-body); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); transition: background var(--transition), border-color var(--transition); }
.form-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }

.input-group { position: relative; }
.input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .95rem; pointer-events: none; }
.input-group .form-control { padding-left: 36px; }
.input-icon-right { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; }

.search-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-bar .form-control { max-width: 300px; }

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  animation: fadeSlideDown .3s ease;
  border-left: 4px solid;
}
.alert i { font-size: 1.05rem; flex-shrink: 0; }
.alert-success { background: rgba(16,185,129,.1);  border-color: #10b981; color: #047857; }
.alert-error   { background: rgba(239,68,68,.1);   border-color: #ef4444; color: #dc2626; }
.alert-info    { background: rgba(6,182,212,.1);   border-color: #06b6d4; color: #0891b2; }
.alert-warning { background: rgba(245,158,11,.1);  border-color: #f59e0b; color: #d97706; }
[data-theme="dark"] .alert-success { color: #34d399; }
[data-theme="dark"] .alert-error   { color: #f87171; }
[data-theme="dark"] .alert-info    { color: #22d3ee; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }

/* ══════════════════════════════════════════════════════════
   MODAL — FIXED layout with proper footer
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(.98);
  transition: transform var(--transition);
  overflow: hidden;
}
.modal-overlay.open .modal { transform: none; }
.modal.lg { max-width: 860px; }

/* Modal header — fixed at top */
.modal-header {
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }

/* Close button — clearly styled */
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
  font-weight: 700;
}
.modal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Modal body — scrollable */
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

/* Modal footer — always at bottom, never clipped */
.modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  overflow: visible;
}

/* Override inline modal footers inside form — never clip */
.modal-body .modal-footer {
  flex-shrink: 0 !important;
  padding: 14px 0 0 !important;
  margin: 0 !important;
  border-top: 1px solid var(--border) !important;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  overflow: visible !important;
}
.modal-footer .btn-secondary,
.modal-body .modal-footer .btn-secondary {
  background: var(--bg-body) !important;
  color: var(--text-secondary) !important;
  border: 1.5px solid var(--border) !important;
  min-width: 80px;
}
.modal-footer .btn-secondary:hover,
.modal-body .modal-footer .btn-secondary:hover {
  background: var(--border) !important;
  color: var(--text-primary) !important;
}

/* ══════════════════════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════════════════════ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 190px;
  z-index: 1100;
  padding: 5px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all var(--transition);
}
.dropdown.open .dropdown-menu { opacity: 1; pointer-events: all; transform: none; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  font-size: .845rem;
  color: var(--text-primary);
  transition: background var(--transition);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-body); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 5px 0; }

/* ══════════════════════════════════════════════════════════
   MISC COMPONENTS
   ══════════════════════════════════════════════════════════ */
.progress { background: var(--bg-body); border-radius: 20px; height: 7px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; border-radius: 20px; transition: width .6s ease; }
.progress-bar.blue   { background: var(--grad-blue); }
.progress-bar.green  { background: var(--grad-green); }
.progress-bar.orange { background: var(--grad-orange); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; background: var(--bg-body); border: 1px solid var(--border); border-radius: 20px; font-size: .73rem; color: var(--text-secondary); font-weight: 600; }
.chip.primary { background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.2); color: var(--primary); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; opacity: .25; margin-bottom: 10px; display: block; }
.empty-state p { font-size: .88rem; }

.pagination-nav { display: flex; justify-content: center; margin-top: 18px; }
.pagination { display: flex; gap: 5px; flex-wrap: wrap; }
.pagination li a { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); font-size: .83rem; font-weight: 600; transition: all var(--transition); }
.pagination li.active a, .pagination li a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-dot { position: absolute; left: -22px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card); z-index: 1; }
.timeline-dot.green  { background: var(--success); }
.timeline-dot.orange { background: var(--warning); }
.timeline-dot.red    { background: var(--danger); }
.timeline-content { background: var(--bg-body); border-radius: var(--radius-sm); padding: 10px 13px; border: 1px solid var(--border); transition: background var(--transition), border-color var(--transition); }
.timeline-content p { font-size: .84rem; color: var(--text-primary); }
.timeline-content small { font-size: .71rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-top: 3px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.media-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-body); aspect-ratio: 4/3; border: 1px solid var(--border); }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-type { position: absolute; top: 5px; left: 5px; background: rgba(0,0,0,.65); color: #fff; font-size: .62rem; padding: 2px 6px; border-radius: 4px; }
.media-video-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #1e293b; color: #fff; font-size: 2rem; }

.attendance-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 5px; background: var(--bg-body); gap: 10px; border: 1px solid var(--border); }
.attendance-row .emp-name { font-weight: 600; font-size: .845rem; flex: 1; }
.attendance-row .emp-id { font-size: .73rem; color: var(--text-muted); }
.att-btn { padding: 4px 11px; border-radius: 20px; font-size: .73rem; font-weight: 700; border: 2px solid; cursor: pointer; transition: all var(--transition); background: transparent; }
.att-btn.present { border-color: var(--success); color: var(--success); }
.att-btn.present.active { background: var(--success); color: #fff; }
.att-btn.absent { border-color: var(--danger); color: var(--danger); }
.att-btn.absent.active { background: var(--danger); color: #fff; }

.chart-wrapper { position: relative; height: 250px; }
.chart-wrapper.sm { height: 190px; }

.upload-zone { border: 2px dashed var(--input-border); border-radius: var(--radius); padding: 28px 18px; text-align: center; cursor: pointer; transition: all var(--transition); color: var(--text-muted); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: rgba(37,99,235,.05); color: var(--primary); }
.upload-zone i { font-size: 2.2rem; margin-bottom: 7px; display: block; }
.upload-zone p { font-size: .84rem; }

.tags-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 9px; background: var(--input-bg); border: 1.5px solid var(--input-border); border-radius: var(--radius-sm); min-height: 42px; cursor: text; }
.tag-item { display: flex; align-items: center; gap: 5px; background: rgba(37,99,235,.15); color: var(--primary); border-radius: 20px; padding: 3px 9px; font-size: .76rem; font-weight: 600; }
.tag-remove { cursor: pointer; opacity: .7; line-height: 1; }
.tag-remove:hover { opacity: 1; }

/* Suggestion list */
.suggestion-item { padding: 9px 13px; cursor: pointer; font-size: .84rem; border-bottom: 1px solid var(--border); color: var(--text-primary); transition: background var(--transition); }
.suggestion-item:hover { background: var(--bg-body); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #070d1a; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.15) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.1) 0%, transparent 60%), radial-gradient(ellipse at 60% 80%, rgba(16,185,129,.07) 0%, transparent 60%); }
.login-bg-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 40px 40px; }
.login-card { position: relative; background: rgba(15,25,41,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 36px 32px; width: 410px; max-width: calc(100vw - 32px); backdrop-filter: blur(16px); box-shadow: 0 25px 70px rgba(0,0,0,.5); animation: fadeSlideUp .5s ease; }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo h2 { color: #fff; font-size: 1.35rem; font-family: var(--font-head); }
.login-logo p  { color: rgba(255,255,255,.42); font-size: .78rem; margin-top: 3px; }
.login-card .form-label { color: rgba(255,255,255,.6); }
.login-card .form-control { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: #fff; }
.login-card .form-control:focus { border-color: var(--primary-light); background: rgba(255,255,255,.09); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.login-card .form-control::placeholder { color: rgba(255,255,255,.22); }
.login-footer { text-align: center; margin-top: 18px; font-size: .76rem; color: rgba(255,255,255,.38); }
.login-footer a { color: rgba(255,255,255,.58); }
.role-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 22px; justify-content: center; }
.role-pill { padding: 4px 13px; border-radius: 20px; font-size: .7rem; font-weight: 700; border: 1px solid; cursor: default; transition: all .2s; }
.role-pill.admin   { border-color: #a78bfa; color: #a78bfa; }
.role-pill.trainer { border-color: #60a5fa; color: #60a5fa; }
.role-pill.factory { border-color: #fbbf24; color: #fbbf24; }
.role-pill.brand   { border-color: #34d399; color: #34d399; }

/* ══════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV
   ══════════════════════════════════════════════════════════ */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-card); border-top: 1px solid var(--border); z-index: 1000; padding: 6px 0; box-shadow: 0 -4px 20px rgba(0,0,0,.08); transition: background var(--transition), border-color var(--transition); }
.mobile-nav ul { display: flex; justify-content: space-around; }
.mobile-nav ul li a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 10px; color: var(--text-muted); font-size: .6rem; font-weight: 600; transition: color var(--transition); border-radius: var(--radius-sm); text-decoration: none; }
.mobile-nav ul li a .nav-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; transition: all var(--transition); }
.mobile-nav ul li.active a { color: var(--primary); }
.mobile-nav ul li.active a .nav-icon { background: rgba(37,99,235,.15); color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeSlideUp   { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeSlideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn        { from { opacity:0; } to { opacity:1; } }
@keyframes spin          { to { transform:rotate(360deg); } }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-charts { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: none; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.3); }
  .main-content { margin-left: 0 !important; max-width: 100vw !important; }
  .page-content { padding: 14px 14px 90px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-card h3 { font-size: 1.5rem; }
  .stat-icon { width: 42px; height: 42px; font-size: 1rem; }
  .topbar { padding: 0 14px; gap: 8px; }
  .grid-3 { grid-template-columns: 1fr; }
  .card-body { padding: 14px 16px; }
  .card-header { padding: 12px 16px 0; }
  .form-row { grid-template-columns: 1fr; }
  .mobile-nav { display: block; }
  .table th, .table td { padding: 9px 11px; font-size: .8rem; }
  .btn { padding: 8px 13px; font-size: .82rem; }
  .page-header h2 { font-size: 1.15rem; }
  .topbar-user .info { display: none; }
  .modal { max-height: 92vh; }
  .modal.lg { max-width: calc(100vw - 24px); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: none; }
  .sidebar-overlay.visible { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 26px 18px; }
  .search-bar .form-control { max-width: 100%; width: 100%; }
  .page-header { flex-direction: column; }
}

/* ============================================================
   sidebar_fixes.css — v1.4
   Append this to the BOTTOM of assets/css/style.css
   Fixes: pill toggle always visible, light mode sidebar,
          larger logo, sidebar re-open on desktop
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   SIDEBAR v1.5 — bigger logo, fixed user info, light mode
   ════════════════════════════════════════════════════════════ */

/* Brand header — taller to accommodate 56px logo */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 76px;
  min-height: 76px;
  padding: 0;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-brand:hover { background: rgba(255,255,255,.05); }

/* Logo SVG — 56px, prominent */
.sb-logo-svg {
  width: 56px;
  height: 56px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(37,99,235,.4));
  transition: transform .2s ease, filter .2s ease;
}
.sidebar-brand:hover .sb-logo-svg {
  transform: scale(1.06);
  filter: drop-shadow(0 6px 16px rgba(37,99,235,.55));
}

/* Custom uploaded logo image */
.sb-logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 14px;
  display: block;
}

/* Hide ALL old brand text/badge elements */
.sidebar-brand .brand-text,
.sidebar-brand .sb-brand-text,
.sidebar-brand h4,
.sidebar-brand small,
.sidebar-brand .sb-org-name,
.sidebar-brand .sb-org-sub,
.sidebar-brand .sb-logo-text,
.sidebar-logo-text,
.sb-toggle,
.sb-toggle-btn,
.sidebar-toggle-btn { display: none !important; }

/* Collapsed: brand stays centered, logo slightly smaller */
.sidebar.collapsed .sidebar-brand { height: 76px; }
.sidebar.collapsed .sb-logo-svg  { width: 44px; height: 44px; }
.sidebar.collapsed .sb-logo-img  { width: 44px; height: 44px; }

/* ── Floating pill toggle — always visible ── */
.sb-pill-toggle {
  position: fixed;
  top: 38px;
  left: calc(var(--sidebar-w) - 13px);
  z-index: 1050;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  transition: left var(--transition), background var(--transition),
              color var(--transition), box-shadow var(--transition);
}
.sb-pill-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
}
@media (max-width: 768px) { .sb-pill-toggle { display: none !important; } }

/* ── Sidebar footer / user info ── */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sb-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition);
  min-width: 0;
}
.sb-user-row:hover { background: rgba(255,255,255,.08); }

.sb-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--grad-purple);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  flex: 1;
  transition: opacity var(--transition), max-width var(--transition);
  max-width: 160px;
}
.sb-user-name {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255,255,255,.9);
}
.sb-user-role {
  font-size: .68rem;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed: hide text, center avatar */
.sidebar.collapsed .sb-user-info {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}
.sidebar.collapsed .sb-user-row {
  justify-content: center;
  padding: 8px;
  gap: 0;
}

/* ── STATS GRID — force 3 columns on desktop ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
/* Tablet: 2 columns */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
/* Mobile: 2 columns */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ── LIGHT MODE sidebar overrides ── */
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
  box-shadow: 2px 0 16px rgba(0,0,0,.07);
  border-right: 1px solid #e2e8f0;
}
[data-theme="light"] .sidebar-brand {
  border-bottom-color: #e2e8f0;
}
[data-theme="light"] .sidebar-brand:hover { background: rgba(0,0,0,.03); }
[data-theme="light"] .nav-section-title  { color: #94a3b8; }
[data-theme="light"] .nav-item a         { color: #475569; }
[data-theme="light"] .nav-item a:hover   { background: rgba(37,99,235,.07); color: var(--primary); }
[data-theme="light"] .nav-item.active a  { background: rgba(37,99,235,.1);  color: var(--primary); }
[data-theme="light"] .nav-item.active a::before { background: var(--primary); }
[data-theme="light"] .icon-blue   { background: rgba(37,99,235,.1);  color: #2563eb !important; }
[data-theme="light"] .icon-green  { background: rgba(16,185,129,.1); color: #059669 !important; }
[data-theme="light"] .icon-orange { background: rgba(245,158,11,.1); color: #d97706 !important; }
[data-theme="light"] .icon-red    { background: rgba(239,68,68,.1);  color: #dc2626 !important; }
[data-theme="light"] .icon-purple { background: rgba(139,92,246,.1); color: #7c3aed !important; }
[data-theme="light"] .icon-cyan   { background: rgba(6,182,212,.1);  color: #0891b2 !important; }
[data-theme="light"] .icon-pink   { background: rgba(236,72,153,.1); color: #db2777 !important; }
[data-theme="light"] .icon-yellow { background: rgba(234,179,8,.1);  color: #b45309 !important; }
[data-theme="light"] .sidebar-footer  { border-top-color: #e2e8f0; }
[data-theme="light"] .sb-user-row:hover { background: rgba(0,0,0,.04); }
[data-theme="light"] .sb-user-name    { color: #1e293b; }
[data-theme="light"] .sb-user-role    { color: #64748b; }
[data-theme="light"] .sb-pill-toggle  {
  background: #fff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
[data-theme="light"] .sb-logo-svg {
  filter: drop-shadow(0 4px 12px rgba(37,99,235,.3));
}

/* ── SCROLL TO TOP button ── */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 9000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-blue);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.9);
  transition: opacity .3s ease, transform .3s ease, box-shadow .2s;
}
.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}
.scroll-top-btn:hover {
  box-shadow: 0 6px 20px rgba(37,99,235,.55);
  transform: translateY(-2px) scale(1.05);
}
@media (max-width: 768px) {
  .scroll-top-btn { bottom: 72px; right: 14px; width: 40px; height: 40px; }
}

/* ── Dev credit ── */
.dev-credit {
  position: fixed;
  bottom: 6px; right: 12px;
  font-size: .62rem;
  color: var(--text-muted);
  z-index: 500;
  pointer-events: none;
}
@media (max-width: 768px) { .dev-credit { display: none; } }
