:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(15, 23, 42, 0.75);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1.5rem 2rem;
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

.glass-container {
    max-width: 1440px;
    margin: 0 auto;
}

/* Glass Card Utility */
.glass-card {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #38bdf8 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    font-size: 0.72rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.status-indicator.locked {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-indicator.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-indicator.paused {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.auth-only.hidden {
    display: none !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

/* Navigation Tabs */
.main-nav {
    display: flex;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.8);
    padding: 0.3rem 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: #ffffff;
}

.nav-tab.active {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Dashboard Sub-Bar (Range Filter & Metadata) */
.dashboard-subbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.subbar-title h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.03em;
}

.subbar-subtitle {
    font-size: 0.78rem;
    color: #64748b;
}

.subbar-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.range-selector {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.9);
    padding: 3px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 3px;
}

.range-selector button {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.4rem 0.8rem;
    border-radius: 7px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.range-selector button:hover {
    color: #ffffff;
}

.range-selector button.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2);
}

.last-update {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

/* View Panels */
.view-panel {
    display: block;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-panel.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 1. STANDALONE LOGIN GATEWAY VIEW */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    padding: 2rem 1rem;
}

.login-card {
    max-width: 520px;
    width: 100%;
    padding: 3rem 2.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.logo-badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}

.login-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

#login-form {
    text-align: left;
    margin-bottom: 1.5rem;
}

#login-form .form-group {
    margin-bottom: 1.25rem;
}

#login-form .form-group label {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 600;
    display: block;
    margin-bottom: 0.4rem;
}

#login-form .form-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#login-form .form-group input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.form-section-toggle {
    text-align: right;
    margin-bottom: 1.25rem;
}

.link-btn {
    background: transparent;
    border: none;
    color: #38bdf8;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
}

.link-btn:hover {
    color: #7dd3fc;
}

.api-fields-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.25rem;
    animation: fadeIn 0.3s ease;
}

.api-fields-container.hidden {
    display: none !important;
}

.auth-status-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    font-size: 0.88rem;
    color: #e2e8f0;
    margin-bottom: 1.5rem;
    width: 100%;
    justify-content: center;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #38bdf8;
}

.status-dot.pulsing {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    animation: pulseDot 1.8s infinite;
}

.status-dot.active-green {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseDotGreen 1.8s infinite;
}

@keyframes pulseDot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(56, 189, 248, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

@keyframes pulseDotGreen {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.login-actions {
    margin-bottom: 2.25rem;
}

.button-launch-primary {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 1.15rem 1.5rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.button-launch-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
}

.login-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.info-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.info-val {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 700;
}

/* 3. DASHBOARD METRICS GRID */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.metric-card h3 {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.metric-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

.metric-sub {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.4rem;
}

/* PnL Helpers */
.text-green {
    color: #34d399 !important;
}

.text-red {
    color: #f87171 !important;
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-card {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.chart-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 1rem;
}

.chart-card h2 small {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 400;
    margin-left: 0.5rem;
}

.chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

/* TABLES */
.table-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow-x: auto;
}

.table-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 0.8rem 1rem;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    text-transform: uppercase;
}

td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.empty-row {
    text-align: center;
    color: #64748b;
    padding: 2rem !important;
}

/* BUTTON STYLES */
.button-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
}

.button-start:hover {
    transform: translateY(-1px);
}

.button-pause {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    transition: all 0.2s ease;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.button-17 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.55rem 1.1rem !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

.button-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* MODAL OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.75rem;
    cursor: pointer;
}

.form-section {
    margin-bottom: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    border-radius: 12px;
}

.form-section h3 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: #38bdf8;
    text-transform: uppercase;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

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

.form-group label {
    font-size: 0.8rem;
    color: #94a3b8;
}

.form-group input,
.form-group select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    color: #ffffff;
    font-family: inherit;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #ffffff;
    padding: 0.8rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* UI ENHANCEMENTS */

/* Daily Risk Drawdown Progress Bar */
.risk-gauge-card {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 14px;
}

.risk-gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.risk-progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
}

.risk-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* Candlestick Interactive Chart Container */
.full-width-chart {
    grid-column: 1 / -1;
}

.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.symbol-select-dropdown {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #38bdf8;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
}

.chart-wrap-candlestick {
    height: 380px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

/* Table Row PnL Heatmap Colors */
tr.profit-row td {
    background: rgba(34, 197, 94, 0.06) !important;
}

tr.loss-row td {
    background: rgba(239, 68, 68, 0.06) !important;
}

/* Action Buttons */
.button-mini-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-mini-danger:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* MOBILE RESPONSIVE MEDIA QUERIES */
@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .charts-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0.75rem !important;
    }
    
    header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    
    .header-controls {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
    }

    .main-nav {
        overflow-x: auto !important;
        white-space: nowrap !important;
        width: 100% !important;
        padding-bottom: 0.5rem !important;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
    }

    .login-card {
        padding: 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    table {
        font-size: 0.8rem !important;
    }

    th, td {
        padding: 0.6rem 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr !important;
    }

    .chart-wrap-candlestick {
        height: 280px !important;
    }
}