/* ======================================================================= */
/* 1. Core Variables & Design Tokens (Dark / Light Harmonious Palettes)    */
/* ======================================================================= */
:root {
    /* Dark Theme (Default) Design Tokens matching mockup */
    --base-bg: #0a0f1d;
    --card-bg: rgba(16, 22, 42, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-purple: #8b5cf6;
    --accent-blue: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.15);
    
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-error: #ef4444;
    --status-info: #06b6d4;
    
    --sidebar-bg: rgba(10, 15, 29, 0.9);
    --header-bg: rgba(10, 15, 29, 0.85);
    --hover-overlay: rgba(255, 255, 255, 0.04);
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --card-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
    /* Light Theme Design Tokens matching mockup */
    --base-bg: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.75);
    --border-color: rgba(15, 23, 42, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    
    --accent-purple: #8b5cf6;
    --accent-blue: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.08);
    
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-error: #ef4444;
    --status-info: #06b6d4;
    
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --header-bg: rgba(241, 245, 249, 0.85);
    --hover-overlay: rgba(15, 23, 42, 0.03);
    
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
    --card-shadow: 0 4px 20px 0 rgba(31, 38, 135, 0.04);
}

/* ======================================================================= */
/* 2. Basic Resets & Typography                                            */
/* ======================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body {
    background-color: var(--base-bg);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
}

/* ======================================================================= */
/* 3. Glassmorphic Cards & Reusable Components                             */
/* ======================================================================= */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

/* Base Inputs */
input, select, textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    width: 100%;
}
[data-theme="light"] input, [data-theme="light"] select {
    background: rgba(0, 0, 0, 0.02);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-glow);
}

label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.field-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* Custom Alert Banner */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid transparent;
}
.alert-success {
    background: rgba(0, 230, 118, 0.1);
    color: var(--status-success);
    border-color: rgba(0, 230, 118, 0.2);
}

/* Premium Buttons */
.btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
    transition: all 0.3s ease;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
    transform: none !important;
}
[data-theme="light"] .btn:disabled {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.05) !important;
    color: #64748b !important;
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-glow);
}
[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
}
[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--accent-blue);
}
.btn-danger {
    background: var(--status-error);
    box-shadow: none;
}
.btn-danger:hover {
    background: #d32f2f;
    box-shadow: none;
}
.btn-buy {
    background: linear-gradient(135deg, var(--status-success), #00c853) !important;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3) !important;
}
.btn-buy:hover {
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.45) !important;
}
.btn-sell {
    background: linear-gradient(135deg, var(--status-error), #d50000) !important;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3) !important;
}
.btn-sell:hover {
    box-shadow: 0 6px 20px rgba(255, 23, 68, 0.45) !important;
}
.btn-exchange {
    background: linear-gradient(135deg, var(--accent-purple), #c084fc, var(--accent-blue)) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3) !important;
}
.btn-exchange:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45) !important;
}

/* Exchange Mode Panel */
.exchange-fields-panel {
    margin-top: 1rem;
    padding: 1.25rem;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.15);
    position: relative;
    animation: fadeIn 0.3s ease-out forwards;
}
[data-theme="light"] .exchange-fields-panel {
    background: rgba(139, 92, 246, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.12);
}
.exchange-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(139, 92, 246, 0.15);
}
.button-row {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ======================================================================= */
/* 4. Glassmorphic Modal Dialog Box                                        */
/* ======================================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 29, 0.75);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-card {
    background: rgba(16, 22, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(6, 182, 212, 0.05);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
[data-theme="light"] .modal-card {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(15, 23, 42, 0.15);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12), 0 0 30px rgba(6, 182, 212, 0.03);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
}
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    width: auto;
    height: auto;
}
.modal-close-btn:hover {
    color: var(--text-primary);
    background: none;
}
[data-theme="light"] .modal-close-btn {
    background: none;
}
[data-theme="light"] .modal-close-btn:hover {
    background: none;
}
.modal-body {
    padding: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}
.modal-footer {
    padding: 1rem 1.5rem;
    background: transparent;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* ======================================================================= */
/* 5. Authentic Sign-In Layout                                             */
/* ======================================================================= */
.auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 10% 20%, rgb(18, 22, 40) 0%, rgb(9, 11, 20) 90%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}
[data-theme="light"] .auth-wrapper {
    background: radial-gradient(circle at 10% 20%, rgb(240, 243, 250) 0%, rgb(220, 225, 238) 90%);
}
.auth-glass-container {
    width: 90%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 0;
}
.auth-logo {
    text-align: center;
}
.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
}
.auth-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.auth-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Persona selection blocks */
.persona-selection-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.persona-button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.persona-btn {
    background: var(--hover-overlay);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.persona-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(6, 182, 212, 0.05);
}
.role-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.role-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    background: var(--accent-blue);
    color: #ffffff;
}

/* ======================================================================= */
/* 6. Navigation Top Header                                                */
/* ======================================================================= */
.app-header {
    height: 70px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo-icon-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.35);
    font-family: 'Outfit', sans-serif;
}
.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}
[data-theme="light"] .logo-text {
    background: linear-gradient(to right, #0f172a, #475569) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.theme-toggle {
    background: var(--hover-overlay);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-size: 0.8rem;
    font-weight: 600;
}
.user-role-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-purple);
}
.logout-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ======================================================================= */
/* 7. App Sidebar & Navigation                                             */
/* ======================================================================= */
.workspace {
    padding-top: 70px;
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    z-index: 90;
    overflow-y: auto;
}
.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.nav-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07rem;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem 0.75rem;
}
.nav-header:first-child {
    margin-top: 0;
}
.nav-item {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}
.nav-item:hover {
    background: var(--hover-overlay);
    color: var(--text-primary);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border-left: 3px solid var(--accent-blue);
    color: var(--text-primary);
    font-weight: 600;
}
.nav-icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Secrets Manager status card */
.secrets-manager-badge {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.15);
    color: var(--status-success);
    font-size: 0.7rem;
    font-family: monospace;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
}
.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--status-success);
    border-radius: 50%;
    box-shadow: 0 0 0 var(--status-success);
    animation: pulse 1.5s infinite;
}

/* ======================================================================= */
/* 8. Main Content Panel & Grids                                           */
/* ======================================================================= */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}
/* Mobile Navigation Hamburger Toggle Button Styles */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
    margin-right: 0.75rem;
}
.mobile-nav-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.mobile-nav-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.mobile-nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.mobile-nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 29, 0.4);
    backdrop-filter: blur(4px);
    z-index: 98;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
}

@media (max-width: 992px) {
    .mobile-nav-toggle {
        display: flex;
    }
    .sidebar {
        position: fixed !important;
        top: 70px;
        left: -280px;
        bottom: 0;
        width: 280px;
        z-index: 99;
        background: var(--sidebar-bg);
        border-right: 1px solid var(--border-color);
        transition: left 0.3s ease;
        display: none !important;
    }
    .sidebar.active {
        left: 0;
        display: flex !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem !important;
    }
}
@media (max-width: 768px) {
    .app-header {
        padding: 0 1rem !important;
    }
    .logo-text {
        font-size: 1rem !important;
    }
    .logo-icon-sm {
        width: 28px !important;
        height: 28px !important;
    }
    .active-group-badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.45rem !important;
        margin-left: 0.5rem !important;
    }
}

.dashboard-selector-bar {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.selector-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 480px;
}
.selector-container label {
    margin-bottom: 0;
    white-space: nowrap;
}
.selector-container select {
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.view-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.4s ease-out forwards;
}

/* Grid systems */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: var(--text-secondary);
}
.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.1fr;
    gap: 2rem;
}
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

/* ======================================================================= */
/* 9. Data Tables                                                          */
/* ======================================================================= */
.table-container {
    overflow-x: auto;
    width: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}
.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03rem;
}
.data-table tbody tr:hover {
    background: var(--hover-overlay);
}

/* Alerts & Banners */
.alert-danger {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(10px);
    color: #fca5a5;
    font-size: 0.85rem;
    line-height: 1.4;
}
.alert-danger strong {
    color: #fee2e2;
    display: block;
    margin-bottom: 0.25rem;
    font-family: 'Outfit';
}

[data-theme="light"] .alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}
[data-theme="light"] .alert-danger strong {
    color: #991b1b;
}

/* Badges */
.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.badge-success {
    background: rgba(0, 230, 118, 0.1);
    color: var(--status-success);
}
.badge-pending {
    background: rgba(0, 176, 255, 0.1);
    color: var(--status-info);
}
.badge-warning {
    background: rgba(255, 234, 0, 0.1);
    color: var(--status-warning);
}
.badge-error {
    background: rgba(255, 23, 68, 0.1);
    color: var(--status-error);
}

.history-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}
.history-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.history-tab-btn:hover {
    color: var(--text-primary);
}
.history-tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* ======================================================================= */
/* 10. Dynamic Order Sizing Box                                            */
/* ======================================================================= */
.preview-box {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    animation: slideDown 0.3s ease-out forwards;
}
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.75rem;
}
.preview-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
}

/* ======================================================================= */
/* 11. Keyframe Animations                                                 */
/* ======================================================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(0, 230, 118, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
    }
}

@keyframes textPulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}
.loading-pulse {
    animation: textPulse 1.5s infinite ease-in-out;
    color: var(--text-secondary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* ======================================================================= */
/* 10. Segmented Control Three-Pill Toggles                                */
/* ======================================================================= */
.segmented-control {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 0.5rem;
}
[data-theme="light"] .segmented-control {
    background: rgba(0, 0, 0, 0.02);
}
.segmented-pill {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: none !important;
    transform: none !important;
}
.segmented-pill:hover {
    color: var(--text-primary);
    background: var(--hover-overlay);
}
.segmented-pill.active {
    color: #ffffff !important;
}
.segmented-pill.active#pill-buy {
    background: linear-gradient(135deg, var(--status-success), #00c853);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}
.segmented-pill.active#pill-sell {
    background: linear-gradient(135deg, var(--status-error), #d50000);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}
.segmented-pill.active#pill-exchange {
    background: linear-gradient(135deg, var(--status-error), var(--accent-purple), var(--status-success));
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3) !important;
}

/* Premium Preview Button Matching Side States */
.btn-preview-buy {
    border: 1px solid var(--status-success) !important;
    color: var(--status-success) !important;
    background: transparent !important;
}
.btn-preview-buy:hover {
    background: rgba(16, 185, 129, 0.08) !important;
}
.btn-preview-sell {
    border: 1px solid var(--status-error) !important;
    color: var(--status-error) !important;
    background: transparent !important;
}
.btn-preview-sell:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}
.btn-preview-exchange {
    border: 1px solid transparent !important;
    color: var(--text-primary) !important;
    background-image: linear-gradient(var(--card-bg), var(--card-bg)), linear-gradient(135deg, var(--status-error), var(--accent-purple), var(--status-success)) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    box-shadow: none !important;
}
.btn-preview-exchange:hover {
    background-image: linear-gradient(var(--hover-overlay), var(--hover-overlay)), linear-gradient(135deg, var(--status-error), var(--accent-purple), var(--status-success)) !important;
}

/* Premium Execute Button Red-To-Buy Transition color */
.btn-exchange {
    background: linear-gradient(135deg, var(--status-error), var(--accent-purple), var(--status-success)) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3) !important;
}

/* Active Group Indicator Badge in Header */
.active-group-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-left: 0.75rem;
    display: inline-flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}
[data-theme="light"] .active-group-badge {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
}


