/* Biolos.ao — Unified portal dashboard styles */
:root {
    --sidebar-width: 270px;
    --header-height: 64px;
    --green-dark: #172538;
    --green-brand: #213551;
    --green-btn: #284165;
    --green-light: #f1f1f1;
    --admin-dark: #1e293b;
    --admin-active: #334155;
    --text-dark: #111827;
    --text-muted: #6b7280;
    --text-label: #374151;
    --text-subtle: #9ca3af;
    --border: #e5e7eb;
    --border-subtle: #d1d5db;
    --bg-page: #f3f4f6;
    --card-bg: #fff;
    --surface-muted: #fafafa;
    --surface-subtle: #f8faf9;
    --elevated-bg: #fafafa;
    --hover-bg: #f9fafb;
    --row-border: #f3f4f6;
    --input-bg: #fff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

/* Password show/hide toggle */
.password-toggle-wrap {
    position: relative;
}

.password-toggle-wrap .form-control {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    transition: color .15s;
}

.password-toggle-btn:hover {
    color: var(--green-brand);
}

.password-toggle-btn:focus {
    outline: none;
    color: var(--green-brand);
}

.auth-brand {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
}

.auth-logo {
    display: block;
    height: 52px;
    width: auto;
    margin: 0 auto;
}

body.portal-body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ── */
.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    overflow-y: auto;
}

.portal-customer .portal-sidebar,
.portal-worker .portal-sidebar {
    background: linear-gradient(180deg, var(--green-dark) 0%, #084734 100%);
}

.portal-admin .portal-sidebar {
    background: var(--admin-dark);
}

.portal-sidebar-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 100%;
}

.portal-nav {
    padding: .75rem 0;
    flex: 1;
    background: linear-gradient(135deg, #172538 0%, #1b2e48 100%);
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.5rem;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.portal-nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.portal-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.portal-nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border-left-color: #fff;
}

.portal-admin .portal-nav-link.active {
    border-left-color: var(--green-brand);
}

.portal-nav-section {
    padding: .5rem 1.5rem .25rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255, 255, 255, .4);
    margin-top: .5rem;
}

.portal-sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
    flex-shrink: 0;
}

.portal-sidebar-footer .portal-nav-link {
    padding: .5rem 0;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

/* ── Main wrapper ── */
.portal-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.portal-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.portal-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .4rem .6rem;
    color: var(--text-dark);
    font-size: 1.25rem;
    cursor: pointer;
}

.portal-breadcrumb {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    font-size: .875rem;
}

.portal-breadcrumb li {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-muted);
}

.portal-breadcrumb li a {
    color: var(--green-brand);
    text-decoration: none;
}

.portal-breadcrumb li a:hover {
    text-decoration: underline;
}

.portal-breadcrumb li.active {
    color: var(--text-dark);
    font-weight: 600;
}

.portal-breadcrumb .sep {
    color: var(--border-subtle);
}

.portal-header-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.portal-header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    transition: all .2s;
}

.portal-header-btn:hover {
    background: var(--green-light);
    color: var(--green-brand);
    border-color: transparent;
}

.portal-user-menu {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .75rem .35rem .35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background .2s, border-color .2s;
}

.portal-user-menu:hover,
.user-menu-dropdown .portal-user-menu[aria-expanded="true"] {
    background: var(--green-light);
    border-color: transparent;
}

.user-menu-chevron {
    font-size: .7rem;
    color: var(--text-muted);
    transition: transform .2s;
}

.user-menu-dropdown .portal-user-menu[aria-expanded="true"] .user-menu-chevron {
    transform: rotate(180deg);
}

.portal-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--green-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    overflow: hidden;
    flex-shrink: 0;
}

.portal-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.portal-user-avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
    border-radius: 12px;
}

.user-menu-panel-avatar {
    width: 40px;
    height: 40px;
    font-size: .95rem;
}

.profile-avatar-upload .portal-user-avatar-lg {
    box-shadow: var(--shadow-sm);
}

.portal-admin .portal-user-avatar {
    background: var(--admin-dark);
}

.portal-user-name {
    font-size: .85rem;
    font-weight: 600;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Page content ── */
.portal-main {
    flex: 1;
    padding: 1.5rem;
}

.portal-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.portal-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.02em;
}

.portal-page-subtitle {
    font-size: .9rem;
    color: var(--text-muted);
    margin: .25rem 0 0;
}

/* ── Footer ── */
.portal-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    font-size: .8rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}

.portal-footer a {
    color: var(--green-brand);
    text-decoration: none;
}

/* ── Cards & components ── */
.portal-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.portal-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.portal-card-body {
    padding: 1.25rem;
}

.portal-stat {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    height: 100%;
}

.portal-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--green-brand);
    line-height: 1.2;
}

.portal-admin .portal-stat-value {
    color: var(--admin-dark);
}

.portal-stat-label {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

/* ── Analytics KPI cards ── */
.analytics-stat {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.15rem 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.analytics-stat:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
    border-color: #d1d5db;
    border-color: var(--green-brand);
}

.analytics-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
}

.analytics-stat-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: rgb(102 102 102 / 10%);
    color: var(--green-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.portal-admin .analytics-stat-icon {
    background: rgb(102 102 102 / 10%);
    color: var(--admin-dark);
}

.analytics-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--green-brand);
    line-height: 1.15;
}

.portal-admin .analytics-stat-value {
    color: var(--admin-dark);
}

.analytics-stat-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-label);
}

.analytics-stat-sub {
    font-size: .75rem;
    color: var(--text-muted);
}

.analytics-stat-period {
    font-size: .7rem;
    color: var(--text-subtle);
    margin-top: auto;
}

.analytics-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: .1rem;
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .45rem;
    border-radius: 999px;
    white-space: nowrap;
}

.analytics-stat-trend.positive {
    color: #172538;
    background: #f1f1f1;
}

.analytics-stat-trend.negative {
    color: #b91c1c;
    background: #f1f1f1;
}

.analytics-stat-trend.neutral {
    color: #6b7280;
    background: var(--row-border);
}

.analytics-stat-trend i {
    font-size: 1rem;
    line-height: 1;
}

.btn-portal {
    background: var(--green-btn);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: .5rem 1rem;
    font-size: .875rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: background .2s;
}

.btn-portal:hover {
    background: var(--green-brand);
    color: #fff;
}

.btn-portal-outline {
    background: var(--card-bg);
    border: 1px solid var(--green-btn);
    color: var(--green-btn);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    font-size: .875rem;
}

.btn-portal-outline:hover {
    background: var(--green-brand);
    color: #fff;
}

.btn-green1 {
    background: var(--card-bg);
    border: 1px solid var(--green-btn);
    color: var(--green-btn);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: .875rem;
}

.btn-green1:hover {
    background: var(--green-btn);
    color: #fff;
}

.tab1 {
    color: var(--green-btn);
}

.tab1:hover {
    background: var(--green-btn);
    color: #fff;
}

.nav-tabs .tab1.active {
    color: #fff;
    background: var(--green-btn);
}

.badge {
    background-color: #172538;
}

.text-blue {
    color: #172538 !important;
}

.status-badge {
    font-size: .75rem;
    font-weight: 600;
    padding: .3rem .65rem;
    border-radius: 6px;
    display: inline-block;
}

.badge-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-progress {
    background: #fef3c7;
    color: #b45309;
}

.badge-completed {
    background: var(--green-light);
    color: var(--green-brand);
}

.badge-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

/* Tables */
.portal-table {
    margin: 0;
}

.portal-table thead th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: .85rem 1.25rem;
    background: var(--elevated-bg);
}

.portal-table tbody td {
    padding: .85rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--row-border);
    font-size: .9rem;
}

.portal-table tbody tr:hover {
    background: var(--hover-bg);
}

/* Pagination */
.portal-card-body.border-top:has(.portal-pagination),
.portal-card-body.border-top:has(.pagination) {
    padding: 1rem 1.25rem;
}

.portal-pagination {
    width: 100%;
}

.portal-pagination .pagination {
    gap: .35rem;
    flex-wrap: wrap;
}

.portal-pagination .page-link {
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-size: .875rem;
    font-weight: 600;
    padding: .5rem .8rem;
    min-width: 2.5rem;
    text-align: center;
    line-height: 1.2;
    box-shadow: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.portal-pagination .page-link:hover {
    background: var(--green-light);
    border-color: #b8e0d2;
    color: var(--green-brand);
}

.portal-pagination .page-item.active .page-link {
    background: var(--green-btn);
    border-color: var(--green-btn);
    color: #fff;
    z-index: 1;
}

.portal-pagination .page-item.active .page-link:hover {
    background: var(--green-brand);
    border-color: var(--green-brand);
    color: #fff;
}

.portal-pagination .page-item.disabled .page-link {
    background: var(--hover-bg);
    border-color: var(--border);
    color: var(--text-subtle);
}

.portal-pagination-summary {
    margin: .75rem 0 0;
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
}

.portal-admin .portal-pagination .page-item.active .page-link {
    background: var(--admin-dark);
    border-color: var(--admin-dark);
}

.portal-admin .portal-pagination .page-item.active .page-link:hover {
    background: var(--admin-active);
    border-color: var(--admin-active);
}

/* Modals */
.modal-portal .modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.modal-portal .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.modal-portal .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-portal .modal-body {
    padding: 1.5rem;
}

.modal-portal .modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

/* Overlay for mobile sidebar */
.portal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1035;
}

.portal-overlay.show {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .portal-sidebar {
        transform: translateX(-100%);
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

    .portal-wrapper {
        margin-left: 0;
    }

    .portal-menu-toggle {
        display: flex;
    }

    .portal-main {
        padding: 1rem;
        margin-top: 80px;
    }

    .portal-header {
        padding: 0 1rem;
    }

    .portal-user-name,
    .user-menu-chevron {
        display: none;
    }

    .portal-user-menu {
        padding: .35rem;
    }

    .portal-page-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .portal-page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-breadcrumb {
        font-size: .6rem;
    }

    .portal-stat-value {
        font-size: 1.4rem;
    }

    .analytics-stat-value {
        font-size: 1.35rem;
    }

    .analytics-stat {
        padding: 1rem;
    }
}

/* ── Notification dropdown popup ── */
.notif-dropdown,
.messages-link-wrap {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
    z-index: 1060;
    overflow: hidden;
}

.notif-panel.show {
    display: block;
    animation: notifFadeIn .15s ease;
}

@keyframes notifFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--elevated-bg);
    font-size: .875rem;
}

.notif-panel-head .btn-link {
    color: var(--green-brand);
    font-size: .8rem;
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--row-border);
    cursor: pointer;
    transition: background .15s;
}

.notif-item:hover {
    background: var(--hover-bg);
}

.notif-item.unread {
    background: #f0fdf4;
    border-left: 3px solid var(--green-brand);
    padding-left: calc(1.1rem - 3px);
}

.notif-item-title {
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: .2rem;
    color: var(--text-dark);
}

.notif-item-body {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .2rem;
    line-height: 1.4;
}

.notif-item-time {
    font-size: .7rem;
    color: var(--text-subtle);
}

.notif-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .875rem;
}

@media (max-width: 800px) {
    .notif-panel {
        position: fixed;
        top: calc(var(--header-height) + 10px);
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
    }

    .notif-panel-head {
        flex-wrap: wrap;
        gap: .35rem .75rem;
    }

    .portal-header{
        position:fixed;
        width:100%;
    }
}

.notif-toast {
    position: fixed;
    top: 84px;
    right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green-brand);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    z-index: 1070;
    max-width: min(360px, calc(100vw - 2rem));
    animation: notifSlideIn .3s ease;
}

@media (max-width: 991.98px) {
    .notif-toast {
        top: calc(var(--header-height) + 10px);
        right: 1rem;
        left: 1rem;
        max-width: none;
        width: auto;
    }
}

.admin-toast-container {
    position: fixed;
    top: 84px;
    right: 24px;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

body:not(.portal-body) .admin-toast-container {
    top: 24px;
}

.admin-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .9rem 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    animation: notifSlideIn .3s ease;
    transition: opacity .3s ease, transform .3s ease;
}

.admin-toast.is-hiding {
    opacity: 0;
    transform: translateX(100%);
}

.admin-toast-success {
    border-left: 4px solid #16a34a;
}

.admin-toast-error {
    border-left: 4px solid #dc2626;
}

.admin-toast-info {
    border-left: 4px solid #2563eb;
}

.admin-toast-body {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    flex: 1;
    min-width: 0;
}

.admin-toast-icon {
    font-size: 1.1rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.admin-toast-text {
    font-size: .875rem;
    color: var(--text-dark);
    line-height: 1.45;
    word-break: break-word;
}

.admin-toast-close {
    border: 0;
    background: transparent;
    color: var(--text-subtle);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.admin-toast-close:hover {
    color: var(--text-dark);
}

@keyframes notifSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── User account dropdown ── */
.user-menu-dropdown {
    position: relative;
}

.user-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    max-width: calc(100vw - 2rem);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
    z-index: 1060;
    overflow: hidden;
}

.user-menu-panel.show {
    display: block;
    animation: notifFadeIn .15s ease;
}

.user-menu-panel-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--elevated-bg);
}

.user-menu-panel-avatar {
    flex-shrink: 0;
}

.user-menu-panel-meta {
    min-width: 0;
}

.user-menu-panel-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
    word-break: break-word;
}

.user-menu-panel-email {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .15rem;
    word-break: break-all;
}

.user-menu-panel-body {
    padding: .35rem 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .7rem 1.1rem;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}

.user-menu-item:hover {
    background: var(--hover-bg);
    color: var(--text-dark);
}

.user-menu-item i {
    font-size: 1rem;
    color: var(--text-muted);
}

.user-menu-item--danger {
    color: #b91c1c;
}

.user-menu-item--danger i {
    color: #b91c1c;
}

.user-menu-item--danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.lang-switcher {
    position: relative;
}

.lang-switcher-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    min-width: 120px;
    z-index: 1100;
}

.lang-switcher-menu.show {
    display: block;
}

.lang-switcher-item {
    display: block;
    padding: .5rem .85rem;
    font-size: .85rem;
    color: var(--text-dark);
    text-decoration: none;
}

.lang-switcher-item:hover,
.lang-switcher-item.active {
    background: #e8f5f0;
    color: var(--green-brand);
    font-weight: 600;
}

/* Order tabs */
.portal-tabs {
    border-bottom: 1px solid var(--border);
    gap: .25rem;
}

.portal-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: .65rem 1rem;
    font-size: .875rem;
    font-weight: 500;
}

.portal-tabs .nav-link:hover {
    color: var(--green-brand);
}

.portal-tabs .nav-link.active {
    color: var(--green-brand);
    background: transparent;
    border-bottom-color: var(--green-brand);
    font-weight: 600;
}

.portal-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    margin-left: 0.35rem;
    background: var(--green-brand);
    color: #fff;
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

/* Order timeline (Fiverr-style) */
.order-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    background: var(--elevated-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.order-timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 0 0 auto;
    min-width: 80px;
    z-index: 1;
}

.order-timeline-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .5rem;
    transition: background .2s, color .2s;
}

.order-timeline-step.done .order-timeline-dot {
    background: var(--green-brand);
    color: #fff;
}

.order-timeline-step.current .order-timeline-dot {
    background: var(--green-light);
    color: var(--green-brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
}

.order-timeline-label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 90px;
    line-height: 1.3;
}

.order-timeline-step.done .order-timeline-label {
    color: var(--text-dark);
}

.order-timeline-step.current .order-timeline-label {
    color: var(--green-brand);
    font-weight: 600;
}

.order-timeline-line {
    flex: 1;
    height: 3px;
    background: var(--border);
    margin-top: 17px;
    min-width: 20px;
}

.order-timeline-line.done {
    background: var(--green-brand);
}

.order-summary-card .order-price strong {
    line-height: 1.2;
}

@media (max-width: 576px) {
    .order-timeline {
        flex-wrap: wrap;
        gap: .5rem;
        justify-content: center;
    }

    .order-timeline-line {
        display: none;
    }
}

/* ── Clickable KPI cards ── */
.analytics-stat-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.analytics-stat-link:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    border-color: var(--green-brand);
}

/* ── Action banners ── */
.portal-action-list {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.portal-action-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    text-decoration: none;
    color: inherit;
    transition: transform .15s, box-shadow .15s;
}

.portal-action-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.portal-action-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-action-copy {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
    min-width: 0;
}

.portal-action-copy strong {
    font-size: .9rem;
}

.portal-action-copy span {
    font-size: .8rem;
    color: var(--text-muted);
}

.portal-action-chevron {
    color: var(--text-muted);
}

.portal-action-warning {
    border-left: 4px solid #f59e0b;
}

.portal-action-warning .portal-action-icon {
    background: #fef3c7;
    color: #b45309;
}

.portal-action-danger {
    border-left: 4px solid #ef4444;
}

.portal-action-danger .portal-action-icon {
    background: #fee2e2;
    color: #b91c1c;
}

.portal-action-success {
    border-left: 4px solid #22c55e;
}

.portal-action-success .portal-action-icon {
    background: #dcfce7;
    color: #15803d;
}

.portal-action-info {
    border-left: 4px solid #3b82f6;
}

.portal-action-info .portal-action-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

/* ── Empty states ── */
.portal-empty-state {
    text-align: center;
    padding: 2rem 1.25rem;
}

.portal-empty-icon {
    font-size: 2rem;
    color: var(--text-subtle);
    margin-bottom: .75rem;
}

.portal-empty-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}

.portal-empty-text {
    font-size: .875rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

/* ── Feed items ── */
.portal-feed-item {
    display: block;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--row-border);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}

.portal-feed-item:hover {
    background: var(--hover-bg);
    color: inherit;
}

.portal-feed-item.unread {
    background: #f0fdf4;
    border-left: 3px solid var(--green-brand);
    padding-left: calc(1.1rem - 3px);
}

/* ── Mobile list cards ── */
.portal-mobile-card {
    display: block;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--row-border);
    text-decoration: none;
    color: inherit;
}

.portal-mobile-card:hover {
    background: var(--hover-bg);
    color: inherit;
}

/* ── Quick links ── */
.portal-quick-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .65rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: box-shadow .15s, border-color .15s;
}

.portal-quick-link:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--green-brand);
    color: inherit;
}

.portal-quick-link-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: var(--green-light);
    color: var(--green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-quick-link-label {
    font-size: .875rem;
    font-weight: 600;
}

/* ── Profile completion ── */
.portal-profile-completion .portal-progress {
    height: .5rem;
    border-radius: 999px;
    background: var(--border);
}

.portal-profile-completion .progress-bar {
    background: var(--green-brand);
}

/* ── Period selector ── */
.portal-period-selector .btn {
    font-size: .8rem;
}

/* ── Sidebar collapse & rail ── */
.portal-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .75rem .75rem .5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.portal-sidebar-collapse {
    border: none;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.portal-sidebar-collapse:hover {
    background: rgba(255, 255, 255, .18);
}

.portal-nav-text {
    flex: 1;
}

.portal-nav-link {
    position: relative;
}

.portal-nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .35rem;
}

.portal-nav-group {
    margin-top: .25rem;
}

.portal-nav-group-toggle {
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .45);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem 1.5rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    cursor: pointer;
}

.portal-nav-group-toggle i {
    transition: transform .2s;
}

.portal-nav-group-toggle[aria-expanded="false"] i {
    transform: rotate(-90deg);
}

.portal-nav-group-panel.collapsed {
    display: none;
}

body.portal-sidebar-collapsed {
    --sidebar-width: 78px;
}

body.portal-sidebar-collapsed .portal-nav-text,
body.portal-sidebar-collapsed .portal-nav-section,
body.portal-sidebar-collapsed .portal-nav-badge,
body.portal-sidebar-collapsed .portal-nav-group-toggle span,
body.portal-sidebar-collapsed .portal-sidebar-logo {
    display: none;
}

body.portal-sidebar-collapsed .portal-nav-link {
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
}

body.portal-sidebar-collapsed .portal-sidebar-top {
    justify-content: center;
    flex-direction: column;
}

/* ── Nav badges on links ── */
.portal-nav-link .portal-nav-badge {
    margin-left: auto;
}

/* ── Skeleton loaders ── */
.portal-skeleton {
    background: linear-gradient(90deg, var(--row-border) 25%, var(--border) 50%, var(--row-border) 75%);
    background-size: 200% 100%;
    animation: portalShimmer 1.2s infinite;
    border-radius: 6px;
}

.portal-skeleton-line {
    height: .75rem;
    margin: .55rem 1rem;
}

.portal-skeleton-line.short {
    width: 55%;
}

.notif-skeleton {
    padding: .5rem 0;
}

@keyframes portalShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── User menu language (mobile) ── */
.user-menu-lang {
    border-top: 1px solid var(--border);
    padding-top: .35rem;
}

.user-menu-lang-label {
    padding: .45rem 1.1rem 0;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.user-menu-item.active {
    background: var(--green-light);
    color: var(--green-brand);
}

/* ── Deprecated alias ── */
.btn-green1 {
    background: var(--card-bg);
    border: 1px solid var(--green-btn);
    color: var(--green-btn);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: .875rem;
}

.btn-green1:hover {
    background: var(--green-btn);
    color: #fff;
}

/* ── Chat layout (shared) ── */
.chat-layout {
    display: flex;
    height: calc(100vh - 220px);
    min-height: 480px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg, #fff);
}

.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-sidebar-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: var(--surface-muted, #fafafa);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.chat-presence-switch {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.chat-presence-switch input {
    cursor: pointer;
}

.chat-presence-label {
    font-weight: 600;
    color: var(--text-dark);
}

.chat-conv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: #9ca3af;
}

.chat-status-dot.online {
    background: #22c55e;
}

.chat-conv-avatar-wrap .chat-status-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    border: 2px solid var(--card-bg, #fff);
}

.chat-main-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted, #fafafa);
    font-weight: 600;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chat-main-head-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-shrink: 0;
}

.chat-delete-btn {
    padding: .25rem .55rem;
    line-height: 1;
    color: var(--text-muted);
}

.chat-delete-btn:hover {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fef2f2;
}

.chat-partner-status {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.chat-conversations {
    overflow-y: auto;
    flex: 1;
}

.chat-conv-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--row-border);
}

.chat-conv-row:hover,
.chat-conv-row.active {
    background: var(--green-light);
}

.chat-conv-row.unread {
    background: #f0fdf6;
    border-left: 3px solid var(--green-brand);
}

.chat-conv-item {
    display: flex;
    gap: .75rem;
    padding: .9rem 1.25rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
    border-bottom: none;
}

.chat-conv-row.unread .chat-conv-item {
    padding-left: calc(1.25rem - 3px);
}

.chat-conv-delete-btn {
    flex-shrink: 0;
    align-self: center;
    margin-right: .65rem;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, background .15s, color .15s;
    cursor: pointer;
}

.chat-conv-row:hover .chat-conv-delete-btn,
.chat-conv-row:focus-within .chat-conv-delete-btn {
    opacity: 1;
}

.chat-conv-delete-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

.chat-conv-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.chat-conv-unread-badge {
    flex-shrink: 0;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.chat-conv-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--green-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.chat-conv-name {
    font-weight: 600;
    font-size: .9rem;
}

.chat-conv-preview {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--surface-subtle, #f8faf9);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.chat-bubble {
    max-width: 75%;
    padding: .65rem 1rem;
    border-radius: 14px;
    font-size: .9rem;
    line-height: 1.5;
}

.chat-bubble.sent {
    align-self: flex-end;
    background: var(--green-btn);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.received {
    align-self: flex-start;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-bubble-time {
    font-size: .7rem;
    opacity: .7;
    margin-top: .2rem;
}

.chat-input-area {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: .75rem;
    align-items: flex-end;
    background: var(--card-bg, #fff);
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.chat-attachment-preview {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .45rem;
    padding: .35rem .5rem;
    background: var(--row-border);
    border-radius: 8px;
}

.chat-attachment-image {
    display: block;
    max-width: 220px;
    max-height: 180px;
    border-radius: 8px;
    margin-bottom: .35rem;
}

.chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: inherit;
    text-decoration: none;
    word-break: break-all;
}

.chat-bubble.sent .chat-attachment-file {
    color: #fff;
}

/* Tablet & Mobile */
@media (max-width:991px) {

    .chat-layout {
        display: flex;
        flex-direction: column;
        height: 70vh;
        overflow: hidden;
    }

    .chat-layout {
        min-height: 450px;
    }

    .chat-sidebar {
        display: block;
        width: 100%;
        background: #fff;
        overflow-y: auto;
    }

    .chat-main {
        display: none;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .chat-layout.chat-open .chat-sidebar {
        display: none;
    }

    .chat-layout.chat-open .chat-main {
        display: flex;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .chat-back-btn {
        border: none;
        background: none;
        font-size: 22px;
        margin-right: 10px;
        color: #222;
    }
}

/* Small phones */
@media (max-width:767px) {

    .chat-sidebar {
        max-height: 450px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .chat-main {
        min-height: 0;
    }
}

/* ── Dark mode ── */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-page: #0f172a;
    --text-dark: #f1f5f9;
    --text-muted: #94a3b8;
    --text-label: #e2e8f0;
    --text-subtle: #64748b;
    --border: #334155;
    --border-subtle: #475569;
    --card-bg: #1e293b;
    --surface-muted: #1e293b;
    --surface-subtle: #0f172a;
    --elevated-bg: #0f172a;
    --hover-bg: #334155;
    --row-border: #334155;
    --input-bg: #0f172a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .35);
    --green-light: rgba(16, 185, 129, .12);
}

/* Surfaces */
:root[data-theme="dark"] .portal-header,
:root[data-theme="dark"] .portal-card,
:root[data-theme="dark"] .portal-footer,
:root[data-theme="dark"] .portal-stat,
:root[data-theme="dark"] .analytics-stat,
:root[data-theme="dark"] .portal-action-item,
:root[data-theme="dark"] .portal-quick-link,
:root[data-theme="dark"] .portal-mobile-card,
:root[data-theme="dark"] .card-panel,
:root[data-theme="dark"] .notif-panel,
:root[data-theme="dark"] .notif-toast,
:root[data-theme="dark"] .user-menu-panel,
:root[data-theme="dark"] .lang-switcher-menu,
:root[data-theme="dark"] .admin-toast,
:root[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-header-btn,
:root[data-theme="dark"] .portal-user-menu,
:root[data-theme="dark"] .portal-menu-toggle {
    background: var(--input-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-header-btn:hover,
:root[data-theme="dark"] .portal-user-menu:hover,
:root[data-theme="dark"] .user-menu-dropdown .portal-user-menu[aria-expanded="true"] {
    background: var(--green-light);
    color: var(--text-dark);
}

:root[data-theme="dark"] .user-menu-panel-head,
:root[data-theme="dark"] .notif-panel-head {
    background: var(--elevated-bg);
    border-color: var(--border);
}

:root[data-theme="dark"] .portal-quick-link-icon {
    color: #fff;
}

:root[data-theme="dark"] .chat-conv-row {
    background: var(--card-bg, #fff);
}

:root[data-theme="dark"] .user-menu-item:hover {
    background: var(--hover-bg);
    color: var(--text-dark);
}

:root[data-theme="dark"] .lang-switcher-item:hover,
:root[data-theme="dark"] .lang-switcher-item.active {
    background: var(--green-light);
}

:root[data-theme="dark"] .portal-breadcrumb li.active {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-breadcrumb .sep {
    color: var(--border-subtle);
}

:root[data-theme="dark"] .analytics-stat-label {
    color: var(--text-label);
}

/* Forms */
:root[data-theme="dark"] .form-label,
:root[data-theme="dark"] .col-form-label,
:root[data-theme="dark"] legend,
:root[data-theme="dark"] .form-check-label {
    color: var(--text-dark);
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] textarea.form-control,
:root[data-theme="dark"] .form-control:focus,
:root[data-theme="dark"] .form-select:focus {
    background-color: var(--input-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .form-control::placeholder {
    color: var(--text-subtle);
    opacity: 1;
}

:root[data-theme="dark"] .form-control:disabled,
:root[data-theme="dark"] .form-select:disabled,
:root[data-theme="dark"] .form-control[readonly] {
    background-color: #1e293b;
    color: var(--text-muted);
}

:root[data-theme="dark"] .form-control[type="file"]::file-selector-button {
    background: #334155;
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .form-check-input {
    background-color: var(--input-bg);
    border-color: var(--border);
}

:root[data-theme="dark"] .form-check-input:checked {
    background-color: var(--green-btn);
    border-color: var(--green-btn);
}

:root[data-theme="dark"] .form-select option,
:root[data-theme="dark"] .form-select optgroup {
    background: #1e293b;
    color: var(--text-dark);
}

:root[data-theme="dark"] input:-webkit-autofill,
:root[data-theme="dark"] input:-webkit-autofill:hover,
:root[data-theme="dark"] input:-webkit-autofill:focus,
:root[data-theme="dark"] textarea:-webkit-autofill,
:root[data-theme="dark"] select:-webkit-autofill {
    -webkit-text-fill-color: var(--text-dark);
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    caret-color: var(--text-dark);
}

/* Modals */
:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}

:root[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Tables & lists — row/hover colors inherit from CSS variables */
:root[data-theme="dark"] .notif-item.unread,
:root[data-theme="dark"] .portal-feed-item.unread,
:root[data-theme="dark"] .chat-conv-row.unread {
    background: rgba(16, 185, 129, .08);
}

/* Buttons & utilities */
:root[data-theme="dark"] .btn-portal-outline,
:root[data-theme="dark"] .btn-green1 {
    background: transparent;
    border-color: var(--green-btn);
    color: #fff;
}

:root[data-theme="dark"] .btn-portal-outline:hover,
:root[data-theme="dark"] .btn-green1:hover {
    background: var(--green-btn);
    color: #fff;
}

:root[data-theme="dark"] .portal-body .text-dark,
:root[data-theme="dark"] a.text-dark {
    color: var(--text-dark) !important;
}

:root[data-theme="dark"] .portal-body .text-muted,
:root[data-theme="dark"] .portal-body small.text-muted {
    color: var(--text-muted) !important;
}

:root[data-theme="dark"] .portal-pagination .page-link {
    background: var(--input-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-pagination .page-link:hover {
    background: var(--green-light);
    color: #fff;
}

:root[data-theme="dark"] .portal-pagination .page-item.disabled .page-link {
    background: var(--card-bg);
    color: var(--text-subtle);
}

:root[data-theme="dark"] .chat-attachment-preview {
    background: var(--input-bg);
    color: var(--text-muted);
}

:root[data-theme="dark"] .chat-bubble.received {
    background: var(--card-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .document-preview-body {
    background: var(--surface-subtle);
}

/* Notifications */
:root[data-theme="dark"] .portal-card>a.border-bottom,
:root[data-theme="dark"] .portal-card a.border-bottom.text-decoration-none {
    color: var(--text-dark);
    border-bottom-color: var(--border) !important;
}

:root[data-theme="dark"] .portal-card>a.border-bottom:hover,
:root[data-theme="dark"] .portal-card a.border-bottom.text-decoration-none:hover {
    background: var(--hover-bg);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-card a.bg-light {
    background: rgba(16, 185, 129, .1) !important;
    box-shadow: inset 3px 0 0 var(--green-brand);
}

:root[data-theme="dark"] .notif-panel-head .btn-link {
    color: #fff;
}

:root[data-theme="dark"] .notif-item-time {
    color: var(--text-muted);
}

:root[data-theme="dark"] .portal-skeleton {
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--hover-bg) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
}

/* Order detail & timeline */
:root[data-theme="dark"] .order-timeline {
    background: var(--card-bg);
    border-color: var(--border);
}

:root[data-theme="dark"] .order-timeline-dot {
    background: var(--border);
    color: #fff;
}

:root[data-theme="dark"] .order-timeline-line {
    background: var(--border);
}

:root[data-theme="dark"] .order-timeline-step.current .order-timeline-dot {
    background: rgba(16, 185, 129, .22);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}

:root[data-theme="dark"] .order-timeline-step.current .order-timeline-label {
    color: #fff;
}

:root[data-theme="dark"] .order-summary-card strong,
:root[data-theme="dark"] .order-summary-card span:not(.badge):not(.status-badge) {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-card.border-warning {
    border-color: #ca8a04 !important;
}

:root[data-theme="dark"] .portal-card-header.bg-warning.bg-opacity-10 {
    background: rgba(234, 179, 8, .12) !important;
    color: #fde68a;
}

:root[data-theme="dark"] .modal-body .bg-light {
    background: var(--input-bg) !important;
    border-color: var(--border) !important;
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body hr,
:root[data-theme="dark"] .portal-card-body.border-top,
:root[data-theme="dark"] .border-top {
    border-color: var(--border) !important;
}

:root[data-theme="dark"] .portal-body .text-blue,
:root[data-theme="dark"] .portal-body .text-blue.fs-4 {
    color: #fff !important;
}

:root[data-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #64748b;
}

:root[data-theme="dark"] .btn-outline-secondary:hover {
    background: #334155;
    border-color: #94a3b8;
    color: #f1f5f9;
}

:root[data-theme="dark"] .btn-outline-danger {
    color: #fca5a5;
    border-color: #ef4444;
}

:root[data-theme="dark"] .btn-outline-danger:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

:root[data-theme="dark"] .badge-open {
    background: rgba(59, 130, 246, .2);
    color: #93c5fd;
}

:root[data-theme="dark"] .badge-progress {
    background: rgba(245, 158, 11, .2);
    color: #fcd34d;
}

:root[data-theme="dark"] .badge-completed {
    background: rgba(16, 185, 129, .2);
    color: #fff;
}

:root[data-theme="dark"] .badge-cancelled {
    background: rgba(239, 68, 68, .2);
    color: #fca5a5;
}

:root[data-theme="dark"] .portal-tabs .nav-link.active {
    color: #fff;
    border-bottom-color: var(--green-btn);
}

:root[data-theme="dark"] .portal-tabs .nav-link:hover {
    color: #fff;
}

:root[data-theme="dark"] .badge.bg-light,
:root[data-theme="dark"] .badge.bg-light.text-dark {
    background: var(--hover-bg) !important;
    color: var(--text-dark) !important;
}

:root[data-theme="dark"] .border-success.bg-light {
    background: rgba(16, 185, 129, .1) !important;
    border-color: var(--green-btn) !important;
}

/* Typography & stat colors */
:root[data-theme="dark"] .portal-body,
:root[data-theme="dark"] .portal-body .portal-card,
:root[data-theme="dark"] .portal-body .portal-card-header,
:root[data-theme="dark"] .portal-body .modal-content {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body strong,
:root[data-theme="dark"] .portal-body .fw-semibold,
:root[data-theme="dark"] .portal-body .fw-bold,
:root[data-theme="dark"] .portal-body h1,
:root[data-theme="dark"] .portal-body h2,
:root[data-theme="dark"] .portal-body h3,
:root[data-theme="dark"] .portal-body h4,
:root[data-theme="dark"] .portal-body h5,
:root[data-theme="dark"] .portal-body h6 {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-stat-value,
:root[data-theme="dark"] .analytics-stat-value {
    color: #fff;
}

:root[data-theme="dark"] .portal-admin .portal-stat-value,
:root[data-theme="dark"] .portal-admin .analytics-stat-value {
    color: #cbd5e1;
}

:root[data-theme="dark"] .portal-admin .analytics-stat-icon {
    background: rgb(102 102 102 / 10%);
    color: #cbd5e1;
}

:root[data-theme="dark"] .analytics-stat-icon {
    background: rgb(102 102 102 / 10%);
    color: #fff;
}

:root[data-theme="dark"] .analytics-stat:hover {
    border-color: #475569;
    box-shadow: var(--shadow-md);
}

:root[data-theme="dark"] .portal-quick-link:hover {
    border-color: #475569;
}

:root[data-theme="dark"] .portal-action-item:hover {
    color: inherit;
}

:root[data-theme="dark"] .portal-action-warning .portal-action-icon {
    background: rgba(245, 158, 11, .18);
    color: #fcd34d;
}

:root[data-theme="dark"] .portal-action-danger .portal-action-icon {
    background: rgba(239, 68, 68, .18);
    color: #fca5a5;
}

:root[data-theme="dark"] .portal-action-success .portal-action-icon {
    background: rgba(34, 197, 94, .18);
    color: #fff;
}

:root[data-theme="dark"] .portal-action-info .portal-action-icon {
    background: rgba(59, 130, 246, .18);
    color: #93c5fd;
}

:root[data-theme="dark"] .analytics-stat-trend.positive {
    color: #fff;
    background: rgba(34, 197, 94, .15);
}

:root[data-theme="dark"] .analytics-stat-trend.negative {
    color: #fca5a5;
    background: rgba(239, 68, 68, .15);
}

:root[data-theme="dark"] .analytics-stat-trend.neutral {
    color: var(--text-muted);
    background: rgba(148, 163, 184, .12);
}

:root[data-theme="dark"] .user-menu-item--danger:hover {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
}

:root[data-theme="dark"] .user-menu-item.active {
    background: var(--green-light);
    color: #fff;
}

:root[data-theme="dark"] .user-menu-item--danger i {
    color: #fca5a5;
}

:root[data-theme="dark"] .admin-toast-close {
    color: var(--text-muted);
}

:root[data-theme="dark"] .chat-back-btn {
    color: #fff;
}

:root[data-theme="dark"] .admin-toast-close:hover {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-mobile-card:hover {
    color: inherit;
}

:root[data-theme="dark"] .chat-conv-row:hover,
:root[data-theme="dark"] .chat-conv-row.active {
    color: inherit;
}

:root[data-theme="dark"] .portal-period-selector .btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}

:root[data-theme="dark"] .portal-period-selector .btn-outline-secondary:hover,
:root[data-theme="dark"] .portal-period-selector .btn-outline-secondary.active {
    background: var(--green-btn);
    border-color: var(--green-btn);
    color: #fff;
}

/* Bootstrap utilities & components */
:root[data-theme="dark"] .portal-body .bg-light,
:root[data-theme="dark"] .portal-body .bg-white {
    background-color: var(--elevated-bg) !important;
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .text-body,
:root[data-theme="dark"] .portal-body .text-black {
    color: var(--text-dark) !important;
}

:root[data-theme="dark"] .portal-body .border,
:root[data-theme="dark"] .portal-body .border-bottom,
:root[data-theme="dark"] .portal-body .border-top,
:root[data-theme="dark"] .portal-body .border-start,
:root[data-theme="dark"] .portal-body .border-end {
    border-color: var(--border) !important;
}

:root[data-theme="dark"] .portal-body .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-dark);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(15, 23, 42, .35);
    --bs-table-hover-bg: var(--hover-bg);
    --bs-table-hover-color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .table-light {
    --bs-table-bg: var(--elevated-bg);
    --bs-table-color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .table> :not(caption)>*>* {
    border-bottom-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .dropdown-menu {
    background: var(--card-bg);
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

:root[data-theme="dark"] .portal-body .dropdown-item {
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .dropdown-item:hover,
:root[data-theme="dark"] .portal-body .dropdown-item:focus {
    background: var(--hover-bg);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .dropdown-divider {
    border-top-color: var(--border);
}

:root[data-theme="dark"] .portal-body .list-group-item {
    background: var(--card-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .list-group-item:hover {
    background: var(--hover-bg);
}

:root[data-theme="dark"] .portal-body .accordion-item {
    background: var(--card-bg);
    border-color: var(--border);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .accordion-button {
    background: var(--elevated-bg);
    color: var(--text-dark);
    box-shadow: none;
}

:root[data-theme="dark"] .portal-body .accordion-button:not(.collapsed) {
    background: var(--green-light);
    color: #fff;
}

:root[data-theme="dark"] .portal-body .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

:root[data-theme="dark"] .portal-body .accordion-body {
    background: var(--card-bg);
    color: var(--text-dark);
}

:root[data-theme="dark"] .portal-body .alert-success {
    background: rgba(34, 197, 94, .12);
    border-color: rgba(34, 197, 94, .35);
    color: #fff;
}

:root[data-theme="dark"] .portal-body .alert-danger {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .35);
    color: #fca5a5;
}

:root[data-theme="dark"] .portal-body .alert-warning {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .35);
    color: #fcd34d;
}

:root[data-theme="dark"] .portal-body .alert-info {
    background: rgba(59, 130, 246, .12);
    border-color: rgba(59, 130, 246, .35);
    color: #93c5fd;
}

:root[data-theme="dark"] .portal-body .alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

:root[data-theme="dark"] .portal-body .text-danger {
    color: #fca5a5 !important;
}

:root[data-theme="dark"] .portal-body .text-warning {
    color: #fcd34d !important;
}

:root[data-theme="dark"] .portal-body .text-info {
    color: #93c5fd !important;
}

:root[data-theme="dark"] .portal-body .text-primary {
    color: #93c5fd !important;
}

:root[data-theme="dark"] .portal-body .btn-link {
    color: #fff;
}

:root[data-theme="dark"] .portal-body .btn-link:hover {
    color: #fff;
}

:root[data-theme="dark"] .portal-body .input-group-text {
    background: var(--elevated-bg);
    border-color: var(--border);
    color: var(--text-muted);
}

:root[data-theme="dark"] .portal-body .progress {
    background: var(--border);
}

:root[data-theme="dark"] .portal-body a:not(.btn):not(.portal-nav-link):not(.nav-link):not(.dropdown-item):not(.page-link):not(.portal-feed-item):not(.portal-mobile-card):not(.portal-action-item):not(.portal-quick-link):not(.user-menu-item):not(.lang-switcher-item) {
    color: #fff;
}

:root[data-theme="dark"] .portal-body a:not(.btn):not(.portal-nav-link):hover {
    color: #fff;
}

:root[data-theme="dark"] .portal-breadcrumb li a {
    color: #fff;
}

:root[data-theme="dark"] .portal-footer a {
    color: #fff;
}

/* ── Dashboard charts ── */
.portal-chart-card .portal-card-header {
    align-items: flex-start;
}

.portal-chart-subtitle {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: .2rem;
}

.portal-chart-body {
    position: relative;
    min-height: 200px;
}

.portal-chart-card-tall .portal-chart-body {
    min-height: 280px;
}

.portal-chart-body canvas {
    width: 100% !important;
    max-height: 320px;
}

/* ── Admin detail pages ── */
.portal-detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.portal-detail-list dd {
    margin-bottom: 0.75rem;
}

.document-preview-body {
    background: var(--surface-subtle);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ── Flatpickr (post job preferred date) ── */
.portal-flatpickr-calendar {
    width: min(100vw - 2rem, 380px) !important;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1070;
}

.portal-flatpickr-calendar .flatpickr-months {
    padding: 0.35rem 0 0.65rem;
}

.portal-flatpickr-calendar .flatpickr-current-month {
    font-size: 1.1rem;
    font-weight: 600;
}

.portal-flatpickr-calendar .flatpickr-weekdays {
    height: 36px;
}

.portal-flatpickr-calendar span.flatpickr-weekday {
    font-size: 0.85rem;
    font-weight: 600;
}

.portal-flatpickr-calendar .flatpickr-days,
.portal-flatpickr-calendar .dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.portal-flatpickr-calendar .flatpickr-day {
    height: 46px;
    line-height: 46px;
    max-width: 46px;
    margin: 2px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
}

.portal-flatpickr-calendar .flatpickr-day.selected,
.portal-flatpickr-calendar .flatpickr-day.startRange,
.portal-flatpickr-calendar .flatpickr-day.endRange {
    background: var(--green-btn);
    border-color: var(--green-btn);
}

.portal-flatpickr-calendar .flatpickr-day:hover,
.portal-flatpickr-calendar .flatpickr-day:focus {
    background: var(--green-light);
    border-color: var(--green-light);
    color: var(--green-brand);
}

.portal-flatpickr-calendar.portal-flatpickr-dark {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-months .flatpickr-month,
.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-weekdays,
.portal-flatpickr-calendar.portal-flatpickr-dark span.flatpickr-weekday {
    background: var(--card-bg);
    color: var(--text-muted);
}

.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-day {
    color: var(--text-dark);
}

.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-day.prevMonthDay,
.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-day.nextMonthDay {
    color: var(--text-subtle);
}

.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-day.flatpickr-disabled {
    color: var(--text-subtle);
    opacity: 0.45;
}

.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-months .flatpickr-prev-month,
.portal-flatpickr-calendar.portal-flatpickr-dark .flatpickr-months .flatpickr-next-month {
    fill: var(--text-dark);
}

.portal-date-input[readonly] {
    background-color: var(--input-bg, var(--card-bg));
    cursor: pointer;
}

.results-empty {
    background: linear-gradient(135deg, #0a4f3c 0%, #084734 50%, #0f7558 100%);
    border-radius: 15px;
    color: #fff;
}

@media (max-width: 576px) {
    .portal-detail-list dd {
        margin-bottom: 1rem;
    }

    .portal-flatpickr-calendar {
        top: 470px !important;
        left: 20px !important;
        right: auto !important;
    }

}