:root {
    --bg: #071018;
    --bg-deep: #03080f;
    --surface: rgba(11, 21, 31, 0.84);
    --surface-strong: rgba(17, 29, 42, 0.92);
    --surface-soft: rgba(14, 24, 35, 0.72);
    --border: rgba(155, 191, 227, 0.14);
    --border-strong: rgba(155, 191, 227, 0.24);
    --text: #ecf4ff;
    --muted: #90a4ba;
    --accent: #67d4ff;
    --accent-soft: rgba(103, 212, 255, 0.18);
    --positive: #39d98a;
    --positive-soft: rgba(57, 217, 138, 0.16);
    --negative: #ff7a7a;
    --negative-soft: rgba(255, 122, 122, 0.18);
    --warning: #f8c15a;
    --shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
    --radius: 28px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(94, 181, 255, 0.16), transparent 30%),
        radial-gradient(circle at bottom right, rgba(45, 214, 143, 0.12), transparent 28%),
        linear-gradient(180deg, #08111a 0%, #050a12 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 88%);
    opacity: 0.24;
}

.app-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    min-height: 100vh;
    padding: 24px;
}

.app-shell > *,
.workspace-grid > *,
.market-tape > * {
    min-width: 0;
}

.side-rail {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: start;
    min-height: calc(100vh - 48px);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 32px;
    background:
        linear-gradient(180deg, rgba(11, 20, 31, 0.92), rgba(7, 15, 25, 0.82));
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    min-width: 0;
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.brand-block h1,
.workspace-header h2,
.section-heading h2,
.hero-metric strong,
.metric-tile strong {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    letter-spacing: -0.04em;
}

.mobile-only {
    display: none;
}

.brand-block,
.section-heading,
.workspace-header,
.panel-topline,
.rail-copy,
.workspace-copy,
.panel-copy,
.refresh-pill,
.meta-row,
.meta-row span,
.meta-row strong {
    min-width: 0;
    max-width: 100%;
}

.brand-block h1 {
    font-size: clamp(2.2rem, 5vw, 3rem);
    line-height: 0.95;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 10px;
    font-size: 0.73rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.rail-copy,
.workspace-copy,
.panel-copy,
.panel-footnote,
.metric-tile span,
.meta-row span,
.refresh-pill span,
.symbol-table-head,
.live-setup-meta,
.exit-meta {
    color: var(--muted);
}

.rail-copy,
.workspace-copy,
.panel-copy {
    margin: 10px 0 0;
    width: min(100%, 60ch);
    max-width: 100%;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.rail-status,
.refresh-pill {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    min-width: 0;
}

.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--positive);
    box-shadow: 0 0 0 8px rgba(57, 217, 138, 0.12);
    animation: pulse 2.4s infinite;
}

.rail-meta,
.rail-panel,
.panel,
.market-tape {
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(18px);
}

.rail-meta,
.rail-panel {
    border-radius: 24px;
}

.rail-meta {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-row strong {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.workspace-header h2,
.section-heading h2,
.brand-block h1 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.meta-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.meta-row strong,
.hero-metric strong,
.metric-tile strong,
.ticker-main strong,
.decision-mix strong,
.exit-pnl,
.setup-main strong {
    font-size: 1.2rem;
    font-weight: 800;
}

.rail-panel {
    padding: 20px;
}

.compact-panel {
    margin-top: auto;
}

.hero-metric {
    display: grid;
    gap: 8px;
    padding-top: 8px;
}

.hero-metric span {
    color: var(--muted);
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    align-items: end;
    padding: 8px 4px 0;
}

.market-tape,
.panel {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(18px);
    animation: reveal-up 0.75s var(--ease) forwards;
}

.market-tape {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    background:
        linear-gradient(180deg, rgba(16, 27, 39, 0.86), rgba(9, 16, 25, 0.88));
    min-width: 0;
}

.market-tape .tape-item {
    position: relative;
    padding: 18px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 132px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    animation: reveal-up 0.55s var(--ease) forwards;
    animation-delay: var(--delay, 0ms);
    min-width: 0;
}

.market-tape .tape-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
    transform: translateX(-120%);
    transition: transform 0.6s var(--ease);
}

.market-tape .tape-item:hover::after {
    transform: translateX(120%);
}

.market-tape .tape-item:last-child {
    border-right: 0;
}

.ticker-head,
.ticker-meta,
.symbol-row,
.symbol-table-head,
.exit-row,
.decision-bar,
.setup-row {
    display: grid;
    align-items: center;
}

.ticker-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.ticker-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.ticker-main span,
.ticker-meta span,
.exit-label,
.setup-main span {
    font-size: 0.78rem;
    color: var(--muted);
}

.ticker-badge,
.exit-reason,
.setup-badge {
    justify-self: end;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text);
}

.ticker-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.ticker-move {
    margin-top: 20px;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.performance-panel {
    padding: 24px;
}

.panel {
    padding: 22px;
    animation-delay: 120ms;
    min-width: 0;
}

.panel-topline {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    align-items: end;
}

.panel-topline > *,
.workspace-header > * {
    min-width: 0;
}

.section-heading h2,
.workspace-header h2 {
    font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.section-heading.compact-heading h2 {
    font-size: 1.1rem;
}

.metrics-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.metric-tile {
    padding: 16px 18px 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.metric-tile span {
    display: block;
    margin-bottom: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.chart-stage {
    margin-top: 22px;
    height: clamp(260px, 34vw, 320px);
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at top, rgba(103, 212, 255, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(6, 13, 21, 0.94), rgba(8, 15, 24, 0.92));
    overflow: hidden;
}

#pnlChart {
    width: 100%;
    height: 100%;
    display: block;
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 22px;
}

.symbol-table-head {
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr;
    gap: 14px;
    margin-top: 26px;
    padding: 0 14px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.symbol-rows {
    display: grid;
    gap: 10px;
}

.symbol-row {
    position: relative;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr;
    gap: 14px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
    transition: transform 0.28s var(--ease), border-color 0.28s var(--ease);
    min-width: 0;
}

.symbol-row::before {
    content: "";
    position: absolute;
    inset: 0;
    width: var(--fill, 0%);
    background: linear-gradient(90deg, rgba(103, 212, 255, 0.12), transparent);
    pointer-events: none;
}

.symbol-row:hover,
.setup-row:hover,
.exit-row:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.symbol-main,
.setup-main {
    display: grid;
    gap: 3px;
}

.symbol-main strong,
.setup-main strong {
    font-size: 1rem;
}

.hour-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 12px;
    margin-top: 26px;
}

.hour-cell {
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    min-height: 110px;
    display: grid;
    align-content: space-between;
}

.hour-cell strong {
    font-size: 1.15rem;
}

.hour-cell span {
    color: var(--muted);
    font-size: 0.82rem;
}

.hour-cell span:last-child {
    font-size: 0.76rem;
}

.panel-footnote {
    margin-top: 16px;
    font-size: 0.92rem;
}

.recent-exits,
.decision-mix,
.live-setup-list,
.insight-list {
    display: grid;
    gap: 12px;
}

.recent-exits,
.decision-mix {
    margin-top: 26px;
}

.exit-row,
.setup-row {
    grid-template-columns: 1.2fr 0.9fr auto;
    gap: 14px;
    padding: 15px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.28s var(--ease), border-color 0.28s var(--ease);
    min-width: 0;
}

.exit-main {
    display: grid;
    gap: 6px;
}

.exit-meta,
.live-setup-meta {
    display: grid;
    gap: 5px;
}

.decision-bar {
    grid-template-columns: 128px 1fr auto;
    gap: 14px;
    padding: 12px 0;
    min-width: 0;
}

.decision-track {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.decision-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(103, 212, 255, 0.84), rgba(57, 217, 138, 0.74));
}

.live-setups {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.insight-list {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.insight-list li {
    position: relative;
    padding-left: 18px;
    color: var(--text);
    line-height: 1.6;
}

.insight-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 8px rgba(103, 212, 255, 0.1);
}

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

.negative {
    color: var(--negative);
}

.soft-positive {
    background: var(--positive-soft);
}

.soft-negative {
    background: var(--negative-soft);
}

.empty-state {
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    color: var(--muted);
}

@keyframes reveal-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(57, 217, 138, 0.2);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(57, 217, 138, 0.04);
    }
}

@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
    }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .side-rail {
        position: static;
        min-height: auto;
    }
}

@media (max-width: 920px) {
    .workspace-grid,
    .panel-topline,
    .workspace-header {
        grid-template-columns: 1fr;
        display: grid;
    }

    .decision-bar,
    .exit-row,
    .setup-row,
    .symbol-row,
    .symbol-table-head {
        grid-template-columns: 1fr;
    }

    .ticker-meta {
        grid-template-columns: 1fr;
    }

    .meta-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }
}

@media (max-width: 640px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: inline !important;
    }

    .app-shell {
        padding: 10px;
        gap: 12px;
    }

    .side-rail,
    .workspace,
    .market-tape,
    .panel,
    .performance-panel {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
    }

    .side-rail,
    .panel,
    .performance-panel {
        padding: 16px;
        border-radius: 24px;
        width: 100%;
        max-width: 100%;
    }

    .market-tape {
        grid-template-columns: 1fr;
    }

    .market-tape .tape-item {
        min-height: auto;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .market-tape .tape-item:last-child {
        border-bottom: 0;
    }

    .ticker-head {
        grid-template-columns: 1fr;
    }

    .ticker-badge {
        justify-self: start;
    }

    .refresh-pill {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        justify-content: initial;
        border-radius: 18px;
        padding: 12px 14px;
        gap: 4px;
    }

    .workspace-header,
    .panel-topline {
        gap: 12px;
    }

    .meta-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .meta-row strong {
        text-align: left;
    }

    .hour-heatmap {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .hour-cell {
        min-height: 96px;
        padding: 12px;
    }

    .chart-stage {
        height: 220px;
    }

    .brand-block h1 {
        font-size: clamp(2rem, 12vw, 3rem);
    }

    .workspace-header h2 {
        max-width: none;
    }

    .meta-row strong,
    .refresh-pill strong {
        font-size: 1rem;
    }

    .section-heading h2,
    .workspace-header h2 {
        font-size: clamp(1.25rem, 9vw, 2rem);
    }

    .panel-copy {
        display: none;
    }

    .insight-list li {
        font-size: 0.96rem;
        line-height: 1.55;
    }
}

@media (max-width: 420px) {
    .meta-row {
        gap: 10px;
    }

    .ticker-move {
        font-size: 1.2rem;
    }

    .hour-cell strong {
        font-size: 1rem;
    }

    .hour-cell span:last-child {
        font-size: 0.72rem;
    }
}
