/* ========================================= */
/* СВЕТЛАЯ ТЕМА (ИСПРАВЛЕННАЯ) */
/* ========================================= */
body.light-theme { background: #f4f6f9 !important; color: #222 !important; }
body.light-theme header { background: #fff !important; border-bottom: 2px solid #E6194B !important; }

/* Карточки, панели */
body.light-theme .card, body.light-theme .tgroup, body.light-theme .map-sidebar, body.light-theme .toolbar, body.light-theme .stat-box {
    background: #ffffff !important; border-color: #e0e0e0 !important; color: #222 !important;
}
body.light-theme .tgroup-head { background: #f4f6f9 !important; border-bottom: 1px solid #e0e0e0 !important; }

/* Текст (общий) */
body.light-theme h1, body.light-theme h2, body.light-theme h3, body.light-theme b, body.light-theme td, body.light-theme th, body.light-theme label, body.light-theme p, body.light-theme div { color: #222 !important; }

/* Кнопки */
body.light-theme .btn { background: #2C5CF0 !important; color: #fff !important; border: 1px solid #2C5CF0 !important; }
body.light-theme .btn.ghost { background: transparent !important; color: #2C5CF0 !important; border: 1px solid #2C5CF0 !important; }
body.light-theme .btn.danger { background: #E6194B !important; color: #fff !important; border: 1px solid #E6194B !important; }

/* Инпуты */
body.light-theme input:not([type="checkbox"]):not([type="radio"]), 
body.light-theme select, 
body.light-theme textarea {
    background: #ffffff !important; color: #000000 !important; border: 1px solid #cccccc !important;
}

/* Перебиваем темные фоны в HTML */
body.light-theme [style*="background:#0f1420"], body.light-theme [style*="background:#1a2333"], body.light-theme [style*="background:#1b2333"], body.light-theme [style*="background:#2a3448"] {
    background: #ffffff !important; color: #222 !important; border-color: #ddd !important;
}

/* Статусы */
body.light-theme .status-ok { color: #2e7d32 !important; font-weight: bold; }
body.light-theme .status-bad { color: #c62828 !important; font-weight: bold; }

/* МЕНЮ */
.custom-dropdown a, .custom-dropdown button { color: #d8dee9 !important; }
.custom-dropdown a:hover, .custom-dropdown button:hover { background: #2a3448 !important; color: #fff !important; }
body.light-theme .custom-dropdown { background: #ffffff !important; border-color: #dddddd !important; }
body.light-theme .custom-dropdown a, body.light-theme .custom-dropdown button { color: #333 !important; }
body.light-theme .custom-dropdown a:hover, body.light-theme .custom-dropdown button:hover { background: #f0f0f0 !important; color: #000 !important; }
body.light-theme .custom-dropdown button[style*="border-bottom"] { border-bottom-color: #dddddd !important; }

/* ========================================= */
/* ФИНАЛЬНЫЙ ФИКС: АРХИВ И ЛЕГЕНДА */
/* ========================================= */

/* Плашка "Показать архив" */
body.light-theme .map-sidebar label[style*="background"] {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #222222 !important;
}
/* Внутренний текст и иконки */
body.light-theme .map-sidebar label[style*="background"] span {
    color: #222222 !important;
}

/* Легенда на карте (фон и текст) */
body.light-theme div[style*="rgba(27,35,51"],
body.light-theme div[style*="rgba(27, 35, 51"] {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #222222 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}
/* Заголовок легенды */
body.light-theme div[style*="rgba(27,35,51"] b,
body.light-theme div[style*="rgba(27, 35, 51"] b {
    color: #222222 !important;
}
/* Квадратики НЕ ТРОГАЕМ, они остаются со своими inline-цветами */
