/* ==========================================================================
   HRBox — Modern HR Platform Design System
   Inspired by BambooHR, Rippling, Deel — world-class HR tools
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Design Tokens
   ========================================================================== */

:root {
    /* Brand Colors */
    --hb-primary: #4F46E5;
    --hb-primary-light: #818CF8;
    --hb-primary-lighter: #E0E7FF;
    --hb-primary-dark: #3730A3;
    --hb-secondary: #0D9488;
    --hb-secondary-light: #5EEAD4;
    --hb-secondary-lighter: #CCFBF1;
    --hb-accent: #F59E0B;
    --hb-accent-light: #FCD34D;
    --hb-accent-lighter: #FEF3C7;

    /* Semantic Colors */
    --hb-success: #10B981;
    --hb-success-light: #D1FAE5;
    --hb-warning: #F59E0B;
    --hb-warning-light: #FEF3C7;
    --hb-danger: #EF4444;
    --hb-danger-light: #FEE2E2;
    --hb-info: #3B82F6;
    --hb-info-light: #DBEAFE;

    /* Neutrals */
    --hb-gray-50: #F8FAFC;
    --hb-gray-100: #F1F5F9;
    --hb-gray-200: #E2E8F0;
    --hb-gray-300: #CBD5E1;
    --hb-gray-400: #94A3B8;
    --hb-gray-500: #64748B;
    --hb-gray-600: #475569;
    --hb-gray-700: #334155;
    --hb-gray-800: #1E293B;
    --hb-gray-900: #0F172A;

    /* Layout */
    --hb-sidebar-width: 272px;
    --hb-sidebar-collapsed: 72px;
    --hb-navbar-height: 64px;
    --hb-sidebar-bg: #0F172A;
    --hb-sidebar-hover: rgba(255, 255, 255, 0.06);
    --hb-sidebar-active: rgba(79, 70, 229, 0.15);
    --hb-sidebar-text: #94A3B8;
    --hb-sidebar-text-active: #FFFFFF;
    --hb-content-bg: #F1F5F9;

    /* Typography */
    --hb-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --hb-text-xs: 0.75rem;
    --hb-text-sm: 0.8125rem;
    --hb-text-base: 0.875rem;
    --hb-text-lg: 1rem;
    --hb-text-xl: 1.125rem;
    --hb-text-2xl: 1.375rem;
    --hb-text-3xl: 1.75rem;

    /* Shadows */
    --hb-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --hb-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --hb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --hb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --hb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    /* Borders */
    --hb-radius-sm: 6px;
    --hb-radius-md: 8px;
    --hb-radius-lg: 12px;
    --hb-radius-xl: 16px;
    --hb-radius-full: 9999px;

    /* Transitions */
    --hb-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --hb-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --hb-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--hb-font);
    font-size: var(--hb-text-base);
    line-height: 1.6;
    color: var(--hb-gray-800);
    background-color: var(--hb-content-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--hb-gray-900);
}

a { color: var(--hb-primary); text-decoration: none; transition: color var(--hb-transition-fast); }
a:hover { color: var(--hb-primary-dark); }

/* Navbar
   ========================================================================== */

.hb-navbar {
    position: fixed;
    top: 0;
    left: var(--hb-sidebar-width);
    right: 0;
    height: var(--hb-navbar-height);
    background: #FFFFFF;
    border-bottom: 1px solid var(--hb-gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1030;
    transition: left var(--hb-transition-slow);
}

.hb-navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.hb-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hb-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--hb-text-sm);
    color: var(--hb-gray-500);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hb-breadcrumb li { display: flex; align-items: center; gap: 0.375rem; }
.hb-breadcrumb a { color: var(--hb-gray-500); font-weight: 500; }
.hb-breadcrumb a:hover { color: var(--hb-primary); }
.hb-breadcrumb .separator { color: var(--hb-gray-300); font-size: 0.7rem; }
.hb-breadcrumb .current { color: var(--hb-gray-800); font-weight: 600; }

.hb-search {
    position: relative;
    max-width: 280px;
}

.hb-search input {
    width: 100%;
    height: 36px;
    padding: 0 0.75rem 0 2.25rem;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-full);
    font-size: var(--hb-text-sm);
    background: var(--hb-gray-50);
    color: var(--hb-gray-800);
    transition: all var(--hb-transition-fast);
    outline: none;
}

.hb-search input:focus {
    border-color: var(--hb-primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.hb-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hb-gray-400);
    font-size: var(--hb-text-sm);
}

.hb-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--hb-radius-md);
    border: 1px solid var(--hb-gray-200);
    background: #fff;
    color: var(--hb-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--hb-transition-fast);
    position: relative;
    font-size: var(--hb-text-sm);
}

.hb-nav-btn:hover { background: var(--hb-gray-50); border-color: var(--hb-gray-300); color: var(--hb-gray-800); }

.hb-nav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: var(--hb-radius-full);
    background: var(--hb-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

.hb-user-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-full);
    background: #fff;
    cursor: pointer;
    transition: all var(--hb-transition-fast);
}

.hb-user-btn:hover { border-color: var(--hb-gray-300); background: var(--hb-gray-50); }

.hb-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--hb-text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.hb-user-info { text-align: left; line-height: 1.2; }
.hb-user-name { font-size: var(--hb-text-sm); font-weight: 600; color: var(--hb-gray-800); }
.hb-user-role { font-size: var(--hb-text-xs); color: var(--hb-gray-500); }

/* Sidebar
   ========================================================================== */

.hb-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--hb-sidebar-width);
    height: 100vh;
    background: var(--hb-sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--hb-transition-slow), transform var(--hb-transition-slow);
}

.hb-sidebar-brand {
    height: var(--hb-navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.hb-sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--hb-radius-md);
    background: linear-gradient(135deg, var(--hb-primary), #7C3AED);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.hb-sidebar-brand-text {
    font-size: var(--hb-text-xl);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
}

.hb-sidebar-brand-text span {
    font-weight: 400;
    color: var(--hb-primary-light);
}

.hb-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.hb-sidebar-nav::-webkit-scrollbar { width: 3px; }
.hb-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

.hb-nav-section {
    padding: 0.75rem 1.25rem 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    transition: opacity var(--hb-transition-fast);
}

.hb-nav-section:hover { opacity: 1; }
.hb-nav-section:hover .hb-nav-section-label { color: rgba(148, 163, 184, 0.9); }

.hb-nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(148, 163, 184, 0.6);
    white-space: nowrap;
    transition: color var(--hb-transition-fast);
}

.hb-nav-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
}

.hb-nav-section-chevron {
    font-size: 0.55rem;
    color: rgba(148, 163, 184, 0.4);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.hb-nav-group[data-collapsed="true"] .hb-nav-section-chevron { transform: rotate(-90deg); }

.hb-nav-group-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}

.hb-nav-group[data-collapsed="true"] .hb-nav-group-items {
    max-height: 0;
    opacity: 0;
}

.hb-nav-group .hb-nav-item.active { display: flex !important; }

.hb-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    margin: 0.125rem 0.625rem;
    color: var(--hb-sidebar-text);
    font-size: var(--hb-text-sm);
    font-weight: 500;
    border-radius: var(--hb-radius-md);
    transition: all var(--hb-transition-fast);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.hb-nav-item:hover {
    color: var(--hb-sidebar-text-active);
    background: var(--hb-sidebar-hover);
}

.hb-nav-item.active {
    color: #fff;
    background: var(--hb-sidebar-active);
}

.hb-nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.625rem;
    top: 0.375rem;
    bottom: 0.375rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--hb-primary);
}

.hb-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    opacity: 0.75;
}

.hb-nav-item.active i { opacity: 1; color: var(--hb-primary-light); }

.hb-nav-item-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--hb-radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-nav-item-badge.danger { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; }
.hb-nav-item-badge.warning { background: rgba(245, 158, 11, 0.2); color: #FCD34D; }
.hb-nav-item-badge.success { background: rgba(16, 185, 129, 0.2); color: #6EE7B7; }
.hb-nav-item-badge.primary { background: rgba(79, 70, 229, 0.2); color: #A5B4FC; }

.hb-sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.hb-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.375rem;
    border-radius: var(--hb-radius-md);
    transition: background var(--hb-transition-fast);
}

.hb-sidebar-user:hover { background: var(--hb-sidebar-hover); }

.hb-sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hb-primary), #7C3AED);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--hb-text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.hb-sidebar-user-info { flex: 1; overflow: hidden; }
.hb-sidebar-user-name { font-size: var(--hb-text-sm); font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-sidebar-user-email { font-size: var(--hb-text-xs); color: var(--hb-gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main Content
   ========================================================================== */

.hb-main {
    margin-left: var(--hb-sidebar-width);
    margin-top: var(--hb-navbar-height);
    min-height: calc(100vh - var(--hb-navbar-height));
    background: var(--hb-content-bg);
    transition: margin-left var(--hb-transition-slow);
}

.hb-content { padding: 1.5rem; max-width: 1400px; }
.hb-content-wide { padding: 1.5rem; }

/* Page Header
   ========================================================================== */

.hb-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hb-page-title {
    font-size: var(--hb-text-2xl);
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.hb-page-subtitle {
    font-size: var(--hb-text-sm);
    color: var(--hb-gray-500);
    margin: 0.25rem 0 0;
}

/* Cards
   ========================================================================== */

.hb-card {
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    box-shadow: var(--hb-shadow-xs);
    transition: box-shadow var(--hb-transition), transform var(--hb-transition);
    overflow: hidden;
}

.hb-card:hover { box-shadow: var(--hb-shadow-sm); }
.hb-card-clickable:hover { box-shadow: var(--hb-shadow-md); transform: translateY(-1px); cursor: pointer; }

.hb-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hb-gray-100);
}

.hb-card-title {
    font-size: var(--hb-text-base);
    font-weight: 700;
    color: var(--hb-gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hb-card-title i { color: var(--hb-gray-400); font-size: var(--hb-text-sm); }

.hb-card-body { padding: 1.25rem; }
.hb-card-body-flush { padding: 0; }
.hb-card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--hb-gray-100); background: var(--hb-gray-50); }

/* Stat Cards
   ========================================================================== */

.hb-stat-card {
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--hb-transition);
}

.hb-stat-card:hover { box-shadow: var(--hb-shadow-sm); transform: translateY(-1px); }

.hb-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--hb-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.hb-stat-icon.primary { background: var(--hb-primary-lighter); color: var(--hb-primary); }
.hb-stat-icon.success { background: var(--hb-success-light); color: var(--hb-success); }
.hb-stat-icon.warning { background: var(--hb-warning-light); color: var(--hb-warning); }
.hb-stat-icon.danger { background: var(--hb-danger-light); color: var(--hb-danger); }
.hb-stat-icon.info { background: var(--hb-info-light); color: var(--hb-info); }
.hb-stat-icon.secondary { background: var(--hb-secondary-lighter); color: var(--hb-secondary); }

.hb-stat-content { flex: 1; min-width: 0; }
.hb-stat-label { font-size: var(--hb-text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--hb-gray-500); margin-bottom: 0.25rem; }
.hb-stat-value { font-size: 1.625rem; font-weight: 800; color: var(--hb-gray-900); line-height: 1.2; }
.hb-stat-change { font-size: var(--hb-text-xs); font-weight: 600; display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.hb-stat-change.positive { color: var(--hb-success); }
.hb-stat-change.negative { color: var(--hb-danger); }

/* Journey Stepper — the main visual component for employee flow
   ========================================================================== */

.hb-stepper {
    position: relative;
    padding: 0;
}

.hb-stepper-item {
    display: flex;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.5rem;
}

.hb-stepper-item:last-child { padding-bottom: 0; }

.hb-stepper-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 40px;
}

.hb-stepper-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: all var(--hb-transition);
}

.hb-stepper-dot.completed {
    background: var(--hb-success);
    color: #fff;
    box-shadow: 0 0 0 4px var(--hb-success-light);
}

.hb-stepper-dot.active {
    background: var(--hb-primary);
    color: #fff;
    box-shadow: 0 0 0 4px var(--hb-primary-lighter);
    animation: hb-pulse 2s infinite;
}

.hb-stepper-dot.overdue {
    background: var(--hb-danger);
    color: #fff;
    box-shadow: 0 0 0 4px var(--hb-danger-light);
}

.hb-stepper-dot.pending {
    background: var(--hb-gray-200);
    color: var(--hb-gray-500);
}

.hb-stepper-line {
    flex: 1;
    width: 2px;
    background: var(--hb-gray-200);
    margin: 0.25rem 0;
    min-height: 1.5rem;
}

.hb-stepper-line.completed { background: var(--hb-success); }

.hb-stepper-body { flex: 1; padding-top: 0.375rem; min-width: 0; }

.hb-stepper-title {
    font-size: var(--hb-text-base);
    font-weight: 600;
    color: var(--hb-gray-800);
    margin-bottom: 0.25rem;
}

.hb-stepper-item.completed .hb-stepper-title { color: var(--hb-gray-500); }

.hb-stepper-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.hb-stepper-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--hb-radius-full);
    font-size: var(--hb-text-xs);
    font-weight: 500;
    background: var(--hb-gray-100);
    color: var(--hb-gray-600);
}

/* Feature Grid — for HR admin command center
   ========================================================================== */

.hb-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.hb-feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    text-align: center;
    transition: all var(--hb-transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--hb-gray-700);
}

.hb-feature-card:hover {
    border-color: var(--hb-primary-light);
    box-shadow: var(--hb-shadow-md);
    transform: translateY(-2px);
    color: var(--hb-primary);
}

.hb-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--hb-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.hb-feature-label {
    font-size: var(--hb-text-sm);
    font-weight: 600;
}

/* Progress Components
   ========================================================================== */

.hb-progress {
    height: 8px;
    border-radius: var(--hb-radius-full);
    background: var(--hb-gray-100);
    overflow: hidden;
}

.hb-progress-bar {
    height: 100%;
    border-radius: var(--hb-radius-full);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.hb-progress-bar.primary { background: linear-gradient(90deg, var(--hb-primary), var(--hb-primary-light)); }
.hb-progress-bar.success { background: linear-gradient(90deg, var(--hb-success), #34D399); }
.hb-progress-bar.warning { background: linear-gradient(90deg, var(--hb-warning), var(--hb-accent-light)); }
.hb-progress-bar.danger { background: linear-gradient(90deg, var(--hb-danger), #F87171); }

.hb-progress-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hb-progress-ring svg { transform: rotate(-90deg); }

.hb-progress-ring .ring-bg { fill: none; stroke: var(--hb-gray-100); }
.hb-progress-ring .ring-fill { fill: none; stroke: var(--hb-primary); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.hb-progress-ring .ring-fill.success { stroke: var(--hb-success); }
.hb-progress-ring .ring-fill.warning { stroke: var(--hb-warning); }
.hb-progress-ring .ring-fill.danger { stroke: var(--hb-danger); }

.hb-progress-ring-label {
    position: absolute;
    font-size: var(--hb-text-xl);
    font-weight: 800;
    color: var(--hb-gray-900);
}

/* Badges & Tags
   ========================================================================== */

.hb-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--hb-radius-full);
    font-size: var(--hb-text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.hb-badge.primary { background: var(--hb-primary-lighter); color: var(--hb-primary-dark); }
.hb-badge.success { background: var(--hb-success-light); color: #065F46; }
.hb-badge.warning { background: var(--hb-warning-light); color: #92400E; }
.hb-badge.danger { background: var(--hb-danger-light); color: #991B1B; }
.hb-badge.info { background: var(--hb-info-light); color: #1E40AF; }
.hb-badge.neutral { background: var(--hb-gray-100); color: var(--hb-gray-600); }
.hb-badge.secondary { background: var(--hb-secondary-lighter); color: #115E59; }

/* Tables
   ========================================================================== */

.hb-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--hb-text-sm);
}

.hb-table thead th {
    padding: 0.75rem 1rem;
    background: var(--hb-gray-50);
    font-size: var(--hb-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hb-gray-500);
    border-bottom: 1px solid var(--hb-gray-200);
    white-space: nowrap;
}

.hb-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hb-gray-100);
    vertical-align: middle;
    color: var(--hb-gray-700);
}

.hb-table tbody tr { transition: background var(--hb-transition-fast); }
.hb-table tbody tr:hover { background: var(--hb-gray-50); }
.hb-table tbody tr:last-child td { border-bottom: none; }

/* Buttons
   ========================================================================== */

.hb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--hb-radius-md);
    font-size: var(--hb-text-sm);
    font-weight: 600;
    font-family: var(--hb-font);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--hb-transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.5;
}

.hb-btn:hover { transform: translateY(-1px); }
.hb-btn:active { transform: translateY(0); }

.hb-btn-primary { background: var(--hb-primary); color: #fff; border-color: var(--hb-primary); }
.hb-btn-primary:hover { background: var(--hb-primary-dark); border-color: var(--hb-primary-dark); color: #fff; box-shadow: var(--hb-shadow-md); }

.hb-btn-success { background: var(--hb-success); color: #fff; border-color: var(--hb-success); }
.hb-btn-success:hover { background: #059669; border-color: #059669; color: #fff; box-shadow: var(--hb-shadow-md); }

.hb-btn-danger { background: var(--hb-danger); color: #fff; border-color: var(--hb-danger); }
.hb-btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }

.hb-btn-outline { background: #fff; color: var(--hb-gray-700); border-color: var(--hb-gray-300); }
.hb-btn-outline:hover { background: var(--hb-gray-50); border-color: var(--hb-gray-400); color: var(--hb-gray-800); }

.hb-btn-ghost { background: transparent; color: var(--hb-gray-600); border-color: transparent; }
.hb-btn-ghost:hover { background: var(--hb-gray-100); color: var(--hb-gray-800); }

.hb-btn-sm { padding: 0.3125rem 0.75rem; font-size: var(--hb-text-xs); }
.hb-btn-lg { padding: 0.625rem 1.5rem; font-size: var(--hb-text-base); }
.hb-btn-icon { width: 36px; height: 36px; padding: 0; }
.hb-btn-icon.sm { width: 30px; height: 30px; }

/* Quick Actions Panel
   ========================================================================== */

.hb-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.hb-quick-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    transition: all var(--hb-transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--hb-gray-700);
}

.hb-quick-action:hover {
    border-color: var(--hb-primary-light);
    background: var(--hb-primary-lighter);
    color: var(--hb-primary-dark);
    box-shadow: var(--hb-shadow-sm);
}

.hb-quick-action i { font-size: 1.125rem; width: 20px; text-align: center; }
.hb-quick-action span { font-size: var(--hb-text-sm); font-weight: 600; }

/* Welcome Banner
   ========================================================================== */

.hb-welcome-banner {
    background: linear-gradient(135deg, var(--hb-primary) 0%, #7C3AED 100%);
    border-radius: var(--hb-radius-xl);
    padding: 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hb-welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hb-welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: 10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.hb-welcome-title { font-size: var(--hb-text-2xl); font-weight: 700; margin-bottom: 0.375rem; position: relative; z-index: 1; }
.hb-welcome-text { font-size: var(--hb-text-base); opacity: 0.85; margin-bottom: 1rem; position: relative; z-index: 1; }

.hb-welcome-stats {
    display: flex;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.hb-welcome-stat-value { font-size: var(--hb-text-3xl); font-weight: 800; }
.hb-welcome-stat-label { font-size: var(--hb-text-xs); opacity: 0.75; text-transform: uppercase; letter-spacing: 0.05em; }

/* Chat / AI Buddy
   ========================================================================== */

.hb-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--hb-navbar-height) - 140px);
    min-height: 450px;
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    overflow: hidden;
}

.hb-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hb-gray-100);
    background: var(--hb-gray-50);
}

.hb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hb-chat-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: var(--hb-radius-lg);
    font-size: var(--hb-text-sm);
    line-height: 1.6;
}

.hb-chat-bubble.user {
    align-self: flex-end;
    background: var(--hb-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.hb-chat-bubble.bot {
    align-self: flex-start;
    background: var(--hb-gray-50);
    color: var(--hb-gray-800);
    border: 1px solid var(--hb-gray-200);
    border-bottom-left-radius: 4px;
}

.hb-chat-input {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--hb-gray-100);
    background: #fff;
}

.hb-chat-input input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-full);
    font-size: var(--hb-text-sm);
    font-family: var(--hb-font);
    outline: none;
    transition: border-color var(--hb-transition-fast);
}

.hb-chat-input input:focus { border-color: var(--hb-primary-light); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Auth Layout
   ========================================================================== */

.hb-auth-body {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 40%, #F1F5F9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.hb-auth-container { width: 100%; max-width: 420px; }

.hb-auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.hb-auth-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--hb-radius-lg);
    background: linear-gradient(135deg, var(--hb-primary), #7C3AED);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.hb-auth-title {
    font-size: var(--hb-text-2xl);
    font-weight: 800;
    color: var(--hb-gray-900);
    letter-spacing: -0.02em;
}

.hb-auth-subtitle {
    color: var(--hb-gray-500);
    font-size: var(--hb-text-sm);
    margin-top: 0.25rem;
}

.hb-auth-card {
    background: #fff;
    border-radius: var(--hb-radius-xl);
    box-shadow: var(--hb-shadow-lg);
    padding: 2rem;
    border: 1px solid var(--hb-gray-200);
}

/* Forms
   ========================================================================== */

.hb-form-group { margin-bottom: 1rem; }

.hb-label {
    display: block;
    font-size: var(--hb-text-sm);
    font-weight: 600;
    color: var(--hb-gray-700);
    margin-bottom: 0.375rem;
}

.hb-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--hb-gray-300);
    border-radius: var(--hb-radius-md);
    font-size: var(--hb-text-sm);
    font-family: var(--hb-font);
    color: var(--hb-gray-800);
    transition: border-color var(--hb-transition-fast), box-shadow var(--hb-transition-fast);
    outline: none;
    background: #fff;
}

.hb-input:focus {
    border-color: var(--hb-primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.hb-input::placeholder { color: var(--hb-gray-400); }

.hb-select {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--hb-gray-300);
    border-radius: var(--hb-radius-md);
    font-size: var(--hb-text-sm);
    font-family: var(--hb-font);
    color: var(--hb-gray-800);
    background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center/12px 12px;
    appearance: none;
    outline: none;
    transition: border-color var(--hb-transition-fast), box-shadow var(--hb-transition-fast);
}

.hb-select:focus {
    border-color: var(--hb-primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Notifications
   ========================================================================== */

.hb-notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hb-gray-100);
    transition: background var(--hb-transition-fast);
}

.hb-notification-item:hover { background: var(--hb-gray-50); }
.hb-notification-item.unread { background: rgba(79, 70, 229, 0.02); border-left: 3px solid var(--hb-primary); }
.hb-notification-item:last-child { border-bottom: none; }

.hb-notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--hb-text-sm);
    flex-shrink: 0;
}

/* Gamification
   ========================================================================== */

.hb-points-hero {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    border-radius: var(--hb-radius-xl);
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.hb-points-value { font-size: 3rem; font-weight: 900; line-height: 1; }
.hb-points-label { font-size: var(--hb-text-sm); opacity: 0.85; margin-top: 0.5rem; }

.hb-badge-card {
    text-align: center;
    padding: 1.25rem 1rem;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    background: #fff;
    transition: all var(--hb-transition);
}

.hb-badge-card.earned { border-color: var(--hb-accent-light); }
.hb-badge-card.earned:hover { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2); transform: translateY(-2px); }
.hb-badge-card.locked { opacity: 0.5; }

.hb-badge-medal {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.hb-badge-medal.gold { background: linear-gradient(135deg, #FCD34D, #F59E0B); color: #fff; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.hb-badge-medal.locked { background: var(--hb-gray-100); color: var(--hb-gray-400); }

/* Leaderboard */

.hb-leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hb-gray-100);
}

.hb-leaderboard-item:last-child { border-bottom: none; }
.hb-leaderboard-item.is-me { background: var(--hb-primary-lighter); border-radius: var(--hb-radius-md); }

.hb-leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--hb-text-sm);
    flex-shrink: 0;
}

.hb-leaderboard-rank.gold { background: #FEF3C7; color: #92400E; }
.hb-leaderboard-rank.silver { background: #F1F5F9; color: #475569; }
.hb-leaderboard-rank.bronze { background: #FED7AA; color: #9A3412; }
.hb-leaderboard-rank.default { background: var(--hb-gray-100); color: var(--hb-gray-500); }

/* Empty States
   ========================================================================== */

.hb-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.hb-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--hb-gray-100);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--hb-gray-400);
    margin-bottom: 1rem;
}

.hb-empty-title { font-size: var(--hb-text-lg); font-weight: 600; color: var(--hb-gray-700); margin-bottom: 0.375rem; }
.hb-empty-text { font-size: var(--hb-text-sm); color: var(--hb-gray-500); max-width: 320px; margin: 0 auto; }

/* Dropdown menus
   ========================================================================== */

.hb-dropdown { position: relative; }

.hb-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-lg);
    box-shadow: var(--hb-shadow-xl);
    padding: 0.375rem;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--hb-transition-fast);
}

.hb-dropdown.open .hb-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.hb-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--hb-radius-sm);
    font-size: var(--hb-text-sm);
    color: var(--hb-gray-700);
    transition: background var(--hb-transition-fast);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.hb-dropdown-item:hover { background: var(--hb-gray-50); color: var(--hb-gray-900); }
.hb-dropdown-item.danger { color: var(--hb-danger); }
.hb-dropdown-item.danger:hover { background: var(--hb-danger-light); }
.hb-dropdown-divider { height: 1px; background: var(--hb-gray-100); margin: 0.25rem 0; }

/* Notification dropdown */
.hb-notif-panel {
    width: 360px;
    max-height: 440px;
    overflow-y: auto;
    padding: 0;
}

.hb-notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hb-gray-100);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.hb-notif-panel-header h6 { margin: 0; font-size: var(--hb-text-sm); font-weight: 700; }

/* Alerts / Toast
   ========================================================================== */

.hb-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--hb-radius-md);
    font-size: var(--hb-text-sm);
    border: 1px solid;
    animation: hb-slideDown 0.3s ease;
}

.hb-alert.success { background: var(--hb-success-light); border-color: #A7F3D0; color: #065F46; }
.hb-alert.danger { background: var(--hb-danger-light); border-color: #FECACA; color: #991B1B; }
.hb-alert.warning { background: var(--hb-warning-light); border-color: #FDE68A; color: #92400E; }
.hb-alert.info { background: var(--hb-info-light); border-color: #BFDBFE; color: #1E40AF; }

/* Upload Zone
   ========================================================================== */

.hb-upload-zone {
    border: 2px dashed var(--hb-gray-300);
    border-radius: var(--hb-radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--hb-transition);
    background: var(--hb-gray-50);
}

.hb-upload-zone:hover, .hb-upload-zone.dragover {
    border-color: var(--hb-primary);
    background: var(--hb-primary-lighter);
}

.hb-upload-zone i { font-size: 2rem; color: var(--hb-gray-400); margin-bottom: 0.5rem; }
.hb-upload-zone.dragover i { color: var(--hb-primary); }

/* Filter Bar
   ========================================================================== */

.hb-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hb-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--hb-gray-200);
    border-radius: var(--hb-radius-full);
    font-size: var(--hb-text-xs);
    font-weight: 600;
    color: var(--hb-gray-600);
    background: #fff;
    cursor: pointer;
    transition: all var(--hb-transition-fast);
    text-decoration: none;
}

.hb-filter-chip:hover { border-color: var(--hb-primary-light); color: var(--hb-primary); background: var(--hb-primary-lighter); }
.hb-filter-chip.active { border-color: var(--hb-primary); color: #fff; background: var(--hb-primary); }

/* Utility Classes
   ========================================================================== */

.hb-fade-in { animation: hb-fadeIn 0.4s ease forwards; }
.hb-slide-up { animation: hb-slideUp 0.4s ease forwards; }

.hb-gap-xs { gap: 0.25rem; }
.hb-gap-sm { gap: 0.5rem; }
.hb-gap-md { gap: 0.75rem; }
.hb-gap-lg { gap: 1rem; }
.hb-gap-xl { gap: 1.5rem; }

.hb-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.hb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hb-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

.hb-flex { display: flex; }
.hb-flex-col { display: flex; flex-direction: column; }
.hb-items-center { align-items: center; }
.hb-justify-between { justify-content: space-between; }
.hb-flex-1 { flex: 1; }
.hb-flex-shrink-0 { flex-shrink: 0; }

.hb-text-xs { font-size: var(--hb-text-xs); }
.hb-text-sm { font-size: var(--hb-text-sm); }
.hb-text-lg { font-size: var(--hb-text-lg); }
.hb-text-muted { color: var(--hb-gray-500); }
.hb-text-primary { color: var(--hb-primary); }
.hb-text-success { color: var(--hb-success); }
.hb-text-warning { color: var(--hb-warning); }
.hb-text-danger { color: var(--hb-danger); }
.hb-font-semibold { font-weight: 600; }
.hb-font-bold { font-weight: 700; }
.hb-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hb-mt-0 { margin-top: 0; }
.hb-mb-0 { margin-bottom: 0; }
.hb-mb-xs { margin-bottom: 0.25rem; }
.hb-mb-sm { margin-bottom: 0.5rem; }
.hb-mb-md { margin-bottom: 0.75rem; }
.hb-mb-lg { margin-bottom: 1rem; }
.hb-mb-xl { margin-bottom: 1.5rem; }

.hb-p-0 { padding: 0; }
.hb-p-sm { padding: 0.5rem; }
.hb-p-md { padding: 1rem; }
.hb-p-lg { padding: 1.5rem; }

.hb-rounded { border-radius: var(--hb-radius-md); }
.hb-rounded-lg { border-radius: var(--hb-radius-lg); }
.hb-rounded-full { border-radius: var(--hb-radius-full); }

.hb-shadow { box-shadow: var(--hb-shadow-sm); }
.hb-shadow-md { box-shadow: var(--hb-shadow-md); }

.hb-divider { height: 1px; background: var(--hb-gray-200); margin: 1rem 0; }

/* Animations
   ========================================================================== */

@keyframes hb-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes hb-slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes hb-slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes hb-pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--hb-primary-lighter); }
    50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.1); }
}

/* Staggered animation for lists */
.hb-stagger > *:nth-child(1) { animation-delay: 0ms; }
.hb-stagger > *:nth-child(2) { animation-delay: 50ms; }
.hb-stagger > *:nth-child(3) { animation-delay: 100ms; }
.hb-stagger > *:nth-child(4) { animation-delay: 150ms; }
.hb-stagger > *:nth-child(5) { animation-delay: 200ms; }
.hb-stagger > *:nth-child(6) { animation-delay: 250ms; }
.hb-stagger > *:nth-child(7) { animation-delay: 300ms; }
.hb-stagger > *:nth-child(8) { animation-delay: 350ms; }

/* Mobile Toggle */
.hb-mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--hb-radius-md);
    border: 1px solid var(--hb-gray-200);
    background: #fff;
    color: var(--hb-gray-600);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Responsive
   ========================================================================== */

@media (max-width: 1199.98px) {
    .hb-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991.98px) {
    .hb-sidebar {
        transform: translateX(-100%);
    }

    .hb-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }

    .hb-navbar { left: 0; }
    .hb-main { margin-left: 0; }
    .hb-mobile-toggle { display: flex; }

    .hb-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .hb-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .hb-welcome-stats { flex-wrap: wrap; gap: 1rem; }

    .hb-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        opacity: 0;
        visibility: hidden;
        transition: all var(--hb-transition-slow);
    }

    .hb-sidebar-overlay.active { opacity: 1; visibility: visible; }
}

@media (max-width: 767.98px) {
    .hb-content { padding: 1rem; }
    .hb-grid-2, .hb-grid-3, .hb-grid-4 { grid-template-columns: 1fr; }
    .hb-feature-grid { grid-template-columns: repeat(2, 1fr); }
    .hb-quick-actions { grid-template-columns: 1fr; }
    .hb-page-header { flex-direction: column; }
    .hb-welcome-banner { padding: 1.25rem; }
    .hb-welcome-title { font-size: var(--hb-text-xl); }
    .hb-stat-card { padding: 1rem; }

    .hb-chat-bubble { max-width: 90%; }
}

@media (max-width: 575.98px) {
    .hb-search { display: none; }
    .hb-user-info { display: none; }
}

/* Gamification Components
   ========================================================================== */

.hb-points-hero {
    text-align: center;
    background: linear-gradient(135deg, var(--hb-primary), #7C3AED);
    color: #fff;
    border-radius: var(--hb-radius-xl);
    padding: 2rem;
    box-shadow: var(--hb-shadow-lg);
}

.hb-points-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.hb-points-label {
    font-size: var(--hb-text-sm);
    opacity: 0.85;
    font-weight: 500;
}

.hb-badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 0.75rem;
    border-radius: var(--hb-radius-lg);
    border: 1px solid var(--hb-gray-200);
    transition: all var(--hb-transition-fast);
}

.hb-badge-card.earned {
    background: var(--hb-warning-light);
    border-color: rgba(245, 158, 11, 0.3);
}

.hb-badge-card.locked {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.hb-badge-medal {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.hb-badge-medal.gold { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.hb-badge-medal.locked { background: var(--hb-gray-200); color: var(--hb-gray-400); }

.hb-leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--hb-gray-100);
    transition: background var(--hb-transition-fast);
}

.hb-leaderboard-item:last-child { border-bottom: none; }
.hb-leaderboard-item:hover { background: var(--hb-gray-50); }
.hb-leaderboard-item.is-me { background: var(--hb-primary-lighter); }

.hb-leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--hb-text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.hb-leaderboard-rank.gold { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.hb-leaderboard-rank.silver { background: linear-gradient(135deg, #9CA3AF, #6B7280); color: #fff; }
.hb-leaderboard-rank.bronze { background: linear-gradient(135deg, #D97706, #92400E); color: #fff; }
.hb-leaderboard-rank.default { background: var(--hb-gray-100); color: var(--hb-gray-600); }

/* Card Variants
   ========================================================================== */

.hb-card-clickable {
    cursor: pointer;
    transition: all var(--hb-transition-fast);
}

.hb-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--hb-shadow-md);
    border-color: var(--hb-primary-light);
}

.hb-card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--hb-gray-100);
    background: var(--hb-gray-50);
    border-radius: 0 0 var(--hb-radius-lg) var(--hb-radius-lg);
}

/* Button Variants
   ========================================================================== */

.hb-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--hb-radius-md);
}

.hb-btn-icon.sm { width: 30px; height: 30px; }

.hb-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: var(--hb-text-xs);
    font-weight: 600;
    color: var(--hb-primary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--hb-radius-md);
    text-decoration: none;
    transition: all var(--hb-transition-fast);
}

.hb-btn-ghost:hover { background: var(--hb-primary-lighter); color: var(--hb-primary-dark); }

.hb-btn-success {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: var(--hb-text-sm);
    font-weight: 600;
    color: #fff;
    background: var(--hb-success);
    border: none;
    border-radius: var(--hb-radius-md);
    cursor: pointer;
    transition: all var(--hb-transition-fast);
    text-decoration: none;
}

.hb-btn-success:hover { background: #059669; color: #fff; }
.hb-btn-success.hb-btn-sm { padding: 0.375rem 0.75rem; font-size: var(--hb-text-xs); }

/* Select Component
   ========================================================================== */

.hb-select {
    display: block;
    width: 100%;
    padding: 0.625rem 2rem 0.625rem 0.875rem;
    font-size: var(--hb-text-sm);
    font-family: inherit;
    color: var(--hb-gray-800);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    border: 1px solid var(--hb-gray-300);
    border-radius: var(--hb-radius-md);
    appearance: none;
    transition: border-color var(--hb-transition-fast), box-shadow var(--hb-transition-fast);
}

.hb-select:focus {
    outline: none;
    border-color: var(--hb-primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Notification Items
   ========================================================================== */

.hb-notification-item.unread {
    background: var(--hb-primary-lighter);
    border-left: 3px solid var(--hb-primary);
}

.hb-notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--hb-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Auth Layout Enhancement
   ========================================================================== */

.hb-auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.hb-auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hb-auth-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--hb-radius-lg);
    background: linear-gradient(135deg, var(--hb-primary), #7C3AED);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
    box-shadow: var(--hb-shadow-md);
}

.hb-auth-title {
    font-size: var(--hb-text-xl);
    font-weight: 800;
    color: var(--hb-gray-900);
}

.hb-auth-subtitle {
    font-size: var(--hb-text-sm);
    color: var(--hb-gray-500);
}

.hb-auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--hb-radius-xl);
    padding: 2rem;
    box-shadow: var(--hb-shadow-lg);
    border: 1px solid var(--hb-gray-200);
}

/* Pipeline (Recruiting Kanban)
   ========================================================================== */

.hb-pipeline {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.hb-pipeline-stage {
    padding: 1rem;
    background: var(--hb-gray-50);
    border-radius: var(--hb-radius-md);
    border: 1px solid var(--hb-gray-200);
}

@media (max-width: 991.98px) {
    .hb-pipeline { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 575.98px) {
    .hb-pipeline { grid-template-columns: repeat(2, 1fr); }
}

/* Quick Action Refinement
   ========================================================================== */

.hb-quick-action {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--hb-radius-md);
    font-size: var(--hb-text-sm);
    font-weight: 500;
    color: var(--hb-gray-700);
    text-decoration: none;
    transition: all var(--hb-transition-fast);
    border: 1px solid transparent;
}

.hb-quick-action:hover {
    background: var(--hb-gray-50);
    border-color: var(--hb-gray-200);
    color: var(--hb-primary);
}

.hb-quick-action i { font-size: 0.875rem; width: 18px; text-align: center; }

/* Modal
   ========================================================================== */

.hb-modal-overlay {
    position: fixed; inset: 0; z-index: 1050;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: hb-fade-in 0.15s ease;
}

.hb-modal {
    background: white;
    border-radius: var(--hb-radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%; max-width: 520px; max-height: 90vh;
    display: flex; flex-direction: column;
    animation: hb-slide-up-sm 0.2s ease;
}

.hb-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--hb-gray-200);
    display: flex; align-items: center; justify-content: space-between;
}

.hb-modal-header h3 { margin: 0; font-size: var(--hb-text-lg); font-weight: 700; color: var(--hb-gray-900); }

.hb-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto; flex: 1;
}

.hb-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--hb-gray-200);
    display: flex; gap: 0.5rem; justify-content: flex-end;
}

@keyframes hb-slide-up-sm { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hb-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Override Bootstrap defaults where needed
   ========================================================================== */

.form-control:focus, .form-select:focus {
    border-color: var(--hb-primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-primary { background-color: var(--hb-primary); border-color: var(--hb-primary); }
.btn-primary:hover { background-color: var(--hb-primary-dark); border-color: var(--hb-primary-dark); }

.btn-success { background-color: var(--hb-success); border-color: var(--hb-success); }
.btn-danger { background-color: var(--hb-danger); border-color: var(--hb-danger); }
.btn-warning { background-color: var(--hb-warning); border-color: var(--hb-warning); }

.card { border: 1px solid var(--hb-gray-200); border-radius: var(--hb-radius-lg); box-shadow: var(--hb-shadow-xs); }
.card-header { background: var(--hb-gray-50); border-bottom: 1px solid var(--hb-gray-100); }
.badge { font-weight: 600; }

.table > :not(caption) > * > * { padding: 0.75rem 1rem; }

/* ==========================================================================
   Dark Mode
   ========================================================================== */

html.dark {
    --hb-content-bg: #0B1120;
    --hb-sidebar-bg: #070D1A;
    --hb-gray-50: #111827;
    --hb-gray-100: #1E293B;
    --hb-gray-200: #334155;
    --hb-gray-300: #475569;
    --hb-gray-400: #64748B;
    --hb-gray-500: #94A3B8;
    --hb-gray-600: #CBD5E1;
    --hb-gray-700: #E2E8F0;
    --hb-gray-800: #F1F5F9;
    --hb-gray-900: #F8FAFC;
    color-scheme: dark;
}

html.dark body { background: var(--hb-content-bg); color: var(--hb-gray-800); }

html.dark .hb-card,
html.dark .card {
    background: #111827;
    border-color: var(--hb-gray-200);
}

html.dark .card-header { background: #0F172A; border-color: var(--hb-gray-200); }

html.dark .hb-navbar {
    background: rgba(11,17,32,0.85);
    border-color: var(--hb-gray-200);
}

html.dark .hb-input,
html.dark .hb-select,
html.dark .form-control,
html.dark .form-select {
    background: #1E293B;
    border-color: var(--hb-gray-200);
    color: var(--hb-gray-800);
}

html.dark .hb-table thead th { background: #0F172A; border-color: var(--hb-gray-200); color: var(--hb-gray-600); }
html.dark .hb-table tbody td { border-color: var(--hb-gray-200); }
html.dark .hb-table tbody tr:hover { background: rgba(255,255,255,0.03); }

html.dark .hb-stat-card { background: #111827; border-color: var(--hb-gray-200); }
html.dark .hb-welcome-banner { background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%); }

html.dark .hb-modal { background: #111827; }
html.dark .hb-modal-header { border-color: var(--hb-gray-200); }
html.dark .hb-modal-footer { border-color: var(--hb-gray-200); }

html.dark .hb-btn-outline {
    border-color: var(--hb-gray-300);
    color: var(--hb-gray-700);
}

html.dark .hb-text-muted { color: var(--hb-gray-400) !important; }
html.dark a:not(.hb-btn) { color: var(--hb-primary-light); }

html.dark .dropdown-menu {
    background: #111827;
    border-color: var(--hb-gray-200);
}
html.dark .dropdown-menu .dropdown-item {
    color: var(--hb-gray-700);
}
html.dark .dropdown-menu .dropdown-item:hover {
    background: var(--hb-gray-100);
}

html.dark .hb-quick-action:hover { background: var(--hb-gray-100); }
html.dark .hb-sidebar { background: var(--hb-sidebar-bg); }
