:root {
    --hspa-primary: #2563eb;
    --hspa-primary-dark: #1d4ed8;
    --hspa-success: #10b981;
    --hspa-bg: #f8fafc;
    --hspa-card-bg: #ffffff;
    --hspa-text-main: #1e293b;
    --hspa-text-muted: #64748b;
    --hspa-border: #e2e8f0;
    --hspa-radius: 16px;
    --hspa-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

/* Scoped Wrapper */
.hspa-dashboard-v2 {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--hspa-text-main);
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    background-color: transparent;
}

.hspa-dashboard-v2 * {
    box-sizing: border-box;
}

/* Grid Layout */
.hspa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

/* Cards */
.hspa-card-modern {
    background: var(--hspa-card-bg);
    border-radius: var(--hspa-radius);
    box-shadow: var(--hspa-shadow);
    border: 1px solid var(--hspa-border);
    padding: 32px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.hspa-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.12);
}

/* Headers & Text */
.hspa-welcome-header {
    margin-bottom: 40px;
    text-align: center;
}

.hspa-welcome-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--hspa-text-main);
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.hspa-welcome-sub {
    font-size: 16px;
    color: var(--hspa-text-muted);
}

/* Certificate Preview */
.hspa-cert-preview {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--hspa-border);
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Badge */
.hspa-badge-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #ecfdf5;
    border-radius: 12px;
    color: #065f46;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #d1fae5;
}

.hspa-badge-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Meta Data */
.hspa-meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    border-bottom: 1px dashed var(--hspa-border);
    padding-bottom: 12px;
}

.hspa-meta-label {
    color: var(--hspa-text-muted);
}

.hspa-meta-value {
    font-weight: 600;
    color: var(--hspa-text-main);
}

/* Buttons */
.hspa-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.hspa-btn-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    flex: 1;
}

.btn-primary {
    background: var(--hspa-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--hspa-primary-dark);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--hspa-border);
    color: var(--hspa-text-main);
}

.btn-outline:hover {
    border-color: var(--hspa-text-muted);
    background: #f1f5f9;
}

.btn-linkedin {
    background: #0077b5;
    color: white;
}

/* Status States */
.state-pending {
    background: #fff7ed;
    color: #9a3412;
    border-color: #ffedd5;
}

.state-empty {
    text-align: center;
    padding: 60px 20px;
}

@media (max-width: 768px) {
    .hspa-actions {
        flex-direction: column;
    }

    .hspa-btn-v2 {
        width: 100%;
    }
}

/* =========================================
   PORTAL LAYOUT (Sidebar + Topbar)
   ========================================= */
.hspa-portal-container {
    display: flex;
    min-height: 800px;
    background: var(--hspa-bg);
    border-radius: var(--hspa-radius);
    overflow: hidden;
    box-shadow: var(--hspa-shadow);
    border: 1px solid var(--hspa-border);
    font-family: 'Inter', sans-serif;
}

/* Sidebar */
.hspa-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid var(--hspa-border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.hspa-brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--hspa-primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hspa-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.hspa-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--hspa-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.hspa-nav-item:hover,
.hspa-nav-item.active {
    background: #eff6ff;
    color: var(--hspa-primary);
}

.hspa-nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* User Profile in Sidebar (Bottom) */
.hspa-sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--hspa-border);
}

/* Main Content Area */
.hspa-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

/* Topbar */
.hspa-topbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--hspa-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 32px;
    gap: 20px;
}

.hspa-user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hspa-avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--hspa-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.hspa-logout-link {
    font-size: 13px;
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
}

/* Content Body */
.hspa-view-body {
    padding: 32px;
    overflow-y: auto;
    height: 100%;
}

/* Responsive */
@media (max-width: 900px) {
    .hspa-portal-container {
        flex-direction: column;
        min-height: auto;
    }

    .hspa-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--hspa-border);
        padding: 16px;
    }

    .hspa-brand {
        margin-bottom: 16px;
    }

    .hspa-sidebar-footer {
        display: none;
    }
}