:root {
    --navbar-height: 72px;
    --primary-color: #BE123C;  /* Darker rose/red to match logo */
    --success-color: #10B981;
    --danger-color: #EF4444;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --bg-page: #F9FAFB;
    --bg-white: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Hide i18n elements until translations load - prevents flash of untranslated content */
[data-i18n]:not(.i18n-loaded) {
    visibility: hidden;
}

/* Show elements once translations are applied */
.i18n-ready [data-i18n],
[data-i18n].i18n-loaded {
    visibility: visible;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Open Sans', 'Roboto', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
}

/* Top Navigation Bar - Horizontal */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0;
}

.navbar-brand img:first-child {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.brand-text-img {
    height: 20px;
    width: auto;
    object-fit: contain;
    margin-left: -2px;
}

/* Hide text image on narrow desktop to prevent overlap with nav */
@media (max-width: 1100px) and (min-width: 769px) {
    .brand-text-img {
        display: none;
    }
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1;
    margin-top: -4px;
    margin-left: -8px;
}

.brand-arena {
    color: var(--text-primary);
    /* color: var(--primary-color); */
}

/* Status indicator - aligned with content area right edge */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.nav-item {
    position: relative;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    font-size: 1.0rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0.3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.2s ease;
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-item:hover::after {
    width: 80%;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active::after {
    width: 80%;
}

/* Main Content */
.main-content {
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}


.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    padding: 1rem 1.5rem;
    transition: all 0.2s;
}

.status-indicator:hover {
    color: var(--text-primary);
}

.status-indicator:active {
    opacity: 0.7;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-dot.spinning {
    animation: spin-continuous 1s linear infinite;
}

@keyframes spin-continuous {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.content-area {
    padding: 0.5rem 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Reasoning Messages - Chat-like (nof1.ai inspired) */
.reasoning-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.reasoning-message {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.reasoning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.reasoning-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.reasoning-text {
    min-width: 0;
}

.reasoning-chart {
    display: flex;
    align-items: center;
    justify-content: center;
}

.reasoning-chart img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: opacity 0.2s;
}

.reasoning-chart img:hover {
    opacity: 0.85;
}

.reasoning-symbol {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.reasoning-time {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.reasoning-badges {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Hide mobile-only line breaks on desktop */
.mobile-only {
    display: none;
}

.badge-long {
    background: #D1FAE5;
    color: #065F46;
}

.badge-short {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-skip {
    background: #F3F4F6;
    color: #6B7280;
}

.badge-hold {
    background: #FEF3C7;
    color: #92400E;
}

/* Filter Card Styles */
.filter-card {
    padding: 1rem 2rem !important;
    order: -1 !important;
    margin-bottom: -1.5rem !important;  /* Add this line with your desired spacing */
}

/* Strategy Tabs Container - shared across sections */
.strategy-tabs-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}

/* Legacy class for backward compatibility */
.strategy-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.strategy-tab {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.strategy-tab:hover {
    background: var(--bg-white);
    color: var(--text-primary);
}

.strategy-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: none;
}

/* Chart Filter Buttons */
.chart-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.chart-filter {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-filter:hover {
    background: var(--bg-white);
    color: var(--text-primary);
}

.chart-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: none;
}

.chart-card.hidden {
    display: none;
}

/* When filtered to single chart, limit its max width */

/* Analysis Section */
.analysis-section {
    margin-bottom: 2rem;
}

.analysis-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    text-align: justify;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Collapsible content for mobile */
.analysis-content.collapsed {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.analysis-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--bg-white));
    pointer-events: none;
}

.expand-toggle {
    display: none;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.expand-toggle:hover {
    background: var(--primary-color);
    color: white;
}

.analysis-divider {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

/* Trader Decision Section */
.trader-section {
    background: var(--bg-page);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.trader-decision {
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.6;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    word-break: break-word;
}

/* Chart Container */
.chart-container {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Dashboard section - needs gap from nav */
#dashboard-section {
    padding-top: 1.5rem !important;
}

/* Dashboard chart container - proper height */
#dashboard-section .chart-container {
    margin-top: 0;
    height: calc(100vh - 14rem) !important;
}

#dashboard-section .chart-container canvas {
    height: calc(100% - 3rem) !important;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Analytics Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

/* Charts Navigation Buttons */
.charts-nav-buttons {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.charts-nav-buttons.visible {
    display: flex;
}

.charts-nav-buttons .col-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a1a1a;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: none;
}

.charts-nav-buttons .col-toggle-btn:hover {
    opacity: 0.8;
}

.chart-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s;
    position: relative;
}

.chart-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


.chart-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.chart-image.loaded {
    opacity: 1;
}

.chart-loading {
    position: absolute;
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

.chart-image.loaded ~ .chart-loading {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Clickable Chart Cursor */
.clickable-chart {
    cursor: pointer;
    transition: opacity 0.2s;
}

.clickable-chart:hover {
    opacity: 1;
}

/* Chart Modal (Full-Screen Lightbox) */
.chart-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(4px);
}

.chart-modal-content {
    margin: auto;
    display: block;
    max-width: 95%;
    max-height: 95%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: zoomIn 0.3s;
    transition: opacity 0.5s ease, filter 0.5s ease;
}

@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.chart-modal-close {
    position: absolute;
    top: 2rem;
    right: 3rem;
    color: #fff;
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.2s;
}

.chart-modal-close:hover {
    color: #bbb;
}

/* Responsive charts */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Tables */
.table-container {
    position: relative;
    background: var(--bg-white);
    border-radius: 12px;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Scroll wrapper handles horizontal overflow */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;  /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}

.table-scroll-wrapper::-webkit-scrollbar {
    display: none;  /* Chrome, Safari, Opera */
}

/* Scroll hint button - hidden by default on desktop */
.scroll-hint-btn {
    display: none;
}

/* Column toggle - DESKTOP: hide toggle, show all columns */
.col-toggle {
    display: none;
}

.col-toggle-btn {
    display: none;
}

/* On desktop, all column groups visible */
.col-group-a,
.col-group-b {
    display: table-cell;
}

.table-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Copy Trading Badge */
.copy-badge-container {
    position: static;
    display: flex;
    align-items: center;
}

.copy-badge {
    background: #FEF3C7;
    color: #92400E;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.3);
}

.copy-badge:hover {
    background: #FDE68A;
}

/* Smaller copy badge on mobile - match .badge mobile sizing */
@media (max-width: 768px) {
    .copy-badge {
        padding: 0.15rem 0.3rem;
        font-size: 0.55rem;
    }
}

/* Backdrop overlay - click to close */
.copy-tooltip-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    cursor: pointer;
}

.copy-tooltip-backdrop.active {
    display: block;
}

.copy-tooltip {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: 90vw;
    background: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.7;
    color: #1f2937;
}

.copy-tooltip.active {
    display: block;
}

.copy-tooltip-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 28px;
    height: 28px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 1.1rem;
    color: #6b7280;
    transition: all 0.2s;
}

.copy-tooltip-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.copy-tooltip-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #111827;
}

.copy-tooltip-intro {
    color: #4b5563;
    margin-bottom: 1rem;
}

.copy-tooltip-steps {
    margin: 1.25rem 0;
    padding-left: 1.5rem;
    color: #374151;
}

.copy-tooltip-steps li {
    margin-bottom: 0.85rem;
}

.copy-tooltip-steps a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.copy-tooltip-steps a:hover {
    text-decoration: underline;
}

.copy-tooltip-steps code {
    background: #f3f4f6;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #dc2626;
}

.copy-tooltip-note {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-page);
}

.data-table th {
    padding: 1rem 2rem;
    text-align: justify;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.data-table tbody tr:hover {
    background: var(--bg-page);
}

/* Trading section tables - consistent width across all tables */
#trading-section .table-container {
    max-width: 950px;
    margin: 0 auto;
}

#trading-section .data-table {
    width: 100%;
    table-layout: fixed;
}

/* Trading section tables - aligned columns (8 visible + toggle) */
#trading-section .data-table th:nth-child(1),
#trading-section .data-table td:nth-child(1) {
    width: 110px;  /* СИМВОЛ */
    white-space: nowrap;
}

#trading-section .data-table th:nth-child(2),
#trading-section .data-table td:nth-child(2) {
    width: 140px;  /* НАПРАВЛЕНИЕ */
}

#trading-section .data-table th:nth-child(3),
#trading-section .data-table td:nth-child(3) {
    width: 100px;  /* ВХОД */
}

#trading-section .data-table th:nth-child(4),
#trading-section .data-table td:nth-child(4) {
    width: 110px;  /* ТЕКУЩАЯ / ВЫХОД */
}

#trading-section .data-table th:nth-child(5),
#trading-section .data-table td:nth-child(5) {
    width: 100px;  /* SL */
}

#trading-section .data-table th:nth-child(6),
#trading-section .data-table td:nth-child(6) {
    width: 100px;  /* TP */
}

#trading-section .data-table th:nth-child(7),
#trading-section .data-table td:nth-child(7) {
    width: 130px;  /* ВРЕМЯ */
}

#trading-section .data-table th:nth-child(8),
#trading-section .data-table td:nth-child(8) {
    width: 160px;  /* РЕЗУЛЬТАТ */
}

/* DESKTOP ONLY: Time column no wrap */
@media (min-width: 769px) {
    /* Time header cells - no wrap */
    #trading-section .data-table th[data-i18n="trading.positions.time"],
    #trading-section .data-table th[data-i18n="trading.orders.placed"],
    #trading-section .data-table th[data-i18n="trading.trades.time"] {
        white-space: nowrap;
    }

    /* Time data cells: all tables column 7 */
    #trading-section .data-table td:nth-child(7) {
        white-space: nowrap;
    }

    /* Trades table placeholder columns (5 & 6) - keep visible but empty for alignment */
}

.positive {
    color: var(--success-color);
    font-weight: 600;
}

.negative {
    color: var(--danger-color);
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-text {
    font-size: 1.1rem;
}

/* Mobile Logo - Hidden on desktop */
.mobile-logo {
    display: none;
}

/* Mobile Navigation - Hidden on desktop */
.mobile-nav {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Hide desktop top navbar on mobile */
    .top-navbar {
        display: none;
    }

    /* Show mobile logo */
    .mobile-logo {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin-top: 0.5rem;
        margin-bottom: -0.5rem;
    }

    .mobile-logo img:first-child {
        width: 120px;
        height: 120px;
        object-fit: contain;
    }

    .mobile-logo .brand-text-img {
        display: none;
    }

    /* Remove top margin and add bottom padding for mobile nav */
    .main-content {
        margin-top: 0;
        padding-bottom: 60px;
    }

    .content-area {
        padding: 0.75rem;
    }

    /* Show mobile navigation */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-white);
        border-top: 1px solid var(--border-color);
        padding: 0.25rem 0 0.5rem 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        height: 60px;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-end;
        padding: 0.5rem 0.5rem 0.25rem;
        color: var(--text-secondary);
        text-decoration: none;
        cursor: pointer;
        transition: color 0.2s;
    }

    .mobile-nav-item i {
        font-size: 1.3rem;
        margin-bottom: 0.15rem;
    }

    .mobile-nav-icon {
        width: 1.5rem;
        height: 1.5rem;
        margin-bottom: 0.35rem;
        position: relative;
        top: 0;
    }

    .mobile-nav-icon-results {
        width: 1.65rem;
        height: 1.65rem;
    }

    .mobile-nav-icon-trading {
        width: 1.5rem;
        height: 1.5rem;
    }

    .mobile-nav-icon-indicators {
        width: 1.75rem;
        height: 1.75rem;
    }

    .mobile-nav-icon-logic {
        width: 1.5rem;
        height: 1.5rem;
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
        line-height: 1;
    }

    .mobile-nav-item.active {
        color: var(--primary-color);
    }

    .mobile-nav-item:hover {
        color: var(--primary-color);
    }

    /* Reasoning cards - vertical layout */
    .reasoning-body {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Reduce spacing between reasoning cards - match Trading section */
    .reasoning-list {
        gap: 0.75rem !important;
    }

    .reasoning-message {
        margin-bottom: 0 !important;
        padding: 1rem !important;
        padding-bottom: 0.5rem !important;
    }

    .trader-decision {
        margin-bottom: 0 !important;
    }

    /* Keep badges on same line as symbol/date on mobile */
    .reasoning-header {
        gap: 0.5rem;
        margin-bottom: 0.75rem !important;
        padding-bottom: 0.5rem !important;
    }

    .reasoning-header > div:first-child {
        flex-shrink: 1;
        min-width: 0;
    }

    .reasoning-badges {
        display: flex;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem !important;
    }

    /* Larger badges only for reasoning/analysis cards */
    .reasoning-header .badge {
        font-size: 0.6rem !important;
        padding: 0.25rem 0.4rem !important;
    }

    .reasoning-header .badge-risk {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.35rem !important;
        text-align: center;
        line-height: 1.3;
    }

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

    /* Strategy tabs - smaller on mobile */
    .strategy-tab {
        padding: 0.35rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .strategy-tabs-container {
        gap: 0.35rem !important;
        margin-bottom: 0.5rem !important;
        padding: 0.5rem 0 !important;
    }

    /* Show expand toggle on mobile */
    .expand-toggle {
        display: block;
    }

    /* Reduce analysis content font size on mobile */
    .analysis-section {
        margin-bottom: 0 !important;
    }

    .analysis-content {
        font-size: 0.85rem;
        line-height: 1.5;
        white-space: pre-line;
    }

    /* Remove margins around reasoning charts */
    .reasoning-chart {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .reasoning-chart > div {
        min-height: 250px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .reasoning-chart img {
        margin: 0 !important;
    }

    .expand-toggle {
        margin-top: 0.5rem !important;
    }

    /* Global font size reductions for mobile */
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    .reasoning-symbol {
        font-size: 0.95rem !important;
        white-space: nowrap;
    }

    .reasoning-time {
        font-size: 0.65rem !important;
    }

    /* Trader decision card - reduce font size */
    .trader-decision {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }

    /* Reduce gap between trader decision text and execution badges */
    .reasoning-text > div[style*="margin-top"] {
        margin-top: 0.4rem !important;
        margin-bottom: 0.5rem !important;
        gap: 0.1rem !important;
    }

    /* Override inline margin-right on execution badges */
    .reasoning-text > div[style*="margin-top"] .badge {
        margin-right: 0 !important;
    }

    /* Filter card - reduce size and match card gap */
    .filter-card {
        padding: 0.5rem 1rem !important;
        margin-bottom: 0 !important;
    }

    .table-header {
        font-size: 0.85rem !important;
        padding: 0.6rem 0.85rem !important;
    }

    /* Trading section tables */
    .table-container {
        margin-bottom: 0.75rem !important;
    }

    /* Keep horizontal scroll as fallback */
    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Table needs min-width to enable scrolling */
    #trading-section table {
        min-width: 500px;
        font-size: 0.65rem;
    }

    /* Column Group Toggle System - MOBILE ONLY */
    /* Group A: Primary columns (visible by default) */
    /* Group B: Secondary columns (hidden by default, shown on toggle) */

    #trading-section .col-group-b {
        display: none !important;
    }

    #trading-section .data-table.show-group-b .col-group-a {
        display: none !important;
    }

    #trading-section .data-table.show-group-b .col-group-b {
        display: table-cell !important;
    }

    /* Toggle cell (always visible on mobile) */
    #trading-section .col-toggle,
    #trading-section th.col-toggle,
    #trading-section td.col-toggle {
        display: table-cell !important;
        width: 40px !important;
        min-width: 40px !important;
        padding: 0.3rem !important;
        text-align: center !important;
        vertical-align: middle !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #trading-section .col-toggle-btn {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: #1a1a1a;
        color: white;
        border: none;
        cursor: pointer;
        font-size: 0.8rem;
        font-weight: bold;
        box-shadow: none;
        transition: transform 0.15s, background 0.15s;
    }

    #trading-section .col-toggle-btn:active {
        transform: scale(0.9);
    }

    /* Group A and B columns - left-aligned */
    #trading-section .col-group-a,
    #trading-section .col-group-b {
        text-align: left !important;
        padding: 0.45rem 0.5rem !important;
    }

    /* Non-trading tables keep scroll behavior */
    table:not(#trading-section table) {
        min-width: 550px;
        font-size: 0.65rem;
    }

    th {
        padding: 0.35rem 0.45rem !important;
        font-size: 0.6rem !important;
        font-weight: 600 !important;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    td {
        padding: 0.45rem 0.65rem !important;
        font-size: 0.7rem !important;
    }

    /* Empty state - make MUCH smaller and left-aligned on mobile */
    .empty-state {
        padding: 0.5rem !important;
        text-align: left !important;
    }

    .empty-icon {
        font-size: 1.25rem !important;
        margin-bottom: 0 !important;
        display: inline-block !important;
        margin-right: 0.5rem !important;
        vertical-align: middle !important;
    }

    .empty-text {
        font-size: 0.65rem !important;
        color: var(--text-muted) !important;
        display: inline !important;
        vertical-align: middle !important;
    }

    /* Reduce section spacing in Trading */
    .trading-section .table-header {
        margin-top: 0.5rem !important;
    }

    /* Performance section fixes */
    .chart-container {
        height: 350px !important;
        margin-bottom: 1.5rem;
    }

    #portfolioChart {
        height: 100% !important;
        max-height: none !important;
    }

    /* Hide performance chart in portrait mode (show only in landscape) */
    @media (max-width: 768px) and (orientation: portrait) {
        #dashboard-section .chart-container {
            display: none !important;
        }

        /* NOTE: Rotate message is now in HTML (.rotate-message div), not CSS pseudo-element */

        /* Portrait: remove min-width so table fits screen */
        #trading-section table {
            min-width: 0 !important;
            width: 100% !important;
        }

        /* Portrait: use table-layout fixed for predictable widths */
        #trading-section table {
            table-layout: fixed !important;
        }

        /* Portrait: balanced widths for СИМВОЛ/СТОРОНА/ВХОД/ТЕКУЩАЯ */
        #trading-section .data-table th.col-group-a:nth-child(1),
        #trading-section .data-table td.col-group-a:nth-child(1) {
            width: 22% !important;
        }

        #trading-section .data-table th.col-group-a:nth-child(2),
        #trading-section .data-table td.col-group-a:nth-child(2) {
            width: 22% !important;
        }

        #trading-section .data-table th.col-group-a:nth-child(3),
        #trading-section .data-table td.col-group-a:nth-child(3) {
            width: 18% !important;
        }

        #trading-section .data-table th.col-group-a:nth-child(4),
        #trading-section .data-table td.col-group-a:nth-child(4) {
            width: 32% !important;
        }

        /* Portrait: column widths for Group B */
        #trading-section .data-table th.col-group-b:nth-child(5),
        #trading-section .data-table td.col-group-b:nth-child(5) {
            width: 20% !important;
        }

        #trading-section .data-table th.col-group-b:nth-child(6),
        #trading-section .data-table td.col-group-b:nth-child(6) {
            width: 20% !important;
        }

        #trading-section .data-table th.col-group-b:nth-child(7),
        #trading-section .data-table td.col-group-b:nth-child(7) {
            width: 25% !important;
        }

        #trading-section .data-table th.col-group-b:nth-child(8),
        #trading-section .data-table td.col-group-b:nth-child(8) {
            width: 25% !important;
        }

        /* Portrait: toggle column - minimal width */
        #trading-section .col-toggle {
            width: 6% !important;
            min-width: 32px !important;
        }

        /* FORCE toggle visible in portrait mode */
        #trading-section .col-toggle,
        #trading-section th.col-toggle,
        #trading-section td.col-toggle {
            display: table-cell !important;
            visibility: visible !important;
        }

        #trading-section .col-toggle-btn {
            display: inline-flex !important;
            visibility: visible !important;
        }

        #trading-section .col-group-b {
            display: none !important;
        }

        #trading-section .data-table.show-group-b .col-group-a {
            display: none !important;
        }

        #trading-section .data-table.show-group-b .col-group-b {
            display: table-cell !important;
            white-space: nowrap !important;
            width: 22% !important;
            padding-right: 12px !important;
        }
    }

    /* Make performance chart smaller in landscape mobile mode */
    @media (max-width: 768px) and (orientation: landscape) {
        /* Hide nav menu in landscape mode for full screen */
        .mobile-nav {
            display: none !important;
        }

        /* Remove bottom padding since nav is hidden */
        .main-content {
            padding-bottom: 0 !important;
        }

        #dashboard-section .chart-container {
            height: calc(100dvh - 0.5rem) !important;
            max-height: calc(100vh - 0.5rem) !important;
            margin: 0 !important;
            width: 100vw !important;
            position: relative;
            left: 50%;
            right: 50%;
            margin-left: -50vw !important;
            margin-right: -50vw !important;
            padding: 0.25rem 0.5rem !important;
        }

        /* Remove all content padding for full width */
        #dashboard-section {
            padding: 0 !important;
            margin: 0 !important;
        }

        .content-area {
            padding: 0 !important;
        }

        /* Make heading bigger and reduce gap to chart */
        #dashboard-section .chart-title {
            font-size: 1.1rem !important;
            margin-bottom: 0 !important;
        }

        /* Reduce gap between title and chart - override inline style */
        #dashboard-section .chart-container > div[style*="position: relative"] {
            margin-bottom: 0.25rem !important;
        }

        /* Make legend text smaller - target first child (legend div) */
        #dashboard-section .chart-container > div:first-child {
            font-size: 0.7rem !important;
            gap: 0.75rem !important;
            margin-bottom: 0 !important;
        }

        #dashboard-section .chart-container > div:first-child span {
            font-size: 0.7rem !important;
        }

        /* Make canvas fill available space */
        #dashboard-section .chart-container canvas {
            height: calc(100% - 1rem) !important;
            width: 100% !important;
        }
    }

    .stat-card {
        padding: 0.75rem !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
    }

    .stat-label {
        font-size: 0.75rem !important;
    }

    /* Indicator/Chart cards - reduce size */
    .chart-card {
        padding: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .charts-grid {
        gap: 0.5rem !important;
        margin-top: 1rem !important;
        margin-bottom: 0.15rem !important;
    }

    .charts-nav-buttons {
        margin-top: -0.25rem;
        margin-bottom: 0.25rem;
    }

    .charts-nav-buttons .col-toggle-btn {
        width: 24px;
        height: 24px;
    }

    .chart-card-title {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }

    .chart-wrapper {
        min-height: 200px !important;
    }

    .chart-image {
        max-height: 200px !important;
        object-fit: contain;
    }

    .chart-loading {
        font-size: 0.65rem !important;
    }

    /* Reasoning empty state - centered, compact */
    #reasoning-section > .reasoning-list > .empty-state {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center !important;
        min-height: 25vh !important;
        padding: 2rem 1.5rem 1.5rem !important;
    }

    #reasoning-section > .reasoning-list > .empty-state .empty-icon {
        font-size: 2rem !important;
        display: block !important;
        margin-bottom: 0.5rem !important;
    }

    #reasoning-section > .reasoning-list > .empty-state .empty-text {
        font-size: 0.85rem !important;
        display: block !important;
    }

    /* Chart filters - 2-column grid on mobile */
    .chart-filters {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        margin: 1.25rem 0 0.5rem;
    }

    .chart-filter {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.75rem !important;
        text-align: center;
    }

    .chart-filter-all {
        display: none !important;
    }

    /* Center last visible button (DXY) when "Все" is hidden */
    .chart-filter:nth-last-child(2) {
        grid-column: 1 / -1;
        justify-self: center;
        width: calc(50% - 0.2rem);
    }
}

/* ============================================
   Strategy Stats Cards (Mobile Portrait Only)
   ============================================ */

/* Hidden on desktop and landscape by default */
.strategy-cards-container {
    display: none;
}

.rotate-message {
    display: none;
}

.strategy-stats-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.strategy-stats-header {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.025em;
}

.strategy-stats-header.alpha {
    background: linear-gradient(135deg, #BE123C 0%, #990E31 100%);
}

.strategy-stats-header.beta {
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
}

.strategy-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border-color);
}

.stat-cell {
    background: var(--bg-white);
    padding: 0.6rem 0.75rem;
    text-align: center;
}

.stat-cell-full {
    grid-column: span 2;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.strategy-stats-loading,
.strategy-stats-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Portrait mode on mobile: Show strategy cards and rotate message */
@media (max-width: 768px) and (orientation: portrait) {
    /* Make dashboard section fill available viewport height (only when active) */
    #dashboard-section.active {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100vh - 8rem) !important; /* viewport minus bottom nav + browser chrome */
        padding: 2.5rem 0.4rem 0.4rem 0.4rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .strategy-cards-container {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        gap: 0.4vh !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .strategy-stats-card {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-height: 0 !important;
    }

    .strategy-stats-header {
        padding: 0.6vh 0.5rem !important;
        font-size: 1.8vh !important;
        flex-shrink: 0 !important;
    }

    .strategy-stats-grid {
        flex: 1 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: repeat(5, 1fr) !important;
        gap: 1px !important;
    }

    .strategy-stats-card .stat-cell {
        padding: 0.2vh 0.3rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .strategy-stats-card .stat-label {
        font-size: 1.2vh !important;
        margin-bottom: 0 !important;
    }

    .strategy-stats-card .stat-value {
        font-size: 1.8vh !important;
    }

    /* Show rotate message */
    .rotate-message {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 1.2vh 0.75rem !important;
        color: var(--text-secondary) !important;
        font-size: 1.8vh !important;
        background: var(--bg-white) !important;
        border-radius: 6px !important;
        margin: 0.4vh 0 0 0 !important;
        border: 1px solid var(--border-color) !important;
        flex: 0 0 auto !important;
    }

    /* Hide chart in portrait mode */
    #dashboard-section .chart-container {
        display: none !important;
    }
}

/* Floating Close Button - for narrow screens (Windows Telegram) */
.floating-close-btn {
    display: none;
    position: fixed;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1001;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

@media (max-width: 768px) {
}

/* Hide floating close button on dashboard page */
body:has(#dashboard-section.active) .floating-close-btn {
    display: none !important;
}

/* Show floating close button only on Windows Telegram Desktop */
.windows-tdesktop .floating-close-btn {
    display: flex;
}

/* Filtered chart - fit in viewport */
.charts-grid.filtered .chart-card {
    margin-bottom: -0.5rem;
    max-width: 98%;
    margin: 0 auto;
}

.charts-grid.filtered .chart-wrapper {
    min-height: auto;
}

.charts-grid.filtered .chart-image {
    max-height: 28vh !important;
    width: auto !important;
    object-fit: contain !important;
}

/* Paywall Overlay */
.paywall-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.paywall-overlay.active {
    display: flex;
}

.paywall-card {
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #1F2937);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.paywall-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--tg-theme-hint-color, #9CA3AF);
}

.paywall-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.paywall-text {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, #6B7280);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.paywall-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--tg-theme-button-color, #BE123C);
    color: var(--tg-theme-button-text-color, #fff);
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

.paywall-button:hover {
    opacity: 0.85;
}
