:root {
    --bg-primary: #060911;
    --bg-secondary: #0b1120;
    --card-bg: rgba(15, 23, 42, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(79, 172, 254, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #38bdf8;
    --accent-cyan: #00f2fe;
    --accent-green: #00e676;
    --accent-green-bg: rgba(0, 230, 118, 0.12);
    --accent-red: #ff3366;
    --accent-red-bg: rgba(255, 51, 102, 0.15);
    --accent-yellow: #fbbf24;
    --accent-purple: #a855f7;
    
    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glass: 0 10px 30px -5px rgba(0, 0, 0, 0.5), inset 0 1px 1px 0 rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.06) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-ui);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.top-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 20px;
    background: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px;
}

.nav-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.nav-row-secondary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-meta-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
}

.logo-delta {
    font-size: 22px;
    font-weight: 800;
    color: #060911;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: block;
}

.brand-subtitle {
    font-size: 0.65rem;
    color: var(--accent-cyan);
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.brand-accent {
    background: linear-gradient(90deg, #00f2fe, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Asset Selector Bar */
.asset-selector-nav {
    display: flex;
    align-items: center;
    background: rgba(6, 9, 17, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 4px;
    flex-shrink: 0;
}

.asset-nav-pill {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.asset-nav-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.asset-nav-pill.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(0, 242, 254, 0.1));
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.asset-price-mini {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.asset-nav-pill.active .asset-price-mini {
    color: var(--accent-cyan);
}

/* Timeframe Selector Bar */
.timeframe-selector-nav {
    display: flex;
    align-items: center;
    background: rgba(6, 9, 17, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
}

.tf-nav-pill {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.tf-nav-pill .tf-sub {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
}

.tf-nav-pill:hover {
    color: var(--text-primary);
}

.tf-nav-pill.active {
    background: rgba(0, 230, 118, 0.15);
    border-color: rgba(0, 230, 118, 0.4);
    color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.2);
}

.tf-nav-pill.active .tf-sub {
    color: var(--accent-green);
}

.nav-market-ticker {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    flex-shrink: 0;
}

.ticker-badge {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: 4px;
}

.ticker-price-container {
    display: flex;
    flex-direction: column;
}

.ticker-price {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.ticker-inr {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Mode Pill */
.mode-pill-container {
    display: flex;
    background: rgba(6, 9, 17, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2px;
}

.mode-pill {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.mode-pill.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.pill-dot.live {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* Bot Toggle Button */
.btn-bot-toggle {
    background: linear-gradient(135deg, #00e676, #00b0ff);
    color: #060911;
    font-weight: 700;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.3);
}

.btn-bot-toggle.running {
    background: linear-gradient(135deg, #ff3366, #ff7043);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
}

/* Emergency Panic Stop Button */
.btn-panic-stop {
    background: linear-gradient(135deg, #ff1744 0%, #b71c1c 100%);
    border: 1px solid rgba(255, 23, 68, 0.5);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: panic-pulse 2s infinite;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-panic-stop:hover {
    transform: scale(1.04);
    box-shadow: 0 0 25px rgba(255, 23, 68, 0.8);
}

@keyframes panic-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 23, 68, 0.4); }
    50% { box-shadow: 0 0 20px rgba(255, 23, 68, 0.7); }
}

.btn-install-app {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--accent-blue);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-icon-nav {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-nav:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

/* ==========================================================================
   Dashboard Grid & Cards
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1.15fr);
    gap: 16px;
    padding: 16px 24px;
    flex: 1;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
}

@media (max-width: 1080px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.main-stage {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-stage {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-glass);
    transition: border-color 0.2s ease;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.glass-card:hover {
    border-color: var(--card-hover-border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    width: 100%;
    min-width: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.card-sub-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: block;
}

/* Badges */
.badge-indicator {
    font-size: 0.68rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.badge-indicator.asset-badge {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-indicator.timeframe-badge {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-indicator.supertrend-badge {
    background: rgba(0, 230, 118, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-indicator.supertrend-badge.bearish {
    background: rgba(255, 51, 102, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.badge-indicator.squeeze-badge {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-indicator.squeeze-badge.expansion {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-indicator.rsi-badge {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.chart-legend {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.legend-dot.st-green { background: #00e676; }
.legend-dot.fast-ema { background: #38bdf8; }
.legend-dot.slow-ema { background: #fbbf24; }

.chart-container {
    width: 100%;
    height: 480px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    transition: opacity 0.2s ease;
}

/* Backtest Studio */
.backtest-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-select {
    background: rgba(6, 9, 17, 0.8);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe, #4facfe);
    color: #060911;
    font-weight: 700;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.backtest-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 14px;
    width: 100%;
}

.kpi-mini-card {
    background: rgba(6, 9, 17, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.kpi-val {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.kpi-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.equity-chart-wrapper {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    width: 100%;
}

.chart-subtitle {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.equity-chart-canvas {
    width: 100%;
    height: 180px;
}

/* ==========================================================================
   Sidebar: Portfolio & Position Telemetry
   ========================================================================== */
.telemetry-card .portfolio-hero {
    margin-bottom: 14px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(0, 242, 254, 0.03));
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    width: 100%;
    box-sizing: border-box;
}

.equity-large {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #ffffff;
}

.equity-inr {
    font-size: 0.9rem;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

.equity-hint {
    font-size: 0.72rem;
    color: var(--accent-yellow);
    margin-top: 6px;
    line-height: 1.3;
}

.stat-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.stat-box {
    background: rgba(6, 9, 17, 0.5);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    min-width: 0;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
}

.stat-number {
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active Position Card & Emergency Controls */
.position-details-container {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.position-active-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.btn-danger-sm {
    background: linear-gradient(135deg, #ff3366, #e11d48);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-danger-sm:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #334155;
}

.btn-danger-sm:not(:disabled):hover {
    box-shadow: 0 0 12px rgba(255, 51, 102, 0.6);
    transform: scale(1.02);
}

.position-badge {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.position-badge.long {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.4);
}

.position-badge.short {
    background: rgba(255, 51, 102, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(255, 51, 102, 0.4);
}

.position-badge.neutral {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.empty-position-state {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.radar-pulse {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-cyan);
    animation: radar-pulse-anim 1.8s infinite;
}

@keyframes radar-pulse-anim {
    0% { transform: scale(0.9); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0.4; }
    100% { transform: scale(0.9); opacity: 1; }
}

.pos-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.pos-label {
    color: var(--text-secondary);
    font-size: 0.76rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.pos-val {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.78rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-val.highlight {
    color: #38bdf8;
    font-weight: 700;
}

.pos-pnl-banner {
    margin-top: 10px;
    padding: 8px;
    background: rgba(6, 9, 17, 0.7);
    border-radius: var(--radius-sm);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 800;
    width: 100%;
    box-sizing: border-box;
}

/* Interactive SL/TP Adjuster Box */
.sltp-adjuster-box {
    margin-top: 10px;
    padding: 10px;
    background: rgba(6, 9, 17, 0.6);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-sm);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

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

.sltp-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.sltp-status {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sltp-control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.sltp-label {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
    min-width: 85px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sltp-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.btn-step {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-step:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sltp-input {
    width: 100%;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    outline: none;
    text-align: right;
    min-width: 0;
    box-sizing: border-box;
}

.btn-update-sltp {
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(0, 242, 254, 0.15));
    border: 1px solid var(--accent-blue);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-update-sltp:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(0, 242, 254, 0.3));
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Radar & Sizing Metrics */
.radar-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.radar-metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    width: 100%;
    box-sizing: border-box;
}

.metric-name {
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 0.75rem;
    flex-shrink: 0;
    padding-right: 10px;
}

.metric-val {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.76rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal-tag {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.signal-tag.buy { background: rgba(0, 230, 118, 0.2); color: var(--accent-green); border: 1px solid var(--accent-green); }
.signal-tag.sell { background: rgba(255, 51, 102, 0.2); color: var(--accent-red); border: 1px solid var(--accent-red); }
.signal-tag.neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

.signal-reason-box {
    margin-top: 10px;
    padding: 8px;
    background: rgba(6, 9, 17, 0.5);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
}

/* RSI Visual Gauge Meter */
.rsi-meter-container {
    margin-top: 8px;
    padding: 4px 0;
    width: 100%;
    box-sizing: border-box;
}

.rsi-bar-track {
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, #38bdf8 0%, #fbbf24 50%, #ff3366 100%);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.rsi-bar-fill {
    position: absolute;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.85);
    border-right: 2px solid #ffffff;
    transition: width 0.3s ease;
}

.rsi-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 3px;
    width: 100%;
}

/* Activity Logs */
.log-terminal {
    height: 150px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
}

.log-line {
    line-height: 1.3;
    word-break: break-word;
}

.log-line.INFO { color: #94a3b8; }
.log-line.WARN { color: var(--accent-yellow); }
.log-line.ERROR, .log-line.CRITICAL { color: var(--accent-red); font-weight: 700; }

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 520px;
    max-width: 90vw;
    background: #0e1526;
    border: 1px solid var(--card-hover-border);
}

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

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.form-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(6, 9, 17, 0.8);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    outline: none;
    box-sizing: border-box;
}

.form-group-checkbox {
    margin-bottom: 8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.conn-status-msg {
    margin-top: 8px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Helpers */
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-yellow { color: var(--accent-yellow) !important; }
.text-orange { color: #f97316 !important; }

/* ==========================================================================
   Strategy Intelligence 2.0 & Platform Enhancements Styling
   ========================================================================== */

/* Multi-Asset Selector Pills */
.asset-selector-nav {
    display: flex;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 4px;
}

.asset-nav-pill {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-nav-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.asset-nav-pill.active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

/* Latency Telemetry Badge */
.latency-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(0, 230, 118, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: #00e676;
    font-weight: 600;
}

.latency-dot {
    width: 6px;
    height: 6px;
    background-color: #00e676;
    border-radius: 50%;
    box-shadow: 0 0 8px #00e676;
}

.latency-badge.med {
    border-color: rgba(250, 204, 21, 0.3);
    color: #facc15;
}
.latency-badge.med .latency-dot {
    background-color: #facc15;
    box-shadow: 0 0 8px #facc15;
}

.latency-badge.high {
    border-color: rgba(255, 51, 102, 0.3);
    color: #ff3366;
}
.latency-badge.high .latency-dot {
    background-color: #ff3366;
    box-shadow: 0 0 8px #ff3366;
}

/* AI Optimizer Button */
.btn-ai-optimize {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.btn-ai-optimize:hover {
    box-shadow: 0 0 18px rgba(217, 70, 239, 0.6);
    transform: translateY(-1px);
}

/* Small Buttons */
.btn-primary-sm {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary-sm:hover {
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
    transform: scale(1.03);
}

.btn-secondary-sm {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 5px 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary-sm:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Institutional Trade Journal Table */
.journal-card {
    margin-top: 14px;
}

.journal-table-wrapper {
    overflow-x: auto;
    max-height: 280px;
    margin-top: 10px;
}

.journal-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-align: left;
}

.journal-table th {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-secondary);
    padding: 8px 10px;
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 600;
}

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

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

/* Rank Badges in Optimizer */
.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
}

.rank-1 {
    background: rgba(250, 204, 21, 0.2);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.4);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.25);
}

.rank-2 {
    background: rgba(226, 232, 240, 0.2);
    color: #e2e8f0;
    border: 1px solid rgba(226, 232, 240, 0.4);
}

.rank-3 {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.optimizer-controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.5);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
}

/* ==========================================================================
   Interactive Chart Action Bar & SL/TP HUD
   ========================================================================== */
.chart-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
}

.chart-order-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chart-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
}

.chart-badge-pill .pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.chart-badge-pill.entry {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.chart-badge-pill.entry .pill-dot { background: #38bdf8; }

.chart-badge-pill.tp {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.35);
}
.chart-badge-pill.tp .pill-dot { background: #00e676; box-shadow: 0 0 6px #00e676; }

.chart-badge-pill.sl {
    background: rgba(255, 51, 102, 0.12);
    color: #ff3366;
    border: 1px solid rgba(255, 51, 102, 0.35);
}
.chart-badge-pill.sl .pill-dot { background: #ff3366; box-shadow: 0 0 6px #ff3366; }

.chart-badge-pill.sl.breakeven {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.chart-badge-pill.sl.breakeven .pill-dot { background: #10b981; box-shadow: 0 0 6px #10b981; }

.chart-quick-adjusters {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-chart-quick {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-chart-quick.tp-quick {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
    border-color: rgba(0, 230, 118, 0.25);
}
.btn-chart-quick.tp-quick:hover {
    background: rgba(0, 230, 118, 0.25);
    border-color: #00e676;
    transform: translateY(-1px);
}

.btn-chart-quick.sl-quick {
    background: rgba(255, 51, 102, 0.12);
    color: #ff3366;
    border-color: rgba(255, 51, 102, 0.25);
}
.btn-chart-quick.sl-quick:hover {
    background: rgba(255, 51, 102, 0.25);
    border-color: #ff3366;
    transform: translateY(-1px);
}

.btn-chart-quick.be-quick {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.35);
}
.btn-chart-quick.be-quick:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: #34d399;
    transform: translateY(-1px);
}

.chart-tool-buttons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-chart-tool {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-chart-tool:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-chart-tool.active {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.btn-chart-tool#btn-click-trade-mode.active {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(245, 158, 11, 0.4); }
    50% { border-color: rgba(245, 158, 11, 0.9); }
}

.btn-chart-tool.icon-only {
    padding: 3px 6px;
    font-size: 0.85rem;
}

/* Floating Click Prompt Box */
.chart-click-prompt {
    position: relative;
    z-index: 10;
    margin-bottom: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.2s ease-out;
}

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

.click-prompt-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.click-price-tag {
    font-size: 0.82rem;
    color: #e2e8f0;
    font-family: var(--font-mono);
}

.click-price-tag strong {
    color: #fbbf24;
    font-size: 0.95rem;
}

.click-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-prompt-apply {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-prompt-apply.tp {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
    border-color: rgba(0, 230, 118, 0.4);
}
.btn-prompt-apply.tp:hover {
    background: #00e676;
    color: #05050d;
}

.btn-prompt-apply.sl {
    background: rgba(255, 51, 102, 0.2);
    color: #ff3366;
    border-color: rgba(255, 51, 102, 0.4);
}
.btn-prompt-apply.sl:hover {
    background: #ff3366;
    color: #ffffff;
}

.btn-prompt-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-prompt-cancel:hover {
    color: #ffffff;
    border-color: #ffffff;
}

/* ==========================================================================
   📱 Mobile & Tablet Responsive Architecture (<= 820px & <= 480px)
   ========================================================================== */
@media (max-width: 820px) {
    body {
        font-size: 13px;
        -webkit-text-size-adjust: 100%;
    }

    .top-nav {
        padding: 8px 12px;
        gap: 6px;
    }

    .nav-row-main {
        gap: 8px;
    }

    .brand-logo-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    .logo-delta {
        font-size: 18px;
    }
    .brand-title {
        font-size: 0.92rem;
        letter-spacing: 0.2px;
    }
    .brand-subtitle {
        display: none;
    }

    .nav-actions {
        gap: 5px;
    }

    .mode-pill {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .btn-bot-toggle {
        padding: 6px 10px;
        font-size: 0.72rem;
        height: 32px;
    }

    .btn-panic-stop {
        padding: 6px 9px;
        font-size: 0.72rem;
        height: 32px;
    }
    .panic-label {
        display: none;
    }

    .btn-icon-nav {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .nav-row-secondary {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
        gap: 8px;
    }
    .nav-row-secondary::-webkit-scrollbar {
        display: none;
    }

    .asset-selector-nav,
    .timeframe-selector-nav {
        padding: 2px;
        gap: 2px;
        flex-shrink: 0;
    }

    .asset-nav-pill,
    .tf-nav-pill {
        padding: 4px 8px;
        font-size: 0.74rem;
        white-space: nowrap;
    }
    .tf-sub {
        display: none;
    }

    .nav-market-ticker {
        padding: 3px 8px;
        gap: 6px;
        flex-shrink: 0;
    }
    .ticker-price {
        font-size: 0.85rem;
    }
    .ticker-inr {
        font-size: 0.65rem;
    }

    .nav-meta-controls {
        flex-shrink: 0;
        gap: 6px;
    }
    .latency-badge {
        font-size: 0.68rem;
        padding: 3px 6px;
    }

    /* Dashboard Layout */
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 8px;
        gap: 12px;
        width: 100vw;
    }

    .glass-card {
        padding: 12px;
        border-radius: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
    }

    .header-left {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .header-left::-webkit-scrollbar {
        display: none;
    }

    .chart-legend {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        font-size: 0.7rem;
    }

    /* Chart on Mobile */
    .chart-container {
        height: 310px !important;
        width: 100% !important;
    }

    .chart-action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 6px 0;
    }

    .chart-order-badges,
    .chart-quick-adjusters,
    .chart-tool-buttons {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        width: 100%;
        padding-bottom: 2px;
    }
    .chart-order-badges::-webkit-scrollbar,
    .chart-quick-adjusters::-webkit-scrollbar,
    .chart-tool-buttons::-webkit-scrollbar {
        display: none;
    }

    .chart-badge-pill {
        font-size: 0.68rem;
        padding: 3px 7px;
        white-space: nowrap;
    }

    .btn-chart-quick,
    .btn-chart-tool {
        font-size: 0.68rem;
        padding: 4px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Stat Cards 2x2 Grid on Mobile */
    .stat-grid,
    .portfolio-grid,
    .metrics-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card,
    .stat-box,
    .metric-card {
        padding: 10px 8px !important;
    }

    .stat-value,
    .metric-value {
        font-size: 1.15rem !important;
    }

    .stat-label,
    .metric-label {
        font-size: 0.68rem !important;
    }

    /* Active Positions Table */
    .table-container,
    .trades-table-container,
    .journal-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 6px;
    }

    table {
        min-width: 480px;
        font-size: 0.74rem;
    }

    th, td {
        padding: 6px 8px;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95vw !important;
        max-height: 88vh !important;
        padding: 14px !important;
        border-radius: 16px !important;
    }

    /* Touch Optimization */
    button, .mode-pill, .asset-nav-pill, .tf-nav-pill {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 420px) {
    .brand-title {
        font-size: 0.85rem;
    }
    .btn-bot-toggle span:not(.btn-icon) {
        font-size: 0.68rem;
    }
    .chart-container {
        height: 280px !important;
    }
}

