/* ДИЗАЙН СИСТЕМА - CSS ПЕРЕМЕННЫЕ */
:root {
    --bg: #020E0A;
    --card: #051611;
    --text: #F1E6D0;
    --dim: #A69C8A;
    --gold: #D9C388;
    --accent: #C5A059;
    --border: #1E332A;
    --success: #5E8C78;
    --danger: #9E5A5A;
}

/* БЛОК ГЛАВНЫЙ СТИЛЬ */
body {
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont,
        'Inter',
        'Segoe UI',
        sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* КРИТИЧЕСКИЕ МОБИЛЬНЫЕ СТИЛИ - ДОБАВЛЕНО В НАЧАЛО ДЛЯ ПРИОРИТЕТА */
@media screen and (max-width: 480px) {

    /* Предотвращаем горизонтальный скролл всей страницы */
    body {
        overflow-x: hidden !important;
    }

    /* Стили для таблиц без фиксированной первой колонки */
    .common-table.no-fixed-column th:first-child,
    .common-table.no-fixed-column td:first-child {
        position: static !important;
        left: auto !important;
        z-index: auto !important;
        background: #051611 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
        min-width: 80px !important;
        max-width: 80px !important;
        width: 80px !important;
    }

    .common-table.no-fixed-column thead th:first-child {
        background: #fff !important;
        color: #051611 !important;
        font-weight: bold !important;
    }

    /* Контейнеры таблиц с горизонтальным скроллом */
    .table-container {
        position: relative !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100% !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 8px !important;
        margin-bottom: 10px !important;
    }

    .common-table {
        font-size: 10px !important;
        width: auto !important;
        min-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    .common-table th,
    .common-table td {
        padding: 4px 6px !important;
        font-size: 10px !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        line-height: 1.2 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    /* Фиксированная первая колонка */
    .common-table th:first-child,
    .common-table td:first-child {
        position: sticky !important;
        left: 0 !important;
        z-index: 10 !important;
        background: #051611 !important;
        border-right: 2px solid #fff !important;
        min-width: 120px !important;
        max-width: 120px !important;
        width: 120px !important;
    }

    /* Остальные колонки с фиксированной шириной */
    .common-table th:not(:first-child),
    .common-table td:not(:first-child) {
        min-width: 80px !important;
        max-width: 80px !important;
        width: 80px !important;
    }

    /* Специальные стили для заголовков */
    .common-table thead th:first-child {
        background: #fff !important;
        color: #051611 !important;
        font-weight: bold !important;
    }

    /* Специальные стили для итоговых строк */
    .common-table tfoot td:first-child {
        background: #051611 !important;
        font-weight: bold !important;
    }

    body {
        padding: 5px !important;
    }

    .block {
        margin: 10px 0 !important;
        padding: 10px !important;
    }

    .factors-container {
        margin: 10px 0 !important;
        padding: 10px !important;
    }

    /* Специальные стили для кнопок в таблицах */
    .common-table .btn-fill,
    .common-table .btn-delete,
    .common-table button {
        font-size: 8px !important;
        padding: 2px 4px !important;
        min-width: auto !important;
        white-space: nowrap !important;
    }

    /* Стили для ссылок в таблицах */
    .common-table a {
        font-size: 9px !important;
        word-break: break-all !important;
    }

    /* Стили для инпутов в таблицах */
    .common-table input[type="text"],
    .common-table input[type="number"],
    .common-table select {
        font-size: 9px !important;
        padding: 2px 4px !important;
        min-width: 60px !important;
        max-width: 100% !important;
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #ccc !important;
    }

    /* Специальные стили для инпутов в таблице Potential P/L (только первые 3 колонки) */
    .analysis-container .common-table input[type="number"] {
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #ccc !important;
        font-size: 10px !important;
        padding: 4px 6px !important;
    }

    .analysis-container .common-table input[type="number"]:focus {
        background: #fff !important;
        color: #333 !important;
        border: 2px solid #007bff !important;
        outline: none !important;
    }

    /* Стили для автоматически вычисляемых значений (последние 4 колонки) */
    .analysis-container .common-table td span {
        color: var(--text) !important;
        font-weight: bold !important;
        font-size: 10px !important;
        display: block !important;
        text-align: center !important;
    }

    /* Стили для столбцов Score и Weighted Score на мобильных */
    .common-table td:nth-child(5),
    /* Score column */
    .common-table td:nth-child(6) {
        /* Weighted Score column */
        background: #051611 !important;
        color: var(--text) !important;
        font-weight: bold !important;
    }

    .common-table td:nth-child(5) input,
    .common-table td:nth-child(6) input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Стили для Total в footer на мобильных */
    .common-table tfoot th,
    .common-table tfoot td {
        font-weight: bold !important;
        background: #051611 !important;
        color: var(--text) !important;
    }

    .common-table tfoot input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Дополнительные стили для мобильных */
    .common-table th,
    .common-table td {
        padding: 4px 2px !important;
    }
}

/* БЛОК HEADER */
header {
    padding: 10px 0;
    position: relative;
}

header .content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

header h1 {
    font-size: 1.5em;
    margin: 0;
}

header h1 span {
    font-size: 1.2em;
    font-weight: bold;
}

header .description {
    font-size: 0.9em;
    margin-top: 5px;
}

header .login {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px;
    color: var(--text);
    cursor: pointer;
}

/* БЛОК КОНТЕЙНЕРЫ */
.block {
    background: var(--card);
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.factors-container {
    background: var(--card);
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.analysis-container {
    background: var(--card);
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
}


/* МОДАЛЬНОЕ ОКНО LOGIN */
.modal {
    display: none;
    /* по умолчанию скрыто */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* затемнённый фон */
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    /* по центру вертикально */
    padding: 20px;
    border: 1px solid #888;
    width: 300px;
    /* ширина окна */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Крестик закрытия */
.modal .close {
    color: #aaa;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.modal .close:hover {
    color: #000;
}

/* Стили формы */
.modal form {
    display: flex;
    flex-direction: column;
}

.modal form label {
    margin-top: 10px;
    font-weight: 500;
}

.modal form input {
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal form button {
    margin-top: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #15284a, #051611);
    color: var(--text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal form button:hover {
    background-color: #0056b3;
}

/* Сообщения об ошибке или успехе */
#loginMessage,
#registerMessage {
    margin-top: 10px;
    font-size: 14px;
    color: red;
}


/* УВЕДОМЛЕНИЯ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: var(--text);
    font-weight: 500;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: #27ae60;
}

.notification.error {
    background-color: #e74c3c;
}

.notification.info {
    background-color: #3498db;
}

/* HEADER & NAVIGATION */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    height: 80px;
    background: #020E0A;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 24px;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.logo-title {
    font-family: 'Georgia', serif;
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    letter-spacing: 3.4px;
    text-transform: uppercase;
}

.logo-subtitle {
    font-family: sans-serif;
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-nav {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    color: var(--dim);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    border: none;
    border-radius: 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: transparent;
}

.header-login-btn {
    background: var(--gold);
    color: var(--bg);
    border: none;
    padding: 8px 20px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.header-login-btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.user-display span {
    color: var(--text) !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 15px;
    border: 1px solid var(--border);
    padding: 8px 15px;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Fix login button display in header */
.login-wrapper {
    display: flex;
    align-items: center;
}

/* ========================= */
/* БЛОК TICKER INPUT */

#tickerForm {
    margin-bottom: 20px;
    /* отступ снизу */
    font-size: 18px;
    /* увеличиваем шрифт всей формы */
    display: flex;
    align-items: center;
    gap: 10px;
    /* расстояние между инпутом и кнопкой */
}

#tickerForm input {
    font-size: 18px;
    /* текст в инпуте */
    padding: 8px 12px;
    /* внутренние отступы */
    flex: 1;
    /* инпут растягивается на ширину контейнера */
    border-radius: 6px;
    border: 1px solid #ccc;
}

#tickerForm button {
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: var(--gold);
    color: var(--bg);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#tickerForm button:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 195, 136, 0.3);
}

/* БЛОК ТЕКУЩИЙ ТИКЕР */
#currentTicker {
    margin: 10px 0 10px;
    /* отступ сверху и снизу */
    font-size: 20px;
    /* увеличиваем шрифт всего блока */
    display: flex;
    align-items: center;
    gap: 10px;
    /* расстояние между тикером и кнопкой */
}

#currentTicker #tickerName {
    font-weight: bold;
}

#currentTicker #changeTickerBtn {
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 2px;
    border: 1px solid var(--accent);
    background: var(--gold);
    color: var(--bg);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#currentTicker #changeTickerBtn:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 195, 136, 0.3);
}

#versionsBtn {
    margin-left: 10px;
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 2px;
    border: 1px solid var(--accent);
    background: var(--gold);
    color: var(--bg);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#versionsBtn:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 195, 136, 0.3);
}




/* УНИВЕРСАЛЬНЫЙ СТИЛЬ ДЛЯ ВСЕХ ТАБЛИЦ */
.common-table td a {
    color: var(--text);
    text-decoration: underline;
}

.common-table td a:hover {
    color: #ccc;
}

.common-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-family: inherit;
    background: #051611;
    color: var(--text);
}

.common-table thead th {
    color: var(--bg);
    background: var(--text);
    font-weight: bold;
    padding: 10px 8px;
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    text-align: center;
}

.common-table thead th:first-child {
    text-align: left;
}

.common-table tbody td,
.common-table tfoot td {
    color: var(--text);
    background: #051611;
    padding: 8px 8px;
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.common-table tbody td:first-child,
.common-table tfoot td:first-child {
    text-align: left;
}

.common-table td input[type="number"],
.common-table td input[type="text"],
.common-table td textarea {
    color: #051611;
    background: #fff;
    border: 1px solid #ccc;
    padding: 2px 6px;
    border-radius: 4px;
    width: 90%;
    min-width: 100px;
    box-sizing: border-box;
}

.common-table td textarea {
    min-height: 30px;
    /* Начальная высота */
    resize: vertical;
    /* Разрешить изменять размер по вертикали */
    overflow-y: hidden;
    /* Скрыть скроллбар */
    line-height: 1.4;
}


.common-table td:first-child,
.common-table th:first-child {
    font-weight: bold;
}

.common-table tfoot td {
    font-weight: bold;
    background: #051611;
}

.common-table tfoot tr td:first-child {
    text-align: left;
}

.common-table tr:last-child td {
    border-bottom: 1px solid var(--border);
}

/* СТИЛИ ДЛЯ MARKET SENTIMENTS */
.market-sentiments-section {
    margin-top: 40px;
    padding: 20px;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.market-sentiments-section h3 {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 18px;
}

.market-sentiments-section label {
    color: var(--text);
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.market-sentiments-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    resize: vertical;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}

.market-sentiments-section input[type="number"] {
    width: 80px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    text-align: center;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}

.market-sentiments-section a {
    color: var(--gold);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.market-sentiments-section a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* УНИВЕРСАЛЬНЫЙ СТИЛЬ ДЛЯ ВСЕХ КНОПОК */
button {
    padding: 10px 20px;
    background: var(--gold);
    color: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

button:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(217, 195, 136, 0.3);
}

.market-sentiments-section button {
    margin-top: 10px;
}

/* СТИЛИ ДЛЯ ФОРМУЛ */
.formula-actions {
    margin-top: 20px;
    text-align: center;
}

.btn-primary {
    background: var(--gold);
    color: var(--bg);
    padding: 12px 24px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(217, 195, 136, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: var(--text);
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: var(--success);
    color: var(--text);
    padding: 8px 16px;
    border: 1px solid rgba(94, 140, 120, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}

.btn-success:hover {
    background: rgba(94, 140, 120, 0.8);
}

.btn-danger {
    background: var(--danger);
    color: var(--text);
    padding: 8px 16px;
    border: 1px solid rgba(158, 90, 90, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}

.btn-danger:hover {
    background: rgba(158, 90, 90, 0.8);
}

.btn-fill {
    display: inline-block;
    padding: 5px 15px;
    background: var(--gold);
    color: var(--bg);
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-fill:hover {
    background: var(--accent);
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(217, 195, 136, 0.3);
}

.btn-delete {
    display: inline-block;
    padding: 5px 15px;
    background: var(--danger);
    color: var(--text);
    text-decoration: none;
    border: 1px solid rgba(158, 90, 90, 0.5);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: rgba(158, 90, 90, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(158, 90, 90, 0.4);
}

/* СТИЛИ ДЛЯ РЕДАКТИРУЕМЫХ ЯЧЕЕК */
.editable-cell {
    background: #fff !important;
    color: #333 !important;
    padding: 4px 8px !important;
}

.editable-cell input {
    width: 100%;
    border: none;
    background: transparent;
    color: #333;
    font-size: 14px;
    padding: 2px;
}

.editable-cell input:focus {
    outline: 2px solid #007bff;
    border-radius: 3px;
}

/* СТИЛИ ДЛЯ НОВОЙ СТРОКИ */
.new-row {
    background: rgba(255, 255, 255, 0.1) !important;
}

.new-row td {
    border: 2px dashed rgba(255, 255, 255, 0.3) !important;
}

/* СТИЛИ ДЛЯ СТОЛБЦОВ SCORE И WEIGHTED SCORE */
.metric-score,
.weighted-score {
    background: transparent !important;
    border: none !important;
    color: var(--text) !important;
    font-weight: bold !important;
    text-align: center !important;
    width: 60px !important;
    min-width: 60px !important;
    font-size: 14px;
    outline: none !important;
}

/* Hide spin buttons for Score input */
.metric-score::-webkit-inner-spin-button,
.metric-score::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.metric-score {
    -moz-appearance: textfield;
}

.common-table td:nth-child(5),
/* Score column */
.common-table td:nth-child(6) {
    /* Weighted Score column */
    background: #051611 !important;
    color: var(--text) !important;
    font-weight: bold !important;
}


/* СТИЛИ ДЛЯ TOTAL В FOOTER */
.common-table tfoot th,
.common-table tfoot td {
    font-weight: bold !important;
    background: #051611 !important;
    color: var(--text) !important;
}

.common-table tfoot input {
    background: #051611 !important;
    color: var(--text) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    font-weight: bold !important;
}

/* /* БЛОК УВЕДОМЛЕНИЯ */
*/ .notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
}

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

/* Медиа-запросы для планшетов (768px и меньше) */
@media screen and (max-width: 768px) {

    /* Предотвращаем горизонтальный скролл всей страницы */
    body {
        overflow-x: hidden;
    }

    /* Стили для таблиц без фиксированной первой колонки */
    .common-table.no-fixed-column th:first-child,
    .common-table.no-fixed-column td:first-child {
        position: static;
        left: auto;
        z-index: auto;
        background: #051611;
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        min-width: 100px;
        max-width: 100px;
        width: 100px;
    }

    .common-table.no-fixed-column thead th:first-child {
        background: #fff;
        color: #051611;
        font-weight: bold;
    }

    /* Контейнеры таблиц с горизонтальным скроллом для планшетов */
    .table-container {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        margin-bottom: 15px;
    }

    .common-table {
        width: auto;
        min-width: 100%;
        table-layout: fixed;
        border-collapse: separate;
        border-spacing: 0;
    }

    .common-table th,
    .common-table td {
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Специальные стили для инпутов в таблице Potential P/L (только первые 3 колонки) */
    .analysis-container .common-table input[type="number"] {
        background: #fff;
        color: #333;
        border: 1px solid #ccc;
        font-size: 12px;
        padding: 6px 8px;
    }

    .analysis-container .common-table input[type="number"]:focus {
        background: #fff;
        color: #333;
        border: 2px solid #007bff;
        outline: none;
    }

    /* Стили для автоматически вычисляемых значений (последние 4 колонки) */
    .analysis-container .common-table td span {
        color: var(--text);
        font-weight: bold;
        font-size: 12px;
        display: block;
        text-align: center;
    }

    /* Стили для столбцов Score и Weighted Score на планшетах */
    .common-table td:nth-child(5),
    /* Score column */
    .common-table td:nth-child(6) {
        /* Weighted Score column */
        background: #051611 !important;
        color: var(--text) !important;
        font-weight: bold !important;
    }

    .common-table td:nth-child(5) input,
    .common-table td:nth-child(6) input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Стили для Total в footer на планшетах */
    .common-table tfoot th,
    .common-table tfoot td {
        font-weight: bold !important;
        background: #051611 !important;
        color: var(--text) !important;
    }

    .common-table tfoot input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Дополнительные стили для планшетов */
    .common-table th,
    .common-table td {
        line-height: 1.3;
        padding: 6px 4px;
    }

    /* Фиксированная первая колонка для планшетов */
    .common-table th:first-child,
    .common-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background: #051611;
        border-right: 2px solid #fff;
        min-width: 150px;
        max-width: 150px;
        width: 150px;
    }

    /* Остальные колонки с фиксированной шириной для планшетов */
    .common-table th:not(:first-child),
    .common-table td:not(:first-child) {
        min-width: 100px;
        max-width: 100px;
        width: 100px;
    }

    /* Специальные стили для заголовков */
    .common-table thead th:first-child {
        background: #fff;
        color: #051611;
        font-weight: bold;
    }

    /* Специальные стили для итоговых строк */
    .common-table tfoot td:first-child {
        background: #051611;
        font-weight: bold;
    }

    body {
        padding: 10px;
    }

    header .content {
        max-width: 100%;
    }

    header h1 {
        font-size: 1.3em;
    }

    header .description {
        font-size: 0.8em;
    }

    .navigation {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    #tickerForm {
        flex-direction: column;
        gap: 10px;
    }

    #tickerForm input {
        font-size: 16px;
        padding: 10px;
    }

    #tickerForm button {
        font-size: 16px;
        padding: 10px;
    }

    #currentTicker {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    #currentTicker #changeTickerBtn {
        font-size: 16px;
        padding: 10px;
    }

    .block {
        margin: 15px 0;
        padding: 15px;
    }

    .block h2 {
        font-size: 20px;
    }

    .factors-container {
        margin: 15px 0;
        padding: 15px;
    }

    .factors-container h2 {
        font-size: 20px;
    }

    .modal-content {
        width: 90%;
        margin: 5% auto;
        padding: 15px;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }

    .notification.show {
        transform: translateY(0);
    }
}

/* Медиа-запросы для смартфонов (480px и меньше) */
@media screen and (max-width: 480px) {
    body {
        padding: 5px !important;
    }

    header h1 {
        font-size: 1.1em !important;
    }

    header .description {
        font-size: 0.75em !important;
    }

    .navigation {
        padding: 10px !important;
        gap: 8px !important;
    }

    .nav-link {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    .block {
        margin: 10px 0 !important;
        padding: 10px !important;
    }

    .block h2 {
        font-size: 18px !important;
    }

    .factors-container {
        margin: 10px 0 !important;
        padding: 10px !important;
    }

    .factors-container h2 {
        font-size: 18px !important;
    }

    .modal-content {
        width: 95% !important;
        margin: 2% auto !important;
        padding: 10px !important;
    }

    /* Адаптивные таблицы для мобильных устройств - теперь с горизонтальным скроллом */
    .common-table {
        font-size: 12px !important;
        width: auto !important;
        min-width: 100% !important;
        table-layout: fixed !important;
    }

    .common-table thead th {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    .common-table tbody td,
    .common-table tfoot td {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    .common-table td input[type="number"],
    .common-table td input[type="text"],
    .common-table td textarea {
        font-size: 11px !important;
        padding: 2px 4px !important;
        min-width: 60px !important;
    }

    /* Кнопки на мобильных */
    button {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .btn-primary {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }

    .btn-fill {
        padding: 4px 10px !important;
        font-size: 12px !important;
    }

    .btn-delete {
        padding: 4px 10px !important;
        font-size: 12px !important;
    }

    /* Market sentiments section на мобильных */
    .market-sentiments-section {
        margin-top: 20px !important;
        padding: 15px !important;
    }

    .market-sentiments-section h3 {
        font-size: 16px !important;
    }

    .market-sentiments-section input[type="number"] {
        width: 60px !important;
        font-size: 14px !important;
    }
}

/* Медиа-запросы для очень маленьких экранов (320px и меньше) */
@media screen and (max-width: 320px) {
    body {
        padding: 3px !important;
    }

    header h1 {
        font-size: 1em !important;
    }

    .navigation {
        padding: 8px !important;
        gap: 6px !important;
    }

    .nav-link {
        padding: 5px 8px !important;
        font-size: 11px !important;
    }

    .block {
        margin: 8px 0 !important;
        padding: 8px !important;
    }

    .block h2 {
        font-size: 16px !important;
    }

    .factors-container {
        margin: 8px 0 !important;
        padding: 8px !important;
    }

    .factors-container h2 {
        font-size: 16px !important;
    }

    .common-table {
        font-size: 9px !important;
        width: auto !important;
        min-width: 100% !important;
        table-layout: fixed !important;
    }

    .common-table th,
    .common-table td {
        padding: 3px 1px !important;
        font-size: 9px !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        line-height: 1.1 !important;
    }

    /* Фиксированная первая колонка для очень маленьких экранов */
    .common-table th:first-child,
    .common-table td:first-child {
        position: sticky !important;
        left: 0 !important;
        z-index: 10 !important;
        background: #051611 !important;
        border-right: 2px solid #fff !important;
        min-width: 100px !important;
        max-width: 100px !important;
        width: 100px !important;
    }

    /* Остальные колонки с фиксированной шириной для очень маленьких экранов */
    .common-table th:not(:first-child),
    .common-table td:not(:first-child) {
        min-width: 70px !important;
        max-width: 70px !important;
        width: 70px !important;
    }

    /* Специальные стили для заголовков */
    .common-table thead th:first-child {
        background: #fff !important;
        color: #051611 !important;
        font-weight: bold !important;
    }

    /* Специальные стили для итоговых строк */
    .common-table tfoot td:first-child {
        background: #051611 !important;
        font-weight: bold !important;
    }

    .common-table td input[type="number"],
    .common-table td input[type="text"],
    .common-table td textarea {
        font-size: 9px !important;
        padding: 1px 2px !important;
        min-width: 40px !important;
    }

    button {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    .btn-primary {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .btn-fill {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }

    .btn-delete {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }

    /* Стили для таблиц без фиксированной первой колонки */
    .common-table.no-fixed-column th:first-child,
    .common-table.no-fixed-column td:first-child {
        position: static !important;
        left: auto !important;
        z-index: auto !important;
        background: #051611 !important;
        border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
        min-width: 70px !important;
        max-width: 70px !important;
        width: 70px !important;
    }

    .common-table.no-fixed-column thead th:first-child {
        background: #fff !important;
        color: #051611 !important;
        font-weight: bold !important;
    }

    /* Специальные стили для инпутов в таблице Potential P/L (только первые 3 колонки) */
    .analysis-container .common-table input[type="number"] {
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #ccc !important;
        font-size: 8px !important;
        padding: 2px 4px !important;
    }

    .analysis-container .common-table input[type="number"]:focus {
        background: #fff !important;
        color: #333 !important;
        border: 2px solid #007bff !important;
        outline: none !important;
    }

    /* Стили для автоматически вычисляемых значений (последние 4 колонки) */
    .analysis-container .common-table td span {
        color: var(--text) !important;
        font-weight: bold !important;
        font-size: 8px !important;
        display: block !important;
        text-align: center !important;
    }

    /* Стили для столбцов Score и Weighted Score на очень маленьких экранах */
    .common-table td:nth-child(5),
    /* Score column */
    .common-table td:nth-child(6) {
        /* Weighted Score column */
        background: #051611 !important;
        color: var(--text) !important;
        font-weight: bold !important;
    }

    .common-table td:nth-child(5) input,
    .common-table td:nth-child(6) input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Стили для Total в footer на очень маленьких экранах */
    .common-table tfoot th,
    .common-table tfoot td {
        font-weight: bold !important;
        background: #051611 !important;
        color: var(--text) !important;
    }

    .common-table tfoot input {
        background: #051611 !important;
        color: var(--text) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        font-weight: bold !important;
    }

    /* Дополнительные стили для очень маленьких экранов */
    .common-table th,
    .common-table td {
        padding: 2px 1px !important;
    }
}

/* Горизонтальная прокрутка для таблиц на мобильных - теперь интегрирована в медиа-запросы выше */

/* Улучшения для touch-устройств */
@media (hover: none) and (pointer: coarse) {
    .nav-link:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.1);
    }

    button:hover {
        transform: none;
    }

    .btn-fill:hover {
        transform: none;
    }

    .btn-delete:hover {
        transform: none;
    }

    #tickerForm button:hover {
        transform: none;
    }

    #currentTicker #changeTickerBtn:hover {
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }
}

/* СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ВЕРСИЙ - используем существующие стили */
#versionModal .modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 5% auto;
    padding: 0;
    border: 1px solid #333;
    border-radius: 15px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

#versionModal .modal-header {
    background: linear-gradient(90deg, #0f3460 0%, #16537e 100%);
    color: var(--text);
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#versionModal .modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

#versionModal .close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

#versionModal .close:hover {
    color: var(--text);
}

#versionModal .modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.ticker-info {
    margin-bottom: 20px;
    text-align: center;
    color: #ccc;
}

.versions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.version-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.version-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #0f3460;
    transform: translateY(-2px);
}

.version-item.active {
    background: rgba(15, 52, 96, 0.3);
    border-color: #0f3460;
    box-shadow: 0 0 15px rgba(15, 52, 96, 0.3);
}

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

.version-number {
    font-weight: bold;
    color: #0f3460;
    font-size: 1.1em;
}

.version-badges {
    display: flex;
    gap: 10px;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.badge.active {
    background: #28a745;
    color: var(--text);
}

.badge.own {
    background: #007bff;
    color: var(--text);
}

.badge.data-type {
    background: #6f42c1;
    color: var(--text);
}

.version-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    color: #ccc;
}

.version-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.version-actions .btn-fill {
    padding: 8px 16px;
    font-size: 0.9em;
    margin: 0;
}

.version-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.btn-version-switch {
    transition: all 0.3s ease;
}

.btn-version-switch:hover {
    background: #16537e !important;
    transform: translateY(-1px);
}

/* Мобильные стили для модального окна версий */
@media screen and (max-width: 768px) {
    #versionModal .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }

    #versionModal .modal-header h2 {
        font-size: 1.2em;
    }

    .version-details {
        grid-template-columns: 1fr;
    }

    .version-actions {
        flex-direction: column;
    }

    .version-actions .btn-fill {
        width: 100%;
    }
}

/* Notification animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification {
    animation: slideIn 0.3s ease;
}

.notification.removing {
    animation: slideOut 0.3s ease;
}

/* CAPTCHA STYLES */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(26, 53, 95, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: nowrap;
}

.captcha-container label {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.captcha-container input[type="number"] {
    flex: 0 0 60px;
    padding: 4px 6px;
    border: 1px solid #051611;
    border-radius: 4px;
    background: #ffffff;
    color: #051611;
    font-size: 14px;
    font-weight: bold;
    width: 60px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.captcha-container input[type="number"]:focus {
    outline: none;
    border-color: #15284a;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(21, 40, 74, 0.3);
}

.captcha-container input[type="number"]::placeholder {
    color: #051611;
    font-weight: normal;
    font-size: 12px;
    opacity: 0.6;
}

/* Дополнительные стили для лучшей видимости */
.captcha-container input[type="number"]:not(:placeholder-shown) {
    background: #ffffff;
    border-color: #051611;
    color: #051611;
    font-weight: bold;
}

.captcha-container input[type="number"]:valid {
    border-color: #051611;
    background: #ffffff;
}

.captcha-container input[type="number"]:invalid {
    border-color: #051611;
    background: #ffffff;
}

#refresh-captcha {
    background: #051611;
    border: 1px solid #15284a;
    color: var(--text);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

#refresh-captcha:hover {
    background: #15284a;
    border-color: #051611;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#refresh-captcha:active {
    background: #051611;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#captcha-question {
    font-weight: bold;
    color: var(--text);
    font-size: 16px;
    background: rgba(26, 53, 95, 0.5);
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

/* Mobile responsive for captcha */
@media screen and (max-width: 480px) {
    .captcha-container {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 8px;
        flex-wrap: wrap;
    }

    .captcha-container label {
        min-width: auto;
        text-align: left;
        font-size: 12px;
        flex: 1;
        min-width: 80px;
    }

    .captcha-container input[type="number"] {
        width: 50px;
        min-width: 50px;
        font-size: 12px;
        padding: 4px;
        border-width: 1px;
        font-weight: bold;
    }

    #refresh-captcha {
        width: 28px;
        min-width: 28px;
        height: 26px;
        font-size: 12px;
    }

    #captcha-question {
        font-size: 14px;
        padding: 2px 4px;
    }
}

/* Risk Proximity Statuses */
.common-table tr td.status-upcoming {
    color: var(--dim) !important;
    font-weight: normal !important;
}

.common-table tr td.status-preparation {
    color: var(--gold) !important;
    font-weight: normal !important;
}

.common-table tr td.status-alert {
    color: var(--accent) !important;
    font-weight: normal !important;
}

.common-table tr td.status-event-day {
    color: var(--danger) !important;
    font-weight: normal !important;
}

.common-table tr td.status-passed {
    color: rgba(166, 156, 138, 0.4) !important;
    /* Harmonized with --dim */
    font-weight: normal !important;
}