/* ═══════════════════════════════════════════════════════════════
   Energon Flows — Live Pipeline Visualization
   Transformers Energon-inspired glowing liquid stream aesthetic
   ═══════════════════════════════════════════════════════════════ */

:root {
    --ef-bg: var(--bg-primary);
    --ef-bg-secondary: #0c1018;
    --ef-panel: rgba(19, 23, 40, 0.6);
    --ef-panel-border: rgba(0, 207, 255, 0.15);
    --ef-energon: #00cfff;
    --ef-energon-bright: #00FFFF;
    --ef-energon-dim: rgba(0, 207, 255, 0.15);
    --ef-outflow: #ff4444;
    --ef-outflow-dim: rgba(255, 68, 68, 0.15);
    --ef-positive: #00ff88;
    --ef-text: #e0e8f0;
    --ef-text-dim: rgba(224, 232, 240, 0.5);
    --ef-font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ── Page Layout ─────────────────────────────────────────────── */

#ef-page {
    min-height: 80vh;
    padding: 1rem;
}

/* ── Loading ─────────────────────────────────────────────────── */

#ef-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 1.5rem;
    color: var(--ef-text-dim);
    font-size: 0.875rem;
}

.ef-loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--ef-energon-dim);
    border-top-color: var(--ef-energon);
    border-radius: 50%;
    animation: ef-spin 1s linear infinite;
}

@keyframes ef-spin {
    to { transform: rotate(360deg); }
}

/* ── Cyan link button (hover + tap feedback) ────────────────── */
.ef-cyan-link { background: transparent; transition: background 0.2s; }
.ef-cyan-link:hover, .ef-cyan-link:active { background: rgba(0, 207, 255, 0.1); }
.ef-etlp-link {
    color: #00cfff;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid rgba(0, 207, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ef-cyan-dashed { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(0, 207, 255, 0.4); transition: border-color 0.2s; }
.ef-cyan-dashed:hover, .ef-cyan-dashed:active { border-color: #00cfff; }

/* ── Auth Gate ────────────────────────────────────────────────── */

#ef-auth-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.ef-auth-card {
    text-align: center;
    padding: 3rem;
    background: var(--ef-panel);
    border: 1px solid var(--ef-panel-border);
    border-radius: var(--panel-radius);
}

.ef-auth-card h2 {
    color: var(--ef-text);
    font-size: 1.25rem;
    margin: 1.5rem 0;
    font-weight: 500;
}

.ef-auth-icon {
    animation: ef-pulse 2s ease-in-out infinite;
}

.ef-auth-btn,
.ef-cta-btn {
    display: inline-block;
    padding: 0.625rem 1.75rem;
    background: rgba(0, 207, 255, 0.12);
    border: 1px solid var(--ef-energon);
    border-radius: 8px;
    color: var(--ef-energon);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
}

.ef-auth-btn:hover,
.ef-cta-btn:hover {
    background: rgba(0, 207, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 207, 255, 0.2);
}

/* ── Header ──────────────────────────────────────────────────── */

#ef-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--ef-panel);
    border: 1px solid var(--ef-panel-border);
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ef-paper-badge {
    background: rgba(0, 207, 255, 0.12);
    border: 1px solid rgba(0, 207, 255, 0.4);
    color: #00cfff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.ef-header-left h1 {
    font-size: 1.25rem;
    color: var(--ef-energon);
    margin: 0;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(0, 207, 255, 0.4);
}

.ef-subtitle {
    font-size: 0.75rem;
    color: var(--ef-text-dim);
    margin: 0.125rem 0 0;
}

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

.ef-balance-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ef-balance-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ef-text-dim);
}

.ef-balance-value {
    font-family: var(--ef-font-mono);
    font-size: 1.25rem;
    color: var(--ef-text);
    font-weight: 600;
}

.ef-net-flow {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ef-net-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ef-text-dim);
}

.ef-net-value {
    font-family: var(--ef-font-mono);
    font-size: 1rem;
    font-weight: 500;
}

.ef-net-value.positive { color: var(--ef-positive); }
.ef-net-value.negative { color: var(--ef-outflow); }

/* ── Time Range Selector ─────────────────────────────────────── */

#ef-time-range {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem;
    background: var(--ef-panel);
    border: 1px solid var(--ef-panel-border);
    border-radius: 8px;
    width: fit-content;
}

.ef-time-btn {
    padding: 0.375rem 1rem;
    min-height: 44px;
    min-width: 44px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--ef-text-dim);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
}

.ef-time-btn:hover,
.ef-time-btn:focus-visible {
    color: var(--ef-text);
    outline: 1px solid rgba(0, 207, 255, 0.5);
    outline-offset: -1px;
}

.ef-time-btn.active {
    background: rgba(0, 207, 255, 0.1);
    border-color: var(--ef-energon);
    color: var(--ef-energon);
    box-shadow: 0 0 8px rgba(0, 207, 255, 0.15);
}

/* ── Visualization Container ─────────────────────────────────── */

.ef-viz-container {
    position: relative;
    width: 100%;
    min-height: 680px;
    height: 680px;
    background: var(--ef-bg-secondary);
    border: 1px solid var(--ef-panel-border);
    border-radius: var(--panel-radius);
    overflow: hidden;
}

.ef-viz-container svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ef-viz-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ── SVG Pipeline Styles ─────────────────────────────────────── */

.ef-pipe-bg {
    fill: none;
    stroke: rgba(0, 207, 255, 0.08);
    stroke-linecap: round;
}

.ef-pipe-bg.outflow {
    stroke: rgba(255, 68, 68, 0.08);
}

.ef-pipe-flow {
    fill: none;
    stroke-linecap: round;
    animation: ef-dash-flow 2s linear infinite;
}

.ef-pipe-flow.inflow {
    stroke: var(--ef-energon);
    opacity: 0.5;
}

.ef-pipe-flow.outflow {
    stroke: var(--ef-outflow);
    opacity: 0.5;
}

@keyframes ef-dash-flow {
    to { stroke-dashoffset: -40; }
}

/* ── Node Styles ─────────────────────────────────────────────── */

.ef-node-circle {
    cursor: pointer;
    transition: r 0.3s ease;
}

.ef-node-circle.inflow {
    fill: rgba(0, 207, 255, 0.12);
    stroke: var(--ef-energon);
    stroke-width: 1.5;
}

.ef-node-circle.outflow {
    fill: rgba(255, 68, 68, 0.12);
    stroke: var(--ef-outflow);
    stroke-width: 1.5;
}

.ef-node-circle.inactive {
    opacity: 0.3;
}

.ef-node-label {
    fill: var(--ef-text);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
}

.ef-node-value {
    fill: var(--ef-text-dim);
    font-size: 12px;
    font-family: var(--ef-font-mono);
    pointer-events: none;
}
.ef-node-value.negative { fill: var(--ef-outflow); }

/* ── Core Orb ────────────────────────────────────────────────── */

.ef-core-outer {
    fill: none;
    stroke: var(--ef-energon);
    stroke-width: 2;
    opacity: 0.3;
    animation: ef-core-breathe 2.5s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.ef-core-mid {
    fill: rgba(0, 207, 255, 0.08);
    stroke: var(--ef-energon);
    stroke-width: 1.5;
    animation: ef-core-breathe 2.5s ease-in-out infinite 0.3s;
    transform-box: fill-box;
    transform-origin: center;
}

.ef-core-inner {
    fill: rgba(0, 207, 255, 0.25);
}

.ef-core-label {
    fill: var(--ef-text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-anchor: middle;
}

.ef-core-value {
    fill: #ffffff;
    font-size: 16px;
    font-family: var(--ef-font-mono);
    font-weight: 600;
    text-anchor: middle;
}

@keyframes ef-core-breathe {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.03); }
}

/* ── Glow Pulse ──────────────────────────────────────────────── */

@keyframes ef-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1.0; }
}

.ef-glow-pulse {
    animation: ef-pulse 1.5s ease-in-out infinite;
}

/* ── Empty State ─────────────────────────────────────────────── */
/* Positioned inside .ef-viz-container which has position: relative */

#ef-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

.ef-empty-card {
    text-align: center;
    padding: 1rem 2rem;
    background: rgba(10, 14, 23, 0.85);
    border: 1px solid rgba(0, 207, 255, 0.15);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.ef-empty-card p {
    color: var(--ef-text-dim);
    margin: 0.5rem 0;
    font-size: 0.8rem;
}

/* ── Mobile Stream Cards ─────────────────────────────────────── */

.ef-cards-container {
    display: none;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ef-stream-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--ef-panel);
    border: 1px solid var(--ef-panel-border);
    border-radius: 8px;
}

.ef-card-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.ef-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ef-energon);
    box-shadow: 0 0 8px var(--ef-energon);
}

.ef-card-dot.outflow {
    background: var(--ef-outflow);
    box-shadow: 0 0 8px var(--ef-outflow);
}

.ef-card-dot.inactive {
    opacity: 0.3;
    box-shadow: none;
}

.ef-card-label {
    font-size: 0.8125rem;
    color: var(--ef-text);
}

.ef-card-value {
    font-family: var(--ef-font-mono);
    font-size: 0.8125rem;
    color: var(--ef-text);
}

.ef-card-value.inflow { color: var(--ef-energon); }
.ef-card-value.outflow { color: var(--ef-outflow); }

/* ── Burst Flash ─────────────────────────────────────────────── */

@keyframes ef-burst-flash {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(2.5); }
}

.ef-burst {
    fill: var(--ef-energon);
    opacity: 0;
}

/* ── Token Holdings Divider ─────────────────────────────────── */

.ef-cards-divider {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ef-text-dim);
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid var(--ef-panel-border);
    margin-top: 0.25rem;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    #ef-page {
        padding: 0.5rem;
    }

    #ef-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ef-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .ef-balance-display {
        align-items: flex-start;
    }

    .ef-viz-container {
        min-height: 500px;
        height: 500px;
    }

    .ef-cards-container {
        display: grid;
    }

    .ef-node-label {
        font-size: 12px;
    }

    .ef-node-value {
        font-size: 12px;
    }

    .ef-core-value {
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .ef-viz-container {
        min-height: 420px;
        height: 420px;
    }

    .ef-balance-value {
        font-size: 1rem;
    }

    .ef-time-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.6875rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Control Panel — Mission Control Dashboard
   ═══════════════════════════════════════════════════════════════ */

.ef-cp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.ef-cp-panel {
    background: var(--ef-panel);
    border: 1px solid var(--ef-panel-border);
    border-radius: 10px;
    padding: 0.75rem;
    overflow: visible;
}

.ef-cp-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ef-text-dim);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.ef-cp-unit {
    font-size: 0.75rem;
    opacity: 0.6;
    text-transform: none;
    letter-spacing: normal;
}

/* ── Grid Span Rules ────────────────────────────────────────── */

.ef-cp-performance { grid-column: span 2; }
.ef-cp-gauges { grid-column: span 2; }
.ef-cp-sparklines { grid-column: span 4; }
.ef-cp-montecarlo { grid-column: span 2; }
.ef-cp-backtest { grid-column: span 2; }
.ef-cp-calculator { grid-column: span 2; }
.ef-cp-revenue { grid-column: span 2; }
.ef-cp-allocation { grid-column: span 2; }
.ef-cp-botfleet { grid-column: span 2; }
.ef-cp-microfunds { grid-column: span 2; }

/* ── Revenue Earnings Panel ───────────────────────────────────── */

.ef-cp-revenue-grid {
    display: grid;
    gap: 0.375rem;
}

.ef-cp-revenue-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-text);
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--panel-border);
}

.ef-cp-revenue-row:last-child {
    border-bottom: none;
}

.ef-cp-revenue-total {
    font-weight: 700;
    color: var(--ef-energon);
    border-top: 1px solid var(--ef-panel-border);
    padding-top: 0.375rem;
    margin-top: 0.125rem;
}

.ef-cp-revenue-cta {
    margin-top: 0.5rem;
    text-align: center;
}

.ef-cp-revenue-cta a,
.ef-cp-cta-link {
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-energon);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 207, 255, 0.4);
}

.ef-cp-cta-wrapper { margin-top: 8px; text-align: center; }

.ef-cp-revenue-cta a:hover {
    color: var(--ef-energon-bright);
    border-bottom-color: var(--ef-energon-bright);
}

/* ── Performance Metrics ────────────────────────────────────── */

.ef-cp-metrics-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.ef-cp-metric {
    text-align: center;
    padding: 0.25rem 0;
}

.ef-cp-metric-value {
    font-family: var(--ef-font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ef-text);
    display: block;
    line-height: 1.2;
}

.ef-cp-metric-value.positive { color: var(--ef-positive); }
.ef-cp-metric-value.negative { color: var(--ef-outflow); }

.ef-cp-metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ef-text-dim);
    display: block;
    margin-top: 0.125rem;
}

.ef-cp-secondary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--ef-panel-border);
}

.ef-cp-stat {
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-text);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ef-cp-stat-label {
    font-family: inherit;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ef-text-dim);
}

/* ── Win Rate Dial ──────────────────────────────────────────── */

.ef-cp-dial svg {
    display: block;
    margin: 0 auto 0.125rem;
    width: 80px;
    height: 50px;
}

.ef-dial-bg {
    fill: none;
    stroke: rgba(224, 232, 240, 0.08);
    stroke-linecap: round;
}

.ef-dial-fill {
    fill: none;
    stroke: var(--ef-positive);
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
}

.ef-dial-needle {
    fill: var(--ef-text);
    transition: transform 0.8s ease;
}

.ef-dial-center {
    fill: var(--ef-bg);
    stroke: var(--ef-text-dim);
    stroke-width: 0.5;
}

/* ── Flow Rate Gauges ───────────────────────────────────────── */

.ef-cp-gauge-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ef-cp-gauge-row {
    display: grid;
    grid-template-columns: 60px 1fr 65px;
    align-items: center;
    gap: 0.5rem;
}

.ef-cp-gauge-label {
    font-size: 0.75rem;
    color: var(--ef-text-dim);
    text-align: right;
}

.ef-cp-gauge-track {
    height: 6px;
    background: rgba(224, 232, 240, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.ef-cp-gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    width: 0;
}

.ef-cp-gauge-fill.ef-inflow { background: var(--ef-energon); box-shadow: 0 0 6px rgba(0, 207, 255, 0.4); }
.ef-cp-gauge-fill.ef-outflow { background: var(--ef-outflow); box-shadow: 0 0 6px rgba(255, 68, 68, 0.4); }
.ef-cp-gauge-fill.ef-net { background: var(--ef-positive); box-shadow: 0 0 6px rgba(0, 255, 136, 0.4); }
.ef-cp-gauge-fill.ef-net.negative { background: var(--ef-outflow); box-shadow: 0 0 6px rgba(255, 68, 68, 0.4); }
.ef-cp-gauge-fill.ef-feeburn { background: var(--ef-outflow); opacity: 0.7; }

.ef-cp-gauge-val {
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-text);
    text-align: right;
}

/* ── Sparklines ─────────────────────────────────────────────── */

.ef-cp-spark-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.ef-cp-spark {
    min-width: 0;
}

.ef-cp-spark-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.ef-cp-spark-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ef-text-dim);
}

.ef-cp-spark-val {
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-text);
}

.ef-cp-spark-val.positive { color: var(--ef-positive); }
.ef-cp-spark-val.negative { color: var(--ef-outflow); }

.ef-cp-spark-svg {
    display: block;
    width: 100%;
    height: 40px;
}

.ef-spark-line {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ef-spark-line.positive { stroke: var(--ef-positive); }
.ef-spark-line.negative { stroke: var(--ef-outflow); }

.ef-spark-area {
    opacity: 0.15;
}

.ef-spark-area.positive { fill: var(--ef-positive); }
.ef-spark-area.negative { fill: var(--ef-outflow); }

/* ── Token Allocation Donut ─────────────────────────────────── */

#ef-donut {
    display: block;
    width: 100%;
    max-width: 160px;
    margin: 0 auto;
}

.ef-donut-arc {
    stroke: var(--ef-bg);
    stroke-width: 1;
    transition: opacity 0.3s;
    cursor: pointer;
}

.ef-donut-arc:hover { opacity: 0.8; }

.ef-donut-center-val {
    fill: var(--ef-text);
    font-family: var(--ef-font-mono);
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
}

.ef-donut-center-label {
    fill: var(--ef-text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-anchor: middle;
}

.ef-cp-donut-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.625rem;
    margin-top: 0.5rem;
    justify-content: center;
}

.ef-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--ef-text-dim);
}

.ef-donut-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Monte Carlo ────────────────────────────────────────────── */

.ef-cp-mc-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.ef-cp-mc-label,
.ef-cp-bt-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--ef-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ef-cp-mc-label input[type="range"],
.ef-cp-bt-label input[type="range"] {
    width: 80px;
    height: 4px;
    accent-color: var(--ef-energon);
    cursor: pointer;
}

.ef-cp-mc-val {
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    color: var(--ef-energon);
    min-width: 32px;
    text-align: right;
}

.ef-cp-btn {
    padding: 0.25rem 0.75rem;
    min-height: 44px;
    background: rgba(0, 207, 255, 0.1);
    border: 1px solid var(--ef-energon);
    border-radius: 5px;
    color: var(--ef-energon);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
}

.ef-cp-btn:hover,
.ef-cp-btn:focus-visible {
    background: rgba(0, 207, 255, 0.25);
    box-shadow: 0 0 12px rgba(0, 207, 255, 0.2);
    outline: 1px solid rgba(0, 207, 255, 0.5);
    outline-offset: -1px;
}

.ef-cp-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ef-cp-mc-chart {
    display: block;
    width: 100%;
    height: 160px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.ef-mc-band { opacity: 0.15; fill: var(--ef-energon); }
.ef-mc-band-inner { opacity: 0.25; fill: var(--ef-energon); }
.ef-mc-median-line { fill: none; stroke: var(--ef-energon); stroke-width: 2; }
.ef-mc-start-line { stroke: var(--ef-text-dim); stroke-width: 1; stroke-dasharray: 4 4; }

.ef-cp-mc-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--ef-panel-border);
}

/* ── Bot Fleet ──────────────────────────────────────────────── */

.ef-cp-fleet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.ef-cp-fleet-stat {
    text-align: center;
    padding: 0.375rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

.ef-cp-fleet-val {
    font-family: var(--ef-font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ef-text);
    display: block;
}

.ef-cp-fleet-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ef-text-dim);
}

.ef-cp-fleet-best {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--ef-panel-border);
    font-size: 0.75rem;
}

.ef-cp-fleet-best .ef-cp-stat-label {
    flex-shrink: 0;
}

.ef-positive { color: var(--ef-positive); }

/* ── Backtest Simulator ─────────────────────────────────────── */

.ef-cp-bt-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.ef-cp-input {
    width: 80px;
    padding: 0.25rem 0.375rem;
    min-height: 44px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--ef-panel-border);
    border-radius: 4px;
    color: var(--ef-text);
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
    outline: none;
}

.ef-cp-input:focus {
    border-color: var(--ef-energon);
    box-shadow: 0 0 6px rgba(0, 207, 255, 0.15);
}

.ef-cp-bt-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--ef-panel-border);
}

/* ── Revenue Calculator ─────────────────────────────────────── */

.ef-cp-calc-input {
    margin-bottom: 0.625rem;
}

.ef-cp-calc-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--ef-text);
}

.ef-cp-calc-field {
    display: flex;
    align-items: center;
    gap: 0;
}

.ef-cp-calc-prefix {
    padding: 0.25rem 0.375rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--ef-panel-border);
    border-right: none;
    border-radius: 4px 0 0 4px;
    color: var(--ef-energon);
    font-family: var(--ef-font-mono);
    font-size: 0.75rem;
}

.ef-cp-calc-field .ef-cp-input {
    border-radius: 0 4px 4px 0;
    width: 100px;
}

.ef-cp-calc-results {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ef-cp-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ef-cp-calc-val {
    font-family: var(--ef-font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ef-positive);
}

.ef-cp-calc-disclaimer {
    font-size: 0.75rem;
    color: var(--ef-text-dim);
    opacity: 0.6;
    margin-top: 0.375rem;
    line-height: 1.4;
}

/* ── Control Panel Responsive ───────────────────────────────── */

@media (max-width: 768px) {
    .ef-cp-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ef-cp-performance,
    .ef-cp-gauges,
    .ef-cp-sparklines,
    .ef-cp-montecarlo,
    .ef-cp-backtest,
    .ef-cp-calculator,
    .ef-cp-allocation,
    .ef-cp-botfleet,
    .ef-cp-microfunds,
    .ef-cp-revenue { grid-column: span 2; }

    .ef-cp-metrics-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .ef-cp-spark-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .ef-cp-mc-controls,
    .ef-cp-bt-controls {
        gap: 0.5rem;
    }
}

@media (max-width: 400px) {
    .ef-cp-grid {
        grid-template-columns: 1fr;
    }

    .ef-cp-performance,
    .ef-cp-gauges,
    .ef-cp-sparklines,
    .ef-cp-montecarlo,
    .ef-cp-backtest,
    .ef-cp-calculator,
    .ef-cp-allocation,
    .ef-cp-botfleet,
    .ef-cp-microfunds,
    .ef-cp-revenue { grid-column: span 1; }

    .ef-cp-metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .ef-cp-spark-row {
        grid-template-columns: 1fr;
    }
}


/* ── Detail Panels (Bot/Agent/Asset click panels) ────────────── */

.ef-detail-panel {
    position: absolute;
    z-index: 100;
    min-width: 200px;
    max-width: 260px;
    background: rgba(13, 21, 32, 0.95);
    border: 1px solid var(--panel-border-hover);
    border-radius: 10px;
    padding: 0.75rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.ef-detail-close {
    position: absolute;
    top: 0.375rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
}

.ef-detail-close:hover {
    color: var(--ef-text, #e5e7eb);
}

.ef-detail-title {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    padding-right: 1rem;
}

.ef-detail-subtitle {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    text-transform: capitalize;
    margin-bottom: 0.5rem;
}

.ef-detail-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.ef-detail-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ef-detail-stat-val {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
}

.ef-detail-stat-lbl {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ef-detail-divider {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.375rem 0 0.25rem;
    border-top: 1px solid var(--panel-border);
    margin-top: 0.25rem;
}

.ef-detail-breakdown-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0;
}

.ef-detail-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ef-detail-stream-name {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    flex: 1;
}

.ef-detail-stream-val {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.75rem;
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
    flex-shrink: 0;
}

.ef-detail-bar-wrap {
    height: 2px;
    background: rgba(0, 207, 255, 0.06);
    border-radius: 1px;
    margin-bottom: 0.1875rem;
}

.ef-detail-bar {
    height: 100%;
    border-radius: 1px;
    min-width: 2px;
    opacity: 0.6;
}

.ef-detail-bot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    color: var(--ef-text, #e5e7eb);
    border-bottom: 1px solid var(--panel-border);
}

.ef-detail-bot-row:last-child {
    border-bottom: none;
}

/* ── Expandable Mobile Cards ──────────────────────────────────── */

.ef-card-expandable .ef-card-expand-body {
    display: none;
    padding: 0.375rem 1rem 0.5rem 2.25rem;
}

.ef-card-expandable.expanded .ef-card-expand-body {
    display: block;
}

.ef-card-expand-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0;
}

.ef-card-expand-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ef-card-expand-name {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    flex: 1;
}

.ef-card-expand-val {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.75rem;
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
}

/* ── Profit Paths Section ───────────────────────────────────── */

.ef-pp-section {
    margin-top: 2rem;
    padding: 1.5rem 0;
}

.ef-pp-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.ef-pp-header h2 {
    color: var(--ef-energon, #00cfff);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.ef-pp-subtitle {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    margin: 0;
}

.ef-pp-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
}

.ef-pp-stat {
    text-align: center;
}

.ef-pp-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ef-text, #e5e7eb);
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
}

.ef-pp-highlight {
    color: var(--ef-positive, #00ff88) !important;
}

.ef-pp-stat-label {
    font-size: 0.75rem;
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Category accordions */
.ef-pp-categories {
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.ef-pp-cat {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.ef-pp-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.ef-pp-cat-header:hover {
    background: rgba(0, 207, 255, 0.05);
}

.ef-pp-cat-name {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.875rem;
    font-weight: 600;
}

.ef-pp-cat-meta {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
}

.ef-pp-cat-body {
    display: none;
    padding: 0 1rem 0.75rem;
}

.ef-pp-cat.expanded .ef-pp-cat-body {
    display: block;
}

/* Mechanism rows */
.ef-pp-mech {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--panel-border);
    gap: 0.75rem;
}

.ef-pp-mech:last-child {
    border-bottom: none;
}

.ef-pp-mech-left {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.ef-pp-mech-name {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.75rem;
    font-weight: 500;
}

.ef-pp-mech-desc {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    line-height: 1.3;
}

.ef-pp-mech-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
    flex-shrink: 0;
}

.ef-pp-mech-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ef-pp-status-active {
    color: var(--ef-positive, #00ff88);
}

.ef-pp-status-planned {
    color: var(--ef-energon, #00cfff);
}

.ef-pp-status-coming {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
}

.ef-pp-mech-paths {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    font-size: 0.75rem;
    font-family: var(--ef-font-mono, 'JetBrains Mono', monospace);
}

/* Compatibility matrix (desktop only) */
.ef-pp-matrix {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ef-pp-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.ef-pp-matrix-corner {
    width: 180px;
}

.ef-pp-matrix-col-header {
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
    padding: 0.5rem 0.25rem 0.375rem;
    font-weight: 500;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    text-align: left;
    white-space: nowrap;
    height: 90px;
}

.ef-pp-matrix-cat-row {
    background: rgba(0, 207, 255, 0.04);
}

.ef-pp-matrix-cat-label {
    color: var(--ef-energon, #00cfff);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.5rem;
    text-align: left;
}

.ef-pp-matrix-mech-name {
    color: var(--ef-text, #e5e7eb);
    font-size: 0.75rem;
    padding: 0.3125rem 0.5rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.ef-pp-matrix-cell {
    text-align: center;
    padding: 0.25rem;
    border-bottom: 1px solid var(--panel-border);
    color: var(--ef-text-dim, rgba(0,207,255,0.4));
}

.ef-pp-check {
    color: var(--ef-energon, #00cfff) !important;
    font-weight: 700;
}

@media (max-width: 768px) {
    .ef-pp-stats {
        flex-wrap: wrap;
        gap: 1.25rem;
    }

    .ef-pp-stat {
        min-width: 70px;
    }

    .ef-pp-matrix {
        display: none;
    }

    .ef-pp-cat-header {
        padding: 0.625rem 0.75rem;
    }

    .ef-pp-mech {
        flex-direction: column;
        gap: 0.25rem;
    }

    .ef-pp-mech-right {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Metric-tip overrides for Flows page — bigger, more visible
   ═══════════════════════════════════════════════════════════════ */

#ef-page .metric-tip {
    width: 16px; height: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(0, 207, 255, 0.5);
    margin-left: 4px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 207, 255, 0.3);
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}
#ef-page .metric-tip:hover,
#ef-page .metric-tip.tip-open {
    border-color: #00cfff;
    color: #00cfff;
    background: rgba(0, 207, 255, 0.1);
    box-shadow: 0 0 6px rgba(0, 207, 255, 0.2);
}

/* Metric-tip tooltip popup (mirrors .panel-tip .tip-text) */
#ef-page .metric-tip .tip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 207, 255, 0.25);
    border-radius: 8px;
    color: var(--ef-text);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
    text-align: left;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.15s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 207, 255, 0.08);
}

#ef-page .metric-tip .tip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 207, 255, 0.25);
}

#ef-page .metric-tip:hover .tip-text,
#ef-page .metric-tip.tip-open .tip-text {
    visibility: visible;
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   Panel-tip ? Icons  —  panel-level tooltips on control panels
   ═══════════════════════════════════════════════════════════════ */

.panel-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ef-energon);
    border: 1px solid rgba(0, 207, 255, 0.35);
    border-radius: 50%;
    cursor: help;
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.panel-tip:hover {
    border-color: var(--ef-energon);
    background: rgba(0, 207, 255, 0.12);
}

.panel-tip .tip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 207, 255, 0.25);
    border-radius: 8px;
    color: var(--ef-text);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
    text-align: left;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.15s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 207, 255, 0.08);
}

.panel-tip .tip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 207, 255, 0.25);
}

.panel-tip:hover .tip-text {
    visibility: visible;
    opacity: 1;
}

.ef-header-right .panel-tip .tip-text {
    left: auto;
    right: 0;
    transform: none;
}

.ef-header-right .panel-tip .tip-text::after {
    left: auto;
    right: 12px;
}

@media (max-width: 768px) {
    .panel-tip .tip-text,
    #ef-page .metric-tip .tip-text {
        position: fixed;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        top: auto;
        max-width: none;
        width: auto;
        transform: none;
        font-size: 0.75rem;
        padding: 12px 16px;
        border-radius: 10px;
        z-index: 10001;
    }
    .panel-tip .tip-text::after,
    #ef-page .metric-tip .tip-text::after {
        display: none;
    }
}
