/* ====================================================================== */
/* MOBILE-TABLE.CSS - АДАПТАЦИЯ ТАБЛИЦ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ            */
/* Этот файл содержит ВСЕ медиа-запросы с max-width для таблиц           */
/* Подключается в base.html и base_acc.html через media="(max-width: 768px)" */
/* ====================================================================== */

/* ==================== ОСНОВНЫЕ СТИЛИ ДЛЯ ТАБЛИЦ ==================== */

@media (max-width: 768px) {
    /* Скрываем десктопные таблицы на мобильных */
    .table-desktop {
        display: none !important;
    }
    
    /* Показываем мобильную версию */
    .table-mobile {
        display: block !important;
        width: 100%;
    }
    
    /* Карточный контейнер */
    .portfolio-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    /* Карточка сектора */
    .portfolio-mobile-card {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        transition: all 0.3s ease;
        overflow: hidden;
    }
    
    .portfolio-mobile-card.active {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-color: var(--sea-turquoise);
    }
    
    /* Заголовок карточки */
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        cursor: pointer;
    }
    
    .sector-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .sector-code {
        font-size: 0.85rem;
        color: var(--muted);
        font-weight: normal;
    }
    
    /* Кнопка переключения */
    .mobile-card-toggle {
        background: transparent;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--sea-turquoise);
        font-size: 1.2rem;
        padding: 0;
        transition: all 0.2s ease;
    }
    
    .mobile-card-toggle:hover {
        background: rgba(95, 170, 184, 0.1);
    }
    
    .mobile-card-toggle.active .toggle-icon {
        transform: rotate(180deg);
    }
    
    /* Краткая сводка - ПЕРЕОПРЕДЕЛЕНА ДЛЯ НОВОЙ СТРУКТУРЫ */
    .mobile-card-summary {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px 0;
        margin-bottom: 12px;
    }
    
    .summary-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 0;
    }
    
    .summary-label {
        font-size: 0.9rem;
        color: var(--muted);
        font-weight: 500;
        min-width: 80px;
    }
    
    .summary-value {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        text-align: right;
        flex: 1;
    }
    
    /* Особый стиль для эталона с полем ввода */
    .benchmark-item {
        align-items: center;
    }
    
    .summary-editable {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 1;
    }
    
    .benchmark-input-mobile {
        width: 70px;
        text-align: center;
        font-size: 1rem;
        font-weight: 600;
        background: transparent;
        border: none;
        color: var(--text);
        padding: 0;
        margin: 0;
        -moz-appearance: textfield;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .benchmark-input-mobile::-webkit-inner-spin-button,
    .benchmark-input-mobile::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    .benchmark-input-mobile:disabled {
        background: transparent !important;
        border: none !important;
        color: var(--text) !important;
        font-weight: 600 !important;
        font-size: 1rem !important;
        text-align: center !important;
        padding: 0 !important;
        width: auto !important;
        min-width: 50px !important;
        max-width: 80px !important;
        cursor: default !important;
        box-shadow: none !important;
        outline: none !important;
        -moz-appearance: textfield !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    .benchmark-input-mobile:not(:disabled) {
        width: 70px !important;
        padding: 8px 10px !important;
        border: 1px solid var(--border) !important;
        border-radius: 6px !important;
        text-align: center !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        background: var(--card-bg) !important;
        color: var(--text) !important;
        transition: all 0.2s ease !important;
        cursor: text !important;
        -moz-appearance: auto !important;
        -webkit-appearance: auto !important;
        appearance: auto !important;
    }
    
    .benchmark-input-mobile:not(:disabled):focus {
        outline: none !important;
        border-color: var(--sea-turquoise) !important;
        box-shadow: 0 0 0 2px rgba(95, 170, 184, 0.2) !important;
    }
    
    .percent-symbol {
        font-weight: 600;
        color: var(--text);
        min-width: 16px;
    }
    
    /* Детали (скрыты по умолчанию) */
    .mobile-card-details {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease;
        padding-top: 0;
        border-top: 1px solid transparent;
    }
    
    .portfolio-mobile-card.active .mobile-card-details {
        max-height: 150px;
        opacity: 1;
        padding-top: 12px;
        border-top-color: var(--border-light);
    }
    
    /* Строка деталей - ТОЛЬКО ЭКОНОМИКА И РЫНОК */
    .detail-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-light);
    }
    
    .detail-row:last-child {
        border-bottom: none;
    }
    
    .detail-label {
        font-size: 0.9rem;
        color: var(--muted);
        flex: 1;
    }
    
    .detail-value {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        text-align: right;
        margin-right: 8px;
    }
    
    /* Итоги для мобильной версии */
    .mobile-totals {
        background: var(--section-bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 16px;
        margin-top: 20px;
    }
    
    .total-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
    }
    
    .total-row:not(:last-child) {
        border-bottom: 1px solid var(--border-light);
    }
    
    .total-label {
        font-size: 0.95rem;
        color: var(--text);
        font-weight: 500;
    }
    
    .total-value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--sea-turquoise);
    }
    
    /* Бейджи отклонений - адаптация для мобильных */
    .deviation-badge {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px 10px !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
        font-size: 0.85rem !important;
        min-width: 60px !important;
        height: 28px !important;
    }
    
    /* Стили для бейджей отклонений */
    .deviation-good {
        background: rgba(26, 155, 90, 0.1) !important;
        color: var(--green) !important;
        border: 1px solid rgba(26, 155, 90, 0.3) !important;
    }
    
    .deviation-warning {
        background: rgba(240, 173, 78, 0.1) !important;
        color: var(--orange) !important;
        border: 1px solid rgba(240, 173, 78, 0.3) !important;
    }
    
    .deviation-critical {
        background: rgba(217, 83, 79, 0.1) !important;
        color: var(--red) !important;
        border: 1px solid rgba(217, 83, 79, 0.3) !important;
    }
    
    .deviation-neutral {
        background: rgba(95, 170, 184, 0.1) !important;
        color: var(--sea-turquoise) !important;
        border: 1px solid rgba(95, 170, 184, 0.3) !important;
    }
    
    /* Панель управления - адаптация для мобильных */
    .control-panel {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        padding: 16px !important;
    }
    
    .left-controls, .right-controls {
        justify-content: center !important;
        width: 100% !important;
    }
    
    .right-controls .btn {
        width: 100% !important;
        padding: 12px !important;
    }
    
    /* Метрики анализа - адаптация для мобильных */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .metric-card {
        padding: 14px !important;
        min-height: 100px !important;
    }
    
    .metric-value {
        font-size: 1.5rem !important;
    }
    
    .metric-label {
        font-size: 0.8rem !important;
    }
    
    .metric-details {
        font-size: 0.75rem !important;
    }
    
    /* Информационные сообщения */
    .alert {
        padding: 12px !important;
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }
    
    /* Ссылки в сообщениях */
    .alert a {
        color: var(--sea-turquoise) !important;
        text-decoration: underline !important;
    }
}

/* ==================== СТИЛИ ДЛЯ МОБИЛЬНОЙ ФИНАНСОВОЙ ТАБЛИЦЫ ==================== */

@media (max-width: 768px) {
    /* Контейнер мобильной финансовой таблицы */
    .financials-mobile-container {
        width: 100%;
        margin-bottom: 20px;
    }
    
    /* Селектор подтабов для финансовых данных */
    .financials-subtab-selector {
        margin-bottom: 16px;
        position: relative;
    }
    
    .financials-subtab-select {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--card-bg);
        color: var(--text);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        padding-right: 40px;
    }
    
    .financials-subtab-select:focus {
        outline: none;
        border-color: var(--sea-turquoise);
        box-shadow: 0 0 0 2px rgba(95, 170, 184, 0.2);
    }
    
    /* Кастомная стрелка для селектора */
    .financials-select-arrow {
        position: absolute;
        top: 50%;
        right: 16px;
        transform: translateY(-50%);
        color: var(--sea-turquoise);
        font-size: 0.9rem;
        pointer-events: none;
        transition: transform 0.2s ease;
    }
    
    .financials-subtab-select:focus + .financials-select-arrow {
        transform: translateY(-50%) rotate(180deg);
    }
    
    /* Контейнеры подтабов */
    .financials-subtab-content {
        display: none;
    }
    
    .financials-subtab-content.active {
        display: block;
    }
    
    /* Карточки финансовых показателей */
    .financials-mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .financials-mobile-card {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0,  0, 0, 0.05);
        transition: all 0.3s ease;
        overflow: hidden;
    }
    
    .financials-mobile-card.active {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-color: var(--sea-turquoise);
    }
    
    .financials-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        cursor: pointer;
    }
    
    .financials-sector-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .financials-card-toggle {
        background: transparent;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--sea-turquoise);
        font-size: 1.2rem;
        padding: 0;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }
    
    .financials-card-toggle:hover {
        background: rgba(95, 170, 184, 0.1);
    }
    
    .financials-card-summary {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px 0;
        margin-bottom: 12px;
    }
    
    .financials-summary-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 0;
    }
    
    .financials-summary-label {
        font-size: 0.9rem;
        color: var(--muted);
        font-weight: 500;
        min-width: 80px;
    }
    
    .financials-summary-value {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        text-align: right;
        flex: 1;
    }
    
    /* Детали карточки (скрыты по умолчанию) */
    .financials-card-details {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease;
        padding-top: 0;
        border-top: 1px solid transparent;
    }
    
    .financials-mobile-card.active .financials-card-details {
        max-height: 200px;
        opacity: 1;
        padding-top: 12px;
        border-top-color: var(--border-light);
    }
    
    /* Горизонтальный скролл по годам */
    .financials-years-scroll-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--sea-turquoise) rgba(95, 170, 184, 0.08);
        padding-bottom: 8px;
        scroll-behavior: smooth;
    }
    
    .financials-years-scroll-wrapper::-webkit-scrollbar {
        height: 6px;
    }
    
    .financials-years-scroll-wrapper::-webkit-scrollbar-track {
        background: rgba(95, 170, 184, 0.08);
        border-radius: 3px;
    }
    
    .financials-years-scroll-wrapper::-webkit-scrollbar-thumb {
        background: var(--sea-turquoise);
        border-radius: 3px;
        opacity: 0.5;
    }
    
    .financials-years-scroll-wrapper::-webkit-scrollbar-thumb:hover {
        opacity: 0.8;
    }
    
    .financials-years-scroll {
        display: flex;
        gap: 16px;
        min-width: min-content;
        padding: 0 4px;
    }
    
    .financials-year-column {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 70px;
        padding: 8px;
        background: var(--section-bg);
        border-radius: 6px;
        border: 1px solid var(--border-light);
    }
    
    .financials-year-header {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--muted);
        margin-bottom: 4px;
        white-space: nowrap;
    }
    
    .financials-year-value {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text);
        margin-bottom: 4px;
        text-align: center;
    }
    
    .financials-year-growth {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    /* Разделители между карточками */
    .financials-card-separator {
        height: 1px;
        background: linear-gradient(90deg, 
            transparent 0%, 
            var(--border) 20%, 
            var(--border) 80%, 
            transparent 100%);
        margin: 8px 0;
    }
    
    /* 🔥 ИСПРАВЛЕНИЕ: Убрать стандартные стрелки из селектора, но оставить нашу кастомную */
    .financials-subtab-select {
        background-image: none !important;
        background: var(--card-bg) !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
    
    /* Дополнительно для всех браузеров */
    .financials-subtab-select::-ms-expand {
        display: none !important;
    }
    
    .financials-subtab-select::-webkit-inner-spin-button,
    .financials-subtab-select::-webkit-outer-spin-button,
    .financials-subtab-select::-webkit-clear-button,
    .financials-subtab-select::-webkit-calendar-picker-indicator {
        display: none !important;
        -webkit-appearance: none !important;
    }
}

/* ==================== НОВЫЕ СТИЛИ ДЛЯ МОБИЛЬНОЙ ВЕРСИИ ДЕТАЛЬНОЙ СТРАНИЦЫ ==================== */

@media (max-width: 768px) {
    /* Общий контейнер мобильной финансовой страницы */
    .financials-mobile-page {
        width: 100%;
        padding: 0;
        margin: 0;
        background: var(--card-bg);
    }
    
    /* 1. Кнопки действий (центрированные) */
    .mobile-actions-container {
        display: flex;
        justify-content: center;
        width: 100%;
        margin: 20px 0;
        padding: 0 16px;
    }
    
    .mobile-actions-container .watchlist-analytics-container {
        width: 100%;
        max-width: 400px;
    }
    
    /* 2. Исторические цены (аккордеон) */
    .mobile-prices-container {
        margin: 0 16px 20px;
    }
    
    .mobile-prices-container .financials-mobile-card {
        margin-bottom: 0;
    }
    
    /* Секция цен внутри аккордеона */
    .financials-price-section {
        margin-bottom: 16px;
    }
    
    .financials-price-section:last-child {
        margin-bottom: 0;
    }
    
    .financials-price-title {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 8px;
        padding-left: 4px;
    }
    
    /* 3. Верхние табы (sticky навигация) */
    .mobile-main-tabs {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border);
        padding: 12px 0;
    }
    
    .mobile-tabs-scroll-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .mobile-tabs-scroll-wrapper::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-tabs-scroll {
        display: flex;
        padding: 0 16px;
        gap: 8px;
        min-width: min-content;
    }
    
    .mobile-tab {
        flex: 0 0 auto;
        padding: 10px 16px;
        background: var(--section-bg);
        border: 1px solid var(--border);
        border-radius: 20px;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--muted);
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.2s ease;
    }
    
    .mobile-tab.active {
        background: var(--sea-turquoise);
        color: var(--dark-blue);
        border-color: var(--sea-turquoise);
    }
    
    .mobile-tab:active {
        transform: scale(0.98);
    }
    
    /* 4. Контент вкладок */
    .mobile-tab-contents {
        width: 100%;
    }
    
    .mobile-tab-contents .mobile-tab-content {
        display: none;
        padding: 16px;
    }
    
    .mobile-tab-contents .mobile-tab-content.active {
        display: block;
    }
    
    /* Скрываем десктопные таблицы внутри вкладок на мобильных */
    .mobile-tab-content .table-desktop {
        display: none !important;
    }
    
    .mobile-tab-content .table-mobile {
        display: block !important;
    }
    
    /* 5. Нижняя навигация (фиксированная) */
    .mobile-bottom-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        z-index: 1100;
        padding: 10px 16px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-bottom-navigation.visible {
        transform: translateY(0);
    }
    
    /* Адаптация существующей MinimalNavigation для мобильных */
    .mobile-bottom-navigation .table-nav-container {
        margin: 0;
        padding: 0;
        position: relative;
        height: auto;
    }
    
    .mobile-bottom-navigation .absolute-minimal-nav {
        display: flex;
        justify-content: space-between;
        gap: 2px;
    }
    
    .mobile-bottom-navigation .absolute-item {
        flex: 1;
        height: 4px;
        margin: 0;
        background: var(--border);
        border-radius: 2px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-bottom-navigation .absolute-item.active {
        background: var(--sea-turquoise);
        height: 6px;
    }
    
    .mobile-bottom-navigation .absolute-tooltip {
        display: none;
    }
    
    /* Отступ для нижней навигации */
    body.mobile-detail-page {
        padding-bottom: 70px;
    }
}

/* ==================== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 480px) ==================== */

@media (max-width: 480px) {
    .portfolio-mobile-card {
        padding: 14px;
    }
    
    .sector-title {
        font-size: 1rem;
    }
    
    .sector-code {
        font-size: 0.8rem;
    }
    
    .summary-label, .detail-label {
        font-size: 0.85rem;
    }
    
    .summary-value, .detail-value {
        font-size: 0.95rem;
    }
    
    .benchmark-input-mobile {
        width: 60px;
    }
    
    .benchmark-input-mobile:not(:disabled) {
        width: 60px !important;
        padding: 6px 8px !important;
        font-size: 0.9rem !important;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr !important;
    }
    
    .metric-card {
        padding: 12px !important;
    }
    
    /* Мобильная навигация ЛК - корректировка отступов */
    .lk-main-single-page {
        padding-bottom: calc(var(--lk-mobile-nav-height) + 20px) !important;
    }
    
    .table-mobile {
        margin-bottom: 10px;
    }
    
    /* Финансовая таблица - адаптация для очень маленьких экранов */
    .financials-mobile-card {
        padding: 14px;
    }
    
    .financials-sector-title {
        font-size: 0.95rem;
    }
    
    .financials-year-column {
        min-width: 60px;
        padding: 6px;
    }
    
    .financials-year-value {
        font-size: 0.9rem;
    }
    
    .financials-year-header {
        font-size: 0.8rem;
    }
    
    .financials-select-arrow {
        right: 12px;
        font-size: 0.8rem;
    }
    
    /* Мобильная детальная страница - адаптация */
    .mobile-tab {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .mobile-bottom-navigation {
        padding: 8px 12px;
    }
    
    .mobile-bottom-navigation .absolute-item {
        height: 3px;
    }
    
    .mobile-bottom-navigation .absolute-item.active {
        height: 5px;
    }
    
    body.mobile-detail-page {
        padding-bottom: 60px;
    }
}

/* ==================== ПЛАНШЕТЫ (от 481px до 768px) ==================== */

@media (min-width: 481px) and (max-width: 768px) {
    .portfolio-mobile-card {
        padding: 18px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .mobile-card-summary {
        padding: 14px 0;
    }
    
    /* Финансовая таблица - адаптация для планшетов */
    .financials-year-column {
        min-width: 80px;
    }
    
    /* Мобильная детальная страница - адаптация */
    .mobile-bottom-navigation .absolute-tooltip {
        display: block;
        opacity: 0;
    }
    
    .mobile-bottom-navigation .absolute-item:hover .absolute-tooltip {
        opacity: 1;
        transform: translateX(-50%) translateY(-2px);
    }
}

/* ==================== ТЕМНАЯ ТЕМА ДЛЯ МОБИЛЬНЫХ ТАБЛИЦ ==================== */

@media (max-width: 768px) {
    :root[data-theme="dark"] .portfolio-mobile-card {
        background: var(--card-bg);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    :root[data-theme="dark"] .portfolio-mobile-card.active {
        border-color: var(--sea-turquoise);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    :root[data-theme="dark"] .mobile-card-summary,
    :root[data-theme="dark"] .detail-row {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    :root[data-theme="dark"] .mobile-totals {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    :root[data-theme="dark"] .total-row:not(:last-child) {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    :root[data-theme="dark"] .benchmark-input-mobile {
        background: transparent;
        border: none;
        color: var(--text);
    }
    
    :root[data-theme="dark"] .benchmark-input-mobile:not(:disabled) {
        background: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        color: var(--text) !important;
    }
    
    :root[data-theme="dark"] .benchmark-input-mobile:disabled {
        background: transparent !important;
        border: none !important;
        color: var(--text) !important;
    }
    
    /* Темная тема для финансовой таблицы */
    :root[data-theme="dark"] .financials-mobile-card {
        background: var(--card-bg);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    :root[data-theme="dark"] .financials-mobile-card.active {
        border-color: var(--sea-turquoise);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    :root[data-theme="dark"] .financials-subtab-select {
        background: var(--card-bg);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text);
    }
    
    :root[data-theme="dark"] .financials-select-arrow {
        color: var(--sea-turquoise);
    }
    
    :root[data-theme="dark"] .financials-year-column {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    :root[data-theme="dark"] .financials-card-separator {
        background: linear-gradient(90deg, 
            transparent 0%, 
            rgba(255, 255, 255, 0.1) 20%, 
            rgba(255, 255, 255, 0.1) 80%, 
            transparent 100%);
    }
    
    /* Темная тема для мобильной детальной страницы */
    :root[data-theme="dark"] .mobile-main-tabs {
        background: var(--card-bg);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    :root[data-theme="dark"] .mobile-tab {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.7);
    }
    
    :root[data-theme="dark"] .mobile-tab.active {
        background: var(--sea-turquoise);
        color: var(--dark-blue);
        border-color: var(--sea-turquoise);
    }
    
    :root[data-theme="dark"] .mobile-bottom-navigation {
        background: var(--card-bg);
        border-top-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }
    
    :root[data-theme="dark"] .mobile-bottom-navigation .absolute-item {
        background: rgba(255, 255, 255, 0.2);
    }
    
    :root[data-theme="dark"] .mobile-bottom-navigation .absolute-item.active {
        background: var(--sea-turquoise);
    }
}

/* ==================== ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ ТАБЛИЦ ПРОЕКТА ==================== */

@media (max-width: 768px) {
    /* Адаптация контейнеров таблиц */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 8px !important;
        border: 1px solid var(--border) !important;
        margin-bottom: 16px !important;
    }
    
    .table-scroll-wrapper {
        min-width: 600px !important; /* Минимальная ширина для горизонтальной прокрутки */
    }
    
    /* Стили для заголовков таблиц */
    .data-table th {
        font-size: 0.85rem !important;
        padding: 12px 8px !important;
        white-space: nowrap !important;
    }
    
    .data-table td {
        font-size: 0.85rem !important;
        padding: 10px 8px !important;
    }
    
    /* Скрытие неважных колонок на мобильных для обычных таблиц */
    .data-table .mobile-hide {
        display: none !important;
    }
    
    /* Кнопки в таблицах */
    .data-table .btn {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
        min-height: 32px !important;
    }
    
    /* Иконки в таблицах */
    .data-table .icon {
        font-size: 0.9rem !important;
    }
}

/* ==================== УЛУЧШЕНИЯ ДЛЯ ГОРИЗОНТАЛЬНОЙ ПРОКРУТКИ ==================== */

@media (max-width: 768px) {
    /* Индикатор горизонтальной прокрутки */
    .table-scroll-wrapper {
        position: relative !important;
        overflow-x: auto !important;
        scrollbar-width: thin !important;
    }
    
    .table-scroll-wrapper::-webkit-scrollbar {
        height: 6px !important;
    }
    
    .table-scroll-wrapper::-webkit-scrollbar-track {
        background: var(--section-bg) !important;
        border-radius: 3px !important;
    }
    
    .table-scroll-wrapper::-webkit-scrollbar-thumb {
        background: var(--sea-turquoise) !important;
        border-radius: 3px !important;
        opacity: 0.5 !important;
    }
    
    .table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
        opacity: 0.8 !important;
    }
    
    /* Подсказка о горизонтальной прокрутке */
    .table-scroll-wrapper::after {
        content: "← прокрутите →" !important;
        position: absolute !important;
        bottom: -25px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        font-size: 0.75rem !important;
        color: var(--muted) !important;
        white-space: nowrap !important;
    }
}

/* ==================== ПЕРЕОПРЕДЕЛЕНИЯ ДЛЯ СПЕЦИФИЧЕСКИХ ТАБЛИЦ ==================== */

@media (max-width: 768px) {
    /* Уникальные стили для таблицы портфеля */
    .portfolio-table th,
    .portfolio-table td {
        min-width: 100px !important;
    }
    
    .portfolio-table th:first-child,
    .portfolio-table td:first-child {
        min-width: 150px !important;
        position: sticky !important;
        left: 0 !important;
        background: var(--card-bg) !important;
        z-index: 1 !important;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1) !important;
    }
    
    /* Заморозка первой колонки при горизонтальной прокрутке */
    .table-scroll-wrapper {
        position: relative !important;
    }
    
    /* Стили для таблиц сравнений */
    .comparison-table th:nth-child(n+4),
    .comparison-table td:nth-child(n+4) {
        display: none !important;
    }
    
    /* Стили для таблиц листа наблюдения */
    .watchlist-table .company-name {
        min-width: 120px !important;
        position: sticky !important;
        left: 0 !important;
        background: var(--card-bg) !important;
        z-index: 1 !important;
    }
}

/* ==================== КОНЕЦ МОБИЛЬНЫХ СТИЛЕЙ ДЛЯ ТАБЛИЦ ==================== */

/* ========== НОВЫЕ СТИЛИ ДЛЯ МОБИЛЬНОЙ ТАБЛИЦЫ ОЦЕНКИ (ИЗ _mobile_valuation_table.html) ========== */

@media (max-width: 768px) {
    /* Специфичные стили для мобильной версии оценки */
    .financials-method-details {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 8px 0;
    }

    .financials-method-detail {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .financials-method-label {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--muted);
        min-width: 60px;
    }

    .financials-method-value {
        font-size: 0.9rem;
        color: var(--text);
        line-height: 1.3;
    }

    /* Стили для статусов оценки (как в десктопной версии) */
    .valuation-status {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 0.85rem;
        font-weight: 500;
        padding: 2px 6px;
        border-radius: 4px;
    }

    .status-valid {
        background: rgba(26, 155, 90, 0.1);
        color: var(--green);
    }

    .status-invalid {
        background: rgba(217, 83, 79, 0.1);
        color: var(--red);
    }

    .status-filtered {
        background: rgba(240, 173, 78, 0.1);
        color: var(--orange);
    }

    .status-negative_equity,
    .status-insufficient_assets,
    .status-negative_fcf,
    .status-high_volatility,
    .status-high_risk,
    .status-negative_earnings,
    .status-no_dividends,
    .status-unstable_dividends,
    .status-negative_growth,
    .status-negative_ebitda {
        background: rgba(240, 173, 78, 0.1);
        color: var(--orange);
    }

    .status-no_data,
    .status-insufficient {
        background: rgba(153, 153, 153, 0.1);
        color: var(--muted);
    }

    .status-unstable {
        background: rgba(95, 170, 184, 0.1);
        color: var(--sea-turquoise);
    }

    /* Подсказки для мобильной оценки - FIX: скрыты по умолчанию */
    .financials-sector-title .table-tooltip {
        border-bottom: 1px dotted var(--sea-turquoise);
        cursor: pointer;
    }

    .financials-sector-title .table-tiptext {
        font-size: 12px;
        max-width: 280px;
        line-height: 1.4;
        display: none; /* Скрываем по умолчанию */
        position: fixed;
        z-index: 1500;
        background: var(--dark-blue);
        color: var(--light-beige);
        padding: 12px;
        border-radius: 8px;
        box-shadow: var(--shadow);
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    /* Подсказки появляются только при клике (тапе) */
    .financials-sector-title .table-tooltip.active .table-tiptext {
        display: block;
        visibility: visible;
        opacity: 1;
    }

    /* Адаптивность для очень маленьких экранов */
    @media (max-width: 480px) {
        .financials-method-detail {
            flex-direction: column;
            gap: 2px;
        }
        
        .financials-method-label {
            min-width: 50px;
            font-size: 0.8rem;
        }
        
        .financials-method-value {
            font-size: 0.85rem;
        }
        
        .valuation-status {
            font-size: 0.8rem;
            padding: 1px 4px;
        }
    }

    /* Темная тема для статусов */
    :root[data-theme="dark"] .valuation-status.status-valid {
        background: rgba(26, 155, 90, 0.2);
    }
    
    :root[data-theme="dark"] .valuation-status.status-invalid {
        background: rgba(217, 83, 79, 0.2);
    }
    
    :root[data-theme="dark"] .valuation-status.status-filtered,
    :root[data-theme="dark"] .valuation-status.status-negative_equity,
    :root[data-theme="dark"] .valuation-status.status-insufficient_assets,
    :root[data-theme="dark"] .valuation-status.status-negative_fcf,
    :root[data-theme="dark"] .valuation-status.status-high_volatility,
    :root[data-theme="dark"] .valuation-status.status-high_risk,
    :root[data-theme="dark"] .valuation-status.status-negative_earnings,
    :root[data-theme="dark"] .valuation-status.status-no_dividends,
    :root[data-theme="dark"] .valuation-status.status-unstable_dividends,
    :root[data-theme="dark"] .valuation-status.status-negative_growth,
    :root[data-theme="dark"] .valuation-status.status-negative_ebitda {
        background: rgba(240, 173, 78, 0.2);
    }
    
    :root[data-theme="dark"] .valuation-status.status-no_data,
    :root[data-theme="dark"] .valuation-status.status-insufficient {
        background: rgba(153, 153, 153, 0.2);
    }
    
    :root[data-theme="dark"] .valuation-status.status-unstable {
        background: rgba(95, 170, 184, 0.2);
    }
}