:root {
    --ppc-primary: #0B3D2E;
    --ppc-primary-dark: #062820;
    --ppc-accent: #C4A35A;
    --ppc-accent-light: #D4B872;
    --ppc-bg: #f0f4f2;
    --ppc-surface: #ffffff;
    --ppc-border: rgba(11, 61, 46, 0.1);
    --ppc-text: #1a2e28;
    --ppc-text-muted: #5c6f67;
    --ppc-radius: 1rem;
    --ppc-radius-sm: 0.65rem;
    --ppc-shadow: 0 8px 32px rgba(11, 61, 46, 0.08);
    --ppc-sidebar-w: 270px;
    --ppc-header-h: 64px;
    --ppc-font: 'DM Sans', system-ui, sans-serif;
    --ppc-icon-bg: rgba(11, 61, 46, 0.08);
}

[data-theme="dark"] {
    --ppc-bg: #0d1612;
    --ppc-surface: #16241e;
    --ppc-border: rgba(255, 255, 255, 0.08);
    --ppc-text: #e8efeb;
    --ppc-text-muted: #9aafa5;
    --ppc-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --ppc-icon-bg: rgba(196, 163, 90, 0.12);
}

[data-theme="dark"] .feature-alert--warning { background: #3d3210; border-color: #e6a817; color: #f5e6a8; }
[data-theme="dark"] .feature-alert--info { background: #143028; border-color: var(--ppc-accent); color: #c8e0d6; }
[data-theme="dark"] .feature-alert--success { background: #143028; border-color: #198754; color: #a8e0c0; }
[data-theme="dark"] .feature-alert--danger { background: #3a1818; border-color: #dc3545; color: #f0b0b0; }
[data-theme="dark"] .tx-accordion .accordion-button:not(.collapsed) { background: rgba(196, 163, 90, 0.1); color: var(--ppc-accent); }
[data-theme="dark"] .modal-content { background: var(--ppc-surface); color: var(--ppc-text); }
[data-theme="dark"] .modal-footer { border-top-color: var(--ppc-border); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--ppc-bg);
    border-color: var(--ppc-border);
    color: var(--ppc-text);
}
[data-theme="dark"] .text-muted { color: var(--ppc-text-muted) !important; }

[data-theme="dark"] .card,
[data-theme="dark"] .content-card {
    background-color: var(--ppc-surface);
    color: var(--ppc-text);
    border-color: var(--ppc-border);
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .card-body {
    background-color: var(--ppc-surface);
    color: var(--ppc-text);
    border-color: var(--ppc-border);
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light {
    background-color: var(--ppc-bg) !important;
    color: var(--ppc-text);
}

[data-theme="dark"] .form-label,
[data-theme="dark"] .form-check-label,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .h1,
[data-theme="dark"] .h2,
[data-theme="dark"] .h3,
[data-theme="dark"] .h4,
[data-theme="dark"] .h5,
[data-theme="dark"] .h6 {
    color: var(--ppc-text);
}

[data-theme="dark"] .table,
[data-theme="dark"] .table > :not(caption) > * > * {
    color: var(--ppc-text);
    border-color: var(--ppc-border);
    --bs-table-bg: transparent;
    --bs-table-color: var(--ppc-text);
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: rgba(255, 255, 255, 0.04);
    color: var(--ppc-text);
}

[data-theme="dark"] .btn-outline-secondary {
    color: var(--ppc-text-muted);
    border-color: var(--ppc-border);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--ppc-surface);
    color: var(--ppc-text);
    border-color: var(--ppc-border);
}

[data-theme="dark"] .border { border-color: var(--ppc-border) !important; }

[data-theme="dark"] .list-group-item {
    background: var(--ppc-surface);
    color: var(--ppc-text);
    border-color: var(--ppc-border);
}

[data-theme="dark"] .pagination .page-link {
    background: var(--ppc-surface);
    color: var(--ppc-text);
    border-color: var(--ppc-border);
}

*, *::before, *::after { box-sizing: border-box; }

body.portal-body {
    font-family: var(--ppc-font);
    background: var(--ppc-bg);
    color: var(--ppc-text);
    min-height: 100vh;
    margin: 0;
}

.portal-shell { display: flex; min-height: 100vh; }

.portal-sidebar {
    width: var(--ppc-sidebar-w);
    background: var(--ppc-primary);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.portal-sidebar.is-open { transform: translateX(0); }

.portal-sidebar__brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.portal-sidebar__logo,
.portal-sidebar__brand img,
.portal-sidebar__brand .site-logo {
    height: 40px;
    width: auto;
    max-width: 100%;
    display: block;
}

.portal-sidebar__brand-text {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.portal-sidebar__brand-sub {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.portal-wallet-chip {
    margin: 1rem 1.25rem;
    padding: 0.85rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--ppc-radius-sm);
    font-size: 0.85rem;
}

.portal-nav { padding: 0.5rem 0.75rem 1rem; flex: 1; }

.portal-nav__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    border-radius: var(--ppc-radius-sm);
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    transition: background 0.2s;
}

.portal-nav__link:hover,
.portal-nav__link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.portal-nav__link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }

.portal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1035;
}

.portal-overlay.is-visible { display: block; }

.portal-main {
    flex: 1;
    margin-left: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--ppc-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: var(--ppc-header-h);
}

.portal-mobile-header__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.portal-mobile-header__logo-img {
    height: 36px;
    width: auto;
    max-width: min(200px, 55vw);
    display: block;
    flex-shrink: 0;
}

.portal-mobile-header__brand-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.portal-mobile-header__logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-mobile-header__logo img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.portal-mobile-header__toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 0.25rem;
    line-height: 1;
    cursor: pointer;
}

.portal-mobile-header__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.portal-mobile-header__theme {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    padding: 0.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-mobile-header__theme:hover {
    opacity: 0.85;
}

.portal-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--ppc-surface);
    border-bottom: 1px solid var(--ppc-border);
    position: sticky;
    top: 0;
    z-index: 1010;
}

.portal-topbar__balances {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.portal-topbar__balance strong { color: var(--ppc-primary); }

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

.portal-page-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 0.15rem; color: var(--ppc-primary); }
.portal-page-subtitle { font-size: 0.875rem; color: var(--ppc-text-muted); margin: 0; }

.surface-card {
    background: var(--ppc-surface);
    border-radius: var(--ppc-radius);
    box-shadow: var(--ppc-shadow);
    border: 1px solid var(--ppc-border);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.surface-card--flush { padding: 0; overflow: hidden; }

.surface-card__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ppc-border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.surface-card__body { padding: 1.25rem; }

.stat-card {
    background: var(--ppc-primary);
    color: #fff;
    border-radius: var(--ppc-radius);
    padding: 1.25rem;
    text-align: center;
    height: 100%;
}

.stat-card__label { font-size: 0.8rem; opacity: 0.85; margin-bottom: 0.35rem; }
.stat-card__value { font-size: 2rem; font-weight: 700; line-height: 1; }

.feature-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-radius: var(--ppc-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.feature-alert--warning { background: #fff8e6; border-color: #e6a817; color: #5c4a0a; }
.feature-alert--info { background: #e8f4ef; border-color: var(--ppc-primary); color: var(--ppc-primary-dark); }
.feature-alert--success { background: #e8f5ee; border-color: #198754; color: #0d4d2a; }
.feature-alert--danger { background: #fdecea; border-color: #dc3545; color: #842029; }
.feature-alert a { font-weight: 600; color: inherit; }

.virtual-card-section { margin-bottom: 1.25rem; }

.virtual-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.virtual-card-header h5 { margin: 0; font-size: 1rem; font-weight: 600; }

.btn-view-card {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--ppc-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.virtual-card {
    background: linear-gradient(135deg, var(--ppc-primary) 0%, var(--ppc-primary-dark) 100%);
    border-radius: 1.15rem;
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.virtual-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(196,163,90,.25) 0%, transparent 70%);
    border-radius: 50%;
}

.virtual-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.virtual-card__logo {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.virtual-card__name {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.virtual-card__footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.virtual-card__label { font-size: 0.7rem; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.04em; }
.virtual-card__value { font-size: 1rem; font-weight: 700; }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--ppc-surface);
    border-radius: var(--ppc-radius-sm);
    border: 1px solid var(--ppc-border);
    text-decoration: none;
    color: var(--ppc-text);
    font-size: 0.78rem;
    font-weight: 500;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--ppc-shadow);
    color: var(--ppc-primary);
}

.quick-action__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ppc-icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--ppc-primary);
}

[data-theme="dark"] .quick-action__icon { color: var(--ppc-accent); }

.referral-block {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.referral-block input {
    flex: 1;
    border: 1px solid var(--ppc-border);
    border-radius: var(--ppc-radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    background: var(--ppc-bg);
    color: var(--ppc-text);
}

.btn-ppc {
    background: var(--ppc-primary);
    border-color: var(--ppc-primary);
    color: #fff;
}

.btn-ppc:hover {
    background: var(--ppc-primary-dark);
    border-color: var(--ppc-primary-dark);
    color: #fff;
}

.btn-ppc-outline {
    background: transparent;
    border: 1px solid var(--ppc-primary);
    color: var(--ppc-primary);
}

.btn-ppc-outline:hover {
    background: var(--ppc-primary);
    color: #fff;
}

.portal-theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid var(--ppc-border);
    background: var(--ppc-surface);
    color: var(--ppc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    padding: 0;
}

.portal-theme-toggle:hover {
    border-color: var(--ppc-primary);
    background: rgba(11, 61, 46, 0.06);
}

.tx-accordion .accordion-item {
    border: 1px solid var(--ppc-border);
    border-radius: var(--ppc-radius-sm) !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.tx-accordion .accordion-button {
    font-size: 0.875rem;
    padding: 0.85rem 1rem;
    background: var(--ppc-surface);
}

.tx-accordion .accordion-button:not(.collapsed) {
    background: rgba(11, 61, 46, 0.05);
    color: var(--ppc-primary);
}

.portal-table-responsive { overflow-x: auto; }

.content-card {
    background: var(--ppc-surface);
    color: var(--ppc-text);
    border-radius: var(--ppc-radius);
    box-shadow: var(--ppc-shadow);
    border: 1px solid var(--ppc-border);
    border-left: 4px solid var(--ppc-accent);
}

@media (max-width: 767.98px) {
    .portal-table-stack thead { display: none; }
    .portal-table-stack tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--ppc-border);
        border-radius: var(--ppc-radius-sm);
        padding: 0.5rem;
        background: var(--ppc-surface);
    }
    .portal-table-stack td {
        display: flex;
        justify-content: space-between;
        padding: 0.35rem 0.5rem;
        border: none;
        font-size: 0.85rem;
    }
    .portal-table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ppc-text-muted);
        margin-right: 1rem;
    }
}

@media (min-width: 992px) {
    .portal-sidebar { transform: translateX(0); }
    .portal-main { margin-left: var(--ppc-sidebar-w); }
    .portal-mobile-header { display: none; }
    .portal-topbar { display: flex; }
    .portal-content { padding: 1.5rem 2rem; }
}

@media (max-width: 575.98px) {
    .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
    .quick-action { padding: 0.6rem 0.25rem; font-size: 0.68rem; gap: 0.3rem; }
    .quick-action__icon { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; }
    .quick-action:nth-child(5) { grid-column: 1; }
    .quick-action:nth-child(6) { grid-column: 4; }

    .virtual-card {
        min-height: auto;
        padding: 0.85rem 1rem;
        border-radius: 0.85rem;
    }

    .virtual-card__top { margin-bottom: 0.5rem; }

    .virtual-card__logo {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .virtual-card__name {
        font-size: 1rem;
        margin-bottom: 0.65rem;
    }

    .virtual-card__label { font-size: 0.62rem; }
    .virtual-card__value { font-size: 0.85rem; }

    .virtual-card-header { margin-bottom: 0.6rem; }
    .virtual-card-header h5 { font-size: 0.9rem; }
    .btn-view-card { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
}

/* Auth split layout */
.auth-split { min-height: 100vh; display: flex; }
.auth-split__brand {
    display: none;
    flex: 1;
    background: linear-gradient(160deg, var(--ppc-primary) 0%, var(--ppc-primary-dark) 60%, #041a14 100%);
    color: #fff;
    padding: 3rem;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.auth-split__brand::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(196,163,90,.2) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-split__brand-content { position: relative; z-index: 1; max-width: 420px; }
.auth-split__logo { height: 44px; width: auto; max-width: 100%; display: block; }
.auth-split__brand h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-split__brand .tagline { color: var(--ppc-accent-light); font-size: 1.1rem; margin-bottom: 2rem; }
.auth-split__features { list-style: none; padding: 0; margin: 0; }
.auth-split__features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    opacity: 0.9;
}
.auth-split__features i { color: var(--ppc-accent); font-size: 1.1rem; margin-top: 0.15rem; }
.auth-split__form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--ppc-bg);
}
.auth-form-card {
    width: 100%;
    max-width: 440px;
    background: var(--ppc-surface);
    border-radius: var(--ppc-radius);
    box-shadow: var(--ppc-shadow);
    padding: 2rem;
    border: 1px solid var(--ppc-border);
}
.auth-form-card h2 { font-size: 1.5rem; font-weight: 700; color: var(--ppc-primary); margin-bottom: 0.25rem; }
.auth-form-card .subtitle { color: var(--ppc-text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

@media (min-width: 992px) {
    .auth-split__brand { display: flex; }
}

/* Performance chart */
.perf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.perf-header__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--ppc-text);
}

.perf-range {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.2rem;
    background: var(--ppc-icon-bg);
    border-radius: 999px;
}

.perf-range__btn {
    border: none;
    background: transparent;
    color: var(--ppc-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.perf-range__btn.is-active {
    background: var(--ppc-primary);
    color: #fff;
}

.perf-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.perf-metric__label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ppc-text-muted);
    margin-bottom: 0.25rem;
}

.perf-metric__value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ppc-text);
    line-height: 1.2;
}

.perf-chart {
    min-height: 280px;
    width: 100%;
}

@media (max-width: 576px) {
    .perf-header__title { font-size: 1.05rem; }

    .perf-metrics { gap: 0.5rem; }

    .perf-metric__label { font-size: 0.62rem; }

    .perf-metric__value { font-size: 0.9rem; }
}

