/* ============================================================================
   DASHBOARD STYLES
   ============================================================================ */

/* Dashboard Layout */
.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
}
.main-content {
    min-width: 0;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Sidebar Stats */
.sidebar-stats {
    background: var(--color-blue);
    border-radius: var(--radius-xl);
    padding: 20px;
    color: white;
}
.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
.sidebar-stat:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.sidebar-stat-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-align: right;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.sidebar-stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}
.sidebar-stat-value {
    font-size: 16px;
    font-weight: 600;
}

/* Sidebar Nav */
.sidebar-nav {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.sidebar-nav-btn:hover {
    background: var(--color-bg);
    color: var(--color-text-primary);
}
.sidebar-nav-btn.active {
    background: rgba(22, 97, 119, 0.05);
    border-left-color: var(--color-blue);
    color: var(--color-blue);
}
.sidebar-nav-btn:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}
.sidebar-nav-icon {
    font-size: 16px;
}
.sidebar-nav-badge {
    margin-left: auto;
    background: var(--color-orange);
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

/* Content Cards */
.content-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.card-badge {
    background: var(--color-blue);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.card-content {
    padding: 20px 24px;
}

/* Tab Panels */
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.activity-item:hover {
    background: #e8e8e8;
}
.activity-item:last-child {
    margin-bottom: 0;
}
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.activity-icon.buy {
    background: rgba(22, 97, 119, 0.15);
    color: var(--color-blue);
}
.activity-icon.sell {
    background: rgba(177, 59, 60, 0.15);
    color: var(--color-red);
}
.activity-icon.withdraw {
    background: rgba(248, 114, 45, 0.15);
    color: var(--color-orange);
}
.activity-type-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.activity-pnl {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}
.activity-pnl.positive {
    color: var(--color-blue);
}
.activity-pnl.negative {
    color: var(--color-red);
}
.activity-info {
    flex: 1;
    min-width: 0;
}
.activity-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}
.activity-meta {
    font-size: 11px;
    color: var(--color-text-tertiary);
}
.activity-value {
    text-align: right;
}
.activity-eth {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.activity-usd {
    font-size: 11px;
    color: var(--color-text-tertiary);
}
.activity-expand-icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-tertiary);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.activity-item.expanded .activity-expand-icon {
    transform: rotate(180deg);
}
.activity-tokens {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin-top: -8px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
    border-top: none;
}
.activity-tokens.expanded {
    display: block;
}
.activity-tokens-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}
.token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}
.token-row:last-child {
    margin-bottom: 0;
}
.token-logo-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}
.token-symbol {
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-primary);
}
.token-address {
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-decoration: none;
}
.token-address:hover {
    color: var(--color-blue);
}
.token-amount {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* PnL Summary */
.pnl-summary {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.pnl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.pnl-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pnl-refresh {
    font-size: 12px;
    color: var(--color-blue);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.pnl-refresh:hover {
    background: rgba(22, 97, 119, 0.1);
}
.pnl-refresh:disabled {
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}
.pnl-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
}
.pnl-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.pnl-change {
    font-size: 15px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}
.pnl-change.positive {
    background: rgba(22, 97, 119, 0.1);
    color: var(--color-blue);
}
.pnl-change.negative {
    background: rgba(177, 59, 60, 0.1);
    color: var(--color-red);
}
.pnl-change.neutral {
    background: var(--color-bg);
    color: var(--color-text-tertiary);
}
.pnl-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.pnl-detail {
    text-align: center;
}
.pnl-detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.pnl-detail-value.pnl-positive {
    color: var(--color-blue);
}
.pnl-detail-value.pnl-negative {
    color: var(--color-red);
}
.pnl-detail-label {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pnl-updated {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-align: right;
    margin-top: 10px;
}

/* Holdings */
.holdings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.holding-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
}
.holding-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.holding-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    background: var(--color-blue);
}
.holding-info {
    flex: 1;
    min-width: 0;
}
.holding-symbol {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-primary);
}
.holding-pnl {
    font-size: 11px;
    font-weight: 500;
}
.holding-pnl.positive {
    color: var(--color-blue);
}
.holding-pnl.negative {
    color: var(--color-red);
}
.holding-balance {
    text-align: right;
}
.holding-amount {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-primary);
}
.holding-value {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

/* Portfolio Footer */
.portfolio-footer {
    padding: 18px 24px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.portfolio-help {
    font-size: 13px;
    color: var(--color-text-tertiary);
}
.portfolio-help a {
    color: var(--color-blue);
    text-decoration: none;
}
.portfolio-actions {
    display: flex;
    gap: 10px;
}
.action-btn {
    padding: 10px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.action-btn:hover {
    border-color: var(--color-blue);
    color: var(--color-blue);
}

/* Messages Tab */
.messages-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    margin: -20px -24px 20px -24px;
    padding: 0 24px;
}
.messages-tab {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.messages-tab:hover {
    color: var(--color-text-primary);
}
.messages-tab.active {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
}
.messages-tab .tab-count {
    background: var(--color-orange);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 6px;
}

.message-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.message-list-item:hover {
    background: #e8e8e8;
}
.message-list-item.unread {
    background: rgba(22, 97, 119, 0.08);
}
.message-list-item.request {
    background: rgba(248, 114, 45, 0.08);
    border: 1px solid rgba(248, 114, 45, 0.2);
}
.message-avatar {
    width: 40px;
    height: 40px;
    background: var(--color-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.message-avatar.request {
    background: var(--color-orange);
}
.message-info {
    flex: 1;
    min-width: 0;
}
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.message-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.message-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
}
.message-badge.request {
    background: rgba(248, 114, 45, 0.15);
    color: var(--color-orange);
}
.message-badge.unread {
    background: var(--color-blue);
    color: white;
}
.message-preview {
    font-size: 12px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message-meta {
    text-align: right;
    flex-shrink: 0;
}
.message-time {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-bottom: 6px;
}
.message-actions {
    display: flex;
    gap: 6px;
}
.message-action-btn {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.message-action-btn.accept {
    background: var(--color-blue);
    color: white;
}
.message-action-btn.decline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-tertiary);
}
.message-action-btn.decline:hover {
    border-color: var(--color-red);
    color: var(--color-red);
}

/* Referrals */
.referral-link-card {
    background: var(--color-blue);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    margin-bottom: 24px;
}
.referral-link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.referral-link-title {
    font-size: 16px;
    font-weight: 600;
}
.referral-link-rate {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
}
.referral-link-input-wrap {
    display: flex;
    gap: 10px;
}
.referral-link-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 6px;
    color: white;
    font-family: inherit;
    font-size: 13px;
}
.referral-link-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.referral-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.referral-stat-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}
.referral-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--color-blue);
    margin-bottom: 4px;
}
.referral-stat-label {
    font-size: 12px;
    color: var(--color-text-tertiary);
}
.referred-by-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.referred-by-icon {
    font-size: 24px;
}
.referred-by-info {
    flex: 1;
}
.referred-by-label {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.referred-by-address {
    font-size: 14px;
    font-weight: 600;
}
.referred-by-address a {
    color: var(--color-blue);
    text-decoration: none;
}
.referrals-list {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.referrals-list-header {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}
.referral-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
}
.referral-item:last-child {
    border-bottom: none;
}

/* Settings */
.settings-section {
    margin-bottom: 32px;
    border: none;
    padding: 0;
}
.settings-section:last-child {
    margin-bottom: 0;
}
.settings-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.prefs-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: none;
}
.prefs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.prefs-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
}
.prefs-select,
.prefs-input {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    background: white;
}
.prefs-select:focus,
.prefs-input:focus {
    outline: none;
    border-color: var(--color-blue);
}
.prefs-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.prefs-btn {
    padding: 10px 20px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.prefs-btn:hover {
    background: #124e5f;
}
.prefs-saved {
    font-size: 13px;
    color: var(--color-blue);
    font-weight: 500;
}

/* Toggle Switch */
.toggle-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.toggle-field:last-child {
    border-bottom: none;
}
.toggle-info {
    flex: 1;
}
.toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}
.toggle-desc {
    font-size: 11px;
    color: var(--color-text-tertiary);
}
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border);
    transition: 0.2s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-blue);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Blocked Users */
.blocked-list {
    margin-top: 12px;
}
.blocked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
}
.blocked-address {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
}
.blocked-unblock {
    font-size: 11px;
    color: var(--color-red);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.blocked-empty {
    font-size: 13px;
    color: var(--color-text-tertiary);
    padding: 12px 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-tertiary);
}
.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
}
.empty-text {
    font-size: 14px;
}
.empty-link {
    color: var(--color-blue);
    text-decoration: none;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-tertiary);
}
.loading-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

/* Fix form borders */
form {
    border: none;
}
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .sidebar-stats {
        grid-column: span 2;
    }
    .sidebar-nav {
        grid-column: span 2;
        display: flex;
        flex-wrap: wrap;
    }
    .sidebar-nav-btn {
        flex: 1;
        min-width: 80px;
        border-left: none;
        border-bottom: 3px solid transparent !important;
        justify-content: center;
        font-size: 11px;
        padding: 12px 8px;
    }
    .sidebar-nav-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--color-blue) !important;
    }
    .sidebar-nav-btn .sidebar-nav-icon {
        display: none;
    }
    .pnl-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .pnl-detail {
        display: flex;
        justify-content: space-between;
        text-align: left;
    }
    .holdings-grid {
        grid-template-columns: 1fr;
    }
    .portfolio-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .portfolio-actions {
        justify-content: stretch;
    }
    .action-btn {
        flex: 1;
        text-align: center;
    }
    .referral-stats {
        grid-template-columns: 1fr;
    }
    .referral-link-input-wrap {
        flex-direction: column;
    }
    .messages-tabs {
        margin: -20px -24px 16px -24px;
        padding: 0 16px;
    }
    .messages-tab {
        padding: 12px 14px;
        font-size: 12px;
    }
}
