/* ===================================================
   ZeroHack Shared Dashboard Sidebar & Layout
   Cloudflare-inspired modern UI
   =================================================== */

/* --- CSS Variables (Light Theme) --- */
:root {
    --zh-bg: #f5f6fa;
    --zh-surface: #ffffff;
    --zh-surface-hover: #f1f3f5;
    --zh-border: #e2e5ea;
    --zh-text: #1a1d23;
    --zh-text-secondary: #6b7280;
    --zh-text-muted: #9ca3af;
    --zh-primary: #0067DA;
    --zh-primary-hover: #0056b3;
    --zh-primary-bg: #eff6ff;
    --zh-primary-text: #0067DA;
    --zh-accent: #ea580c;
    --zh-accent-bg: #fff7ed;
    --zh-success: #16a34a;
    --zh-success-bg: #f0fdf4;
    --zh-danger: #dc2626;
    --zh-danger-bg: #fef2f2;
    --zh-warning: #ca8a04;
    --zh-warning-bg: #fefce8;
    --zh-purple: #7c3aed;
    --zh-purple-bg: #f5f3ff;
    --zh-sidebar-bg: #0a192f;
    --zh-sidebar-text: #94a3b8;
    --zh-sidebar-text-hover: #ffffff;
    --zh-sidebar-active-bg: rgba(0,103,218,0.15);
    --zh-sidebar-active-text: #0067DA;
    --zh-sidebar-hover-bg: rgba(255,255,255,0.06);
    --zh-sidebar-section: #4b5e75;
    --zh-sidebar-border: rgba(255,255,255,0.06);
    --zh-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --zh-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --zh-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --zh-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --zh-radius: 12px;
    --zh-radius-sm: 8px;
    --zh-radius-lg: 16px;
    --zh-transition: 0.15s ease;
    --zh-sidebar-w: 260px;
    --zh-topbar-h: 60px;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --zh-bg: #0d1117;
    --zh-surface: #161b22;
    --zh-surface-hover: #1c2129;
    --zh-border: #30363d;
    --zh-text: #e6edf3;
    --zh-text-secondary: #8b949e;
    --zh-text-muted: #6e7681;
    --zh-primary-bg: rgba(0,103,218,0.15);
    --zh-success-bg: rgba(22,163,74,0.15);
    /* The light palette's #dc2626 is 3.6:1 on --zh-surface, so anything using it
       as ink (the "Danger Zone" heading and button, `.zh-badge.red`,
       `.zh-stat-change.down`, and ~19 pages' inline `color:var(--zh-danger)`)
       fell under AA on the dark chrome. red-400 is 5.9-6.3:1 on every dark
       surface here. The filled `.zh-btn-danger` is re-pinned below, because
       this token doubles as its background and it needs white ink. */
    --zh-danger: #f87171;
    --zh-danger-bg: rgba(220,38,38,0.15);
    --zh-warning-bg: rgba(202,138,4,0.15);
    --zh-purple-bg: rgba(124,58,237,0.15);
    --zh-accent-bg: rgba(234,88,12,0.15);
    --zh-shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --zh-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --zh-shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --zh-shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* --- Per-Portal Accents (aside + chrome) --- */
body[data-portal="academy"] {
    --zh-primary: #3b82f6;
    --zh-primary-hover: #2563eb;
    --zh-primary-bg: rgba(59,130,246,0.15);
    --zh-sidebar-active-bg: rgba(59,130,246,0.18);
    --zh-sidebar-active-text: #60a5fa;
    --zh-sidebar-glow: #3b82f6;
}
body[data-portal="researcher"] {
    --zh-primary: #7c3aed;
    --zh-primary-hover: #6d28d9;
    --zh-primary-bg: rgba(124,58,237,0.16);
    --zh-sidebar-active-bg: rgba(124,58,237,0.18);
    --zh-sidebar-active-text: #a78bfa;
    --zh-sidebar-glow: #7c3aed;
}
body[data-portal="client"] {
    --zh-primary: #059669;
    --zh-primary-hover: #047857;
    --zh-primary-bg: rgba(5,150,105,0.15);
    --zh-sidebar-active-bg: rgba(5,150,105,0.18);
    --zh-sidebar-active-text: #34d399;
    --zh-sidebar-glow: #059669;
}

.zh-sidebar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -160px;
    height: 320px;
    background: radial-gradient(110% 110% at 50% 100%, var(--zh-sidebar-glow, rgba(0,103,218,0.4)), transparent 70%);
    pointer-events: none;
    opacity: 0.4;
}

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

body.zh-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--zh-bg);
    color: var(--zh-text);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 0;
}

/* --- Sidebar --- */
.zh-sidebar {
    width: var(--zh-sidebar-w);
    min-height: 100vh;
    background: var(--zh-sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    /* Palette rides along with the collapse animation, for the reason spelled
       out on `.zh-card`. */
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), width 0.25s ease,
        background-color var(--zh-transition),
        border-color var(--zh-transition),
        color var(--zh-transition);
    overflow: hidden;
}

.zh-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--zh-sidebar-border);
    flex-shrink: 0;
}

.zh-sidebar-logo img { height: 56px; flex-shrink: 0; }

.zh-sidebar-logo span {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.zh-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.zh-sidebar-nav::-webkit-scrollbar { width: 4px; }
.zh-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.zh-nav-section {
    padding: 18px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--zh-sidebar-section);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.zh-nav-section:first-child { padding-top: 10px; }

/* Categories tab — toggles the .zh-cat-list aside (hidden by default) */
.zh-cat-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.zh-cat-toggle:hover { color: var(--zh-primary); }
.zh-cat-toggle .fa-chevron-down {
    font-size: 9px;
    transition: transform .2s ease;
}
.zh-cat-toggle[aria-expanded="true"] .fa-chevron-down { transform: rotate(180deg); }

.zh-cat-list { display: none; margin-top: 2px; }
.zh-cat-list.open { display: block; }

.zh-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 16px 8px 20px;
    margin: 1px 8px;
    border-radius: 8px;
    color: var(--zh-sidebar-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--zh-transition);
    cursor: pointer;
    white-space: nowrap;
    border-left: none;
}

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

.zh-nav-item.active {
    background: var(--zh-sidebar-active-bg);
    color: var(--zh-sidebar-active-text);
    font-weight: 600;
}

.zh-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
    opacity: 0.8;
}

.zh-nav-item.active i { opacity: 1; }

.zh-nav-item .badge {
    margin-left: auto;
    background: rgba(0,103,218,0.6);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    line-height: 1.4;
}

.zh-nav-item .badge.warn { background: rgba(234,88,12,0.7); }
.zh-nav-item .badge.green { background: rgba(22,163,74,0.7); }

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

.zh-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--zh-radius-sm);
    transition: background var(--zh-transition), border-color var(--zh-transition),
        color var(--zh-transition);
    cursor: pointer;
}

.zh-user-card:hover { background: var(--zh-sidebar-hover-bg); }

.zh-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0067DA, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.zh-user-info { flex: 1; min-width: 0; }

.zh-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zh-user-role { font-size: 11px; color: var(--zh-sidebar-text); }

/* --- Main Content --- */
/* Palette on the same footing as the collapse animation, so swapping the theme
   does not snap the shell's own ink and rules (see `.zh-card`). */
.zh-main {
    flex: 1;
    margin-left: var(--zh-sidebar-w);
    min-height: 100vh;
    transition: margin-left 0.25s ease,
        background-color var(--zh-transition),
        border-color var(--zh-transition),
        color var(--zh-transition);
    display: flex;
    flex-direction: column;
}

/* --- Top Bar --- */
.zh-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    height: var(--zh-topbar-h);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--zh-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255,255,255,0.82);
    flex-shrink: 0;
}

[data-theme="dark"] .zh-topbar {
    background: rgba(22,27,34,0.82);
}

.zh-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.zh-topbar-left h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--zh-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zh-topbar-breadcrumb {
    font-size: 12px;
    color: var(--zh-text-muted);
    white-space: nowrap;
}

.zh-topbar-breadcrumb span { color: var(--zh-text-secondary); margin: 0 4px; }

.zh-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.zh-topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--zh-radius-sm);
    border: 1px solid var(--zh-border);
    background: var(--zh-surface);
    color: var(--zh-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--zh-transition);
    position: relative;
}

.zh-topbar-btn:hover {
    background: var(--zh-surface-hover);
    color: var(--zh-text);
    border-color: var(--zh-primary);
}

.zh-topbar-btn.active {
    background: var(--zh-primary-bg);
    color: var(--zh-primary);
    border-color: var(--zh-primary);
}

.zh-topbar-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--zh-danger);
    border-radius: 50%;
    border: 1.5px solid var(--zh-surface);
}

.zh-hamburger {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--zh-text);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--zh-radius-sm);
}

.zh-hamburger:hover { background: var(--zh-surface-hover); }

.zh-content {
    padding: 28px 32px 40px;
    flex: 1;
}

/* --- Mobile Bottom Nav --- */
.zh-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--zh-surface);
    border-top: 1px solid var(--zh-border);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255,255,255,0.92);
}

[data-theme="dark"] .zh-mobile-nav {
    background: rgba(22,27,34,0.92);
}

.zh-mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.zh-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    text-decoration: none;
    color: var(--zh-text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: color var(--zh-transition), border-color var(--zh-transition),
        background-color var(--zh-transition);
    border-radius: var(--zh-radius-sm);
}

.zh-mobile-nav-item i { font-size: 18px; }
.zh-mobile-nav-item.active { color: var(--zh-primary); }
.zh-mobile-nav-item:hover { color: var(--zh-text); }

/* Academy premium checkout */
.academy-payment-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.academy-payment-option { min-width: 0; padding: 16px; border: 1px solid var(--zh-border); border-radius: 10px; text-align: center; min-height: 80px; display: flex; align-items: center; justify-content: center; }

/* --- Mobile Overlay --- */
.zh-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.zh-sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* --- Dashboard Grid --- */
.zh-grid { display: grid; gap: 20px; }
.zh-grid-2 { grid-template-columns: repeat(2, 1fr); }
.zh-grid-3 { grid-template-columns: repeat(3, 1fr); }
.zh-grid-4 { grid-template-columns: repeat(4, 1fr); }
.zh-grid-2-1 { grid-template-columns: 2fr 1fr; }
.zh-grid-1-2 { grid-template-columns: 1fr 2fr; }

/* --- Cards --- */
.zh-card {
    background: var(--zh-surface);
    border: 1px solid var(--zh-border);
    border-radius: var(--zh-radius);
    padding: 24px;
    /* `box-shadow` alone covers only the hover lift: on a theme swap the card's
       own background, border and text switched instantly while `.zh-btn` and
       friends (transition: all) faded, so the chrome appeared to slide under
       a static card. Carrying the palette properties here keeps the whole
       shell moving together. `background` stays out on purpose — a gradient
       cannot be interpolated, and no shell surface uses one. */
    transition: box-shadow var(--zh-transition),
        background-color var(--zh-transition),
        border-color var(--zh-transition),
        color var(--zh-transition);
}

.zh-card:hover { box-shadow: var(--zh-shadow-md); }

.zh-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.zh-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--zh-text);
}

.zh-card-subtitle {
    font-size: 12px;
    color: var(--zh-text-muted);
    margin-top: 2px;
}

.zh-card-action {
    font-size: 12px;
    font-weight: 600;
    color: var(--zh-primary);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--zh-transition);
    background: none;
    border: none;
    font-family: inherit;
}

.zh-card-action:hover { color: var(--zh-primary-hover); }

/* --- Stat Cards --- */
.zh-stat {
    background: var(--zh-surface);
    border: 1px solid var(--zh-border);
    border-radius: var(--zh-radius);
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--zh-transition);
}

.zh-stat:hover { box-shadow: var(--zh-shadow-md); transform: translateY(-2px); }

.zh-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.zh-stat-icon.blue { background: var(--zh-primary-bg); color: var(--zh-primary); }
.zh-stat-icon.green { background: var(--zh-success-bg); color: var(--zh-success); }
.zh-stat-icon.orange { background: var(--zh-accent-bg); color: var(--zh-accent); }
.zh-stat-icon.red { background: var(--zh-danger-bg); color: var(--zh-danger); }
.zh-stat-icon.purple { background: var(--zh-purple-bg); color: var(--zh-purple); }
.zh-stat-icon.yellow { background: var(--zh-warning-bg); color: var(--zh-warning); }

.zh-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--zh-text);
    line-height: 1.1;
}

.zh-stat-label {
    font-size: 12px;
    color: var(--zh-text-secondary);
    margin-top: 4px;
}

.zh-stat-change {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.zh-stat-change.up { color: var(--zh-success); }
.zh-stat-change.down { color: var(--zh-danger); }

/* --- Pathway Cards --- */
.zh-pathways {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.zh-pathway-card {
  background: var(--zh-surface);
  border: 1.5px solid var(--zh-border);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.zh-pathway-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  border-color: var(--zh-primary);
}

.zh-pathway-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.zh-pathway-icon.blue { background: var(--zh-primary-bg); color: var(--zh-primary); }
.zh-pathway-icon.amber { background: #fffbeb; color: #f59e0b; }
.zh-pathway-icon.green { background: #ecfdf5; color: #10b981; }

[data-theme="dark"] .zh-pathway-icon.blue { background: rgba(59,130,246,0.15); }
[data-theme="dark"] .zh-pathway-icon.amber { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .zh-pathway-icon.green { background: rgba(16,185,129,0.15); }

.zh-pathway-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--zh-text);
  margin: 0 0 8px 0;
}

.zh-pathway-desc {
  font-size: 13px;
  color: var(--zh-text-secondary);
  line-height: 1.6;
  margin: 0 0 16px 0;
  flex: 1;
}

.zh-pathway-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.zh-pathway-feat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--zh-text-secondary);
}

.zh-pathway-feat i {
  font-size: 12px;
  width: 16px;
}

.zh-pathway-feat i.fa-check { color: var(--zh-success); }
.zh-pathway-feat i.fa-times { color: var(--zh-text-muted); }
.zh-pathway-feat i.fa-star { color: #f59e0b; }

.zh-pathway-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  font-family: inherit;
  width: 100%;
}

.zh-pathway-btn.blue {
  background: var(--zh-primary);
  color: #fff;
}
.zh-pathway-btn.blue:hover {
  background: var(--zh-primary-hover);
}

.zh-pathway-btn.amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}
.zh-pathway-btn.amber:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(245,158,11,0.35);
}

.zh-pathway-btn.green {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
.zh-pathway-btn.green:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}

.zh-pathway-btn i { font-size: 14px; }

.zh-pathway-price {
  font-size: 11px;
  color: var(--zh-text-muted);
  text-align: center;
  margin-top: 8px;
}

.zh-pathway-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.zh-pathway-badge.blue { background: var(--zh-primary-bg); color: var(--zh-primary); }
.zh-pathway-badge.amber { background: #fffbeb; color: #f59e0b; }
.zh-pathway-badge.green { background: #ecfdf5; color: #10b981; }

[data-theme="dark"] .zh-pathway-badge.amber { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .zh-pathway-badge.green { background: rgba(16,185,129,0.15); }

@media (max-width: 900px) {
  .zh-pathways { grid-template-columns: 1fr; }
}

/* --- Stats Bar --- */
.zh-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: center;
  background: var(--zh-surface);
  border: 1.5px solid var(--zh-border);
  border-radius: 16px;
  padding: 14px 16px;
  gap: 12px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.zh-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
  background: var(--zh-surface-hover);
  border-radius: 12px;
  border: 1px solid var(--zh-border);
}

.zh-stat-divider {
  display: none;
}

.zh-stat-level {
  padding: 10px 12px;
}

.zh-stat-level-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(37,99,235,0.3);
  transition: transform 0.2s;
}
.zh-stat-level-circle:hover { transform: scale(1.05); }

.zh-stat-xp {
  padding: 10px 14px;
}

@media (max-width: 600px) {
  .zh-stats-bar {
    grid-template-columns: 1fr;
  }
  .zh-stat-xp {
    grid-column: span 1;
  }
}

.zh-stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.zh-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--zh-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zh-stat-item .zh-stat-label {
  font-size: 11px;
  color: var(--zh-text-muted);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
}

.zh-stat-item i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.2s;
}
.zh-stat-item i:hover { transform: scale(1.08); }

.zh-stat-item i.blue { background: var(--zh-primary-bg); color: var(--zh-primary); }
.zh-stat-item i.green { background: var(--zh-success-bg); color: var(--zh-success); }
.zh-stat-item i.purple { background: var(--zh-purple-bg); color: var(--zh-purple); }
.zh-stat-item i.orange { background: var(--zh-accent-bg); color: var(--zh-accent); }

.zh-stat-streak-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(245,158,11,0.1);
  color: #f59e0b;
  transition: transform 0.2s;
}
.zh-stat-streak-icon:hover { transform: scale(1.08); }

.zh-progress-track {
  height: 6px;
  background: var(--zh-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
  min-width: 100px;
}

.zh-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px;
  transition: width 0.6s ease;
  width: 0%;
}

@media (max-width: 1000px) {
  .zh-stats-bar { border-radius: 14px; }
  .zh-stat-item { flex: 1 1 33.33%; padding: 12px 14px; }
  .zh-stat-divider { display: none; }
  .zh-stat-item + .zh-stat-item { border-top: 1px solid var(--zh-border); }
  .zh-stat-item:nth-child(-n+3) { border-top: none; }
  .zh-stat-item:nth-child(3n+1) { border-left: none; }
  .zh-stat-item:nth-child(3n+2),
  .zh-stat-item:nth-child(3n+3) { border-left: 1px solid var(--zh-border); }
}

@media (max-width: 600px) {
  .zh-stats-bar { border-radius: 12px; }
  .zh-stat-item { flex: 1 1 100%; padding: 10px 14px; border-left: none !important; }
  .zh-stat-item + .zh-stat-item { border-top: 1px solid var(--zh-border); }
  .zh-stat-item:nth-child(-n+3) { border-top: none; }
  .zh-stat-level-circle { width: 36px; height: 36px; font-size: 14px; }
  .zh-stat-val { font-size: 14px; }
  .zh-stat-item i,
  .zh-stat-streak-icon { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .zh-progress-track { min-width: 80px; }
}

/* --- Badges / Pills --- */
.zh-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.zh-badge.blue { background: var(--zh-primary-bg); color: var(--zh-primary); }
.zh-badge.green { background: var(--zh-success-bg); color: var(--zh-success); }
.zh-badge.orange { background: var(--zh-accent-bg); color: var(--zh-accent); }
.zh-badge.red { background: var(--zh-danger-bg); color: var(--zh-danger); }
.zh-badge.purple { background: var(--zh-purple-bg); color: var(--zh-purple); }
.zh-badge.yellow { background: var(--zh-warning-bg); color: var(--zh-warning); }
.zh-badge.gray { background: var(--zh-surface-hover); color: var(--zh-text-secondary); }

/* --- Buttons --- */
.zh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--zh-radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--zh-transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.zh-btn-primary { background: var(--zh-primary); color: #fff; }
.zh-btn-primary:hover { background: var(--zh-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,103,218,0.3); }

.zh-btn-outline {
    background: transparent;
    color: var(--zh-text-secondary);
    border: 1px solid var(--zh-border);
}
.zh-btn-outline:hover { border-color: var(--zh-primary); color: var(--zh-primary); background: var(--zh-primary-bg); }

.zh-btn-sm { padding: 6px 12px; font-size: 12px; }
.zh-btn-success { background: var(--zh-success); color: #fff; }
.zh-btn-success:hover { background: #15803d; }
.zh-btn-danger { background: var(--zh-danger); color: #fff; }
.zh-btn-danger:hover { background: #b91c1c; }
/* The dark palette lifts --zh-danger to a text-safe red, which would leave
   white on a pale fill at 2.8:1. Keep the fill at the dark brand red. */
[data-theme="dark"] .zh-btn-danger { background: #b91c1c; }
[data-theme="dark"] .zh-btn-danger:hover { background: #991b1b; }

/* --- Tables --- */
.zh-table-wrap { overflow-x: auto; }

.zh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.zh-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--zh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--zh-border);
}

.zh-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--zh-border);
    color: var(--zh-text-secondary);
}

.zh-table tr:last-child td { border-bottom: none; }
.zh-table tr:hover td { background: var(--zh-surface-hover); }
.zh-table .zh-text-primary { color: var(--zh-text); font-weight: 600; }

/* --- Progress Bar --- */
.zh-progress {
    width: 100%;
    height: 6px;
    background: var(--zh-border);
    border-radius: 3px;
    overflow: hidden;
}

.zh-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.zh-progress-bar.blue { background: var(--zh-primary); }
.zh-progress-bar.green { background: var(--zh-success); }
.zh-progress-bar.orange { background: var(--zh-accent); }
.zh-progress-bar.purple { background: var(--zh-purple); }

/* --- Tags --- */
.zh-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--zh-surface-hover);
    color: var(--zh-text-secondary);
}

/* --- Tabs --- */
.zh-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--zh-border);
    margin-bottom: 20px;
}

.zh-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--zh-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--zh-transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.zh-tab:hover { color: var(--zh-text); }
.zh-tab.active { color: var(--zh-primary); border-bottom-color: var(--zh-primary); font-weight: 600; }

/* --- Skill Tags (Mindmap) --- */
.zh-skill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zh-skill-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--zh-radius-sm);
    border: 1px solid var(--zh-border);
    background: var(--zh-surface);
    font-size: 13px;
    font-weight: 500;
    color: var(--zh-text);
    transition: all var(--zh-transition);
}

.zh-skill-chip:hover { border-color: var(--zh-primary); }

.zh-skill-chip .skill-count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--zh-primary-bg);
    color: var(--zh-primary);
}

.zh-skill-bar {
    width: 60px;
    height: 4px;
    background: var(--zh-border);
    border-radius: 2px;
    overflow: hidden;
}

.zh-skill-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--zh-primary);
}

/* --- Empty State --- */
.zh-empty {
    text-align: center;
    padding: 48px 24px;
}

.zh-empty i {
    font-size: 40px;
    color: var(--zh-text-muted);
    margin-bottom: 16px;
}

.zh-empty h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--zh-text);
    margin-bottom: 8px;
}

.zh-empty p {
    font-size: 13px;
    color: var(--zh-text-muted);
    max-width: 360px;
    margin: 0 auto 20px;
}

/* ==============================
   Shared List Helpers (ZHList)
   ============================== */
.zh-filter-btn {
    padding: 8px 16px;
    border: 1.5px solid var(--zh-border);
    border-radius: 20px;
    background: var(--zh-surface);
    color: var(--zh-text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.zh-filter-btn:hover { border-color: var(--zh-primary); color: var(--zh-primary); }
.zh-filter-btn.active { background: var(--zh-primary); color: #fff; border-color: var(--zh-primary); }

.zh-list-loading, .zh-list-empty {
    text-align: center;
    padding: 60px 20px;
}
.zh-list-loading i { font-size: 24px; color: var(--zh-primary); }
.zh-list-loading p, .zh-list-empty p {
    margin-top: 12px;
    font-size: 13px;
    color: var(--zh-text-secondary);
}
.zh-list-empty i {
    font-size: 48px;
    color: var(--zh-text-muted);
    margin-bottom: 16px;
}
.zh-list-empty h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--zh-text);
    margin-bottom: 8px;
}
.zh-list-empty .zh-empty-title-muted { color: var(--zh-text-muted); }
.zh-list-full { display: none; }

/* Talent / researcher cards (client portal browse talent) */
.zh-talent-card{background:var(--zh-surface);border:1px solid var(--zh-border);border-radius:var(--zh-radius);padding:24px;transition:transform .2s,box-shadow .2s,background-color var(--zh-transition),border-color var(--zh-transition)}.zh-talent-card:hover{box-shadow:var(--zh-shadow-md);transform:translateY(-2px)}.zh-talent-avatar{width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:18px;font-weight:700;flex-shrink:0}.zh-talent-name{font-size:15px;font-weight:700;color:var(--zh-text);margin-bottom:2px}.zh-talent-handle{font-size:12px;color:var(--zh-text-muted);margin-bottom:10px}.zh-talent-skills{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}.zh-talent-skill{display:inline-block;padding:3px 10px;border-radius:12px;font-size:11px;font-weight:600;background:var(--zh-primary-bg);color:var(--zh-primary)}.zh-talent-meta{display:flex;align-items:center;justify-content:space-between;padding-top:12px;border-top:1px solid var(--zh-border)}.zh-talent-rating{display:flex;align-items:center;gap:5px;font-size:13px;font-weight:600;color:var(--zh-text)}.zh-talent-rate{font-size:15px;font-weight:700;color:var(--zh-success)}.zh-talent-certs{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:12px}.zh-talent-cert{display:inline-block;padding:2px 8px;border-radius:6px;font-size:10px;font-weight:700;background:var(--zh-success-bg);color:var(--zh-success);letter-spacing:.3px}

/* Service cards (Client shared services) */
.service-card{background:var(--zh-surface);border:1px solid var(--zh-border);border-radius:var(--zh-radius);padding:24px;transition:transform .2s,box-shadow .2s,background-color var(--zh-transition),border-color var(--zh-transition);display:flex;flex-direction:column}.service-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,.08)}.service-icon{width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:20px;margin-bottom:16px}.service-title{font-size:16px;font-weight:700;color:var(--zh-text);margin-bottom:8px}.service-desc{font-size:13px;color:var(--zh-text-secondary);margin-bottom:16px;line-height:1.5;flex:1}.service-price{font-size:14px;font-weight:700;color:var(--zh-primary);margin-bottom:16px}.service-price span{font-size:11px;font-weight:500;color:var(--zh-text-muted)}.service-features{list-style:none;padding:0;margin:0 0 20px 0;display:grid;gap:8px}.service-features li{font-size:12px;color:var(--zh-text-secondary);display:flex;align-items:center;gap:8px}.service-features li .fa{color:var(--zh-success);font-size:11px;width:14px;text-align:center}

/* Proposal cards (Client) */
.zh-proposal-card{padding:0;overflow:hidden;transition:all .2s}.zh-proposal-card:hover{transform:translateY(-2px);box-shadow:var(--zh-shadow-md)}.zh-status-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:6px}

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

@media (max-width: 768px) {
    body.zh-dashboard { padding-bottom: 72px; }

    .zh-sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
    }
    .zh-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--zh-shadow-lg);
    }

    .zh-sidebar-overlay.visible { display: block; }

    .zh-main { margin-left: 0; }

    .zh-content { padding: 20px 16px; }

    .zh-grid-2, .zh-grid-3, .zh-grid-4,
    .zh-grid-2-1, .zh-grid-1-2 { grid-template-columns: 1fr; }

    .zh-topbar { padding: 0 16px; }
    .zh-topbar-left h2 { font-size: 15px; }

    .zh-hamburger { display: flex; align-items: center; justify-content: center; }

    .zh-mobile-nav { display: block; }

    .zh-stat { padding: 16px; }
    .zh-stat-value { font-size: 24px; }
    .zh-card { padding: 18px; }
}

@media (max-width: 600px) {
    .academy-payment-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .zh-topbar-breadcrumb { display: none; }
    .zh-topbar-left h2 { font-size: 14px; }
}
