/* ── Portfolio onboarding banners ────────────────────────────────────────── */
.portfolio-onboarding-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 10px;
}

.portfolio-onboarding-banner--new {
    border-color: var(--accent);
    background: rgba(240, 185, 11, 0.05);
}

.portfolio-onboarding-banner--new .pob-icon {
    background: rgba(240, 185, 11, 0.12);
}

.portfolio-onboarding-banner--returning {
    border-color: var(--accent);
    background: rgba(240, 185, 11, 0.05);
}

.pob-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
    margin-top: 1px;
}

.portfolio-onboarding-banner--returning .pob-icon {
    background: rgba(240, 185, 11, 0.12);
}

.pob-body {
    flex: 1;
    min-width: 0;
}

.pob-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.pob-sub {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.pob-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.pob-btn-primary {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    background: var(--accent);
    color: #000;
    cursor: pointer;
    transition: opacity 0.15s;
}

.pob-btn-primary:hover {
    opacity: 0.85;
}

.pob-btn-ghost {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.pob-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.pob-dismiss {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s;
}

.pob-dismiss:hover {
    color: var(--text-primary);
}

/* ── End portfolio onboarding banners ────────────────────────────────────── */

.main-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    gap: 0px;
    background: var(--bg--primary);
    min-height: calc(100vh - 60px);
}

.left-panel {
    display: flex;
    flex-direction: column;
    margin: 10px;
    border-radius: 8px;
    min-width: 0;
}

.right-panel {
    display: flex;
    flex-direction: column;
    margin: 10px 10px 10px 0px;
    border-radius: 5px;
    min-width: 0;
}

.portfolio-summary {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 5px;
    margin-bottom: 10px;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.summary-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.time-updated {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.time-updated::before {
    content: '●';
    color: var(--green);
    font-size: 8px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.total-value {
    margin-bottom: 8px;
}

.value-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.value-amount {
    font-size: 32px;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
}

.pnl-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.pnl-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
}

.pnl-badge.positive {
    background: rgba(14, 203, 129, 0.15);
    color: var(--green);
}

.pnl-badge.negative {
    background: rgba(246, 70, 93, 0.15);
    color: var(--red);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.stat-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
}

.portfolio-details {
    background: var(--bg-secondary);
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 10px;
}

.holdings-section {
    overflow: auto;         /* single scroll container for both axes */
    max-height: 560px;      /* bounded height so sticky has a scroll context */
}

.section-header {
    padding: 16px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: var(--bg-secondary);
}

th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
    padding: 12px 20px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-secondary);
}

td {
    padding: 16px 20px;
    font-size: 14px;
    text-align: center;
}

td:first-child {
    text-align: left;
}

.asset-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

.asset-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    /* Don't let icon shrink */
}

.asset-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.asset-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 72px
}

.asset-symbol {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.asset-name {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.2;
    margin-top: 2px;
}

/* Ensure all asset cells have consistent height */
td .asset-cell {
    min-height: 48px;
}

.price-cell {
    font-family: 'IBM Plex Mono', monospace;
}

.change-cell {
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

.action {
    display: flex;
    flex-flow: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.action-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Allocation strength colors (percentage based) ===== */

.action-very-strong {
    background: rgba(14, 203, 129, 0.30);
    color: #0ECB81;
}

.action-strong {
    background: rgba(14, 203, 129, 0.18);
    color: #0ECB81;
}

.action-medium {
    background: rgba(240, 185, 11, 0.18);
    color: #F0B90B;
}

.action-light {
    background: rgba(132, 142, 156, 0.18);
    color: #848E9C;
}

.action-exit {
    background: rgba(246, 70, 93, 0.25);
    color: #F6465D;
}

.action-buy {
    background: rgba(14, 203, 129, 0.15);
    color: var(--green);
}

.action-sell {
    background: rgba(246, 70, 93, 0.15);
    color: var(--red);
}

.action-hold {
    background: rgba(240, 185, 11, 0.18);
    color: #F0B90B;
}

/* Drawer signal badge — reuses action-badge colours */
.sig-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    padding: 3px 9px;
    letter-spacing: 0.3px;
}

.sig-buy {
    background: rgba(14, 203, 129, 0.15);
    color: var(--green);
}

.sig-sell {
    background: rgba(246, 70, 93, 0.15);
    color: var(--red);
}

.sig-hold {
    background: rgba(240, 185, 11, 0.18);
    color: #F0B90B;
}

/* Confidence pill inside recommendation cell */
.conf-rec-pill {
    font-size: 10px;
    font-family: 'IBM Plex Mono', monospace;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
    display: inline-block;
    vertical-align: middle;
}

.conf-rec-pill.high {
    background: rgba(14, 203, 129, 0.1);
    color: var(--green);
}

.conf-rec-pill.med {
    background: rgba(240, 185, 11, 0.1);
    color: var(--accent);
}

.conf-rec-pill.low {
    background: rgba(132, 142, 156, 0.1);
    color: var(--text-secondary);
}

.panel-section {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* Exchange Tabs Styles */
.exchange-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.exchange-tab {
    padding: 8px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.exchange-tab:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.exchange-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Performance graph */
.performance-graph-section {
    display: grid;
    grid-template-rows: auto 260px;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    overflow-y: auto;
    border-radius: 5px;
    margin-bottom: 10px;
}

.performance-graph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.performance-graph-section .section-title {
    margin-bottom: 0;
}

.perf-range-tabs {
    display: flex;
    gap: 4px;
}

.perf-range-tab {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
}

.perf-range-tab:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.perf-range-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.perf-range-tab--disabled,
.perf-range-tab:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.performance-chart-container {
    position: relative;
}

/* Allocation Chart Styles */
#allocationChartContainer {
    padding: 16px;
}

#allocationChart {
    max-height: 280px;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.recommendation-card {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.recommendation-card:hover {
    background: #252A30;
    transform: translateX(2px);
}

.recommendation-card.buy {
    border-left-color: var(--green);
}

.recommendation-card.sell {
    border-left-color: var(--red);
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rec-symbol {
    font-weight: 700;
    font-size: 14px;
}

.rec-action {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
}

.rec-reason {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.btn-export {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-export:hover {
    background: var(--bg-tertiary);
}

.export-icon {
    margin-top: -1px;
}


/* ── Wallet type badges — used in asset drawer ──────────────────────────── */
.wallet-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    display: inline-block;
}

.wallet-type-spot {
    background: rgba(14, 203, 129, 0.15);
    color: #0ECB81;
    border: 1px solid rgba(14, 203, 129, 0.3);
}

.wallet-type-earn-flexible {
    background: rgba(240, 180, 41, 0.15);
    color: #F0B429;
    border: 1px solid rgba(240, 180, 41, 0.3);
}

.wallet-type-earn-locked {
    background: rgba(114, 137, 218, 0.15);
    color: #7289DA;
    border: 1px solid rgba(114, 137, 218, 0.3);
}

.wallet-type-staking {
    background: rgba(91, 143, 255, 0.15);
    color: #5B8FFF;
    border: 1px solid rgba(91, 143, 255, 0.3);
}

.wallet-type-reserved,
.wallet-type-funding {
    background: rgba(94, 102, 115, 0.15);
    color: #848E9C;
    border: 1px solid rgba(94, 102, 115, 0.3);
}

/* ── Asset drawer layout ─────────────────────────────────────────────────── */
.drawer-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-conf-pill {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

/* Equal-sized signal + confidence pills — used in drawer header */
.drawer-sig-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    height: 26px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    white-space: nowrap;
}

.drawer-conf-pill-eq {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 26px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 5px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Two-column layout: wallet 50% + ring 50% on large screens */
.drawer-body-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.drawer-ring-panel {
    display: none;
    /* hidden on small screens */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    min-height: 180px;
}

.drawer-ring-col--solo {
    display: none;
    /* no ring on small screens when no wallet data */
}

/* Large screen — 580px+ splits into two equal columns */
@media (min-width: 580px) {
    .drawer-body-cols {
        grid-template-columns: 1fr 1fr;
    }

    .drawer-ring-panel {
        display: flex;
    }

    .drawer-ring-col--solo {
        display: flex;
        justify-content: center;
        margin-bottom: 12px;
    }

    .drawer-conf-pill-eq {
        display: none;
    }

    #assetDrawer {
        position: fixed;
        max-width: 720px;
        width: 90%;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
        border-radius: 16px;
        bottom: 20px;
    }

    #assetDrawer.open {
        transform: translateX(-50%) translateY(0);
    }
}

/* Edit buy price button */
.pnl-with-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.edit-price-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-secondary);
    line-height: 1;
    padding: 2px 4px;
    cursor: pointer;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.edit-price-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.delete-price-btn:hover {
    color: #F6465D;
    border-color: #F6465D;
}