/* =========================================================
   CertifyPro — shared stylesheet (topnav, sidebar, layout,
   dashboard cards, and template gallery)
   ========================================================= */
:root {
  --primary: #FF6B35;
  --primary-light: #fff3ef;
  --primary-dark: #e55a24;
  --secondary: #392C7D;
  --accent: #00C9A7;
  --bg: #F8F9FC;
  --sidebar-bg: #fff;
  --card-bg: #fff;
  --text-dark: #1a1a2e;
  --text-mid: #4b5563;
  --text-light: #9ca3af;
  --border: #e9ecef;
  --shadow: 0 4px 24px rgba(0,0,0,0.07);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 270px;
  --sidebar-w-collapsed: 68px;
  --header-h: 68px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── TOP NAV ───────────────────────────────── */
.topnav {
  position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  box-shadow: var(--shadow-sm);
}
.topnav-left { display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #ff9a5c);
  display: flex; align-items: center; justify-content: center;
}
.logo-icon i { color: #fff; font-size: 16px; }
.logo-text { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--text-dark); }
.logo-text span { color: var(--primary); }

.hamburger {
  background: none; border: none; cursor: pointer;
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: background .2s;
}
.hamburger:hover { background: var(--bg); }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text-mid); border-radius: 2px; transition: .3s; }
.hamburger.active { background: var(--primary-light); }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.topnav-right { display: flex; align-items: center; gap: 12px; }
.nav-search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 40px; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 14px;
}
.nav-search input { border: none; background: none; outline: none; font-size: .875rem; color: var(--text-dark); width: 200px; font-family: inherit; }
.nav-search i { color: var(--text-light); font-size: .85rem; }

.nav-icon-wrap { position: relative; }

/* ── topnav dropdowns: search results, notifications, user menu ──── */
.nav-dropdown {
  display: none;
  position: absolute; top: calc(100% + 10px); left: 0;
  width: min(300px, calc(100vw - 32px)); max-height: 380px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0,0,0,.12));
  z-index: 200;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-right { left: auto; right: 0; }
.nav-search-results { top: calc(100% + 8px); width: 100%; }
.nav-dropdown-title {
  padding: 12px 16px 8px; font-size: .78rem; font-weight: 700;
  color: var(--text-light); text-transform: uppercase; letter-spacing: .03em;
}
.nav-dropdown-body { display: flex; flex-direction: column; }
.nav-dropdown-empty { padding: 18px 16px; font-size: .82rem; color: var(--text-light); text-align: center; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; text-decoration: none; color: var(--text-dark);
  font-size: .85rem; transition: background .15s;
}
.nav-dropdown-item:hover { background: var(--primary-light); }
.nav-dropdown-item i { width: 16px; text-align: center; color: var(--text-light); font-size: .85rem; flex-shrink: 0; }
.nav-dropdown-item.danger { color: #ef4444; }
.nav-dropdown-item.danger i { color: #ef4444; }
.nav-dropdown-item-title { font-weight: 600; }
.nav-dropdown-item-time { font-size: .75rem; color: var(--text-light); margin-top: 1px; }
.nav-dropdown-footer {
  display: block; padding: 10px 16px; text-align: center;
  font-size: .8rem; font-weight: 700; color: var(--primary);
  text-decoration: none; border-top: 1px solid var(--border);
}
.nav-dropdown-footer:hover { background: var(--primary-light); }
.nav-dropdown-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.nav-dropdown-user-name { font-size: .85rem; font-weight: 700; color: var(--text-dark); }
.nav-dropdown-user-role { font-size: .75rem; color: var(--text-light); }
.nav-search-group-label {
  padding: 10px 16px 4px; font-size: .72rem; font-weight: 700;
  color: var(--text-light); text-transform: uppercase; letter-spacing: .03em;
}
.nav-search-group:not(:last-child) { border-bottom: 1px solid var(--border); padding-bottom: 4px; }

.nav-icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s;
}
.nav-icon-btn:hover { background: var(--primary-light); }
.nav-icon-btn i { color: var(--text-mid); font-size: .95rem; }
.nav-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: #fff;
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  height: 40px; box-sizing: border-box;
  padding: 0 14px 0 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 40px; cursor: pointer; transition: background .2s;
}
.user-pill:hover { background: var(--primary-light); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg,#FF6B35,#392C7D);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #fff;
}
.user-name { font-size: .82rem; font-weight: 600; color: var(--text-dark); }
.user-pill i { font-size: .7rem; color: var(--text-light); }

/* ── LAYOUT ────────────────────────────────── */
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }

/* ── SIDEBAR ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  position: fixed; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); left: 0; bottom: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow: visible; z-index: 50;
  transition: transform .3s ease, width .2s ease;
}
/* Scrolling lives on this inner wrapper, not on .sidebar itself, so the
   collapse button (which deliberately sits half outside the sidebar's
   right edge) never gets clipped by scroll-container overflow clipping. */
.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Collapsed (minimized) sidebar — icons only, used to give a page like the
   Certificate Designer more screen width. Toggled by .layout.sidebar-collapsed. */
.sidebar-collapse-btn {
  position: absolute; top: 14px; right: -13px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-mid);
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 51;
  font-size: .7rem; box-shadow: 0 1px 4px rgba(0,0,0,.12); transition: transform .2s ease;
}
.sidebar-collapse-btn:hover { color: var(--primary); }
.layout.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.layout.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }
.layout.sidebar-collapsed .sidebar-section-label,
.layout.sidebar-collapsed .sp-name, .layout.sidebar-collapsed .sp-role, .layout.sidebar-collapsed .sp-btns,
.layout.sidebar-collapsed .nav-item span.nav-item-label { display: none; }
.layout.sidebar-collapsed .sidebar-profile { padding: 14px 8px; margin: 16px 8px; }
.layout.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.layout.sidebar-collapsed .nav-item i { margin: 0; }
.layout.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
.layout.sidebar-collapsed .sidebar-divider { margin: 10px 8px; }

.sidebar-profile {
  margin: 20px 16px 16px;
  background: linear-gradient(135deg, var(--secondary) 0%, #6a3de8 100%);
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  color: #fff;
  position: relative; overflow: hidden;
}
.sidebar-profile::before { content: ''; position: absolute; top: -20px; right: -20px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.08); }
.sidebar-profile::after { content: ''; position: absolute; bottom: -30px; right: 20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.06); }
.sp-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg,#FF6B35,#ffbd8a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800; color: #fff;
  border: 3px solid rgba(255,255,255,.3);
  margin-bottom: 10px; position: relative; z-index: 1;
}
.sp-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; position: relative; z-index: 1; }
.sp-role { font-size: .75rem; opacity: .75; margin-bottom: 14px; position: relative; z-index: 1; }
.sp-btns { display: flex; gap: 8px; position: relative; z-index: 1; }
.sp-btn {
  flex: 1; padding: 7px 6px; border-radius: 8px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: .72rem; font-weight: 600;
  cursor: pointer; text-align: center; transition: background .2s;
  text-decoration: none; display: block; font-family: inherit;
}
.sp-btn:hover { background: rgba(255,255,255,.3); }
.sp-btn.primary { background: var(--primary); border-color: var(--primary); }
.sp-btn.primary:hover { background: var(--primary-dark); }

.sidebar-section { padding: 10px 16px 4px; }
.sidebar-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  color: var(--text-light); text-transform: uppercase; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-mid);
  font-size: .875rem; font-weight: 500;
  transition: all .2s; margin-bottom: 2px; cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active i { color: var(--primary); }
.nav-item .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-left: auto; animation: pulse 2s infinite; }
.nav-item .nav-count {
  margin-left: auto; background: var(--bg); border: 1px solid var(--border);
  color: var(--text-light); font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.sidebar-divider { height: 1px; background: var(--border); margin: 10px 16px; }

/* ── MAIN CONTENT ──────────────────────────── */
.main { flex: 1; margin-left: var(--sidebar-w); padding: 28px 28px 60px; transition: opacity .15s ease; }
.main.main-loading { opacity: .45; pointer-events: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.breadcrumb a { text-decoration: none; color: var(--text-light); font-size: .82rem; }
.breadcrumb i { font-size: .6rem; color: var(--text-light); }
.breadcrumb span { font-size: .82rem; font-weight: 600; color: var(--text-dark); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 800; font-family: 'Nunito', sans-serif; margin-bottom: 6px; color: var(--text-dark); }
.page-sub { font-size: .88rem; color: var(--text-light); }

.placeholder-card {
  background: var(--card-bg); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 60px 30px; text-align: center; color: var(--text-light);
}
.placeholder-card i { font-size: 2rem; color: var(--primary); margin-bottom: 14px; display: block; }
.placeholder-card h3 { color: var(--text-dark); font-family: 'Nunito', sans-serif; margin-bottom: 6px; }
.placeholder-card p { font-size: .85rem; max-width: 460px; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text-dark);
  text-decoration: none; transition: all .2s; font-family: inherit;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .76rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-mid); }
.btn-ghost:hover { background: var(--bg); color: var(--primary); }
.btn-danger:hover { border-color: #ef4444; color: #ef4444; }

/* ── STAT CARDS ─────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  transition: transform .25s, box-shadow .25s;
  animation: fadeUp .5s ease both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
@keyframes fadeUp { from { opacity:0; transform: translateY(18px); } to { opacity:1; transform: translateY(0); } }
.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-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-icon.orange { background: #fff3ef; color: var(--primary); }
.stat-icon.purple { background: #f0ecff; color: #7c5cbf; }
.stat-icon.green  { background: #e6faf7; color: var(--accent); }
.stat-icon.blue   { background: #e8f4ff; color: #3b82f6; }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: .78rem; color: var(--text-light); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 800; font-family: 'Nunito', sans-serif; color: var(--text-dark); }
.stat-trend { display: flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; margin-top: 4px; }
.stat-trend.up { color: #10b981; }

/* ── DASHBOARD GRID ─────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }
.card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); animation: fadeUp .5s ease both; animation-delay: .3s; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-dark); font-family: 'Nunito', sans-serif; }
.card-action { font-size: .78rem; font-weight: 600; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 4px; }
.card-action:hover { opacity: .75; }

/* Recent activity */
.activity-list { padding: 8px 0; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--border); transition: background .15s; }
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg); }
.activity-icon { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: #fff; }
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-weight: 600; font-size: .84rem; color: var(--text-dark); }
.activity-sub { font-size: .73rem; color: var(--text-light); margin-top: 1px; }
.activity-meta { text-align: right; flex-shrink: 0; }
.activity-time { font-size: .72rem; color: var(--text-light); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .68rem; font-weight: 700; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fff3ef; color: var(--primary); }
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-gray { background: #eef0f4; color: #6b7280; }

/* Quick actions */
.qa-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.qa-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  text-decoration: none; color: var(--text-dark); font-weight: 600; font-size: .85rem;
  transition: all .2s;
}
.qa-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); transform: translateX(2px); }
.qa-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; color: #fff; }
.qa-btn small { display: block; font-weight: 400; color: var(--text-light); font-size: .7rem; margin-top: 1px; }

/* ── TEMPLATE GALLERY ───────────────────────── */
.tpl-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.tpl-search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
}
.tpl-search input { border: none; outline: none; background: none; font-size: .85rem; width: 100%; color: var(--text-dark); font-family: inherit; }
.tpl-search i { color: var(--text-light); }
.tpl-select {
  padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card-bg); font-size: .85rem; color: var(--text-mid); font-family: inherit; cursor: pointer;
}
.tpl-chip-row { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tpl-chip {
  padding: 7px 14px; border-radius: 20px; font-size: .78rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text-mid); cursor: pointer; transition: all .2s;
}
.tpl-chip.active, .tpl-chip:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.tpl-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
  animation: fadeUp .4s ease both;
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tpl-thumb {
  height: 140px; position: relative; display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.05rem; text-align: center; padding: 14px;
}
.tpl-thumb-badge {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92); color: var(--text-dark);
  font-size: .66rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.tpl-thumb-default {
  position: absolute; top: 10px; right: 10px; background: #fbbf24; color: #7a4a00;
  font-size: .66rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  display: flex; align-items: center; gap: 4px;
}
.tpl-body { padding: 14px 16px 16px; }
.tpl-name { font-weight: 700; font-size: .9rem; color: var(--text-dark); margin-bottom: 3px; }
.tpl-meta { font-size: .72rem; color: var(--text-light); margin-bottom: 12px; }
.tpl-actions { display: flex; gap: 6px; }
.tpl-actions .btn { flex: 1; justify-content: center; padding: 8px; }
.tpl-actions .icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card-bg); color: var(--text-mid);
  cursor: pointer; transition: all .2s; font-size: .8rem;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn.danger:hover { border-color: #ef4444; color: #ef4444; }

.tpl-create-card {
  border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 220px; text-decoration: none; color: var(--text-light);
  transition: all .2s;
}
.tpl-create-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.tpl-create-card i { font-size: 1.6rem; }
.tpl-create-card span { font-weight: 700; font-size: .85rem; }

@media(max-width:1300px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); } }
@media(max-width:1100px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
}
@media(max-width:480px) { .stats-grid { grid-template-columns: 1fr; } .tpl-grid { grid-template-columns: 1fr; } }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 6px; }

@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 18px; }
  .nav-search { display: none; }
  .sidebar-collapse-btn { display: none; }
  .layout.sidebar-collapsed .main { margin-left: 0; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14141f; --sidebar-bg: #1b1b28; --card-bg: #1b1b28;
    --text-dark: #f1f1f6; --text-mid: #b7b7c4; --text-light: #7b7b8c;
    --border: #2b2b3a; --primary-light: #2a1f1a;
  }
}
:root[data-theme="dark"] {
  --bg: #14141f; --sidebar-bg: #1b1b28; --card-bg: #1b1b28;
  --text-dark: #f1f1f6; --text-mid: #b7b7c4; --text-light: #7b7b8c;
  --border: #2b2b3a; --primary-light: #2a1f1a;
}
.topnav, .sidebar { background: var(--sidebar-bg); }
