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

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Startup Loading Modal Styles */
.startup-modal {
    display: none; /* Will be shown via JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.startup-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.startup-header {
    text-align: center;
    margin-bottom: 30px;
}

.startup-header h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.startup-account {
    font-size: 14px;
    color: var(--text-secondary);
}

.startup-account span {
    color: var(--primary-color);
    font-weight: 600;
}

.progress-container {
    position: relative;
    margin-bottom: 30px;
}

.progress-bar {
    height: 8px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #7c3aed);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.progress-percentage {
    position: absolute;
    right: 0;
    top: -25px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.startup-status {
    text-align: center;
    margin-bottom: 30px;
}

.startup-stage {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.startup-timer {
    font-size: 14px;
    color: var(--text-secondary);
}

.startup-timer span {
    font-weight: 600;
    color: var(--warning-color);
}

.startup-steps {
    display: grid;
    gap: 12px;
}

.step {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.step.pending {
    opacity: 0.5;
}

.step.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
    opacity: 1;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.step.completed {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    opacity: 1;
}

.step-icon {
    font-size: 20px;
    margin-right: 12px;
    filter: grayscale(1);
    transition: filter 0.3s ease;
}

.step.active .step-icon,
.step.completed .step-icon {
    filter: grayscale(0);
}

.step-text {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.step.active .step-text {
    color: var(--text-primary);
    font-weight: 500;
}

.step.completed .step-text {
    color: var(--success-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .startup-content {
        padding: 30px 20px;
    }

    .startup-header h2 {
        font-size: 24px;
    }

    .startup-stage {
        font-size: 14px;
    }

    .step {
        padding: 10px 14px;
    }

    .step-icon {
        font-size: 18px;
    }

    .step-text {
        font-size: 13px;
    }
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Header Control Buttons */
.header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    min-width: 95px;
    text-align: center;
}

/* Exit Positions - Subtle slate/gray tone */
.header-btn.exit-positions {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border-color: rgba(100, 116, 139, 0.3);
}

.header-btn.exit-positions:hover {
    background: rgba(100, 116, 139, 0.35);
    color: #cbd5e1;
    border-color: rgba(100, 116, 139, 0.5);
}

/* Stop - Subtle amber/warning tone */
.header-btn.stop-strategy {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.header-btn.stop-strategy:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

/* Stop & Exit - Subtle rose/danger tone */
.header-btn.stop-exit {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.header-btn.stop-exit:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.position-status-card, .freeze-status-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.freeze-status-card {
    border: 2px solid #ff8c00;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 140, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 140, 0, 0.8);
    }
}

.position-status-card .status-badge, .freeze-status-card .status-badge {
    margin-bottom: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.position-status-card .trade-count, .freeze-status-card .trade-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 8px;
}

/* Header Timer & Status (COMPACT) */
.header-timer-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-timer {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
}

.header-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.header-badge.waiting {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.header-badge.active {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: headerPulse 1.5s ease-in-out infinite;
}

@keyframes headerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.header-time {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: #3b82f6;
    letter-spacing: 1px;
    min-width: 45px;
}

.header-buffer {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}

.header-status {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
}

.header-status-icon {
    font-size: 0.9rem;
}

.header-status-text {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 500;
    white-space: nowrap;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.main-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(12, 1fr);
    margin-bottom: 0;
}

.summary-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
}

.pnl-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pnl-section, .action-section {
    display: flex;
    flex-direction: column;
}

@media (max-width: 1200px) {
    .summary-section {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .pnl-action-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.charts-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}


.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14.55px;
    border: 1px solid var(--border-color);
}

.card-divider {
    height: 1px;
    background: var(--border-color);
    margin: 15px -15px 15px -15px;
}

.card h3 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 9px;
    letter-spacing: 0.5px;
}

.pnl-value {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.pnl-value.positive {
    color: var(--success-color);
}

.pnl-value.negative {
    color: var(--danger-color);
}

.pnl-multiplier-display {
    margin-bottom: 8px;
    margin-top: 2px;
}

.pnl-points-value {
    font-size: 1.9rem;
    font-weight: 700;
}

.pnl-points-value.positive {
    color: var(--success-color);
}

.pnl-points-value.negative {
    color: var(--danger-color);
}

.multiplier-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pnl-breakdown {
    display: flex;
    gap: 11px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

/* P&L Breakdown Calculation (shown in Total mode) */
.pnl-breakdown-calc {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.85rem;
}

.pnl-breakdown-calc .per-lot-value {
    font-weight: 700;
    color: var(--text-primary);
}

.pnl-breakdown-calc .per-lot-value.positive {
    color: var(--success-color);
}

.pnl-breakdown-calc .per-lot-value.negative {
    color: var(--danger-color);
}

.pnl-breakdown-calc .multiplier-text {
    color: var(--text-secondary);
    font-weight: 500;
}

/* P&L Toggle Switch */
.card-header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pnl-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.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: #475569;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 60px;
    font-weight: 500;
}

.pnl-multiplier-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.price-value {
    font-size: 1.66rem;
    font-weight: 700;
    color: var(--primary-color);
}

.commodity-name {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.straddle-value {
    font-size: 1.66rem;
    font-weight: 700;
    color: var(--warning-color);
}

.straddle-low {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.market-info {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.market-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.market-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.market-sublabel {
    font-size: 0.71rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.market-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.strike-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 5px;
    border-top: 1px solid var(--border-color);
}

.strike-label {
    font-weight: 600;
    color: var(--text-primary);
}

.strike-price {
    font-weight: 500;
    color: var(--primary-color);
    margin-left: 4px;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.status-badge.active {
    background: var(--success-color);
    color: white;
}

.status-badge.inactive {
    background: var(--text-secondary);
    color: white;
}

.trade-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.action-levels {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.action-level {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.76rem;
    border-bottom: 1px solid var(--border-color);
}

.action-level:last-child {
    border-bottom: none;
}

.action-level.exit .action-label {
    color: var(--danger-color);
    font-weight: 600;
}

.action-level.adjust .action-label {
    color: var(--warning-color);
    font-weight: 600;
}

.action-level.market-based .action-label {
    color: #667eea;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MARKET-BASED ADJUSTMENT SECTION
   Premium trading dashboard component with refined dark theme aesthetics
   ═══════════════════════════════════════════════════════════════════════════ */

.action-level.mba-section {
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: none;
}

.mba-content {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
}

.mba-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.mba-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mba-label {
    font-size: 0.62rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 3px;
    font-weight: 600;
}

/* Ensure percentage in threshold inherits the same color */
#mbaThresholdPercent {
    color: inherit;
}

.mba-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MBA Status Indicator - Premium Trading Dashboard Component
   Refined pill-style badge with static green (normal) / animated red (breached)
   ───────────────────────────────────────────────────────────────────────────── */

.mba-status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

/* MBA Dot - Dedicated class to avoid global .status-dot conflicts */
.mba-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    /* NO animation by default */
}

/* ═══ NORMAL STATE ═══
   Static green indicator - calm, stable appearance
   No animations, just a subtle glow for premium feel */
.mba-status-indicator.status-ok {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.mba-status-indicator.status-ok .mba-dot {
    background: var(--success-color);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
    /* Completely static - no animation */
}

.mba-status-indicator.status-ok .status-text {
    color: var(--success-color);
}

/* ═══ BREACHED STATE ═══
   Pulsing red alert - draws immediate attention
   Animated dot and subtle text fade for urgency */
.mba-status-indicator.status-breached {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.mba-status-indicator.status-breached .mba-dot {
    background: var(--danger-color);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    animation: mbaBreachPulse 1.2s ease-in-out infinite;
}

.mba-status-indicator.status-breached .status-text {
    color: var(--danger-color);
    animation: mbaTextPulse 1.2s ease-in-out infinite;
}

@keyframes mbaBreachPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 14px rgba(239, 68, 68, 1);
    }
}

@keyframes mbaTextPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Breach Details Banner
   ───────────────────────────────────────────────────────────────────────────── */

.mba-breach {
    grid-column: 1 / -1;
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 4px;
    border-left: 3px solid var(--danger-color);
    font-size: 0.72rem;
    color: var(--danger-color);
}

.action-level span:last-child {
    font-weight: 700;
    color: var(--text-primary);
}

/* Action Section Header with Right-aligned Quantity Info */
.action-section {
    position: relative;
}

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

.action-header-row h3 {
    margin: 0;
}

.action-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-label {
    font-size: 0.71rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.quantity-value {
    font-size: 0.76rem;
    color: var(--primary-color);
    font-weight: 600;
}

.chart-card {
    height: 332px;
}

.chart-card canvas {
    max-height: 266px;
}

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

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

th {
    padding: 7px 9px;
    text-align: left;
    font-weight: 600;
    font-size: 0.71rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 7px 9px;
    border-top: 1px solid var(--border-color);
    font-size: 0.83rem;
}

.pnl-positive {
    color: var(--success-color);
    font-weight: 600;
}

.pnl-negative {
    color: var(--danger-color);
    font-weight: 600;
}

.trades-log {
    max-height: 400px;
    overflow-y: auto;
}

.trade-entry {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-dark);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.trade-entry.entry {
    border-left-color: var(--success-color);
}

.trade-entry.exit {
    border-left-color: var(--danger-color);
}

.trade-entry.adjustment {
    border-left-color: var(--warning-color);
}

.trade-timestamp {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.trade-action {
    font-weight: 600;
    margin-bottom: 4px;
}

.trade-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Closed Positions Styling */
.closed-position-group {
    margin-bottom: 16px;
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.closed-position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.closed-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.closed-reason {
    font-size: 0.8rem;
    color: var(--warning-color);
    font-weight: 500;
}

.closed-total-pnl {
    font-size: 0.875rem;
    font-weight: 700;
}

.closed-positions-table {
    font-size: 0.8rem;
}

.closed-positions-table th {
    font-size: 0.7rem;
    padding: 6px 8px;
}

.closed-positions-table td {
    padding: 6px 8px;
}

/* Responsive */
@media (max-width: 1400px) {
    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-card {
        height: 323px;
    }

    .chart-card canvas {
        max-height: 258px;
    }

    .pnl-action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .summary-section {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        flex-direction: column;
    }
}

/* Header Emergency Controls (NEW) */
.header-emergency-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
}

.header-emergency-controls .emergency-label {
    color: #a0a0b0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-btn.exit-positions {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.header-btn.exit-positions:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.header-btn.stop-only {
    background: rgba(59, 130, 246, 0.9);
    color: white;
}

.header-btn.stop-only:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.header-btn.stop-exit {
    background: rgba(249, 115, 22, 0.9);
    color: white;
}

.header-btn.stop-exit:hover {
    background: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* Exit Controls Section - DEPRECATED: Moved to header */
.exit-controls-section {
    display: none;
}

.exit-controls-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.exit-controls-label {
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exit-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.exit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.exit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.exit-btn:active {
    transform: translateY(0);
}

.exit-btn.exit-only {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.exit-btn.exit-only:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.exit-btn.stop-only {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.exit-btn.stop-only:hover {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
}

.exit-btn.stop-and-exit {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #333;
}

.exit-btn.stop-and-exit:hover {
    background: linear-gradient(135deg, #fee140 0%, #fa709a 100%);
}

.exit-status {
    color: white;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 13px;
}

@media (max-width: 768px) {
    .exit-controls-section {
        margin: -8px -16px 20px -16px;
        border-radius: 0;
    }

    .exit-controls-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .exit-buttons {
        flex-direction: column;
    }

    .exit-btn {
        width: 100%;
    }
}

/* ===================================================================
   COMPACT STRATEGY STATUS BAR (NEW)
   =================================================================== */

.strategy-status-bar {
    display: none;  /* Hidden - no longer needed */
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    color: #a0a0a0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator {
    color: #4CAF50;
    font-weight: bold;
    font-size: 14px;
}

.status-indicator.inactive {
    color: #666;
}

.status-details {
    color: #d0d0d0;
    font-size: 13px;
}

.status-details span {
    color: #ffd700;
    font-weight: 600;
}

.status-divider {
    width: 1px;
    height: 20px;
    background: rgba(100, 100, 150, 0.3);
}

.mode-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.mode-badge.normal {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.mode-badge.freeze {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Market-Based Section - Matches ACTION LEVELS styling */
.market-based-section {
    margin-top: 12px;
}

.market-based-section .section-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.market-based-section .section-header {
    color: #a0a0b0;  /* Match ACTION LEVELS header color */
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 8px 0 6px 0;
}

.market-based-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.market-based-info .mb-label {
    color: #ffa500;  /* Orange like Adjust High Leg */
    font-size: 13px;
    font-weight: 600;
}

.market-based-info .mb-value {
    color: #ffffff;  /* White for values */
    font-size: 14px;
    font-weight: 600;
}

.market-based-info .mb-separator {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

/* Remove old strategy features card styles */
.strategy-features-card {
    display: none;
    color: white;
    padding: 24px;
}

.strategy-features-card h3 {
    color: white;
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 12px;
}

.features-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.feature-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.feature-section h4 {
    color: white;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background 0.2s;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.feature-item .label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.feature-item .value {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.feature-item .value.highlight {
    color: #ffd700;
    font-size: 17px;
    font-weight: 700;
}

.feature-item .value.highlight-warning {
    color: #ff4444;
    font-weight: 700;
    animation: pulse 1s infinite;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.feature-item .value.freeze-active {
    color: #4fc3f7;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.badge {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.badge-success {
    background: #4caf50;
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Responsive design for strategy features */
@media (max-width: 1024px) {
    .features-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .strategy-features-card {
        padding: 16px;
    }

    .feature-section {
        padding: 16px;
    }

    .feature-item {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .feature-item .label {
        font-size: 12px;
    }

    .feature-item .value {
        font-size: 14px;
    }
}

/* ===================================================================
   CONDITION TIMERS SECTION
   ================================================================ */
.condition-timers-section {
    margin-top: 12px;
}

.timer-card, .info-card {
    background: #16213e;
    border-left: 4px solid #f39c12;
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
}

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

.timer-header, .info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.timer-label, .info-label {
    font-weight: 600;
    color: #ecf0f1;
    font-size: 13px;
}

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

.timer-badge.active {
    background: #e74c3c;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

.timer-badge.waiting {
    background: #f39c12;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.timer-content, .info-content {
    padding-top: 8px;
}

.timer-display {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 5px 0;
}

.timer-value {
    font-size: 28px;
    font-weight: 700;
    color: #3498db;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.timer-buffer {
    color: #95a5a6;
    font-size: 14px;
}

.timer-reason, .skip-reason {
    color: #bdc3c7;
    font-size: 13px;
    margin-top: 5px;
    line-height: 1.5;
}

.skip-time {
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 5px;
}

.info-card {
    border-left-color: #3498db;
}

/* ============================================================
   ACTIVITY LOG - Real-time event display in header
   ============================================================ */
.header-activity-log {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 450px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.activity-icon {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.activity-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.activity-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.activity-timestamp {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Severity-based colors */
.header-activity-log.severity-info {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.header-activity-log.severity-warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.header-activity-log.severity-critical {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: criticalPulse 2s ease-in-out infinite;
}

@keyframes criticalPulse {
    0%, 100% {
        border-color: #ef4444;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    50% {
        border-color: #ff6b6b;
        box-shadow: 0 2px 12px rgba(239, 68, 68, 0.5);
    }
}

/* ============================================================
   COLLAPSIBLE SECTIONS - Closed Positions & Adjustments
   ============================================================ */

.collapsible-section {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    transition: background 0.2s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapse-arrow {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.collapsible-section.expanded .collapse-arrow {
    transform: rotate(90deg);
}

.collapsible-content {
    display: none;
    padding: 0;
    border-top: 1px solid var(--border-color);
}

.collapsible-section.expanded .collapsible-content {
    display: block;
}

/* Collapsible Table Styles */
.collapsible-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.collapsible-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.collapsible-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
}

.collapsible-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.collapsible-table tbody tr:last-child td {
    border-bottom: none;
}

.collapsible-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.collapsible-table .no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* P&L Colors in collapsible tables */
.collapsible-table .pnl-positive {
    color: var(--success-color);
    font-weight: 600;
}

.collapsible-table .pnl-negative {
    color: var(--danger-color);
    font-weight: 600;
}
