/* ============================================================
   🤖 MFT BOT DASHBOARD — Design System
   ============================================================ */

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

/* --- DESIGN TOKENS --- */
:root {
    /* Background */
    --bg-base: #060a13;
    --bg-surface: #0d1321;
    --bg-card: #111827;
    --bg-card-hover: #1a2235;
    --bg-sidebar: #0a0f1e;
    --bg-input: #0f1629;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-active: rgba(0, 212, 255, 0.3);

    /* Text */
    --text-primary: #f0f2f5;
    --text-secondary: #8b95a5;
    --text-muted: #4a5568;
    --text-inverse: #060a13;

    /* Accent Colors */
    --accent-cyan: #00d4ff;
    --accent-cyan-dim: rgba(0, 212, 255, 0.15);
    --accent-green: #00ff88;
    --accent-green-dim: rgba(0, 255, 136, 0.15);
    --accent-red: #ff4757;
    --accent-red-dim: rgba(255, 71, 87, 0.15);
    --accent-orange: #ff6b35;
    --accent-orange-dim: rgba(255, 107, 53, 0.15);
    --accent-purple: #a855f7;
    --accent-purple-dim: rgba(168, 85, 247, 0.15);
    --accent-yellow: #fbbf24;
    --accent-yellow-dim: rgba(251, 191, 36, 0.15);

    /* Glassmorphism */
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);
    --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.15);
    --shadow-glow-red: 0 0 20px rgba(255, 71, 87, 0.15);

    /* Sizing */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --header-height: 0px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-smooth: 350ms 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-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* --- LAYOUT --- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-smooth), min-width var(--transition-smooth);
    z-index: 100;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--accent-cyan-dim), transparent);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    display: flex;
    flex-direction: column;
}

.sidebar-logo .logo-title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-cyan), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo .logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Nav Items */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
}

.nav-item.active {
    color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow-cyan);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-cyan);
    border-radius: 0 4px 4px 0;
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.4;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 16px 20px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.engine-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

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

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.status-dot.paper {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px var(--accent-yellow);
    animation: pulse-yellow 2s ease-in-out infinite;
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.status-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px;
    background: var(--bg-base);
    position: relative;
}

.main-content::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -30%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(0, 212, 255, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* --- PAGE HEADER --- */
.page-header {
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.page-header .page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- PAGE TOOLBAR (Next Trade Refresh Bar) --- */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding-top: 6px;
}

.toolbar-timestamp {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    min-width: 140px;
    text-align: center;
}

.toolbar-pill {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
    border: 1px solid rgba(0,212,255,0.15);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}


/* --- CARDS --- */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 1.1rem;
}

/* --- GRID LAYOUTS --- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

/* --- STAT CARDS --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

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

.stat-card.cyan::before { background: var(--accent-cyan); }
.stat-card.green::before { background: var(--accent-green); }
.stat-card.red::before { background: var(--accent-red); }
.stat-card.orange::before { background: var(--accent-orange); }
.stat-card.purple::before { background: var(--accent-purple); }

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

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.02em;
}

.stat-value.cyan { color: var(--accent-cyan); }
.stat-value.green { color: var(--accent-green); }
.stat-value.red { color: var(--accent-red); }
.stat-value.orange { color: var(--accent-orange); }
.stat-value.purple { color: var(--accent-purple); }

.stat-change {
    font-size: 0.75rem;
    margin-top: 6px;
    font-weight: 500;
}

.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-red); }

/* --- TABLES --- */
.data-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--text-secondary);
}

.data-table th .sort-arrow {
    margin-left: 4px;
    opacity: 0.3;
}

.data-table th.sorted .sort-arrow {
    opacity: 1;
    color: var(--accent-cyan);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

/* --- STATUS BADGES --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge.open {
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.badge.closed {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge.stop-loss {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.badge.go {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge.block {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.badge.neutral {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

/* --- GATE STATUS LAMPS --- */
.gate-lamp {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.gate-lamp:hover {
    border-color: var(--border-default);
}

.gate-indicator {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

.gate-indicator.go {
    background: radial-gradient(circle, var(--accent-green), rgba(0, 255, 136, 0.3));
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3), inset 0 0 10px rgba(255, 255, 255, 0.1);
    animation: pulse-green 2.5s ease-in-out infinite;
}

.gate-indicator.block {
    background: radial-gradient(circle, var(--accent-red), rgba(255, 71, 87, 0.3));
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.3), inset 0 0 10px rgba(255, 255, 255, 0.1);
    animation: pulse-red 1.5s ease-in-out infinite;
}

.gate-indicator.neutral {
    background: radial-gradient(circle, var(--accent-yellow), rgba(251, 191, 36, 0.3));
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

.gate-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.gate-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
    color: var(--text-inverse);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #00cc6a);
    color: var(--text-inverse);
    box-shadow: 0 2px 10px rgba(0, 255, 136, 0.2);
}

.btn-success:hover {
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #cc2233);
    color: #fff;
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-outline:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent-cyan);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* --- FORM ELEMENTS --- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b95a5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-track {
    width: 48px;
    height: 26px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 13px;
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toggle-track.active {
    background: var(--accent-cyan-dim);
    border-color: var(--accent-cyan);
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all var(--transition-fast);
}

.toggle-track.active .toggle-thumb {
    left: 24px;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- PROGRESS BAR --- */
.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
}

.progress-fill.cyan {
    background: linear-gradient(90deg, var(--accent-cyan), #0099cc);
}

.progress-fill.green {
    background: linear-gradient(90deg, var(--accent-green), #00cc6a);
}

.progress-fill.red {
    background: linear-gradient(90deg, var(--accent-red), #cc2233);
}

.progress-fill.orange {
    background: linear-gradient(90deg, var(--accent-orange), #cc5522);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* --- GAUGE / INDICATOR --- */
.gauge-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.gauge-row:last-child {
    border-bottom: none;
}

.gauge-name {
    width: 80px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.gauge-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

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

.gauge-value {
    width: 70px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* --- CHART CONTAINER --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

/* --- HEADLINE LIST --- */
.headline-list {
    list-style: none;
}

.headline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.headline-item:last-child {
    border-bottom: none;
}

.headline-item:hover {
    background: rgba(255, 255, 255, 0.02);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: var(--radius-sm);
}

.headline-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
    min-width: 80px;
}

.headline-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.headline-source {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    margin-top: 3px;
}

/* --- ALERT BANNERS --- */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.85rem;
    border: 1px solid;
}

.alert-banner.info {
    background: var(--accent-cyan-dim);
    border-color: rgba(0, 212, 255, 0.2);
    color: var(--accent-cyan);
}

.alert-banner.success {
    background: var(--accent-green-dim);
    border-color: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.alert-banner.warning {
    background: var(--accent-orange-dim);
    border-color: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
}

.alert-banner.danger {
    background: var(--accent-red-dim);
    border-color: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

/* --- DB ACTION BUTTONS (prominent, zentraler Bereich) --- */
.db-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 12px;
}

.db-action-card {
    background: var(--bg-card);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.db-action-card:hover {
    border-color: var(--accent-cyan);
    border-style: solid;
    background: var(--accent-cyan-dim);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-cyan);
}

.db-action-card .db-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.db-action-card .db-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.db-action-card .db-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* --- FILE UPLOAD --- */
.upload-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-card);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
}

.upload-zone .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.upload-zone .upload-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-zone .upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- SCORE COMPARISON --- */
.score-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.score-model {
    width: 120px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.score-track {
    flex: 1;
    height: 28px;
    background: var(--bg-input);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-inverse);
    transition: width 1s ease;
    min-width: 40px;
}

.score-fill.bullish {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.6), var(--accent-green));
}

.score-fill.bearish {
    background: linear-gradient(90deg, rgba(255, 71, 87, 0.6), var(--accent-red));
}

.score-fill.neutral-score {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.6), var(--accent-yellow));
}

/* --- ANIMATIONS --- */
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 8px var(--accent-green); }
    50% { box-shadow: 0 0 20px var(--accent-green), 0 0 40px rgba(0, 255, 136, 0.2); }
}

@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 6px var(--accent-yellow); }
    50% { box-shadow: 0 0 16px var(--accent-yellow), 0 0 30px rgba(251, 191, 36, 0.15); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 8px var(--accent-red); }
    50% { box-shadow: 0 0 20px var(--accent-red), 0 0 40px rgba(255, 71, 87, 0.2); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

/* --- LOADING SPINNER --- */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- EMPTY STATE --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 1400px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .db-actions { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left var(--transition-smooth);
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 20px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- MODAL OVERLAY --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

.toast.success {
    background: var(--accent-green-dim);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--accent-green);
}

.toast.error {
    background: var(--accent-red-dim);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--accent-red);
}

.toast.info {
    background: var(--accent-cyan-dim);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--accent-cyan);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- NEXT TRADE PREVIEW: SIGNAL AMPEL --- */
.signal-traffic-light {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    border-radius: var(--radius-lg);
    border: 2px solid;
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.signal-traffic-light::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background: radial-gradient(circle at 50% 0%, currentColor, transparent 70%);
}
.signal-traffic-light.ready {
    border-color: var(--accent-green);
    color: var(--accent-green);
    background: var(--accent-green-dim);
    box-shadow: 0 0 40px rgba(0,255,136,0.12);
    animation: pulse-green 3s ease-in-out infinite;
}
.signal-traffic-light.watch {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
    background: var(--accent-yellow-dim);
    box-shadow: 0 0 30px rgba(251,191,36,0.1);
}
.signal-traffic-light.block {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: var(--accent-red-dim);
    box-shadow: 0 0 40px rgba(255,71,87,0.12);
    animation: pulse-red 2s ease-in-out infinite;
}
.signal-traffic-light.no-data {
    border-color: var(--border-default);
    color: var(--text-muted);
    background: var(--bg-card);
}
.signal-traffic-light .signal-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 8px;
}
.signal-traffic-light .signal-label {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
}
.signal-traffic-light .signal-sub {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.75;
    font-weight: 500;
}

/* --- SIGNAL REASON LIST --- */
.signal-reason-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}
.signal-reason-item.ok {
    background: rgba(0,255,136,0.05);
    border-color: rgba(0,255,136,0.12);
}
.signal-reason-item.nok {
    background: rgba(255,71,87,0.05);
    border-color: rgba(255,71,87,0.12);
}
.signal-reason-item.neutral {
    background: rgba(251,191,36,0.05);
    border-color: rgba(251,191,36,0.12);
}
.signal-reason-label {
    flex: 1;
    font-weight: 500;
}
.signal-reason-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.signal-reason-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* --- SPARKLINE MINI CHART --- */
.sparkline-wrap {
    position: relative;
    height: 60px;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
}
.sparkline-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- TRADE PATH CANVAS --- */
.trade-path-wrap {
    position: relative;
    height: 100px;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
}
.trade-path-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- PRICE SOURCE BADGE --- */
.price-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 6px;
}
.price-source-badge.binance {
    background: rgba(240,185,11,0.15);
    color: #f0b90b;
    border: 1px solid rgba(240,185,11,0.3);
}
.price-source-badge.db {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid rgba(0,255,136,0.2);
}
.price-source-badge.demo {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
    border: 1px solid rgba(251,191,36,0.2);
}

/* --- WHALE FLOW RANGE BAR --- */
.whale-flow-range {
    position: relative;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0;
}
.whale-flow-fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
    transition: all 0.8s ease;
}
.whale-flow-fill.bullish { background: linear-gradient(90deg, var(--accent-green), rgba(0,255,136,0.4)); }
.whale-flow-fill.bearish { background: linear-gradient(90deg, rgba(255,71,87,0.4), var(--accent-red)); }

/* ============================================================
   🗺️ FEATURE HEATMAP ANALYTICS (Neu in V2.0)
   ============================================================ */

.heatmap-grid {
    display: grid;
    /* Flexibles Layout: so viele Kästchen nebeneinander wie reinpassen */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 16px;
}

.heatmap-cell {
    border-radius: var(--radius-sm);
    padding: 16px 8px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: help;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.heatmap-cell:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: var(--shadow-md);
    border-color: rgba(255,255,255,0.4);
    z-index: 10;
}

/* Background Glanz-Effekt für den Hover */
.heatmap-cell::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.heatmap-cell:hover::after {
    opacity: 1;
}

/* --- UPDATE: Größere & besser lesbare Heatmap-Zahlen --- */
.heatmap-val {
    font-family: 'Inter', sans-serif; /* Weg von der Code-Schrift, hin zu klarer Schrift */
    font-weight: 800;
    font-size: 1.25rem; /* +25% größer (vorher 1.0rem) */
    color: #fff;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8); /* Stärkerer Schatten für besseren Kontrast */
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.heatmap-ret {
    font-family: 'Inter', sans-serif;
    font-size: 1.0rem; /* +25% größer (vorher 0.8rem) */
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.35); /* Dunklerer Hintergrund für die Prozentzahl */
    border-radius: 6px;
    padding: 4px 8px; /* Etwas mehr Platz um die Zahl */
    display: inline-block;
    margin: 0 auto;
}

.heatmap-count {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem; /* +25% größer (vorher 0.7rem) */
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    margin-top: 8px;
    font-weight: 600;
}

/* Legende */
.heatmap-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0,0,0,0.1);
}

.heatmap-legend-bar {
    width: 150px;
    height: 8px;
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.heatmap-legend-density {
    /* Zeigt die Alpha-Transparenz */
    background: linear-gradient(90deg, rgba(0,212,255,0.1), rgba(0,212,255,1));
}

.heatmap-legend-return {
    /* Zeigt Rot bis Grün */
    background: linear-gradient(90deg, var(--accent-red), rgba(255,255,255,0.1), var(--accent-green));
}

