/* ============================================================
   FManager — улучшения интерфейса (v2.0)
   Подключается в layout/default.phtml после основных стилей.
   ============================================================ */

/* ---------- Единые SVG-иконки вместо эмодзи ---------- */

/* Иконка масштабируется от font-size родителя и наследует его цвет.
   Работает в любых блоках: сайдбар, карточки, бейджи, кнопки. */
.fm-ei {
    width: 1em;
    height: 1em;
    vertical-align: -0.12em;
    display: inline-block;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Иконка внутри «плитки» сайдбара / карточек */
.fm-ei-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fm-ei-box .fm-ei {
    vertical-align: 0;
}

/* ---------- Twemoji: выравнивание SVG-эмодзи по тексту ---------- */

img.emoji {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.15em;
    margin: 0 0.05em;
}

/* Крупные эмодзи-«иконки» в карточках и заголовках сохраняют размер родителя */
h1 img.emoji, h2 img.emoji, h3 img.emoji,
h4 img.emoji, h5 img.emoji, h6 img.emoji {
    vertical-align: -0.1em;
}

/* ---------- Быстрая навигация в мобильной шапке ---------- */

.fm-quick-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 62vw;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.fm-quick-nav::-webkit-scrollbar {
    display: none;
}

.fm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 10px;
    margin-right: 6px;
    border-radius: 6px;
    white-space: nowrap;
    transition: filter 0.15s ease, transform 0.15s ease;
}
.fm-chip:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: #fff;
}
.fm-chip .fm-ei { font-size: 0.9rem; }

.fm-chip-green { background: #10b981; }
.fm-chip-amber { background: #f59e0b; color: #1e293b; }
.fm-chip-navy  { background: #1e3c72; }
.fm-chip-live  { background: #ef4444; }

.fm-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    animation: fm-live-pulse 1.4s ease-in-out infinite;
}
@keyframes fm-live-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.8); }
}

/* ---------- Карточки быстрых разделов (Game Hub) ---------- */

/* Делаем очевидную кликабельность: подъем + зеленая рамка */
a.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.14) !important;
    border-color: #10b981 !important;
}
a.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* ---------- Сайдбар: ровные иконки ---------- */

.sidebar .fm-ei {
    font-size: 1.05rem;
    margin-right: 8px;
}

/* ---------- Мобильная адаптация ---------- */
@media (max-width: 767.98px) {

    .content-container-padding {
        padding-top: 12px;
    }

    /* Защита от «пустых» фиксированных высот баннеров на телефоне */
    .fm-hero-banner,
    .hero-banner,
    [class*="hero"] {
        min-height: 0 !important;
        height: auto !important;
    }

    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.3rem; }

    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Крупные кнопки на всю ширину */
    .card-body .btn-lg,
    .fm-hero-banner .btn {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .fm-quick-nav { max-width: 56vw; }
    .fm-chip { font-size: 0.72rem; padding: 5px 8px; }
}


/* ============ FM Notify — всплывающие уведомления (v7) ============ */
#fm-toast-container {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 28px));
    pointer-events: none;
}
.fm-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
    border: 1px solid rgba(134, 239, 172, 0.35);
    color: #ecfdf5;
    box-shadow: 0 10px 30px rgba(4, 32, 17, 0.45);
    animation: fmToastIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.fm-toast-out {
    animation: fmToastOut 0.35s ease forwards;
}
@keyframes fmToastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.92); }
    to   { opacity: 1; transform: none; }
}
@keyframes fmToastOut {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateX(60px) scale(0.92); }
}
.fm-toast-link { cursor: pointer; }
.fm-toast-link:hover { filter: brightness(1.12); }
.fm-toast-icon { font-size: 1.5rem; line-height: 1.2; flex-shrink: 0; }
.fm-toast-icon img.emoji { width: 1.5rem; height: 1.5rem; margin: 0; }
.fm-toast-body { min-width: 0; flex: 1; }
.fm-toast-title { font-weight: 800; font-size: 0.9rem; line-height: 1.25; }
.fm-toast-text { font-size: 0.78rem; opacity: 0.85; margin-top: 2px; word-break: break-word; }
.fm-toast-close {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.fm-toast-close:hover { background: rgba(255,255,255,0.28); }
.fm-toast-win  { background: linear-gradient(135deg, #052e16, #15803d); border-color: rgba(74,222,128,0.6); }
.fm-toast-loss { background: linear-gradient(135deg, #450a0a, #7f1d1d); border-color: rgba(252,165,165,0.45); color: #fef2f2; }
.fm-toast-draw { background: linear-gradient(135deg, #1e293b, #334155); border-color: rgba(148,163,184,0.5); color: #f1f5f9; }
.fm-toast-live { background: linear-gradient(135deg, #450a0a, #b91c1c); border-color: rgba(255,120,120,0.6); color: #fff; }
.fm-toast-news { background: linear-gradient(135deg, #172554, #1d4ed8); border-color: rgba(147,197,253,0.5); color: #eff6ff; }
.fm-toast-friendly { background: linear-gradient(135deg, #3b0764, #7e22ce); border-color: rgba(216,180,254,0.5); color: #faf5ff; }
@media (max-width: 576px) {
    #fm-toast-container { right: 8px; bottom: 8px; gap: 8px; }
    .fm-toast { padding: 10px; border-radius: 12px; }
}

/* ============ FM Stadium Background (v8) — красивый фон всего сайта ============
   Слой 1 (body::before): градиент + свет прожекторов + зелёная виньетка снизу.
   Слой 2 (body::after): полупрозрачные «соты» как на футбольном мяче.
   Оба слоя position: fixed — фон не прокручивается вместе со страницей. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 65% 45% at 50% -8%, rgba(74, 222, 128, 0.22) 0%, transparent 65%),
        radial-gradient(ellipse 38% 30% at 6% 0%, rgba(253, 224, 71, 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 38% 30% at 94% 0%, rgba(253, 224, 71, 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 75% 42% at 50% 112%, rgba(20, 83, 45, 0.15) 0%, transparent 70%),
        linear-gradient(180deg, #f0f7f2 0%, #e9f2ec 50%, #e1eee6 100%);
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cg fill='none' stroke='%2314532d' stroke-opacity='0.055' stroke-width='1.4'%3E%3Cpath d='M28 66L0 50V16l28-16 28 16v34zM28 100l28-16V50M28 0v34M0 84l28 16'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 56px 100px;
}
/* Лёгкое затемнение сот у верхней кромки, чтобы шапка читалась лучше */
@supports (mask-image: linear-gradient(#000, #000)) {
    body::after {
        mask-image: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, #000 140px);
        -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, #000 140px);
    }
}

/* ============ FM Topbar (v9) — тёмная верхняя панель ============ */
.fm-topbar {
    background: linear-gradient(90deg, #060f0a 0%, #0e2a19 48%, #060f0a 100%) !important;
    border-bottom: 1px solid rgba(74, 222, 128, 0.22) !important;
    box-shadow: 0 2px 14px rgba(3, 15, 8, 0.45) !important;
}
.fm-topbar .navbar-toggler-bar { background: #d1fae5 !important; }
.fm-topbar-controls { gap: 4px; }

.fm-tb-item { position: relative; }
.fm-tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #d1fae5;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.fm-tb-btn:hover, .fm-tb-btn:focus {
    background: rgba(74, 222, 128, 0.16);
    border-color: rgba(74, 222, 128, 0.4);
    color: #ffffff;
    outline: none;
}
.fm-tb-icon { width: 17px; height: 17px; }
.fm-tb-flag { font-size: 1.05rem; line-height: 1; }
.fm-tb-flag img.emoji { width: 1.05rem; height: 1.05rem; margin: 0; }
.fm-tb-caret { width: 12px; height: 12px; opacity: 0.65; }
.fm-tb-label { font-weight: 700; }

/* Бейдж на колокольчике */
.fm-tb-bell { position: relative; }
.fm-tb-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 0.64rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0e2a19;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

/* Аватар */
.fm-tb-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    border: 2px solid rgba(74, 222, 128, 0.55);
    flex-shrink: 0;
    background: #fff;
}
.fm-tb-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Выпадающие меню */
.fm-tb-menu {
    background: #0b1f13;
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(3, 15, 8, 0.6);
    padding: 6px;
    margin-top: 8px;
    min-width: 190px;
}
.fm-tb-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d1fae5 !important;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.87rem;
    font-weight: 600;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
}
.fm-tb-menu-item:hover, .fm-tb-menu-item:focus {
    background: rgba(74, 222, 128, 0.14) !important;
    color: #ffffff !important;
}
.fm-tb-menu-item.active { background: rgba(74, 222, 128, 0.2) !important; color: #fff !important; }
.fm-tb-menu-item.text-danger { color: #fca5a5 !important; }
.fm-tb-menu-item.text-danger:hover { background: rgba(239, 68, 68, 0.18) !important; color: #fecaca !important; }
.fm-tb-menu-icon { width: 15px; height: 15px; opacity: 0.8; flex-shrink: 0; }
.fm-tb-menu .dropdown-divider { border-top-color: rgba(255, 255, 255, 0.12); margin: 4px 6px; }

/* Кнопка входа для гостей — акцентная */
.fm-tb-login {
    background: linear-gradient(135deg, #15803d, #22c55e);
    border-color: rgba(134, 239, 172, 0.5);
    color: #ffffff;
}
.fm-tb-login:hover { filter: brightness(1.1); }

@media (max-width: 576px) {
    .fm-tb-btn { padding: 6px 8px; }
    .fm-topbar-controls { gap: 3px; }
}

/* ============ FM Dark Mode (v10) — полноценная тёмная тема всего сайта ============ */
/* Фон «ночной стадион» */
body.dark { background-color: #0a1510 !important; color: #e2e8f0; }
body.dark::before {
    background:
        radial-gradient(ellipse 65% 45% at 50% -8%, rgba(34, 197, 94, 0.14) 0%, transparent 65%),
        radial-gradient(ellipse 38% 30% at 6% 0%, rgba(253, 224, 71, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 38% 30% at 94% 0%, rgba(253, 224, 71, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 75% 42% at 50% 112%, rgba(4, 32, 17, 0.55) 0%, transparent 70%),
        linear-gradient(180deg, #0c1a12 0%, #0a1510 50%, #081209 100%);
}
body.dark::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cg fill='none' stroke='%234ade80' stroke-opacity='0.05' stroke-width='1.4'%3E%3Cpath d='M28 66L0 50V16l28-16 28 16v34zM28 100l28-16V50M28 0v34M0 84l28 16'/%3E%3C/g%3E%3C/svg%3E");
}

/* Карточки и панели */
body.dark .card {
    background: #101f16 !important;
    border-color: rgba(74, 222, 128, 0.14) !important;
    color: #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
body.dark .card-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9;
}
body.dark .card-footer { background: rgba(255, 255, 255, 0.03) !important; border-top-color: rgba(255,255,255,0.08) !important; }
body.dark .bg-white { background-color: #101f16 !important; }
body.dark .bg-light { background-color: #16281d !important; }
body.dark .border-bottom, body.dark .border-top { border-color: rgba(255,255,255,0.08) !important; }

/* Текст */
body.dark h1, body.dark h2, body.dark h3, body.dark h4, body.dark h5, body.dark h6 { color: #f1f5f9 !important; }
body.dark .text-dark { color: #e2e8f0 !important; }
body.dark .text-secondary { color: #94a3b8 !important; }
body.dark .text-muted { color: #7d8f84 !important; }
body.dark a { color: #6ee7a8; }
body.dark a:hover { color: #a7f3c9; }

/* Таблицы */
body.dark .table { color: #e2e8f0; }
body.dark .table th, body.dark .table td { border-top-color: rgba(255, 255, 255, 0.07) !important; }
body.dark .table .thead-light th, body.dark .thead-light th {
    background: #16281d !important;
    color: #a7f3d0 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark .table-hover tbody tr:hover { background-color: rgba(74, 222, 128, 0.06) !important; color: #f1f5f9; }
body.dark .table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.02); }

/* Формы */
body.dark .form-control, body.dark .custom-select, body.dark textarea {
    background-color: #0c1a12 !important;
    border-color: rgba(74, 222, 128, 0.22) !important;
    color: #e2e8f0 !important;
}
body.dark .form-control:focus, body.dark .custom-select:focus {
    background-color: #0c1a12 !important;
    border-color: #22c55e !important;
    color: #fff !important;
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.18) !important;
}
body.dark .form-control::placeholder { color: #64748b; }
body.dark .input-group-text { background: #16281d; border-color: rgba(74,222,128,0.22); color: #a7f3d0; }

/* Выпадашки Bootstrap по умолчанию (не наши fm-tb-menu) */
body.dark .dropdown-menu:not(.fm-tb-menu) {
    background: #0b1f13;
    border-color: rgba(74, 222, 128, 0.25);
}
body.dark .dropdown-menu:not(.fm-tb-menu) .dropdown-item { color: #d1fae5; }
body.dark .dropdown-menu:not(.fm-tb-menu) .dropdown-item:hover { background: rgba(74,222,128,0.14); color: #fff; }
body.dark .dropdown-divider { border-top-color: rgba(255,255,255,0.12); }

/* Модалки */
body.dark .modal-content { background: #101f16; border-color: rgba(74,222,128,0.2); color: #e2e8f0; }
body.dark .modal-header, body.dark .modal-footer { border-color: rgba(255,255,255,0.08); }
body.dark .close { color: #d1fae5; text-shadow: none; }

/* Кнопки-аутлайны */
body.dark .btn-outline-secondary { color: #a7f3d0; border-color: rgba(74,222,128,0.35); }
body.dark .btn-outline-secondary:hover { background: rgba(34,197,94,0.18); color: #fff; border-color: #22c55e; }
body.dark .btn-outline-dark { color: #d1fae5; border-color: rgba(209,250,229,0.4); }
body.dark .btn-outline-dark:hover, body.dark .btn-outline-dark.active { background: #d1fae5; color: #052e16; border-color: #d1fae5; }
body.dark .btn-outline-primary { color: #6ee7a8; border-color: rgba(74,222,128,0.4); }
body.dark .btn-outline-primary:hover, body.dark .btn-outline-primary.active { background: #15803d; border-color: #15803d; color: #fff; }
body.dark .btn-outline-success { color: #4ade80; border-color: rgba(74,222,128,0.4); }
body.dark .btn-outline-success:hover { background: #16a34a; color: #fff; }

/* Бейджи и алерты */
body.dark .badge-light { background: #1c3423 !important; color: #d1fae5 !important; border-color: rgba(74,222,128,0.25) !important; }
body.dark .alert { border-radius: 12px; }
body.dark .alert-warning { background: #2b2113; border-color: rgba(245,158,11,0.35); color: #fcd34d; }
body.dark .alert-success { background: #0d2b1a; border-color: rgba(34,197,94,0.35); color: #86efac; }
body.dark .alert-info { background: #0d1f2b; border-color: rgba(56,189,248,0.3); color: #7dd3fc; }
body.dark .alert-danger { background: #2b1215; border-color: rgba(239,68,68,0.35); color: #fca5a5; }

/* Хлебные крошки, пагинация, подвал */
body.dark .breadcrumb { background: #101f16; }
body.dark .breadcrumb-item a { color: #6ee7a8; }
body.dark .breadcrumb-item.active { color: #94a3b8; }
body.dark .page-link { background: #101f16; border-color: rgba(74,222,128,0.2); color: #a7f3d0; }
body.dark .page-item.active .page-link { background: #15803d; border-color: #15803d; color: #fff; }
body.dark .page-footer { border-top-color: rgba(255,255,255,0.08) !important; }
body.dark .list-group-item { background: #101f16; border-color: rgba(255,255,255,0.07); color: #e2e8f0; }

/* --- Наши компоненты --- */
/* Скорость трансляции и статы матч-центра */
body.dark .mc-speed-panel { background: #101f16; border-color: rgba(74,222,128,0.14); }
body.dark .mc-speed-panel .text-dark { color: #e2e8f0 !important; }
body.dark .mc-stat-card, body.dark .mc-feed-card { background: #101f16 !important; border-color: rgba(74,222,128,0.14) !important; }
body.dark .mc-feed { background: linear-gradient(180deg, #0c1a12 0%, #101f16 30%); }
body.dark .mc-ev-bubble { background: #16281d; border-color: rgba(255,255,255,0.09); }
body.dark .mc-ev-title { color: #e2e8f0; }
body.dark .mc-ev-goal .mc-ev-title { color: #4ade80; }
body.dark .mc-ev-desc { color: #94a3b8; }
body.dark .mc-ev-red_card .mc-ev-bubble { background: #2b1215; }
body.dark .mc-stat-val { color: #f1f5f9; }
body.dark .mc-stat-label { color: #7d8f84; }
body.dark .mc-duo-bar { background: #1c3423; }

/* Состав: сводные карточки и фильтры */
body.dark .fm-squad-stat-card { background: #101f16; border-color: rgba(74,222,128,0.14); }
body.dark .filter-pill { background: #101f16; border-color: rgba(74,222,128,0.18); color: #a7f3d0; }
body.dark .filter-pill:hover { background: #16281d; color: #fff; border-color: rgba(74,222,128,0.35); }
body.dark .filter-pill.active { background: #d1fae5; border-color: #d1fae5; color: #052e16; }
body.dark .filter-badge { background: rgba(255,255,255,0.1); color: #d1fae5; }
body.dark .filter-pill.active .filter-badge { background: rgba(5,46,22,0.15); color: #052e16; }
body.dark .fm-starter-row:hover { background-color: rgba(74,222,128,0.07) !important; }
body.dark .fm-pcard-basic { background: linear-gradient(165deg, #1c3423 0%, #16281d 100%); color: #e2e8f0; }
body.dark .fm-pcard-basic .fm-pcard-btn { background: rgba(255,255,255,0.1); color: #fff !important; border-color: rgba(255,255,255,0.2); }

/* Прочие белые подложки модулей */
body.dark .fm-hub-team, body.dark .fm-mini-card { background: #101f16 !important; border-color: rgba(74,222,128,0.14) !important; }

/* ============ FM Topbar на десктопе (v11) ============
   Штатный CSS прячет .top_nav на экранах >991px — возвращаем нашу панель. */
@media (min-width: 992px) {
    .top_nav.fm-topbar {
        display: block !important;
        /* лейаут сайта — отцентрованная колонка max-width:1100px:
           панель повторяет её ширину и центр, сливаясь с шапкой сайта */
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(1100px, 100%);
        min-height: 3.4rem;
        /* контент панели начинается правее сайдбара, как и контент страницы */
        padding: 6px 1.2rem 6px calc(15rem + 1.2rem);
        border-radius: 0;
    }
    /* В панели на десктопе не нужны бургер и логотип — они уже в сайдбаре */
    .fm-topbar .navbar-toggle,
    .fm-topbar .logo { display: none !important; }
    .wrapper > .page_layout { padding-top: 3.4rem; }
}

/* ============ Тёмная тема: контейнеры (v11) ============ */
body.dark .content-container { background: rgba(10, 21, 16, 0.97) !important; }
body.dark .sidebar { background: #0b1a11 !important; border-right-color: rgba(74, 222, 128, 0.15) !important; }
body.dark .sidebar a { color: #d1fae5 !important; }
body.dark .sidebar a:hover { color: #ffffff !important; }
body.dark .sidebar__logo { border-bottom-color: rgba(74,222,128,0.15) !important; }
body.dark .page-title, body.dark .phdr { color: #f1f5f9; }

/* ============ Тёмная тема: переменные Bootstrap и кнопки (v11b) ============
   Штатный body.dark не задаёт --bs-emphasis-color — таблицы остаются чёрными. */
body.dark {
    --bs-emphasis-color: #e2e8f0;
    --bs-emphasis-color-rgb: 226, 232, 240;
    --bs-body-bg: #0a1510;
    --bs-body-color: #e2e8f0;
}
body.dark .btn-primary { background: #15803d; border-color: #15803d; color: #fff; }
body.dark .btn-primary:hover, body.dark .btn-primary:focus, body.dark .btn-primary:active {
    background: #16a34a; border-color: #16a34a; color: #fff;
}

/* ============ v12: топбар — чипы только на мобильных, лого убрано ============ */
@media (min-width: 992px) {
    .fm-topbar .fm-quick-nav { display: none !important; }
}
.fm-topbar .logo { display: none !important; }

/* ============ v12: тёмная тема — дашборд и инлайн-цвета ============ */
body.dark .fm-hub-card { background: #101f16 !important; border-color: rgba(74,222,128,0.14) !important; }
body.dark .fm-hub-card:hover { background: #16281d !important; border-color: rgba(74,222,128,0.35) !important; box-shadow: 0 10px 20px -4px rgba(0,0,0,0.4) !important; }
body.dark .fm-hub-title { color: #f1f5f9 !important; }
body.dark .fm-hub-title .text-muted { color: #8aa793 !important; }
body.dark .fm-hub-desc { color: #8aa793 !important; }
body.dark .fm-hub-line { background: linear-gradient(90deg, rgba(74,222,128,0.3), rgba(74,222,128,0.02)) !important; }
body.dark .fm-badge-team { background: rgba(21,128,61,.22); color: #86efac; border-color: rgba(74,222,128,.3); }
body.dark .fm-badge-tournament { background: rgba(202,138,4,.16); color: #fde047; border-color: rgba(253,224,71,.3); }
body.dark .fm-badge-economy { background: rgba(37,99,235,.16); color: #93c5fd; border-color: rgba(147,197,253,.3); }
body.dark .fm-badge-community { background: rgba(124,58,237,.16); color: #d8b4fe; border-color: rgba(216,180,254,.3); }

/* Тёмные инлайн-цвета текста в шаблонах -> светлые (инлайн-стиль бьёт классы, ловим атрибутом) */
body.dark [style^="color: #0f172a" i],
body.dark [style^="color:#0f172a" i],
body.dark [style*="; color: #0f172a" i],
body.dark [style*="; color:#0f172a" i],
body.dark [style*=";color: #0f172a" i],
body.dark [style*=";color:#0f172a" i],
body.dark [style^="color: #1e293b" i],
body.dark [style^="color:#1e293b" i],
body.dark [style*="; color: #1e293b" i],
body.dark [style*="; color:#1e293b" i],
body.dark [style*=";color: #1e293b" i],
body.dark [style*=";color:#1e293b" i],
body.dark [style^="color: #334155" i],
body.dark [style^="color:#334155" i],
body.dark [style*="; color: #334155" i],
body.dark [style*="; color:#334155" i],
body.dark [style*=";color: #334155" i],
body.dark [style*=";color:#334155" i],
body.dark [style^="color: #111827" i],
body.dark [style^="color:#111827" i],
body.dark [style*="; color: #111827" i],
body.dark [style*="; color:#111827" i],
body.dark [style*=";color: #111827" i],
body.dark [style*=";color:#111827" i],
body.dark [style^="color: #1f2937" i],
body.dark [style^="color:#1f2937" i],
body.dark [style*="; color: #1f2937" i],
body.dark [style*="; color:#1f2937" i],
body.dark [style*=";color: #1f2937" i],
body.dark [style*=";color:#1f2937" i],
body.dark [style^="color: #374151" i],
body.dark [style^="color:#374151" i],
body.dark [style*="; color: #374151" i],
body.dark [style*="; color:#374151" i],
body.dark [style*=";color: #374151" i],
body.dark [style*=";color:#374151" i],
body.dark [style^="color: #000000" i],
body.dark [style^="color:#000000" i],
body.dark [style*="; color: #000000" i],
body.dark [style*="; color:#000000" i],
body.dark [style*=";color: #000000" i],
body.dark [style*=";color:#000000" i],
body.dark [style^="color: #000" i],
body.dark [style^="color:#000" i],
body.dark [style*="; color: #000" i],
body.dark [style*="; color:#000" i],
body.dark [style*=";color: #000" i],
body.dark [style*=";color:#000" i] {
    color: #e2e8f0 !important;
}
body.dark [style^="color: #475569" i],
body.dark [style^="color:#475569" i],
body.dark [style*="; color: #475569" i],
body.dark [style*="; color:#475569" i],
body.dark [style*=";color: #475569" i],
body.dark [style*=";color:#475569" i],
body.dark [style^="color: #64748b" i],
body.dark [style^="color:#64748b" i],
body.dark [style*="; color: #64748b" i],
body.dark [style*="; color:#64748b" i],
body.dark [style*=";color: #64748b" i],
body.dark [style*=";color:#64748b" i],
body.dark [style^="color: #4b5563" i],
body.dark [style^="color:#4b5563" i],
body.dark [style*="; color: #4b5563" i],
body.dark [style*="; color:#4b5563" i],
body.dark [style*=";color: #4b5563" i],
body.dark [style*=";color:#4b5563" i],
body.dark [style^="color: #6b7280" i],
body.dark [style^="color:#6b7280" i],
body.dark [style*="; color: #6b7280" i],
body.dark [style*="; color:#6b7280" i],
body.dark [style*=";color: #6b7280" i],
body.dark [style*=";color:#6b7280" i] {
    color: #a9bfb2 !important;
}

/* ============ v13: добивка белых блоков football.css в тёмной теме ============
   В football.css белые фоны зашиты с !important — перебиваем более специфичными правилами. */
body.dark .forum-section,
body.dark .post-item,
body.dark .list-item {
    background: transparent !important;
    border-bottom-color: rgba(74, 222, 128, 0.12) !important;
}
body.dark .section-header { border-bottom-color: rgba(74, 222, 128, 0.15) !important; }
body.dark .counter-badge {
    background: #1c3423 !important;
    color: #d1fae5 !important;
    border-color: rgba(74, 222, 128, 0.22) !important;
}
/* Лого и футер сайдбара больше не белые */
body.dark .sidebar .sidebar__logo {
    background: transparent !important;
    border-bottom-color: rgba(74, 222, 128, 0.15) !important;
}
body.dark .sidebar .sidebar__footer {
    background: transparent !important;
    border-top-color: rgba(74, 222, 128, 0.15) !important;
    color: #8aa793 !important;
}
/* Селекты и подвал */
body.dark .form-select {
    background-color: #0c1a12 !important;
    border-color: rgba(74, 222, 128, 0.22) !important;
    color: #e2e8f0 !important;
}
body.dark .page-footer {
    background: #0b1a11;
    border-top-color: rgba(74, 222, 128, 0.15);
    color: #8aa793;
}
/* Чат трибун и таблицы из football.css */
body.dark .fm-tribune-chat { background: #101f16; border-color: rgba(74, 222, 128, 0.14); }
body.dark .fm-chat-msg-row { border-bottom-color: rgba(74, 222, 128, 0.08); color: #d1e5d8; }
body.dark .table thead th { background: #14532d !important; color: #d1fae5 !important; }
/* Инлайн белые фоны (style="background: #fff..." в шаблонах) */
body.dark [style^="background: #fff" i], body.dark [style^="background:#fff" i],
body.dark [style*="; background: #fff" i], body.dark [style*=";background: #fff" i],
body.dark [style*="; background:#fff" i], body.dark [style*=";background:#fff" i],
body.dark [style^="background-color: #fff" i], body.dark [style^="background-color:#fff" i],
body.dark [style*="; background-color: #fff" i], body.dark [style*=";background-color:#fff" i],
body.dark [style*="; background-color:#fff" i], body.dark [style*=";background-color: #fff" i] {
    background: #101f16 !important;
}
/* text-dark-brown: штатная переменная в dark задана криво (#fff вместо rgb-триплета) */
body.dark { --bs-dark-brown-rgb: 226, 232, 240; }
body.dark .text-dark-brown { color: #e2e8f0 !important; }

/* ============ v14: светлая тема — топбар сливается с сайтом ============ */
body:not(.dark) .fm-topbar {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}
body:not(.dark) .fm-topbar .navbar-toggler-bar { background: #334155 !important; }
body:not(.dark) .fm-tb-btn {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}
body:not(.dark) .fm-tb-btn:hover, body:not(.dark) .fm-tb-btn:focus {
    background: #e6f6ec;
    border-color: #86efac;
    color: #14532d;
}
body:not(.dark) .fm-tb-badge { border-color: #ffffff; box-shadow: 0 0 6px rgba(239, 68, 68, 0.45); }
body:not(.dark) .fm-tb-avatar { border-color: #86efac; }
body:not(.dark) .fm-tb-menu {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
body:not(.dark) .fm-tb-menu-item { color: #334155 !important; }
body:not(.dark) .fm-tb-menu-item:hover, body:not(.dark) .fm-tb-menu-item:focus {
    background: #f0fdf4 !important;
    color: #14532d !important;
}
body:not(.dark) .fm-tb-menu-item.active { background: #dcfce7 !important; color: #14532d !important; }
body:not(.dark) .fm-tb-menu-item.text-danger { color: #dc2626 !important; }
body:not(.dark) .fm-tb-menu-item.text-danger:hover { background: #fef2f2 !important; color: #b91c1c !important; }
body:not(.dark) .fm-tb-menu .dropdown-divider { border-top-color: #e2e8f0; }

/* ============ v17: два логотипа — светлый для тёмной темы ============ */
.fm-logo-dark { display: none; }
body.dark .fm-logo-light { display: none !important; }
body.dark .fm-logo-dark { display: inline-block !important; }

/* ============ v18: компактная таблица лиги ============ */
.fm-standings { font-size: 0.88rem; }
.fm-standings th, .fm-standings td {
    white-space: nowrap;
    padding: 0.4rem 0.3rem;
    vertical-align: middle;
}
.fm-standings th:nth-child(2), .fm-standings td:nth-child(2) {
    white-space: normal;
    min-width: 130px;
}
.fm-st-pos { width: 36px; text-align: center; }
.fm-ucl-badge { font-size: 0.6rem; display: inline-block; margin-top: 2px; }
.fm-st-logo {
    width: 24px; height: 24px;
    border-radius: 4px; overflow: hidden;
    background: #e8f5e9;
    margin-right: 6px; flex-shrink: 0;
}
.fm-st-lvl {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.4;
}
.fm-form-dots { display: inline-flex; gap: 2px; align-items: center; }
.fm-form-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.fm-form-w { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.5); }
.fm-form-d { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,0.5); }
.fm-form-l { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.5); }
.fm-standings-wrap { border-radius: 10px; }

body.dark .fm-st-lvl { background: #1c3423; border-color: rgba(74,222,128,0.2); color: #a7f3d0; }
body.dark .fm-st-logo { background: #16281d; }
body.dark .fm-standings .text-dark { color: #e2e8f0 !important; }

/* ============ v18b: переменные football.css в тёмной теме ============
   football.css зашил color: var(--fm-text-main) !important на body —
   поэтому наследуемый текст оставался тёмным. Переопределяем сами переменные. */
body.dark {
    --fm-text-main: #e2e8f0;
    --fm-text-muted: #8aa793;
    --fm-bg-main: #0a1510;
    --fm-bg-card: #101f16;
    --fm-bg-sidebar: #0b1a11;
    --fm-bg-nav: #0b1a11;
    --fm-border: rgba(74, 222, 128, 0.15);
}
/* Цветные строки таблиц (подсветка мест/своей команды) */
body.dark .table .table-light th, body.dark .table .table-light td { background-color: #16281d !important; color: #e2e8f0; }
body.dark .table .table-success th, body.dark .table .table-success td { background-color: rgba(21, 128, 61, 0.3) !important; color: #d1fae5; }
body.dark .table .table-warning th, body.dark .table .table-warning td { background-color: rgba(202, 138, 4, 0.22) !important; color: #fde68a; }
body.dark .table .table-danger th, body.dark .table .table-danger td { background-color: rgba(239, 68, 68, 0.16) !important; color: #fecaca; }
body.dark .table .table-info th, body.dark .table .table-info td { background-color: rgba(37, 99, 235, 0.18) !important; color: #bfdbfe; }
body.dark .table .table-active th, body.dark .table .table-active td { background-color: rgba(255, 255, 255, 0.05) !important; }

/* Строки таблиц через CSS-переменные Bootstrap 5 (inset-тень перекрывает background) */
body.dark .table .table-light { --bs-table-bg: #16281d; --bs-table-accent-bg: #16281d; --bs-table-color: #e2e8f0; --bs-table-bg-state: #16281d; color: #e2e8f0; }
body.dark .table .table-success { --bs-table-bg: #14532d; --bs-table-accent-bg: #14532d; --bs-table-color: #d1fae5; --bs-table-bg-state: #14532d; color: #d1fae5; }
body.dark .table .table-warning { --bs-table-bg: #713f12; --bs-table-accent-bg: #713f12; --bs-table-color: #fde68a; --bs-table-bg-state: #713f12; color: #fde68a; }
body.dark .table .table-danger { --bs-table-bg: #7f1d1d; --bs-table-accent-bg: #7f1d1d; --bs-table-color: #fecaca; --bs-table-bg-state: #7f1d1d; color: #fecaca; }
body.dark .table .table-info { --bs-table-bg: #1e3a5f; --bs-table-accent-bg: #1e3a5f; --bs-table-color: #bfdbfe; --bs-table-bg-state: #1e3a5f; color: #bfdbfe; }

/* ============ v19: витрина скриншотов для гостей ============ */
.fm-shots-title { color: #0f172a; font-size: 1.05rem; }
.fm-shots-title .fm-ei { color: #059669; }
.fm-shots {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: 14px;
    cursor: grab;
}
.fm-shots::-webkit-scrollbar { display: none; }
.fm-shots:active { cursor: grabbing; }
.fm-shots-track {
    display: flex;
    gap: 14px;
    padding: 4px;
    width: max-content;
}
.fm-shot {
    position: relative;
    margin: 0;
    width: min(460px, 84vw);
    flex-shrink: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(15,23,42,0.08);
    background: #0f172a;
    user-select: none;
}
.fm-shot img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    pointer-events: none;
}
.fm-shot figcaption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 30px 14px 10px;
    background: linear-gradient(transparent, rgba(2,6,23,0.88));
    color: #ffffff;
}
.fm-shot figcaption strong { display: block; font-size: 0.95rem; }
.fm-shot figcaption span { font-size: 0.75rem; opacity: 0.8; }
body.dark .fm-shots-title { color: #e2e8f0; }
body.dark .fm-shots-title .fm-ei { color: #4ade80; }
body.dark .fm-shot {
    border-color: rgba(74,222,128,0.18);
    box-shadow: 0 4px 18px rgba(0,0,0,0.4);
}

/* ============ v21: дарк для профиля-витрины (инлайн-фоны трофеев/значков) ============ */
body.dark [style*="background: #f8fafc" i],
body.dark [style*="background:#f8fafc" i],
body.dark [style*="background: #f1f5f9" i] {
    background: #101f16 !important;
}
body.dark [style*="background: #ecfdf5" i] {
    background: #16281d !important;
}
body.dark [style*="background: #fffbeb" i] {
    background: #231d10 !important;
}

/* ============ v22: вкладки кубков (евро / администрация) ============ */
.fm-cup-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none !important;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    margin-right: 8px;
    margin-bottom: 6px;
    transition: all 0.15s;
}
.fm-cup-tab:hover { color: #334155; }
.fm-cup-tab.active {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
}
.fm-cup-tab-count {
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.72rem;
}
.fm-cup-tab:not(.active) .fm-cup-tab-count { background: #e2e8f0; color: #64748b; }
body.dark .fm-cup-tab { background: #101f16; color: #a9bfb2; border-color: rgba(74,222,128,0.15); }
body.dark .fm-cup-tab:hover { color: #e2e8f0; }
body.dark .fm-cup-tab:not(.active) .fm-cup-tab-count { background: #1c3423; color: #8aa793; }
