/* =====================================================
   moextool.ru — светлая тема «Утренний синий» + тумблер темы
   Включается атрибутом <html data-theme="light">.
   Тёмная тема (по умолчанию) не затрагивается.
   ===================================================== */

/* ---------- Тумблер темы (солнце / луна) ---------- */
.theme-fab {
    position: fixed !important;
    top: 66px !important;
    right: 18px !important;
    z-index: 80;
    width: auto !important;
    height: 48px !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 5px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    background: rgba(10, 25, 47, .65);
    border: 1px solid rgba(255, 255, 255, .35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
    cursor: pointer;
    transition: transform .15s, background .2s, border-color .2s;
}
.theme-fab:hover { transform: scale(1.06); }
.theme-fab .fab-opt {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; line-height: 1;
    opacity: .4; filter: grayscale(.6);
    transition: all .2s;
}
.theme-fab[data-active="dark"] .fab-moon,
.theme-fab[data-active="light"] .fab-sun {
    opacity: 1; filter: none;
    background: #f59e0b;
    box-shadow: 0 2px 10px rgba(245, 158, 11, .5);
}
html[data-theme="light"] .theme-fab {
    background: rgba(255, 255, 255, .92);
    border-color: rgba(23, 74, 117, .3);
    box-shadow: 0 4px 16px rgba(23, 74, 117, .2);
}
@media (max-width: 768px) {
    .theme-fab { top: 60px !important; right: 10px !important; height: 44px !important; padding: 4px !important; }
    .theme-fab .fab-opt { width: 32px; height: 32px; font-size: 16px; }
}

/* ---------- База светлой темы ---------- */
html[data-theme="light"] body {
    background: radial-gradient(circle at center, #f2f7fd 0%, #dce8f6 100%);
    background-attachment: fixed;
    color: #1c2b3a;
}
html[data-theme="light"] p,
html[data-theme="light"] li { color: #5b6d80; }
html[data-theme="light"] b,
html[data-theme="light"] strong { color: #16374f; }
html[data-theme="light"] h1,
html[data-theme="light"] h2 { color: #14507e; }
html[data-theme="light"] h3,
html[data-theme="light"] h4 { color: #16374f; }

/* ---------- Меню и футер (layout.js) ---------- */
html[data-theme="light"] .topnav {
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid rgba(23, 74, 117, .15);
}
html[data-theme="light"] .topnav .brand { color: #12395e; }
html[data-theme="light"] .topnav .nav-links a { color: #46617a; }
html[data-theme="light"] .topnav .nav-links a:hover { color: #b45309; background: rgba(217, 119, 6, .08); }
html[data-theme="light"] .topnav .nav-links a.active { color: #b45309; }
html[data-theme="light"] .sitefoot { border-top: 1px solid rgba(23, 74, 117, .15); color: #64748b; }
html[data-theme="light"] .sitefoot a { color: #b45309; }

/* ---------- Карточки и контейнеры ---------- */
html[data-theme="light"] .card,
html[data-theme="light"] .section,
html[data-theme="light"] .header,
html[data-theme="light"] .acc-card,
html[data-theme="light"] .step,
html[data-theme="light"] .result-card,
html[data-theme="light"] .spread-section,
html[data-theme="light"] .toggle-group,
html[data-theme="light"] .subnav a {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(23, 74, 117, .14);
    box-shadow: 0 6px 24px rgba(23, 74, 117, .08);
    color: #1c2b3a;
}
html[data-theme="light"] .subnav a { color: #b45309; }
html[data-theme="light"] .subnav a:hover { background: rgba(217, 119, 6, .08); }

/* ---------- Приглушённый текст ---------- */
html[data-theme="light"] .description,
html[data-theme="light"] .header p,
html[data-theme="light"] ul.plain,
html[data-theme="light"] .footnote,
html[data-theme="light"] .badge small,
html[data-theme="light"] .acc-card,
html[data-theme="light"] .step,
html[data-theme="light"] .res-card .l,
html[data-theme="light"] .toggle-info p,
html[data-theme="light"] .result-label,
html[data-theme="light"] .detail-label,
html[data-theme="light"] .spread-calc,
html[data-theme="light"] .result-card .label { color: #5b6d80; }

/* ---------- Таблицы и проводки ---------- */
html[data-theme="light"] table { background: #ffffff; }
html[data-theme="light"] thead { background: rgba(217, 119, 6, .10); }
html[data-theme="light"] th { color: #92400e; }
html[data-theme="light"] td { border-top-color: #e3eaf2; color: #1c2b3a; }
html[data-theme="light"] tr:hover { background: #f2f6fa; }
html[data-theme="light"] .account { color: #047857; }
html[data-theme="light"] .num { color: #b45309; }

/* ---------- Акцентные блоки ---------- */
html[data-theme="light"] .note { background: rgba(217, 119, 6, .10); border-left-color: #d97706; color: #92400e; }
html[data-theme="light"] .example { background: rgba(4, 120, 87, .08); border-left-color: #059669; color: #1c2b3a; }
html[data-theme="light"] .badge { background: rgba(217, 119, 6, .10); border-color: rgba(217, 119, 6, .4); color: #92400e; }
html[data-theme="light"] .acc-card b { color: #047857; }
html[data-theme="light"] .step b { color: #b45309; }
html[data-theme="light"] .section h2::before { background: #d97706; }
html[data-theme="light"] .header h1::before { color: #d97706; }

/* ---------- Калькулятор (exc) ---------- */
html[data-theme="light"] .mode-switch { background: rgba(23, 74, 117, .08); }
html[data-theme="light"] .mode-btn { color: #5b6d80; }
html[data-theme="light"] .mode-btn.active { background: #1e5b94; color: #ffffff; }
html[data-theme="light"] .input-field { color: #0f2740; border-bottom-color: #8fa8c0; }
html[data-theme="light"] .input-field::placeholder { color: #94a3b8; }
html[data-theme="light"] .quick-btn { border-color: #b9c9da; color: #41586e; }
html[data-theme="light"] .quick-btn:hover { border-color: #b45309; color: #b45309; }
html[data-theme="light"] .toggle-slider { background: #cbd5e1; }
html[data-theme="light"] .toggle-switch input:checked + .toggle-slider { background: #f59e0b; }
html[data-theme="light"] .result-value { color: #b45309; }
html[data-theme="light"] .result-card .value { color: #16374f; }
html[data-theme="light"] .result-card .value span { color: #5b6d80; }
html[data-theme="light"] .spread-toggle { background: rgba(23, 74, 117, .10); }
html[data-theme="light"] .spread-toggle button { color: #5b6d80; }
html[data-theme="light"] .spread-toggle button.active { background: #f59e0b; color: #1f2937; }
html[data-theme="light"] .savings-card {
    background: linear-gradient(135deg, rgba(209, 250, 229, .9) 0%, rgba(167, 243, 208, .7) 100%);
    border: 1px solid #34d399;
}
html[data-theme="light"] .savings-card .label { color: #047857; }
html[data-theme="light"] .savings-card .value { color: #047857; }
html[data-theme="light"] .details-toggle { color: #5b6d80; }
html[data-theme="light"] .details-toggle:hover { color: #16374f; }
html[data-theme="light"] .detail-item { border-bottom-color: #e3eaf2; }
html[data-theme="light"] .detail-value { color: #16374f; }
html[data-theme="light"] #totalComm { color: #b45309 !important; }
html[data-theme="light"] #rateUpdateTime { color: #5b6d80 !important; }

/* ---------- exc: заголовок калькулятора сливается с фоном ---------- */
html[data-theme="light"] .page-head {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ---------- Свопы (accounting) ---------- */
html[data-theme="light"] .timeline { border-left-color: rgba(217, 119, 6, .45); }
html[data-theme="light"] .day::before { background: #d97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, .25); }
html[data-theme="light"] .day-head { color: #16374f; }
html[data-theme="light"] .res-card { background: rgba(4, 120, 87, .06); border-color: rgba(4, 120, 87, .35); }
html[data-theme="light"] .res-card .v { color: #047857; }
html[data-theme="light"] .res-card.amber { background: rgba(217, 119, 6, .08); border-color: rgba(217, 119, 6, .4); }
html[data-theme="light"] .res-card.amber .v { color: #b45309; }
html[data-theme="light"] .cta.ghost { background: transparent; color: #b45309; border: 1px solid rgba(180, 83, 9, .5); }

/* =====================================================
   ЖЁСТКАЯ ЧИТАБЕЛЬНОСТЬ: не зависит от имён классов страниц.
   Любой текст (кроме ссылок, кнопок и акцентов) — тёмный.
   ===================================================== */
html[data-theme="light"] body *:not(a):not(button):not(select):not(input):not(textarea):not(.account):not(.num):not(.badge):not([class*="date"]):not(.fab-opt):not(.v):not([class*="neg"]):not([class*="pos"]):not([class*="minus"]):not([class*="plus"]) {
color: #1c2b3a !important;
}

/* Возвращаем иерархию: вторичный текст — приглушённый */
html[data-theme="light"] body p,
html[data-theme="light"] body small,
html[data-theme="light"] body [class*="desc"],
html[data-theme="light"] body [class*="subtitle"],
html[data-theme="light"] body [class*="label"] { color: #5b6d80 !important; }
/* Возвращаем синие заголовки секций */
html[data-theme="light"] h1,
html[data-theme="light"] h2 { color: #14507e !important; }
/* Возвращаем акценты */
html[data-theme="light"] body a { color: #b45309 !important; }
html[data-theme="light"] .account { color: #047857 !important; }
html[data-theme="light"] .num { color: #b45309 !important; }
html[data-theme="light"] .badge,
html[data-theme="light"] [class*="date"] { color: #b45309 !important; }
html[data-theme="light"] .moex-btn,
html[data-theme="light"] .cta { color: #062645 !important; }
html[data-theme="light"] .savings-card .label,
html[data-theme="light"] .savings-card .value { color: #047857 !important; }
html[data-theme="light"] .result-value { color: #b45309 !important; }
html[data-theme="light"] .res-card .v { color: #047857 !important; }
html[data-theme="light"] .res-card.amber .v { color: #b45309 !important; }

/* ---------- Видимые блоки-плитки в светлой теме (не зависит от имён классов) ---------- */
html[data-theme="light"] div:has(> h3 + p):not(.section):not(.subsection):not(.card):not(.day):not(.savings-card):not(.header):not(.toggle-info):not(.detail-item) {
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid rgba(23, 74, 117, .16) !important;
    border-radius: 12px !important;
    box-shadow: 0 6px 24px rgba(23, 74, 117, .08) !important;
    padding: 18px !important;
}
/* ---------- iropt: поля ввода и график в светлой теме ---------- */
/* Цифры в инпутах снова видны */
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select { color: #0f2740 !important; }
html[data-theme="light"] input::placeholder { color: #94a3b8 !important; }

/* График: все SVG-подписи (оси, месяцы, легенда) — тёмные */
html[data-theme="light"] svg text { fill: #46617a !important; }

/* График: белые линии/заливки (сетка, оси) становятся видимыми */
html[data-theme="light"] svg [stroke^="#fff"],
html[data-theme="light"] svg [stroke^="#FFF"],
html[data-theme="light"] svg [stroke^="rgba(255"],
html[data-theme="light"] svg [stroke^="white"] { stroke: rgba(23, 74, 117, .35) !important; }
html[data-theme="light"] svg [fill^="#fff"],
html[data-theme="light"] svg [fill^="#FFF"],
html[data-theme="light"] svg [fill^="rgba(255"],
html[data-theme="light"] svg [fill^="white"] { fill: rgba(23, 74, 117, .6) !important; }

/* График: если сетка/оси заданы классами, а не атрибутами */
html[data-theme="light"] svg [class*="grid"] ,
html[data-theme="light"] svg [class*="gridline"] { stroke: rgba(23, 74, 117, .25) !important; }
html[data-theme="light"] svg [class*="axis"] ,
html[data-theme="light"] svg [class*="label"] { fill: #46617a !important; }

/* ---------- Знаки: минус красный, плюс зелёный, порог янтарный ---------- */
html[data-theme="light"] [style*="#ef4444"],
html[data-theme="light"] [style*="rgb(239, 68, 68)"],
html[data-theme="light"] [class*="neg"],
html[data-theme="light"] [class*="minus"] { color: #dc2626 !important; }
html[data-theme="light"] [style*="#2ecc71"],
html[data-theme="light"] [style*="rgb(46, 204, 113)"],
html[data-theme="light"] [style*="#10b981"],
html[data-theme="light"] [style*="rgb(16, 185, 129)"],
html[data-theme="light"] [class*="pos"],
html[data-theme="light"] [class*="plus"],
html[data-theme="light"] [class*="profit"] { color: #059669 !important; }
html[data-theme="light"] [style*="#fbbf24"],
html[data-theme="light"] [style*="rgb(251, 191, 36)"] { color: #b45309 !important; }

/* ---------- График: возвращаем сетку и служебные линии ---------- */
html[data-theme="light"] svg line { stroke: rgba(23, 74, 117, .28) !important; }
html[data-theme="light"] svg [style*="rgba(255"],
html[data-theme="light"] svg [style*="rgb(255"],
html[data-theme="light"] svg [style*="#fff"] { stroke: rgba(23, 74, 117, .28) !important; }
html[data-theme="light"] svg [class*="grid"] line,
html[data-theme="light"] svg [class*="grid"] path { stroke: rgba(23, 74, 117, .28) !important; }

/* Плитки-карточки (главная и подобные), кроме ячеек с полями ввода */
html[data-theme="light"] [class*="grid"]:not(.result-grid):not(.accounts):not(.steps):not(.badges) > *:not(:has(input)):not(:has(textarea)):not(:has(> h3 + p)) {
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid rgba(23, 74, 117, .16) !important;
    border-radius: 12px !important;
    box-shadow: 0 6px 24px rgba(23, 74, 117, .08) !important;
    padding: 18px !important;
}

/* ---------- iropt: знаковые цвета значений (классы v r / v g / прочие) ---------- */
html[data-theme="light"] .v.r { color: #dc2626 !important; }
html[data-theme="light"] .v.g { color: #059669 !important; }
html[data-theme="light"] .v:not(.r):not(.g) { color: #b45309 !important; }
html[data-theme="light"] .l { color: #5b6d80 !important; }

/* ---------- iropt: светлая доводка ---------- */
html[data-theme="light"] .seg { background: rgba(23, 74, 117, .08); }
html[data-theme="light"] .seg button { color: #5b6d80; }
html[data-theme="light"] .seg button.active { background: #1e5b94; color: #ffffff; }
html[data-theme="light"] .strats button { background: rgba(23, 74, 117, .04); border-color: rgba(23, 74, 117, .2); color: #41586e; }
html[data-theme="light"] .strats button.active { border-color: #b45309; color: #b45309; background: rgba(217, 119, 6, .08); }
html[data-theme="light"] .goal { color: #b45309 !important; }
html[data-theme="light"] .field label { color: #5b6d80 !important; }
html[data-theme="light"] .rcard { background: rgba(23, 74, 117, .06); }
html[data-theme="light"] .rcard .l { color: #5b6d80 !important; }
html[data-theme="light"] .rcard .v.r { color: #dc2626 !important; }
html[data-theme="light"] .rcard .v.g { color: #059669 !important; }
html[data-theme="light"] .rcard .v:not(.r):not(.g) { color: #b45309 !important; }
html[data-theme="light"] .presets button { border-color: rgba(23, 74, 117, .25); color: #41586e; }
html[data-theme="light"] .presets button:hover { border-color: #b45309; color: #b45309; }
html[data-theme="light"] .legend { color: #5b6d80 !important; }
/* ---------- iropt: видимое подчёркивание полей ввода в светлой теме ---------- */
html[data-theme="light"] .field input { border-bottom: 2px solid #8fa8c0 !important; }
html[data-theme="light"] .field input:focus { border-bottom-color: #b45309 !important; }
/* ---------- cbr: светлая доводка ---------- */
html[data-theme="light"] .stat { background: rgba(23, 74, 117, .06); }
html[data-theme="light"] .stat .l { color: #5b6d80 !important; }
html[data-theme="light"] .stat .v { color: #b45309 !important; }
html[data-theme="light"] .stat .v small { color: #5b6d80 !important; }
html[data-theme="light"] .btn-save { border-color: rgba(23, 74, 117, .25); color: #41586e; }
html[data-theme="light"] .btn-save:hover { border-color: #b45309; color: #b45309; }
html[data-theme="light"] #tip { background: rgba(255, 255, 255, .97); color: #1c2b3a; border-color: #b45309; }
html[data-theme="light"] #tip b { color: #b45309; }
html[data-theme="light"] .src { color: #64748b !important; }
/* ---------- news: возвращаем панели-блоки как в тёмной теме ---------- */
html[data-theme="light"] .feature {
    background: rgba(23, 74, 117, .05) !important;
    border: 1px solid rgba(23, 74, 117, .16) !important;
}
/* внутренняя обёртка текста — снова прозрачная, панель только у .feature */
html[data-theme="light"] .feature div:has(> h3 + p):not(.section):not(.subsection):not(.card):not(.day):not(.savings-card):not(.header):not(.toggle-info):not(.detail-item) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
html[data-theme="light"] .feature img { border: 1px solid rgba(23, 74, 117, .25); }

/* ---------- news: светлая доводка остальных элементов ---------- */
html[data-theme="light"] .badge-date { background: rgba(4, 120, 87, .10); color: #047857; }
html[data-theme="light"] .badge-free { background: rgba(217, 119, 6, .12); color: #b45309; }
html[data-theme="light"] .lead,
html[data-theme="light"] .feature p { color: #5b6d80 !important; }
html[data-theme="light"] .list li::before { color: #b45309; }
html[data-theme="light"] .speaker { background: rgba(30, 91, 148, .10); border-color: rgba(30, 91, 148, .35); }
/* ---------- import: светлая тема ---------- */
/* Зона загрузки: видимая синеватая окантовка, янтарная при наведении */
html[data-theme="light"] .upload-zone {
    border: 2px dashed rgba(23, 74, 117, .35);
    background: rgba(23, 74, 117, .03);
}
html[data-theme="light"] .upload-zone:hover,
html[data-theme="light"] .upload-zone.dragover {
    border-color: #b45309;
    background: rgba(217, 119, 6, .06);
}
html[data-theme="light"] .upload-zone .text { color: #5b6d80; }
html[data-theme="light"] .upload-zone .text strong { color: #b45309; }
html[data-theme="light"] .file-info { background: rgba(23, 74, 117, .06); }
html[data-theme="light"] .file-info .name { color: #b45309; }

/* Вкладки и сводка */
html[data-theme="light"] .tabs { background: rgba(23, 74, 117, .08); }
html[data-theme="light"] .tab-btn { color: #5b6d80; }
html[data-theme="light"] .tab-btn.active { background: #1e5b94; color: #ffffff; }
html[data-theme="light"] .summary-card { background: rgba(23, 74, 117, .06); }
html[data-theme="light"] .summary-card .label { color: #5b6d80; }
html[data-theme="light"] .summary-card .value { color: #b45309; }
html[data-theme="light"] .badge-swap { color: #b45309; }

/* Сноски под таблицами — без янтарной плашки (это не callout, а примечание) */
html[data-theme="light"] .card .note { background: transparent; border-left: none; padding: 0; color: #5b6d80; }

/* Инлайн-белой текст (прочерки, суммы, заголовки списков) становится видимым */
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #fff"] { color: #16374f !important; }
/* Инлайн-линии разделителей комиссий — синеватые */
html[data-theme="light"] [style*="rgba(255,255,255"] { border-bottom-color: rgba(23, 74, 117, .15) !important; }
/* ---------- главная: окантовки и контраст в светлой теме ---------- */
html[data-theme="light"] .aud {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(23, 74, 117, .16);
    box-shadow: 0 4px 16px rgba(23, 74, 117, .06);
}
html[data-theme="light"] .aud .d { color: #5b6d80 !important; }
html[data-theme="light"] .card { border: 1px solid rgba(23, 74, 117, .16); }
html[data-theme="light"] .placeholder {
    border: 1px dashed rgba(23, 74, 117, .35);
    color: #5b6d80;
}
html[data-theme="light"] .badge-soon { background: rgba(217, 119, 6, .12); color: #b45309; }
/* инлайн-янтарная ссылка анонса — тёмно-янтарная на белом */
html[data-theme="light"] [style*="color:#fbbf24"] { color: #b45309 !important; }