:root {
    --bg-primary: #0b0d13;
    --bg-secondary: #11131a;
    --bg-card: rgba(255, 255, 255, 0.035);
    --bg-card-hover: rgba(255, 255, 255, 0.065);
    --border-subtle: rgba(255, 255, 255, 0.055);
    --border-hover: rgba(255, 255, 255, 0.14);
    --text-primary: #e4e5ea;
    --text-secondary: #7d7f8a;
    --text-tertiary: #50525c;
    --positive: #00d2a0;
    --negative: #ff4d5a;
    --arbitrage: #ff6b35;
    --arbitrage-dim: rgba(255, 107, 53, 0.12);
    --value: #b476f5;
    --value-dim: rgba(180, 118, 245, 0.12);
    --gold: #f5a623;
    --gold-dim: rgba(245, 166, 35, 0.12);
    --blue: #4facfe;
    --blue-dim: rgba(79, 172, 254, 0.12);
    --radius: 10px;
    --font: 'Inter', -apple-system, system-ui, sans-serif;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ===== Header ===== */
header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    height: 52px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-accent {
    color: var(--gold);
}

.header-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--gold);
    background: var(--gold-dim);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.nav-btn {
    padding: 5px 14px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-card);
}

.nav-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gold);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.header-stat,
.update-time {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.countdown {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    min-width: 24px;
}

.refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.refresh-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

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

/* ===== Views ===== */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ===== Board ===== */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 12px;
}

/* ===== Column ===== */
.column {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 6px;
}

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-title h2 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.column-subtitle {
    font-size: 10px;
    color: var(--text-tertiary);
    padding: 0 16px 10px;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: 0.02em;
}

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

.column[data-category="arbitrage"] .dot {
    background: var(--arbitrage);
    box-shadow: 0 0 8px var(--arbitrage-dim);
}

.column[data-category="value"] .dot {
    background: var(--value);
    box-shadow: 0 0 8px var(--value-dim);
}

.column[data-category="certainty"] .dot {
    background: var(--positive);
    box-shadow: 0 0 8px rgba(0, 210, 160, 0.3);
}

.column[data-category="arbitrage"] {
    --accent: var(--arbitrage);
}

.column[data-category="value"] {
    --accent: var(--value);
}

.column[data-category="certainty"] {
    --accent: var(--positive);
}

.column-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.column-body {
    overflow-y: auto;
    padding: 8px;
    max-height: 78vh;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.column-body::-webkit-scrollbar {
    width: 4px;
}

.column-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* ===== Opportunity Card ===== */
.opp-card {
    display: block;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.18s ease;
    margin-bottom: 8px;
    cursor: pointer;
}

.opp-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    border-left-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.opp-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

.opp-title {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 7px;
    cursor: pointer;
    transition: color 0.2s;
}

.opp-title:hover {
    color: var(--accent, #6c9cff);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.opp-finding {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 6px;
}

.opp-action {
    font-size: 11px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 6px 9px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.opp-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.opp-metric {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.opp-metric.positive {
    color: var(--positive);
    background: rgba(0, 210, 160, 0.08);
}

.opp-metric.negative {
    color: var(--negative);
    background: rgba(255, 77, 90, 0.08);
}

.opp-metric.highlight {
    color: var(--gold);
    background: var(--gold-dim);
}

.opp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.opp-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.btn-detail {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-detail:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-trade {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    transition: all 0.2s;
}

.btn-trade:hover {
    opacity: 0.85;
}

/* ===== Portfolio View ===== */
.portfolio-header {
    padding: 16px 20px 0;
}

.pf-summary {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.pf-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 0.03em;
}

.pf-stat-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.portfolio-list {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== Portfolio Card ===== */
.pf-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s;
}

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

.pf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.pf-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
    margin-right: 12px;
}

.pf-pnl {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pf-pnl.pos {
    color: var(--positive);
}

.pf-pnl.neg {
    color: var(--negative);
}

.pf-legs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.pf-leg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 11px;
}

.pf-leg-label {
    color: var(--text-secondary);
    flex: 1;
}

.pf-leg-side {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.pf-leg-side.yes {
    background: rgba(0, 210, 160, 0.15);
    color: var(--positive);
}

.pf-leg-side.no {
    background: rgba(255, 77, 90, 0.15);
    color: var(--negative);
}

.pf-leg-price {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
}

.pf-leg-current {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
}

.pf-advice {
    font-size: 11px;
    padding: 8px 10px;
    border-radius: 6px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.pf-advice.neutral {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.pf-advice.action {
    background: var(--gold-dim);
    color: var(--gold);
}

.pf-advice.urgent {
    background: rgba(255, 77, 90, 0.1);
    color: var(--negative);
}

.pf-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pf-meta {
    font-size: 10px;
    color: var(--text-tertiary);
}

.btn-close-pos {
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 77, 90, 0.3);
    background: transparent;
    color: var(--negative);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-close-pos:hover {
    background: rgba(255, 77, 90, 0.1);
}

/* ===== Side Panel ===== */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 480px;
    max-width: 95vw;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel.active {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.panel-close:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* Panel sections */
.panel-section {
    margin-bottom: 20px;
}

.panel-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.market-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 12px;
}

.market-row-label {
    color: var(--text-secondary);
    flex: 1;
    margin-right: 8px;
}

.market-row-yes {
    color: var(--positive);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.market-row-no {
    color: var(--negative);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
}

.market-row-liq {
    color: var(--text-tertiary);
    font-size: 10px;
    margin-left: 8px;
}

.panel-finding {
    background: var(--arbitrage-dim);
    border-left: 3px solid var(--arbitrage);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.panel-finding.value {
    background: var(--value-dim);
    border-left-color: var(--value);
}

/* Hedge builder */
.hedge-builder {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 14px;
}

.hedge-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hedge-label {
    font-size: 11px;
    color: var(--text-tertiary);
    width: 60px;
    flex-shrink: 0;
}

.hedge-select,
.hedge-input {
    flex: 1;
    min-width: 100px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.hedge-select:focus,
.hedge-input:focus {
    border-color: var(--gold);
}

.hedge-side-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.hedge-side-btn.active-yes {
    background: rgba(0, 210, 160, 0.15);
    color: var(--positive);
    border-color: var(--positive);
}

.hedge-side-btn.active-no {
    background: rgba(255, 77, 90, 0.15);
    color: var(--negative);
    border-color: var(--negative);
}

.btn-gen-hedge {
    width: 100%;
    padding: 9px;
    border-radius: 7px;
    border: none;
    background: var(--gold);
    color: #000;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    margin-top: 6px;
    transition: opacity 0.2s;
}

.btn-gen-hedge:hover {
    opacity: 0.85;
}

/* Scenario table */
.scenario-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 8px;
}

.scenario-table th {
    text-align: left;
    color: var(--text-tertiary);
    font-weight: 600;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.scenario-table td {
    padding: 6px 8px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.scenario-table td.pos {
    color: var(--positive);
    font-weight: 600;
}

.scenario-table td.neg {
    color: var(--negative);
    font-weight: 600;
}

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

.btn-enter-sim {
    width: 100%;
    padding: 10px;
    border-radius: 7px;
    border: none;
    background: var(--positive);
    color: #000;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    margin-top: 12px;
    transition: opacity 0.2s;
}

.btn-enter-sim:hover {
    opacity: 0.85;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    width: 420px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

/* ===== Trade Form ===== */
.trade-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.trade-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
    flex-shrink: 0;
}

.trade-input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.trade-input:focus {
    border-color: var(--accent, #6c9cff);
}

select.trade-input {
    cursor: pointer;
}

.trade-side-btns {
    display: flex;
    gap: 6px;
    flex: 1;
}

.trade-side-btn {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    transition: all 0.2s;
}

.trade-side-btn.active.yes {
    background: rgba(0, 210, 160, 0.15);
    border-color: var(--positive);
    color: var(--positive);
}

.trade-side-btn.active.no {
    background: rgba(255, 77, 90, 0.15);
    border-color: var(--negative);
    color: var(--negative);
}

.trade-side-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.04);
}

.trade-current-price {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
}

.trade-calc {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
}

.trade-divider {
    border-top: 1px solid var(--border-subtle);
    margin: 4px 0;
}

.trade-row-half {
    gap: 16px;
}

.trade-row-half>div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-row-half label {
    min-width: 0;
}

.trade-preview {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-preview-row {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.trade-preview-row .pos {
    color: var(--positive);
    font-weight: 600;
}

.trade-preview-row .neg {
    color: var(--negative);
    font-weight: 600;
}

.trade-submit {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #6c9cff 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.trade-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 156, 255, 0.25);
}

.trade-submit:active {
    transform: translateY(0);
}

.trade-note {
    text-align: center;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.btn-trade {
    padding: 3px 10px;
    border-radius: 5px;
    border: 1px solid rgba(108, 156, 255, 0.3);
    background: rgba(108, 156, 255, 0.08);
    color: #6c9cff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-trade:hover {
    background: rgba(108, 156, 255, 0.18);
    border-color: #6c9cff;
}

/* ===== Empty & Loading ===== */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 200;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-overlay p {
    font-size: 13px;
    color: var(--text-secondary);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.error-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 13, 19, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 200;
}

.error-overlay p {
    font-size: 13px;
    color: var(--negative);
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
}

.retry-btn {
    padding: 8px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.retry-btn:hover {
    background: var(--bg-card-hover);
}

.skeleton-card {
    height: 130px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.055) 50%, rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 8px;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0
    }

    100% {
        background-position: -200% 0
    }
}

/* ===== Responsive ===== */
@media (max-width:900px) {
    .board {
        grid-template-columns: 1fr;
    }

    .side-panel {
        width: 100%;
    }
}

@media (max-width:600px) {
    header {
        padding: 0 12px;
        gap: 8px;
    }

    .header-tag {
        display: none;
    }

    .pf-summary {
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* ===== TP/SL Gauge ===== */
.pf-tpsl {
    margin: 8px 0;
    padding: 6px 0;
}

.tpsl-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 4px;
}

.tpsl-labels .pos {
    color: var(--positive);
}

.tpsl-labels .neg {
    color: var(--negative);
}

.tpsl-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: visible;
}

.tpsl-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.tpsl-marker {
    position: absolute;
    top: -3px;
    width: 3px;
    height: 12px;
    background: #fff;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.3s ease;
}

.tpsl-alert {
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    padding: 5px 10px;
    border-radius: 5px;
    animation: pulse 1.5s ease-in-out infinite;
}

.tpsl-alert.pos {
    background: rgba(0, 210, 160, 0.12);
    color: var(--positive);
}

.tpsl-alert.neg {
    background: rgba(255, 77, 90, 0.12);
    color: var(--negative);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.6
    }
}

.pf-card.tp-triggered {
    border-left: 3px solid var(--positive);
}

.pf-card.sl-triggered {
    border-left: 3px solid var(--negative);
}

.pf-card-btns {
    display: flex;
    gap: 6px;
}

.btn-close-watch {
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.btn-close-watch:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* ===== History Cards ===== */
.hist-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.2s;
}

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

.hist-card.win {
    border-left: 3px solid var(--positive);
}

.hist-card.loss {
    border-left: 3px solid var(--negative);
}

.hist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.hist-title {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    margin-right: 12px;
    line-height: 1.4;
}

.hist-outcome {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.hist-outcome.win {
    color: var(--positive);
}

.hist-outcome.loss {
    color: var(--negative);
}

.hist-meta {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hist-legs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.hist-leg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 9px;
    background: var(--bg-card);
    border-radius: 5px;
    font-size: 11px;
}

.hist-leg-label {
    color: var(--text-secondary);
    flex: 1;
}

.hist-leg-side {
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    margin: 0 6px;
}

.hist-leg-side.yes {
    background: rgba(0, 210, 160, 0.15);
    color: var(--positive);
}

.hist-leg-side.no {
    background: rgba(255, 77, 90, 0.15);
    color: var(--negative);
}

.hist-leg-prices {
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hist-leg-legpnl {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
}

.hist-sparkline {
    margin: 4px 0 8px;
}

.hist-type-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hist-snapshots {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.stat-box {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
}

.stat-box-label {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

.stat-box-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-box-value.pos {
    color: var(--positive);
}

.stat-box-value.neg {
    color: var(--negative);
}

.stat-box-value.neutral {
    color: var(--text-primary);
}

.stat-type-section {
    padding: 12px 20px;
}

.stat-type-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.stat-type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 11px;
    margin-bottom: 4px;
}

.stat-type-name {
    color: var(--text-secondary);
}

.stat-type-stats {
    display: flex;
    gap: 12px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.hist-clear-btn {
    font-size: 11px;
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 77, 90, 0.3);
    background: transparent;
    color: var(--negative);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.hist-clear-btn:hover {
    background: rgba(255, 77, 90, 0.1);
}