/**
 * Kraken Futures — cyberpunk / neon dashboard (presentation only)
 */
:root {
    --void: #0a0a0a;
    --panel: rgba(12, 12, 18, 0.78);
    --glass: rgba(20, 20, 32, 0.55);
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff00ff;
    --electric: #00bfff;
    --lime: #39ff14;
    --text: #e8f4f8;
    --muted: #7a8a99;
    --positive: #39ff14;
    --negative: #ff3366;
    --warning: #ffcc00;
    --radius: 16px;
    --font: "Outfit", "Segoe UI", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --glow-cyan: 0 0 18px rgba(0, 240, 255, 0.35);
    --glow-mag: 0 0 20px rgba(255, 0, 255, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--void);
    background-image:
        radial-gradient(ellipse 100% 60% at 50% -10%, rgba(0, 240, 255, 0.08), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 30%, rgba(255, 0, 255, 0.06), transparent),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(0, 191, 255, 0.05), transparent);
    line-height: 1.45;
    padding: 1rem;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 240, 255, 0.015) 2px,
        rgba(0, 240, 255, 0.015) 4px
    );
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.03) 1px, transparent 1px);
    background-size: 56px 56px;
    pointer-events: none;
    z-index: 0;
}

.wrap {
    position: relative;
    z-index: 1;
    max-width: 1760px;
    margin: 0 auto;
    overflow-x: hidden;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: var(--panel);
    border: 1px solid rgba(0, 240, 255, 0.28);
    border-radius: var(--radius);
    box-shadow: var(--glow-cyan), 0 16px 48px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(14px);
    margin-bottom: 1.1rem;
}

.brand h1 {
    margin: 0;
    font-size: clamp(1.2rem, 2.4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--electric));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.4));
}

.brand .sub {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.feed-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.feed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 14px var(--lime);
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

.feed-dot.stale {
    background: var(--warning);
    box-shadow: 0 0 12px var(--warning);
}

.fx-pill {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid rgba(0, 240, 255, 0.2);
    font-size: 0.78rem;
    margin: 0.15rem;
}

.fx-pill strong { color: var(--neon-cyan); font-family: var(--mono); }

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0.2rem;
}

.status-running {
    color: var(--lime);
    border: 1px solid var(--lime);
    background: rgba(57, 255, 20, 0.1);
    box-shadow: 0 0 16px rgba(57, 255, 20, 0.2);
}
.status-stopped {
    color: var(--muted);
    border: 1px solid rgba(122, 138, 153, 0.5);
    background: rgba(30, 30, 40, 0.5);
}
.status-emergency {
    color: var(--negative);
    border: 1px solid var(--negative);
    background: rgba(255, 51, 102, 0.12);
    animation: pulse-soft 1.2s ease infinite;
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.78; }
}

.heartbeat-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--lime);
    margin-left: 8px;
    box-shadow: 0 0 12px var(--lime);
    animation: heartbeat 1.35s ease infinite;
}

.heartbeat-indicator.heartbeat-dead {
    background: var(--negative);
    box-shadow: 0 0 12px var(--negative);
    animation: none;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    45% { transform: scale(1.28); }
}

.grid-main {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 1100px) {
    .span-4 { grid-column: span 4; }
    .span-6 { grid-column: span 6; }
    .span-8 { grid-column: span 8; }
    .span-12 { grid-column: span 12; }
}

@media (max-width: 1099px) {
    .span-4, .span-6, .span-8, .span-12 { grid-column: span 12; }
}

.card {
    background: var(--panel);
    border: 1px solid rgba(0, 240, 255, 0.22);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-magenta), transparent);
    opacity: 0.65;
}

.card h2 {
    margin: 0 0 0.9rem 0;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    padding-bottom: 0.55rem;
    text-shadow: var(--glow-cyan);
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(0, 240, 255, 0.06);
    font-size: 0.88rem;
}

.metric:last-child { border-bottom: none; }

.metric-label { color: var(--muted); flex-shrink: 0; }
.metric-value {
    font-family: var(--mono);
    font-weight: 600;
    text-align: right;
}

.metric-value.positive { color: var(--positive); }
.metric-value.negative { color: var(--negative); }
.metric-value.neutral { color: var(--electric); }

.muted { color: var(--muted); font-size: 0.85rem; }
.cell-center { text-align: center; padding: 1.25rem !important; }

.progress-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.45rem;
    border: 1px solid rgba(0, 240, 255, 0.12);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--electric), var(--neon-magenta));
    font-size: 0;
    min-width: 0;
    transition: width 0.5s ease;
    box-shadow: 0 0 12px rgba(0, 191, 255, 0.4);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.65rem; }

.btn {
    appearance: none;
    border: 1px solid rgba(0, 240, 255, 0.35);
    background: rgba(10, 10, 20, 0.85);
    color: var(--text);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.82rem;
    transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s;
    font-family: var(--font);
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--glow-cyan);
    border-color: var(--neon-cyan);
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-start { border-color: rgba(57, 255, 20, 0.55); color: var(--lime); }
.btn-stop { border-color: rgba(255, 204, 0, 0.5); color: var(--warning); }
.btn-emergency { border-color: rgba(255, 51, 102, 0.6); color: var(--negative); }
.btn-refresh { border-color: rgba(0, 191, 255, 0.55); color: var(--electric); }

.mode-toggle { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.alert-box {
    display: none;
    margin-top: 0.65rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
}

.alert-success { background: rgba(57, 255, 20, 0.1); border: 1px solid var(--lime); color: var(--lime); }
.alert-warning { background: rgba(255, 204, 0, 0.08); border: 1px solid var(--warning); color: var(--warning); }
.alert-error { background: rgba(255, 51, 102, 0.1); border: 1px solid var(--negative); color: var(--negative); }

.access-badge {
    text-align: center;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-size: 0.78rem;
    margin-bottom: 0.85rem;
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.access-badge.local { background: rgba(57, 255, 20, 0.06); color: var(--lime); }
.access-badge.remote { background: rgba(0, 191, 255, 0.08); color: var(--electric); }

.ticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.55rem;
    margin-top: 0.5rem;
}

.ticker-cell {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid rgba(255, 0, 255, 0.12);
    font-size: 0.72rem;
}

.ticker-cell .sym { font-weight: 800; color: var(--neon-magenta); font-family: var(--mono); }
.ticker-cell .px { font-family: var(--mono); color: var(--neon-cyan); font-size: 0.85rem; margin-top: 0.2rem; }
.ticker-cell .ch { margin-top: 0.15rem; font-size: 0.7rem; }
.ticker-cell .ch.up { color: var(--positive); }
.ticker-cell .ch.down { color: var(--negative); }

.ob-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    font-family: var(--mono);
}

.ob-col h3 {
    margin: 0 0 0.35rem 0;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.ob-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ob-row.bid { color: var(--positive); }
.ob-row.ask { color: var(--negative); }

.pipeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.pipeline-step {
    padding: 0.85rem;
    background: var(--glass);
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.12);
}

.pipeline-step .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-cyan);
    display: inline-block;
    margin-right: 6px;
    box-shadow: 0 0 10px var(--neon-cyan);
    animation: pulse-soft 2s ease infinite;
}

.pipeline-step .label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; }
.pipeline-step .value { font-family: var(--mono); font-size: 0.92rem; margin-top: 0.25rem; }

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.calc-cell {
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    border: 1px solid rgba(255, 0, 255, 0.1);
    font-size: 0.82rem;
}

.calc-cell span:last-child {
    font-family: var(--mono);
    color: var(--neon-cyan);
    font-weight: 600;
}

.computing-shimmer {
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.15), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.env-item {
    padding: 0.55rem 0.65rem;
    background: var(--glass);
    border-radius: 10px;
    border: 1px solid rgba(0, 191, 255, 0.1);
}

.env-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.env-value { font-family: var(--mono); font-size: 0.82rem; margin-top: 0.15rem; color: var(--text); }

.risk-gauge { display: flex; justify-content: center; padding: 0.75rem; }

.gauge-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid rgba(0, 240, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 30%, rgba(255, 0, 255, 0.12), transparent);
    box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.06), var(--glow-mag);
}

.gauge-value { font-size: 1.55rem; font-weight: 900; font-family: var(--mono); }

.signal-strength { display: flex; gap: 4px; height: 40px; align-items: flex-end; margin-top: 0.3rem; }

.signal-bar {
    flex: 1;
    background: rgba(80, 90, 110, 0.35);
    border-radius: 3px 3px 0 0;
    min-height: 14%;
    transition: background 0.25s ease, box-shadow 0.25s;
}

.signal-bar.active {
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-magenta));
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.45);
}

.symbol-card {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.18);
    background: var(--glass);
}

.symbol-header { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 0.25rem; }
.symbol-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

table.data-table th {
    text-align: left;
    padding: 0.55rem 0.45rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.62rem;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    position: sticky;
    top: 0;
    background: rgba(10, 10, 12, 0.97);
}

table.data-table td {
    padding: 0.45rem 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: var(--mono);
}

.side-long { color: var(--positive); font-weight: 800; }
.side-short { color: var(--negative); font-weight: 800; }

.scroll-table {
    max-height: 360px;
    overflow: auto;
    border-radius: 10px;
    border: 1px solid rgba(0, 240, 255, 0.12);
}

.filter-btn {
    padding: 0.32rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.72rem;
    margin: 0.12rem;
    font-family: var(--font);
}

.filter-btn.active {
    background: rgba(0, 240, 255, 0.12);
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.ev-kind { font-weight: 700; }
.extra-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
    color: var(--muted);
}

.logs-box {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 10px;
    padding: 0.45rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    background: rgba(0, 0, 0, 0.4);
}

.log-line {
    display: grid;
    grid-template-columns: 130px 52px 1fr;
    gap: 0.45rem;
    padding: 0.3rem 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-INFO .log-lev { color: var(--neon-cyan); }
.log-WARNING .log-lev { color: var(--warning); }
.log-ERROR .log-lev, .log-CRITICAL .log-lev { color: var(--negative); }

.log-ts { color: var(--muted); }
.log-msg { word-break: break-word; }

.chart-box {
    height: 240px;
    max-height: 240px;
    min-height: 0;
    position: relative;
    margin-top: 0.65rem;
    overflow: hidden;
    contain: layout style;
}

.chart-box.tall {
    height: 280px;
    max-height: 280px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.stat-card {
    text-align: center;
    padding: 0.65rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 0, 255, 0.15);
    background: var(--glass);
    min-height: 0;
}

.stat-card-value { font-family: var(--mono); font-size: 1.05rem; font-weight: 900; }
.stat-card-label { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; margin-top: 0.2rem; }

.heatmap-wrap { overflow-x: auto; margin-top: 0.5rem; }
.heatmap {
    display: grid;
    gap: 3px;
    font-size: 0.62rem;
    font-family: var(--mono);
}
.heatmap-cell {
    padding: 0.35rem;
    text-align: center;
    border-radius: 4px;
    min-width: 2.2rem;
    color: #0a0a0a;
    font-weight: 800;
}

.notification-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 340px;
}

.notification {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: rgba(12, 12, 18, 0.96);
    border: 1px solid rgba(0, 240, 255, 0.35);
    box-shadow: var(--glow-cyan);
    animation: slideIn 0.28s ease;
}

.notification.closing { opacity: 0; transform: translateX(16px); transition: 0.28s ease; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.55rem;
}

select#refreshRate {
    background: rgba(0, 0, 0, 0.5);
    color: var(--text);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    padding: 0.3rem 0.45rem;
    font-family: var(--font);
}

.log-search {
    flex: 1;
    min-width: 140px;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.78rem;
}

.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.neutral { color: var(--electric) !important; }

.metrics-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.spark {
    display: block;
    width: 100% !important;
    max-width: 160px;
    height: 36px !important;
    max-height: 40px !important;
    margin: 0.35rem auto 0;
    opacity: 0.9;
}

@media (max-width: 640px) {
    .log-line { grid-template-columns: 1fr; }
    .ob-grid { grid-template-columns: 1fr; }
}

.sym-perf-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
    font-size: 0.82rem;
}
.sym-perf-name { flex: 1; min-width: 0; font-weight: 600; }
.sym-perf-stat { font-size: 0.75rem; }
.sym-perf-pnl { font-variant-numeric: tabular-nums; font-weight: 600; }
.sym-perf-extra { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mniej „migania” przy częstym poll — wyłącz animacje wykresów ustawiane w JS (animation: false) */
.chart-box canvas {
    vertical-align: bottom;
    max-width: 100% !important;
    max-height: 100% !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
