/* ═══════════════════════════════════════════════════════════════════
   QUANT SIGNAL ENGINE — Premium Design System
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    /* Core palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2236;
    --bg-card: #141c2f;
    --bg-card-hover: #1a2540;
    --bg-glass: rgba(20, 28, 47, 0.85);
    --bg-input: #0d1320;

    /* Accent colors */
    --accent-primary: #d4af37;
    --accent-primary-glow: rgba(212, 175, 55, 0.3);
    --accent-secondary: #b8860b;
    --accent-gradient: linear-gradient(135deg, #d4af37, #b8860b, #daa520);
    --accent-gradient-hover: linear-gradient(135deg, #f3d566, #d4af37, #ffdf00);

    /* Signal colors */
    --color-long: #10b981;
    --color-long-bg: rgba(16, 185, 129, 0.12);
    --color-long-glow: rgba(16, 185, 129, 0.4);
    --color-short: #ef4444;
    --color-short-bg: rgba(239, 68, 68, 0.12);
    --color-short-glow: rgba(239, 68, 68, 0.4);
    --color-flat: #f59e0b;
    --color-flat-bg: rgba(245, 158, 11, 0.12);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;

    /* Borders */
    --border-color: rgba(148, 163, 184, 0.08);
    --border-hover: rgba(148, 163, 184, 0.15);
    --border-accent: rgba(212, 175, 55, 0.3);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(212, 175, 55, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ── Background Effects ────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 175, 55, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(184, 134, 11, 0.06), transparent),
        radial-gradient(ellipse 50% 50% at 20% 80%, rgba(218, 165, 32, 0.04), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ── Top Bar ───────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 75px;
    background: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.crazy-logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    /* Allow the logo to hang off the topbar */
    z-index: 110;
}

.crazy-logo-img {
    height: 95px;
    /* Huge, overlapping the interface */
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.8));
    animation: majestic-float 4s ease-in-out infinite, royal-glow 3s alternate infinite;
    transform-origin: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: auto;
}

.crazy-logo-img:hover {
    transform: scale(1.15) translateY(-5px);
    filter: drop-shadow(0 0 35px rgba(255, 215, 0, 0.9)) brightness(1.3);
}

@keyframes majestic-float {
    0% {
        transform: translateY(0px) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1.02);
    }

    100% {
        transform: translateY(0px) scale(1);
    }
}

@keyframes royal-glow {
    0% {
        filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 5px rgba(255, 215, 0, 0.2)) drop-shadow(0 0 2px rgba(99, 102, 241, 0.3));
    }

    100% {
        filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 15px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 8px rgba(0, 191, 255, 0.5));
    }
}

.topbar-subtitle {
    font-size: 11px;
    color: #d4af37;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent-primary-glow);
    }

    50% {
        box-shadow: 0 0 0 6px transparent;
    }
}

.topbar-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Main Layout ───────────────────────────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: calc(100vh - 75px);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
}

.sidebar-section-header:hover {
    background: var(--bg-card-hover);
}

.sidebar-section-header h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section-header .icon {
    font-size: 14px;
}

.sidebar-section-header .chevron {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform var(--transition-fast);
}

.sidebar-section.expanded .chevron {
    transform: rotate(180deg);
}

.sidebar-section-body {
    display: none;
    padding: 4px 8px 8px;
}

.sidebar-section.expanded .sidebar-section-body {
    display: block;
}

.symbol-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.symbol-btn:hover {
    background: var(--bg-tertiary);
}

.symbol-btn.active {
    background: var(--accent-primary-glow);
    border: 1px solid var(--border-accent);
}

.symbol-btn .sym-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 12px;
}

.symbol-btn .sym-name {
    font-size: 10px;
    color: var(--text-tertiary);
    text-align: right;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 4px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Config Bar ────────────────────────────────────────────────── */
.config-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.config-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.config-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.tf-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.tf-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 12px var(--accent-primary-glow);
}

.tf-btn.mtf-active {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: white;
}

.config-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    border-radius: var(--radius-sm);
    outline: none;
    text-align: center;
}

.config-input:focus {
    border-color: var(--accent-primary);
}

.config-separator {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 4px;
}

.analyze-btn {
    padding: 8px 24px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-left: auto;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.analyze-btn:hover {
    background: var(--accent-gradient-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.analyze-btn:active {
    transform: translateY(0);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.analyze-btn .spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
}

.analyze-btn.loading .spinner {
    display: inline-block;
}

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

/* ── Welcome State ─────────────────────────────────────────────── */
.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 60px 20px;
}

.welcome-icon {
    font-size: 56px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-text {
    font-size: 14px;
    color: var(--text-tertiary);
    max-width: 480px;
    line-height: 1.6;
}

/* ── Signal Dashboard ──────────────────────────────────────────── */
.signal-dashboard {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.signal-dashboard.visible {
    display: flex;
}

/* Header Row */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dash-symbol {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-symbol-name {
    font-size: 22px;
    font-weight: 700;
}

.dash-symbol-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.dash-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ── Signal Cards Row ──────────────────────────────────────────── */
.tf-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
}

.signal-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.signal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.signal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.signal-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.signal-card:hover::before {
    opacity: 1;
}

.signal-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.signal-card-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.signal-card-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Action badge */
.action-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.action-badge.LONG {
    background: var(--color-long-bg);
    color: var(--color-long);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 20px var(--color-long-glow);
}

.action-badge.SHORT {
    background: var(--color-short-bg);
    color: var(--color-short);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px var(--color-short-glow);
}

.action-badge.FLAT {
    background: var(--color-flat-bg);
    color: var(--color-flat);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ── Win Probability Ring ──────────────────────────────────────── */
.prob-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.prob-ring {
    position: relative;
    width: 80px;
    height: 80px;
}

.prob-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.prob-ring circle {
    fill: none;
    stroke-width: 6;
}

.prob-ring .bg-ring {
    stroke: var(--bg-tertiary);
}

.prob-ring .value-ring {
    stroke: var(--accent-primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.prob-ring .prob-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 700;
}

.prob-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prob-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.prob-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Charts ────────────────────────────────────────────────────── */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 350px;
}

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

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-canvas-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Multi-Timeframe Section ───────────────────────────────────── */
.mtf-section {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.mtf-section.visible {
    display: flex;
}

.mtf-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mtf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.mtf-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition-normal);
}

.mtf-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

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

.mtf-card-tf {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
}

.mtf-card-action {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.mtf-card-action.LONG {
    background: var(--color-long-bg);
    color: var(--color-long);
}

.mtf-card-action.SHORT {
    background: var(--color-short-bg);
    color: var(--color-short);
}

.mtf-card-action.FLAT {
    background: var(--color-flat-bg);
    color: var(--color-flat);
}

.mtf-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mtf-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mtf-stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.mtf-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

/* ── Confluence Bar ────────────────────────────────────────────── */
.confluence-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.confluence-bar-wrapper {
    margin-top: 12px;
}

.confluence-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.confluence-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    transition: width 1s ease-out;
    position: relative;
}

.confluence-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2));
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.confluence-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.confluence-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.confluence-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
}

/* ── Strength Meter ────────────────────────────────────────────── */
.strength-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 8px;
}

.strength-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s ease-out;
}

/* ── Loading Overlay ───────────────────────────────────────────── */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.visible {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Z-Score Gauge ─────────────────────────────────────────────── */
.zscore-gauge {
    position: relative;
    width: 100%;
    height: 40px;
    margin-top: 8px;
}

.zscore-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    transform: translateY(-50%);
    background: linear-gradient(90deg,
            var(--color-long) 0%,
            var(--color-long) 20%,
            var(--color-flat) 35%,
            #6b7280 50%,
            var(--color-flat) 65%,
            var(--color-short) 80%,
            var(--color-short) 100%);
    border-radius: var(--radius-full);
    opacity: 0.5;
}

.zscore-marker {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent-primary);
    transform: translate(-50%, -50%);
    transition: left 0.6s ease-out;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    z-index: 2;
}

.zscore-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

/* ── Next Expected Move Section ────────────────────────────────── */
.next-move-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.next-move-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

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

.next-move-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.next-move-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

.next-move-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.next-move-regime-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.next-move-confidence {
    text-align: right;
}

.nm-conf-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.nm-conf-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Direction row */
.nm-direction-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nm-direction-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px;
    border-radius: var(--radius-full);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.nm-direction-badge.BULLISH {
    background: var(--color-long-bg);
    color: var(--color-long);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px var(--color-long-glow);
}

.nm-direction-badge.BEARISH {
    background: var(--color-short-bg);
    color: var(--color-short);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 15px var(--color-short-glow);
}

.nm-direction-badge.NEUTRAL {
    background: var(--color-flat-bg);
    color: var(--color-flat);
    border-color: rgba(245, 158, 11, 0.3);
}

.nm-trend-meter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.nm-trend-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.nm-trend-bar {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.nm-trend-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    transition: width 0.8s ease-out;
}

.nm-trend-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

/* Price Targets */
.nm-targets {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.nm-target-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

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

.nm-target-high {
    border-top: 2px solid var(--color-short);
}

.nm-target-low {
    border-top: 2px solid var(--color-long);
}

.nm-target-current {
    border-top: 2px solid var(--accent-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nm-target-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.nm-target-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.nm-target-arrow {
    font-size: 18px;
    color: var(--accent-primary);
    margin: 2px 0;
    animation: pulseArrow 1.5s ease-in-out infinite;
}

@keyframes pulseArrow {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Price Range Visual */
.nm-range-visual {
    margin-bottom: 20px;
}

.nm-range-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: linear-gradient(90deg,
            rgba(16, 185, 129, 0.15) 0%,
            rgba(99, 102, 241, 0.1) 50%,
            rgba(239, 68, 68, 0.15) 100%);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    overflow: visible;
}

.nm-range-current-marker {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent-primary);
    transform: translate(-50%, -50%);
    transition: left 0.8s ease-out;
    box-shadow: 0 0 12px var(--accent-primary-glow);
    z-index: 3;
}

.nm-range-target-marker {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-secondary);
    border: 2px solid white;
    transform: translate(-50%, -50%);
    transition: left 0.8s ease-out;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    z-index: 2;
    animation: pulseTarget 2s ease-in-out infinite;
}

@keyframes pulseTarget {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
    }
}

.nm-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
}

/* Strategy */
.nm-strategy {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.nm-strategy-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nm-strategy-icon {
    font-size: 16px;
}

.nm-strategy-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
}

.nm-strategy-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.nm-strategy-detail {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Risk Note */
.nm-risk {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-md);
}

.nm-risk-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.nm-risk-text {
    font-size: 11px;
    color: var(--color-flat);
    line-height: 1.5;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 280px 1fr;
    }
}

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

    .sidebar {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 300px;
        z-index: 99;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open {
        display: flex;
    }

    .config-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .analyze-btn {
        margin-left: 0;
        width: 100%;
    }

    .config-separator {
        display: none;
    }

    .nm-targets {
        grid-template-columns: 1fr;
    }
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

/* stagger children animation */
.stagger-children>* {
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 0.3s;
}

.stagger-children>*:nth-child(7) {
    animation-delay: 0.35s;
}

.stagger-children>*:nth-child(8) {
    animation-delay: 0.4s;
}

/* ── Tooltip ───────────────────────────────────────────────────── */
.tooltip {
    position: absolute;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 200;
    box-shadow: var(--shadow-md);
    max-width: 240px;
}

/* ── Mobile menu toggle ────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* ── Error Toast ───────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--color-short);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--color-long);
}

.toast.warning {
    border-color: var(--color-flat);
    background: rgba(20, 28, 47, 0.95);
    max-width: 500px;
}

/* ── All timeframes selector ───────────────────────────────────── */
.all-tf-btn {
    padding: 6px 16px;
    border: 1px solid var(--accent-secondary);
    background: transparent;
    color: var(--accent-secondary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.all-tf-btn:hover {
    background: rgba(139, 92, 246, 0.1);
}

.all-tf-btn.active {
    background: var(--accent-secondary);
    color: white;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════
   TRADE GUIDE & TRADE SETUP SECTION
   ═══════════════════════════════════════════════════════════════════ */

.trade-guide-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Trade Setup Panel ─────────────────────────────────────────── */
.trade-setup {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.trade-setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
    border-bottom: 1px solid var(--border-color);
}

.trade-setup-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trade-setup-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.trade-setup-icon {
    font-size: 22px;
}

.trade-setup-signal {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trade-setup-signal.LONG {
    background: var(--color-long-bg);
    color: var(--color-long);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.trade-setup-signal.SHORT {
    background: var(--color-short-bg);
    color: var(--color-short);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.trade-setup-signal.FLAT {
    background: var(--color-flat-bg);
    color: var(--color-flat);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.trade-setup-body {
    padding: 20px;
}

/* Trade setup grid */
.ts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ts-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border-left: 3px solid var(--border-color);
    transition: all var(--transition-fast);
}

.ts-item:hover {
    background: var(--bg-card-hover);
}

.ts-item.ts-entry {
    border-left-color: var(--accent-primary);
}

.ts-item.ts-sl {
    border-left-color: var(--color-short);
}

.ts-item.ts-tp1 {
    border-left-color: var(--color-long);
}

.ts-item.ts-tp2 {
    border-left-color: #06b6d4;
}

.ts-item.ts-rr {
    border-left-color: var(--accent-secondary);
}

.ts-item.ts-exit {
    border-left-color: var(--color-flat);
}

.ts-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ts-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.ts-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Trade note */
.ts-note {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ts-note-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.ts-note-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* No trade state */
.ts-no-trade {
    text-align: center;
    padding: 24px;
}

.ts-no-trade-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.ts-no-trade-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.ts-no-trade-text {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.6;
    max-width: 450px;
    margin: 0 auto;
}

/* ── Z-Score Guide (Collapsible) ───────────────────────────────── */
.zscore-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.guide-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.guide-toggle:hover {
    background: rgba(99, 102, 241, 0.05);
}

.guide-toggle-icon {
    font-size: 18px;
}

.guide-chevron {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.guide-chevron.open {
    transform: rotate(180deg);
}

.guide-content {
    display: none;
    padding: 0 20px 20px 20px;
    animation: slideDown 0.3s ease;
}

.guide-content.open {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Guide blocks */
.guide-block {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.guide-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.guide-block-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.guide-block p {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.guide-formula {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    text-align: center;
    letter-spacing: 0.5px;
}

/* Zone illustrations */
.guide-zones {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-zone {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid;
}

.guide-zone p {
    margin: 8px 0 0 0;
    font-size: 12.5px;
}

.guide-zone-buy {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}

.guide-zone-neutral {
    background: rgba(245, 158, 11, 0.04);
    border-color: rgba(245, 158, 11, 0.15);
}

.guide-zone-sell {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

.guide-zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.guide-zone-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.guide-zone-badge.long {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-long);
}

.guide-zone-badge.flat {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-flat);
}

.guide-zone-badge.short {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-short);
}

.guide-zone-range {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
}

/* Steps */
.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.guide-step {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.guide-step:last-child {
    border-bottom: none;
}

.guide-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.guide-step-content {
    flex: 1;
}

.guide-step-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.guide-step-content p {
    font-size: 12.5px;
    margin: 0;
}

/* Inline badges */
.inline-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.inline-badge.long {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-long);
}

.inline-badge.short {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-short);
}

/* Risk rules */
.guide-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guide-rule {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid rgba(148, 163, 184, 0.05);
}

.guide-rule-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.guide-rule span {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════
   TRADE LEVELS — SL / TP1 / TP2 / TP3 with Probability Bars
   ═══════════════════════════════════════════════════════════════════ */

/* Entry row */
.tl-entry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.tl-entry-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tl-entry-icon {
    font-size: 24px;
}

.tl-entry-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-entry-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.tl-entry-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.tl-entry-action {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-entry-z {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Level rows container */
.tl-levels {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* Individual level row */
.tl-row {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border-left: 4px solid;
    transition: all var(--transition-fast);
}

.tl-row:hover {
    background: var(--bg-card-hover);
    transform: translateX(2px);
}

.tl-sl {
    border-left-color: var(--color-short);
}

.tl-tp1 {
    border-left-color: var(--color-long);
}

.tl-tp2 {
    border-left-color: #06b6d4;
}

.tl-tp3 {
    border-left-color: #a855f7;
}

/* Row header: icon + label/price on left, RR + distance on right */
.tl-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tl-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tl-icon {
    font-size: 18px;
}

.tl-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.tl-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 700;
}

.tl-row-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tl-rr {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
}

.tl-dist {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Probability bar row */
.tl-prob-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tl-prob-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.tl-prob-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 2px;
}

.tl-prob-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    min-width: 42px;
    text-align: right;
}

.tl-prob-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 55px;
}

/* Summary row */
.tl-summary {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.tl-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 70px;
}

.tl-summary-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-summary-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   TRADE CONTEXT — Previous & Current Trade Info
   ═══════════════════════════════════════════════════════════════════ */

.tc-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.tc-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tc-item.active {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.tc-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.tc-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.tc-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.tc-badge.LONG {
    background: var(--color-long-bg);
    color: var(--color-long);
}

.tc-badge.SHORT {
    background: var(--color-short-bg);
    color: var(--color-short);
}

.tc-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-top: 4px;
}

/* ── Responsive adjustments ────────────────────────────────────── */
@media (max-width: 768px) {
    .ts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .guide-zone-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .tl-entry-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tl-entry-right {
        align-items: flex-start;
    }

    .tl-row-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .tl-summary {
        flex-wrap: wrap;
    }
}
/* ═══════════════════════════════════════════════════════════════════
   EXTRA MOBILE/TABLET RESPONSIVENESS PATCH (2026-02-23)
   - Improves layout on <= 768px (tablets) and <= 480px (phones)
   - Prevents horizontal overflow from wide cards/grids/tables
   ═══════════════════════════════════════════════════════════════════ */

/* Prevent unexpected horizontal scrolling */
html, body {
    overflow-x: hidden;
}

/* Media elements should never overflow their containers */
img, canvas, video {
    max-width: 100%;
    height: auto;
}

/* Make any accidental wide blocks scroll instead of breaking layout */
.table-scroll,
.pre-scroll,
.code-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    /* Reduce global padding to fit more content */
    .main-content {
        padding: 14px;
    }

    /* Dashboard header stacks nicely */
    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Cards get slightly tighter spacing */
    .signal-card {
        padding: 14px;
    }

    /* Make any two-column grids collapse gracefully */
    .signal-cards-row,
    .dash-grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    /* Some sections use inline grid styles; override for small screens */
    #superCard div[style*="grid-template-columns"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Sidebar overlay: full height with safe padding */
    .sidebar {
        width: min(320px, 92vw);
    }

    /* Config bar inputs and buttons scale better */
    .config-input {
        width: 100%;
        max-width: 220px;
    }
}

@media (max-width: 480px) {
    /* Topbar tighter layout */
    .topbar {
        padding: 10px 12px;
    }

    .topbar-subtitle {
        display: none;
    }

    /* Welcome text sizing */
    .welcome-title {
        font-size: 22px;
    }

    /* Timeframe buttons wrap more comfortably */
    .config-bar {
        gap: 10px;
    }

    .tf-btn,
    .all-tf-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    /* Make any long labels wrap */
    .dash-symbol-name {
        font-size: 18px;
        word-break: break-word;
    }

    /* If any table appears, force scroll instead of overflow */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}



/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE + ANIMATION UPGRADE (2026-02-23 v2)
   - Fixes broken mobile/tablet layout (sidebar overlay, config wrapping)
   - Adds subtle, premium animations (reveal, hover, tap)
   ═══════════════════════════════════════════════════════════════════ */

/* Better defaults for responsive layout */
*, *::before, *::after { box-sizing: border-box; }
.main-content { min-width: 0; } /* prevents grid overflow */
.app-container { min-width: 0; }

/* Smooth motion baseline */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Reveal animation (paired with JS IntersectionObserver) */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(2px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out), filter 500ms var(--ease-out);
  will-change: transform, opacity;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Tap feedback */
button, .tf-btn, .all-tf-btn {
  transition: transform 120ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
button:active, .tf-btn:active, .all-tf-btn:active {
  transform: scale(0.98);
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 75px 0 0 0; /* below topbar */
  background: rgba(0,0,0,0.55);
  z-index: 45;
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}
.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

/* Tablet + mobile layout fixes */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 75px; /* topbar height */
    left: 0;
    height: calc(100vh - 75px);
    width: min(360px, 88vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 260ms var(--ease-out);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    border-right: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Main content full width */
  .main-content {
    padding: 14px;
  }

  /* Config bar wraps and scrolls nicely */
  .config-bar {
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: hidden;
  }
  .config-group {
    flex-wrap: wrap;
    gap: 8px;
  }
  .tf-btn, .all-tf-btn {
    margin: 0;
  }
}

/* Smaller phones */
@media (max-width: 520px) {
  .topbar {
    padding: 10px 12px;
  }

  /* Make config bar a sticky bottom control for mobile */
  .config-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 12px;
    margin: 0 -14px; /* align with main padding */
    border-radius: 0;
    backdrop-filter: blur(10px);
  }

  /* If there are button rows, allow horizontal scroll instead of squish */
  .config-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .config-group::-webkit-scrollbar { height: 6px; }
  .config-group::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

  /* Cards: reduce padding and typography */
  .signal-card, .model-card, .ts-card, .tc-card {
    padding: 12px;
  }

  .welcome-title { font-size: 20px; }
  .dash-symbol-name { font-size: 18px; }

  /* Ensure charts don't overflow */
  canvas { max-width: 100%; }
}

/* Reduce motion accessibility */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
