:root {
    --hf-primary: #0A0936;
    --hf-accent: #198754;
    --portal-sidebar-width: 210px;
    --portal-topbar-height: 56px;
    --portal-sidebar-bg: #ffffff;
    --portal-sidebar-hover: rgba(0, 0, 0, 0.05);
    --portal-sidebar-active: rgba(220, 53, 69, 0.12);
    --portal-sidebar-active-bar: #dc3545;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

main,
.portal-public-main {
    flex: 1;
    background: #fff;
}

/* FIDES-style portal sidebar (authenticated member area) */
body.portal-app-body {
    overflow-x: hidden;
}

body.sidebar-mobile-open {
    overflow: hidden;
}

#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

#sidebarOverlay.show {
    display: block;
}

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--portal-sidebar-width);
    height: 100vh;
    background: var(--portal-sidebar-bg);
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

html.portal-sidebar-collapsed #sidebar {
    transform: translateX(-100%);
}

html.portal-sidebar-collapsed .portal-main-content {
    margin-left: 0;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    min-height: var(--portal-topbar-height);
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.sidebar-brand {
    height: var(--portal-topbar-height);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #eee;
}

.brand-text {
    overflow: hidden;
}

.brand-name {
    color: var(--hf-primary);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: var(--portal-topbar-height);
    margin-right: 0.25rem;
    background: transparent;
    border: none;
    color: #495057;
    font-size: 1.15rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
}

#sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    color: #343a40;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    position: relative;
    cursor: pointer;
    text-align: left;
}

#sidebar .nav-item > i:first-child {
    width: 26px;
    font-size: 1.15rem;
    text-align: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
    color: #495057;
}

#sidebar .nav-item > span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sidebar .nav-item:hover {
    color: var(--hf-primary);
    background: var(--portal-sidebar-hover);
}

#sidebar .nav-item:hover > i:first-child {
    color: var(--hf-primary);
}

#sidebar .nav-item.active {
    color: var(--hf-primary);
    font-weight: 600;
}

#sidebar .nav-item.active:not([data-menu-id="dashboard"]) {
    background: var(--portal-sidebar-active);
    color: #212529;
}

#sidebar .nav-item.active:not([data-menu-id="dashboard"])::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--portal-sidebar-active-bar);
    border-radius: 0 3px 3px 0;
}

#sidebar .nav-item.active:not([data-menu-id="dashboard"]) > i:first-child {
    color: #c82333;
}

#sidebar .sidebar-nav > * + * {
    border-top: 1px solid #e9ecef;
}

.portal-nav-logout-form {
    margin: 0;
}

.portal-nav-logout {
    color: #dc3545 !important;
}

.portal-nav-logout > i:first-child {
    color: #dc3545 !important;
}

.portal-nav-logout:hover {
    background: rgba(220, 53, 69, 0.08) !important;
}

.portal-main-content {
    margin-left: var(--portal-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.25s ease;
}

.portal-navbar-top {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 0 1rem;
    height: var(--portal-topbar-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.portal-navbar-left {
    display: flex;
    align-items: center;
    justify-self: start;
}

.portal-navbar-center {
    justify-self: center;
    text-align: center;
    min-width: 0;
    padding: 0 0.5rem;
}

.portal-navbar-right {
    justify-self: end;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.portal-topbar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--hf-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(520px, 70vw);
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #495057;
    cursor: pointer;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.sidebar-toggle:hover {
    color: #212529;
}

.portal-content-wrapper {
    flex: 1;
    padding: 1.25rem 1.5rem;
}

.portal-main-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 0.85rem 1.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
}

@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    .portal-main-content {
        margin-left: 0;
    }

    .portal-content-wrapper {
        padding: 1rem;
    }

    .portal-topbar-title {
        font-size: 0.85rem;
        max-width: 55vw;
    }
}

.hf-navbar,
.navbar.bg-primary {
    background: var(--hf-primary) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.hero-section {
    background: #fff;
    color: #212529;
}

.hero-auth-prompt {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    font-size: 1.05rem;
    color: #495057;
    text-align: center;
}

.hero-auth-prompt a {
    color: var(--hf-accent);
    font-weight: 600;
    text-decoration: none;
}

.hero-auth-prompt a:hover {
    text-decoration: underline;
    color: #157347;
}

@media (max-width: 767.98px) {
    .hero-auth-prompt {
        flex-direction: column;
        align-items: center;
        gap: 0.45rem;
    }

    .hero-auth-question,
    .hero-auth-links {
        display: block;
        width: 100%;
        text-align: center;
    }
}

.btn-hf-accent {
    background-color: var(--hf-accent);
    border-color: var(--hf-accent);
    color: #fff;
    border-radius: 3px;
}

.btn-hf-accent:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #fff;
}

.hf-footer {
    background: #fff;
}

.site-copyright {
    display: block;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #6c757d;
    text-align: center;
    padding: 0 0.75rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.site-copyright-link {
    color: var(--hf-accent);
    font-weight: 600;
    text-decoration: none;
}

.site-copyright-link:hover {
    color: #157347;
    text-decoration: underline;
}

.hf-footer-dev {
    font-size: 0.75rem;
    color: #6c757d;
}

.hf-dev-link {
    color: inherit;
    text-decoration: none;
}

.hf-dev-link:hover {
    color: var(--hf-primary);
    text-decoration: none;
}

.stat-card {
    background: #fff;
    border-radius: 3px;
    border-top: 4px solid var(--hf-accent);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.step-number {
    width: 48px;
    height: 48px;
    line-height: 48px;
    border-radius: 50%;
    background: var(--hf-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
}

.form-control, .form-select {
    border-radius: 3px;
    padding: 0.55rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--hf-primary);
    box-shadow: 0 0 0 0.2rem rgba(10, 9, 54, 0.15);
}

.card {
    border-radius: 3px !important;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.auth-card {
    max-width: 480px;
    margin: 0 auto;
}

/* FIDES-style inline form alerts */
.alert {
    border: none;
    border-left: 4px solid;
    border-radius: 3px !important;
    font-size: 0.875rem;
}
.alert-success { background-color: #d4edda; border-left-color: #28a745; color: #155724; }
.alert-danger { background-color: #f8d7da; border-left-color: #dc3545; color: #721c24; }
.alert-info { background-color: #d1ecf1; border-left-color: #17a2b8; color: #0c5460; }
.alert-warning { background-color: #fff3cd; border-left-color: #ffc107; color: #856404; }

.member-dashboard-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    background: #e9ecef;
}
.member-dashboard-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.member-dashboard-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 2rem;
}

/* Professional profile pages */
.portal-profile-page .portal-profile-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--hf-primary);
}

.portal-profile-page .detail-stat-card,
.portal-profile-page .detail-section-card {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.portal-profile-page .detail-stat-card {
    padding: 1rem;
    text-align: center;
}

.portal-profile-page .detail-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: #212529;
}

.portal-profile-page .detail-stat-value-sm {
    font-size: 1rem;
}

.portal-profile-page .detail-stat-label {
    font-size: 0.78rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

.portal-profile-page .detail-section-card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #495057;
}

.portal-profile-page .detail-section-card-body {
    padding: 1rem;
}

.portal-profile-page .detail-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.portal-profile-page .detail-field-value {
    font-weight: 500;
    color: #344054;
}

.portal-profile-page .detail-photo-wrap,
.portal-profile-photo {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-profile-page .detail-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-profile-page .detail-table thead th {
    background: #f8f9fa;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

.portal-profile-page .detail-table tbody td {
    border-bottom: 1px solid #dee2e6;
    color: #333;
    vertical-align: middle;
}

.portal-form-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.portal-profile-edit-photo {
    max-height: 180px;
    width: 100%;
    object-fit: cover;
}

.portal-profile-edit-photo-placeholder {
    height: 180px;
}
