/* =========================================================
   Brownie dark theme polish (chat, modals, dividers, leftovers)
   Tokens: styles.css :root / html[data-theme="dark"]
   ========================================================= */

html[data-theme="dark"] body {
  background: transparent !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] body.brownie-chat-page {
  background: transparent !important;
}

html[data-theme="dark"] body.dashboard-page,
html[data-theme="dark"] body.houses-page,
html[data-theme="dark"] body.profile-page,
html[data-theme="dark"] body.guide-page,
html[data-theme="dark"] body.admin-page,
html[data-theme="dark"] body.legal-page,
html[data-theme="dark"] body.login-page {
  background: transparent !important;
}

html[data-theme="dark"] .navbar {
  background: var(--br-navbar) !important;
}

/* ---- Surfaces ---- */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .districts-list-section,
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] #stats .admin-stats-panel,
html[data-theme="dark"] #stats .admin-stats-badge {
    background: var(--br-surface);
}

html[data-theme="dark"] #stats .admin-stats-badge {
    background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .search-card,
html[data-theme="dark"] .house-card:not(.highlighted),
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .users-table-container,
html[data-theme="dark"] .excel-section,
html[data-theme="dark"] .settings-form-container,
html[data-theme="dark"] .create-user-form,
html[data-theme="dark"] .create-district-section,
html[data-theme="dark"] .guide-section,
html[data-theme="dark"] .nav-menu,
html[data-theme="dark"] #navMenu.nav-menu {
  background: var(--br-surface) !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}

/* Адрес и номер дома в карточке — оранжевые в тёмной теме */
html[data-theme="dark"] .house-card-address-link,
html[data-theme="dark"] .house-card-address-link:visited,
html[data-theme="dark"] .house-address-sep,
html[data-theme="dark"] .house-address-title,
html[data-theme="dark"] .house-header h4.house-address-title {
  color: var(--br-accent, #e95420) !important;
  -webkit-text-fill-color: var(--br-accent, #e95420);
}

html[data-theme="dark"] #houseViewModal .modal-header h3,
html[data-theme="dark"] #houseViewModalTitle {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}

html[data-theme="dark"] .house-card-address-link:hover {
  color: var(--br-btn-primary-hover, #ff6b35) !important;
  -webkit-text-fill-color: var(--br-btn-primary-hover, #ff6b35);
}

/* ---- Dividers / hairlines ---- */
html[data-theme="dark"] hr,
html[data-theme="dark"] .chat-menu-divider,
html[data-theme="dark"] .divider,
html[data-theme="dark"] .separator {
  background: var(--br-divider) !important;
  border-color: var(--br-divider) !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .profile-section,
html[data-theme="dark"] .section-header,
html[data-theme="dark"] .admin-tabs,
html[data-theme="dark"] .nav-footer,
html[data-theme="dark"] .house-header,
html[data-theme="dark"] .house-details,
html[data-theme="dark"] .comment-item,
html[data-theme="dark"] .session-item,
html[data-theme="dark"] .info-item,
html[data-theme="dark"] .form-group,
html[data-theme="dark"] table th,
html[data-theme="dark"] table td {
  border-color: var(--br-divider) !important;
}

html[data-theme="dark"] .close:hover,
html[data-theme="dark"] .modal-header .close:hover {
  background: color-mix(in srgb, var(--br-accent) 18%, transparent) !important;
  color: var(--br-accent) !important;
}

/* ---- Stats / Team modals ---- */
html[data-theme="dark"] #statsModal .modal-content,
html[data-theme="dark"] #teamModal .modal-content {
  background: var(--br-surface) !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] #statsModal .stat-item,
html[data-theme="dark"] #statsModal .user-stats-section,
html[data-theme="dark"] #teamModal .team-section {
  background: var(--br-muted) !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}

html[data-theme="dark"] .team-shift-district {
  background: var(--br-muted) !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] #statsModal .stat-item h4,
html[data-theme="dark"] #statsModal .dash-user-nick,
html[data-theme="dark"] #teamModal .dash-user-nick,
html[data-theme="dark"] #statsModal .dash-user-right,
html[data-theme="dark"] #teamModal .dash-user-right {
  color: var(--br-muted-text) !important;
}

html[data-theme="dark"] #statsModal .stat-item p,
html[data-theme="dark"] #statsModal .user-stats-section h4,
html[data-theme="dark"] #teamModal .team-section h4,
html[data-theme="dark"] #statsModal .dash-user-name,
html[data-theme="dark"] #teamModal .dash-user-name,
html[data-theme="dark"] #teamModal .team-user-name {
  color: var(--br-text) !important;
}

html[data-theme="dark"] #teamModal .team-user,
html[data-theme="dark"] #statsModal .dash-user-row,
html[data-theme="dark"] #teamModal .dash-user-row,
html[data-theme="dark"] #statsModal .top-user-item {
  border-bottom-color: var(--br-divider) !important;
}

html[data-theme="dark"] #teamModal .team-user-nick,
html[data-theme="dark"] #teamModal .team-tag.tag {
  background: #312e81 !important;
  color: #c7d2fe !important;
}

html[data-theme="dark"] #teamModal .team-user-nick.team-role--main_admin,
html[data-theme="dark"] #teamModal .team-tag.team-role--main_admin {
  background: #4c1d95 !important;
  color: #ddd6fe !important;
}
html[data-theme="dark"] #teamModal .team-user-nick.team-role--admin,
html[data-theme="dark"] #teamModal .team-tag.team-role--admin {
  background: #7f1d1d !important;
  color: #fecaca !important;
}
html[data-theme="dark"] #teamModal .team-user-nick.team-role--moderator,
html[data-theme="dark"] #teamModal .team-tag.team-role--moderator {
  background: #78350f !important;
  color: #fde68a !important;
}

html[data-theme="dark"] #teamModal .team-avatar--moderator {
  color: #111827 !important;
}

/* ---- Chat full polish ---- */
html[data-theme="dark"] .tg-chat {
  color: var(--br-text);
  /* Не заливать wallpaper на всю сетку — иначе фон переписки «залезает» в список */
  background: var(--br-page) !important;
}

html[data-theme="dark"] .tg-chat .chat-sidebar,
html[data-theme="dark"] .tg-chat .chat-main {
  border-color: var(--br-border) !important;
}

html[data-theme="dark"] .tg-chat .chat-sidebar {
  background: var(--br-chat-sidebar) !important;
  background-image: none !important;
}

html[data-theme="dark"] .tg-chat .chat-main {
  background-color: var(--br-chat-wallpaper) !important;
  /* Паттерн/glow только внутри окна переписки */
  isolation: isolate;
  contain: paint;
  overflow: hidden;
  background-clip: padding-box;
}

/* Десктоп: список чатов выше окна переписки — фон не перекрывает сайдбар */
@media (min-width: 769px) {
  html[data-theme="dark"] .tg-chat .chat-layout {
    isolation: isolate;
  }
  html[data-theme="dark"] .tg-chat .chat-sidebar-col {
    position: relative;
    z-index: 2;
  }
  html[data-theme="dark"] .tg-chat .chat-main {
    position: relative;
    z-index: 1;
    /* В тёмной теме убираем огромный radial-glow — он визуально «вылезает» за колонку */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none'%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%239ca3af' fill-opacity='0.14'/%3E%3Ccircle cx='48' cy='28' r='1.2' fill='%239ca3af' fill-opacity='0.12'/%3E%3Ccircle cx='78' cy='18' r='1.4' fill='%239ca3af' fill-opacity='0.12'/%3E%3Ccircle cx='22' cy='62' r='1.3' fill='%239ca3af' fill-opacity='0.10'/%3E%3Ccircle cx='66' cy='70' r='1.6' fill='%239ca3af' fill-opacity='0.12'/%3E%3Ccircle cx='86' cy='86' r='1.2' fill='%239ca3af' fill-opacity='0.10'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-repeat: repeat !important;
    background-size: 96px 96px !important;
  }
}

html[data-theme="dark"] .tg-chat .chat-sidebar-top,
html[data-theme="dark"] .tg-chat .chat-main-header,
html[data-theme="dark"] .tg-chat .chat-inchat-search,
html[data-theme="dark"] .tg-chat .composer,
html[data-theme="dark"] .tg-chat .chat-composer,
html[data-theme="dark"] .tg-chat .chat-input-bar {
  background: var(--br-chat-header) !important;
  border-color: var(--br-divider) !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] .tg-chat .chat-compose-dock,
html[data-theme="dark"] .tg-chat .chat-input {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Поиск чатов: без серого контейнера (как в светлой теме) */
html[data-theme="dark"] .tg-chat .chat-search {
  background: transparent !important;
  border: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .tg-chat .chat-app-name,
html[data-theme="dark"] .tg-chat .chat-app-name-link {
  color: var(--br-accent) !important;
}

html[data-theme="dark"] .tg-chat .message.incoming > .message-bubble,
html[data-theme="dark"] .tg-chat .message.incoming.has-image:not(.image-only) > .message-body,
html[data-theme="dark"] .tg-chat .chat-message-other .chat-bubble,
html[data-theme="dark"] .tg-chat .chat-message-system .chat-bubble {
  background: var(--br-bubble-in) !important;
  color: var(--br-bubble-text) !important;
}

html[data-theme="dark"] .tg-chat .message.outgoing > .message-bubble,
html[data-theme="dark"] .tg-chat .message.outgoing.has-image:not(.image-only) > .message-body,
html[data-theme="dark"] .tg-chat .chat-message-me .chat-bubble {
  background: var(--br-bubble-out) !important;
  color: var(--br-bubble-text) !important;
}

/* Голосовые в тёмной: волна panda-x + Brownie play */
html[data-theme="dark"] .tg-chat .message.outgoing .chat-voice-wave > i,
html[data-theme="dark"] .tg-chat .chat-message-me .chat-voice-wave > i {
  background: rgba(255, 255, 255, 0.35) !important;
}
html[data-theme="dark"] .tg-chat .message.outgoing .chat-voice.is-on .chat-voice-wave > i,
html[data-theme="dark"] .tg-chat .chat-message-me .chat-voice.is-on .chat-voice-wave > i {
  background: rgba(255, 255, 255, 0.92) !important;
}
html[data-theme="dark"] .tg-chat .message.incoming .chat-voice.is-on .chat-voice-wave > i {
  background: var(--br-btn-primary, #e95420) !important;
}
html[data-theme="dark"] .tg-chat .message.incoming .chat-voice-wave .chat-voice-progress {
  background: color-mix(in srgb, var(--br-btn-primary, #e95420) 28%, transparent) !important;
}
html[data-theme="dark"] .tg-chat .message.outgoing.voice-only .chat-voice-wave > i {
  background: rgba(255, 255, 255, 0.35) !important;
}
html[data-theme="dark"] .tg-chat .message.outgoing.voice-only .chat-voice.is-on .chat-voice-wave > i {
  background: rgba(255, 255, 255, 0.92) !important;
}

html[data-theme="dark"] .tg-chat .message-text,
html[data-theme="dark"] .tg-chat .chat-item-title,
html[data-theme="dark"] .tg-chat .chat-name,
html[data-theme="dark"] .tg-chat .chat-peer-name {
  color: var(--br-text) !important;
}

html[data-theme="dark"] .tg-chat .chat-item:has(.chat-avatar-group) .chat-item-title {
  color: var(--br-accent) !important;
}

html[data-theme="dark"] .tg-chat .chat-preview,
html[data-theme="dark"] .tg-chat .chat-meta,
html[data-theme="dark"] .tg-chat .message-time,
html[data-theme="dark"] .tg-chat .chat-bubble-time,
html[data-theme="dark"] .tg-chat .chat-inchat-search-count {
  color: var(--br-muted-text) !important;
}

html[data-theme="dark"] .tg-chat .chat-item:hover,
html[data-theme="dark"] .chat-menu-item:hover,
html[data-theme="dark"] .chat-msg-menu-item:hover,
html[data-theme="dark"] .chat-compose-user-row:hover,
html[data-theme="dark"] .header-menu-btn:hover {
  background: var(--br-hover) !important;
}

html[data-theme="dark"] .tg-chat .chat-inchat-search-btn {
  background: var(--br-surface2, var(--br-surface)) !important;
  border-color: var(--br-border) !important;
  color: var(--br-text) !important;
}
html[data-theme="dark"] .tg-chat .chat-inchat-search-btn:hover {
  background: rgba(233, 84, 32, 0.18) !important;
  border-color: var(--br-btn-primary, #e95420) !important;
  color: var(--br-btn-primary, #e95420) !important;
}
html[data-theme="dark"] .tg-chat .chat-inchat-search-btn--close:hover {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

html[data-theme="dark"] .tg-chat .chat-item.active {
  background: rgba(233, 84, 32, 0.18) !important;
}

html[data-theme="dark"] .chat-menu-dropdown,
html[data-theme="dark"] .chat-msg-menu,
html[data-theme="dark"] .chat-header-dropdown,
html[data-theme="dark"] .chat-emoji-picker,
html[data-theme="dark"] .chat-mention-dropdown,
html[data-theme="dark"] .chat-attach-menu,
html[data-theme="dark"] .chat-clone-menu,
html[data-theme="dark"] .chat-compose-user-list {
  background: var(--br-surface) !important;
  border-color: var(--br-border) !important;
  color: var(--br-text) !important;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55) !important;
}

html[data-theme="dark"] .chat-menu-item,
html[data-theme="dark"] .chat-msg-menu-item {
  color: var(--br-text) !important;
  border-bottom-color: var(--br-divider) !important;
}
html[data-theme="dark"] .chat-compose-tab {
  background: #323232 !important;
  border: 1px solid var(--br-border) !important;
  color: var(--br-text2) !important;
}
html[data-theme="dark"] .chat-compose-tab:hover {
  background: var(--br-hover) !important;
}
html[data-theme="dark"] .chat-compose-tab.active {
  background: rgba(233, 84, 32, 0.22) !important;
  border-color: var(--br-accent) !important;
  color: #ffa780 !important;
}

html[data-theme="dark"] .tg-chat input,
html[data-theme="dark"] .tg-chat textarea,
html[data-theme="dark"] .tg-chat .composer-input,
html[data-theme="dark"] .tg-chat .chat-inchat-search input {
  background: #161616 !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}

/* Поле поиска списка: лёгкая заливка внутри, без контейнера вокруг */
html[data-theme="dark"] .tg-chat .chat-search input {
  background: var(--br-surface2, #242424) !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}
html[data-theme="dark"] .tg-chat .chat-search input:focus,
html[data-theme="dark"] .tg-chat .chat-search input:focus-visible {
  outline: none !important;
  border-color: var(--br-accent, #e95420) !important;
  box-shadow: 0 0 0 2px rgba(233, 84, 32, 0.45) !important;
}

html[data-theme="dark"] .tg-chat .chat-input textarea#chatDemoInput:focus,
html[data-theme="dark"] .tg-chat .chat-input textarea#chatDemoInput:focus-visible {
  outline: none !important;
  border: none !important;
  box-shadow: 0 0 0 2px rgba(233, 84, 32, 0.45), 0 2px 8px var(--br-shadow) !important;
}

html[data-theme="dark"] .tg-chat .chat-icon-btn,
html[data-theme="dark"] .tg-chat .chat-pinned-btn {
  background: var(--br-muted2) !important;
  border-color: var(--br-border) !important;
  color: var(--br-text) !important;
}

/* Бургер и «+» — как на сайте: без заливки кружка */
html[data-theme="dark"] .tg-chat .chat-icon-btn.chat-burger-btn,
html[data-theme="dark"] .tg-chat .chat-icon-btn.chat-sidebar-compose,
html[data-theme="dark"] .tg-chat .chat-icon-btn.chat-sidebar-site-menu {
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .tg-chat .theme-toggle-slot--chat .theme-toggle {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] .tg-chat .chat-back-btn,
html[data-theme="dark"] .tg-chat .chat-menu-toggle,
html[data-theme="dark"] .tg-chat .header-menu-btn,
html[data-theme="dark"] .tg-chat .chat-burger-btn {
  color: var(--br-text) !important;
}

/* ---- Districts ---- */
html[data-theme="dark"] .district-item,
html[data-theme="dark"] .street-item {
  color: #f2f2f2 !important;
}
html[data-theme="dark"] .district-info h4 {
  color: #f5f5f5 !important;
}
html[data-theme="dark"] .districts-list-section h3,
html[data-theme="dark"] .create-district-section h3,
html[data-theme="dark"] #districts h3,
html[data-theme="dark"] #districts .section-header h2 {
  color: #f2f2f2 !important;
}
html[data-theme="dark"] .district-item:hover,
html[data-theme="dark"] .street-item:hover {
  background: rgba(233, 84, 32, 0.28) !important;
}
html[data-theme="dark"] .district-item.active,
html[data-theme="dark"] .street-item.active {
  background: rgba(233, 84, 32, 0.2) !important;
  color: #ffa780 !important;
}

/* Цветные районы/города — только полоска слева */
html[data-theme="dark"] .district-item--tinted,
html[data-theme="dark"] .district-item--tinted:hover,
html[data-theme="dark"] .district-item--tinted.active {
  border-left-color: var(--district-accent, var(--br-border)) !important;
}
html[data-theme="dark"] .district-fav-btn {
  color: #94a3b8;
}
html[data-theme="dark"] .district-fav-btn:hover:not(:disabled) {
  color: #facc15;
  background: rgba(250, 204, 21, 0.16);
}
html[data-theme="dark"] .district-fav-btn.is-favorite,
html[data-theme="dark"] .district-item.is-favorite .district-fav-btn {
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.45), 0 1px 0 rgba(161, 98, 7, 0.5);
}
html[data-theme="dark"] .district-fav-mark {
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.45), 0 1px 0 rgba(161, 98, 7, 0.5);
}

/* ---- Forms / tables ---- */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .search-input {
  background: #161616 !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}

html[data-theme="dark"] table th {
  background: var(--br-muted2) !important;
  color: var(--br-text) !important;
}
html[data-theme="dark"] table td {
  background: var(--br-surface) !important;
  color: var(--br-text2) !important;
}
html[data-theme="dark"] tr:hover td {
  background: rgba(233, 84, 32, 0.28) !important;
}
/* Admin tables: серые строки, оранжевый hover */
html[data-theme="dark"] .users-table tbody tr td,
html[data-theme="dark"] .audit-table tbody tr td,
html[data-theme="dark"] #ipBlocks .users-table tbody tr td,
html[data-theme="dark"] #ipBlocks .users-table tbody tr.ipblock-row-active td {
  background: transparent !important;
}
html[data-theme="dark"] .users-table tbody tr,
html[data-theme="dark"] .audit-table tbody tr,
html[data-theme="dark"] #ipBlocks .users-table tbody tr,
html[data-theme="dark"] #ipBlocks .users-table tbody tr.ipblock-row-active {
  background: #323232 !important;
}
html[data-theme="dark"] .users-table tbody tr:hover,
html[data-theme="dark"] .audit-table tbody tr:hover,
html[data-theme="dark"] #ipBlocks .users-table tbody tr:hover,
html[data-theme="dark"] #ipBlocks .users-table tbody tr.ipblock-row-active:hover,
html[data-theme="dark"] .users-table tbody tr:hover td,
html[data-theme="dark"] .audit-table tbody tr:hover td,
html[data-theme="dark"] #ipBlocks .users-table tbody tr:hover td,
html[data-theme="dark"] #ipBlocks .users-table tbody tr.ipblock-row-active:hover td {
  background: rgba(233, 84, 32, 0.28) !important;
}
html[data-theme="dark"] .ipblock-status.inactive {
  background: var(--br-muted2) !important;
  color: var(--br-muted-text) !important;
}

/* ---- Badges ---- */
html[data-theme="dark"] .role-badge.user,
html[data-theme="dark"] .role-user { background: #0c4a6e !important; color: #7dd3fc !important; }
html[data-theme="dark"] .role-badge.admin,
html[data-theme="dark"] .role-admin { background: #7f1d1d !important; color: #fecaca !important; }
html[data-theme="dark"] .role-badge.main_admin,
html[data-theme="dark"] .role-main_admin { background: #4c1d95 !important; color: #ddd6fe !important; }
html[data-theme="dark"] .role-badge.moderator,
html[data-theme="dark"] .role-moderator { background: #78350f !important; color: #fde68a !important; }
html[data-theme="dark"] .position-badge { background: #1e3a8a !important; color: #bfdbfe !important; }
html[data-theme="dark"] .houses-badge { background: #064e3b !important; color: #a7f3d0 !important; }

/* Подписка в таблице пользователей — иначе светлые бейджи с тёмным текстом плохо читаются */
html[data-theme="dark"] .subscription-badge--lifetime { background: #115e59 !important; color: #99f6e4 !important; }
html[data-theme="dark"] .subscription-badge--ok { background: #475569 !important; color: #f1f5f9 !important; }
html[data-theme="dark"] .subscription-badge--warn { background: #92400e !important; color: #fef3c7 !important; }
html[data-theme="dark"] .subscription-badge--critical,
html[data-theme="dark"] .subscription-badge--expired { background: #991b1b !important; color: #fee2e2 !important; }
html[data-theme="dark"] .subscription-badge--unknown { background: #475569 !important; color: #e2e8f0 !important; }

html[data-theme="dark"] .audit-action.create,
html[data-theme="dark"] .audit-action.grant_district_access,
html[data-theme="dark"] .audit-action.site_register,
html[data-theme="dark"] .audit-action.house_card_review,
html[data-theme="dark"] .audit-action.ip_unblock { background: #064e3b !important; color: #a7f3d0 !important; }
html[data-theme="dark"] .audit-action.update { background: #1e3a8a !important; color: #bfdbfe !important; }
html[data-theme="dark"] .audit-action.delete,
html[data-theme="dark"] .audit-action.delete_comment,
html[data-theme="dark"] .audit-action.delete_photo,
html[data-theme="dark"] .audit-action.revoke_district_access,
html[data-theme="dark"] .audit-action.restart,
html[data-theme="dark"] .audit-action.SERVER_RESTART,
html[data-theme="dark"] .audit-action.wipe_security_events,
html[data-theme="dark"] .audit-action.ip_block { background: #7f1d1d !important; color: #fecaca !important; }
html[data-theme="dark"] .audit-action.export,
html[data-theme="dark"] .audit-action.change_role { background: #78350f !important; color: #fde68a !important; }
html[data-theme="dark"] .audit-action.import,
html[data-theme="dark"] .audit-action.change_position,
html[data-theme="dark"] .audit-action.change_status { background: #312e81 !important; color: #c7d2fe !important; }
html[data-theme="dark"] .audit-action.change_subscription,
html[data-theme="dark"] .audit-action.subscription_modal_settings { background: #115e59 !important; color: #99f6e4 !important; }
html[data-theme="dark"] .audit-action.subscription_modal_clear { background: #78350f !important; color: #fde68a !important; }
html[data-theme="dark"] .audit-action.comment { background: #155e75 !important; color: #a5f3fc !important; }
html[data-theme="dark"] .audit-action.upload_photo { background: #0c4a6e !important; color: #7dd3fc !important; }
html[data-theme="dark"] .audit-action.backup,
html[data-theme="dark"] .audit-action.download_project_backup,
html[data-theme="dark"] .audit-action.download_database_backup { background: #9f1239 !important; color: #fecdd3 !important; }

/* Ники в профиле / названия групп — акцент темы (синий / Ubuntu orange) */
html[data-theme="dark"] .user-profile .profile-name-under-avatar,
html[data-theme="dark"] .profile-avatar-display-name,
html[data-theme="dark"] .profile-info h4,
html[data-theme="dark"] #userProfileModal .up-name,
html[data-theme="dark"] #userProfileModal .profile-name-under-avatar,
html[data-theme="dark"] #userProfileModal .up-nick-name,
html[data-theme="dark"] #userProfileModal .up-mini-nick-text,
html[data-theme="dark"] #chatMembersModal .up-mini-nick-text,
html[data-theme="dark"] #chatMembersModal .up-nick--group,
html[data-theme="dark"] .chat-group-profile-title,
html[data-theme="dark"] .tg-chat .chat-item:has(.chat-avatar-group) .chat-item-title,
html[data-theme="dark"] .tg-chat .chat-main-title.chat-main-title--group {
  color: var(--br-accent) !important;
}
html[data-theme="dark"] .user-profile .profile-name-under-avatar.clickable-username,
html[data-theme="dark"] .profile-avatar-display-name.clickable-username,
html[data-theme="dark"] #userProfileModal .clickable-username:not([class*="username-role-"]) {
  color: var(--br-accent) !important;
  background: transparent !important;
  text-decoration: none !important;
}

html[data-theme="dark"] .profile-level-wrap,
html[data-theme="dark"] .up-level-wrap {
  background: transparent;
  border: none;
}

html[data-theme="dark"] .up-level-panel {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--br-border, #3f3f3f);
}

html[data-theme="dark"] .level-bar-head,
html[data-theme="dark"] .level-bar-title {
  color: var(--br-text, #f1f5f9);
}

html[data-theme="dark"] .level-bar-title--muted,
html[data-theme="dark"] .level-bar-meta {
  color: var(--br-muted-text, #94a3b8);
}

html[data-theme="dark"] .level-bar-track {
  background: color-mix(in srgb, #fff 12%, transparent);
}

html[data-theme="dark"] .level-bar-badge:not([class*="level-bar-badge--m"]) {
  --lvl-a: var(--br-accent, #e95420);
  --lvl-b: color-mix(in srgb, var(--br-accent, #e95420) 55%, #fbbf24);
  --lvl-glow: color-mix(in srgb, var(--br-accent, #e95420) 40%, transparent);
}

html[data-theme="dark"] #userProfileModal .up-nick,
html[data-theme="dark"] #chatMembersModal .up-nick {
  background: rgba(233, 84, 32, 0.14) !important;
  border-color: rgba(233, 84, 32, 0.35) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] #userProfileModal .up-nick-at,
html[data-theme="dark"] #chatMembersModal .up-nick-at {
  color: #c9a090 !important;
}
/* Ник поверх аватара — белый, не акцент темы */
html[data-theme="dark"] #userProfileModal .up-avatar--large .up-avatar-nick .up-nick-name,
html[data-theme="dark"] #userProfileModal .up-avatar--large .up-avatar-nick .up-nick-at,
html[data-theme="dark"] #chatMembersModal .up-avatar--large .up-avatar-nick .up-nick-name,
html[data-theme="dark"] #chatMembersModal .up-avatar--large .up-avatar-nick .up-nick-at {
  color: #fff !important;
}
html[data-theme="dark"] .dashboard-header .clickable-username:not([class*="username-role-"]),
html[data-theme="dark"] .user-welcome .clickable-username:not([class*="username-role-"]) {
  color: var(--br-text2) !important;
  background: transparent !important;
  text-decoration: none !important;
}

html[data-theme="dark"] .audit-table td .clickable-username.username-role-user,
html[data-theme="dark"] .clickable-username.username-role-user { color: #7dd3fc !important; background: #0c4a6e !important; }
html[data-theme="dark"] .audit-table td .clickable-username.username-role-moderator,
html[data-theme="dark"] .clickable-username.username-role-moderator { color: #fde68a !important; background: #78350f !important; }
html[data-theme="dark"] .audit-table td .clickable-username.username-role-admin,
html[data-theme="dark"] .clickable-username.username-role-admin { color: #fecaca !important; background: #7f1d1d !important; }
html[data-theme="dark"] .audit-table td .clickable-username.username-role-main_admin,
html[data-theme="dark"] .clickable-username.username-role-main_admin { color: #ddd6fe !important; background: #4c1d95 !important; }

html[data-theme="dark"] .status-pending { background-color: #78350f !important; color: #fde68a !important; }
html[data-theme="dark"] .status-approved,
html[data-theme="dark"] .status-ok { background-color: #064e3b !important; color: #a7f3d0 !important; }
html[data-theme="dark"] .status-banned,
html[data-theme="dark"] .status-error { background-color: #7f1d1d !important; color: #fecaca !important; }
html[data-theme="dark"] .status-warning { background-color: #78350f !important; color: #fde68a !important; }
html[data-theme="dark"] .status-info { background-color: #1e3a8a !important; color: #bfdbfe !important; }

/* Nested soft panels — без тёмных «карточек» вокруг полей форм */
html[data-theme="dark"] .house-comments,
html[data-theme="dark"] .house-box-photos,
html[data-theme="dark"] .comment-item,
html[data-theme="dark"] .info-item,
html[data-theme="dark"] .search-results,
html[data-theme="dark"] .result-group-header,
html[data-theme="dark"] .excel-info,
html[data-theme="dark"] .act-user-spoiler,
html[data-theme="dark"] .mobile-nav {
  background: var(--br-surface) !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .mobile-nav.is-collapsed {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .mobile-filter-fab {
  background: var(--br-surface) !important;
  color: var(--br-accent, #e95420) !important;
  border-color: var(--br-border) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .mobile-filter-fab[aria-expanded="true"] {
  background: color-mix(in srgb, var(--br-accent, #e95420) 18%, var(--br-surface)) !important;
  border-color: color-mix(in srgb, var(--br-accent, #e95420) 50%, var(--br-border)) !important;
}

html[data-theme="dark"] .mobile-nav.is-collapsed .mobile-select-container {
  background: var(--br-surface) !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .comment-text,
html[data-theme="dark"] .comment-user,
html[data-theme="dark"] .box-photo-caption {
  color: #ffffff !important;
}
html[data-theme="dark"] .box-photo-caption-empty,
html[data-theme="dark"] .comment-date {
  color: #d1d5db !important;
}

html[data-theme="dark"] .mobile-select {
  background: #1e1e1e !important;
  border-color: #4a4a4a !important;
  color: #f2f2f2 !important;
}

html[data-theme="dark"] .mobile-select:focus {
  border-color: #e95420 !important;
  box-shadow: 0 0 0 3px rgba(233, 84, 32, 0.18) !important;
}

html[data-theme="dark"] .form-group {
  background: transparent !important;
  color: var(--br-text) !important;
  border-color: var(--br-border) !important;
}

html[data-theme="dark"] .nav-link {
  color: #c8c8c8 !important;
}
html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link.active {
  color: #ffa780 !important;
  background: rgba(233, 84, 32, 0.16) !important;
}
html[data-theme="dark"] .nav-brand h2 {
  color: #e95420 !important;
}
html[data-theme="dark"] .nav-brand-link:hover h2,
html[data-theme="dark"] .nav-brand-link:focus-visible h2 {
  color: #ff7a45 !important;
}

/* Кнопки под Ubuntu dark */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn.btn-primary,
html[data-theme="dark"] .up-btn-primary,
html[data-theme="dark"] .chat-group-btn-primary,
html[data-theme="dark"] .chat-send,
html[data-theme="dark"] #addHouseModal #addHouseForm .form-actions .btn.btn-primary,
html[data-theme="dark"] #editHouseModal .modal-body #editHouseForm .form-actions .btn.btn-primary {
  background: var(--br-btn-primary) !important;
  background-color: var(--br-btn-primary) !important;
  color: #fff !important;
  box-shadow: 0 3px 10px rgba(233, 84, 32, 0.32) !important;
  border: none !important;
}
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn.btn-primary:hover,
html[data-theme="dark"] .up-btn-primary:hover,
html[data-theme="dark"] .chat-group-btn-primary:hover,
html[data-theme="dark"] .chat-send:hover:not(:disabled),
html[data-theme="dark"] #addHouseModal #addHouseForm .form-actions .btn.btn-primary:hover,
html[data-theme="dark"] #editHouseModal .modal-body #editHouseForm .form-actions .btn.btn-primary:hover {
  background: var(--br-btn-primary-hover) !important;
  background-color: var(--br-btn-primary-hover) !important;
  box-shadow: 0 5px 14px rgba(255, 107, 53, 0.38) !important;
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn.btn-secondary,
html[data-theme="dark"] .btn-info,
html[data-theme="dark"] #addHouseModal #addHouseForm .form-actions .btn.btn-secondary,
html[data-theme="dark"] #editHouseModal .modal-body #editHouseForm .form-actions .btn.btn-secondary {
  background: var(--br-btn-secondary-bg) !important;
  background-color: var(--br-btn-secondary-bg) !important;
  color: var(--br-btn-secondary-color) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
  border: 1px solid var(--br-border) !important;
}
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn.btn-secondary:hover,
html[data-theme="dark"] .btn-info:hover {
  filter: brightness(1.08);
  color: #ffc4a8 !important;
}

/* Выйти / Обновить — отдельные цвета в тёмной теме */
html[data-theme="dark"] #logoutBtn.btn.btn-secondary,
html[data-theme="dark"] #logoutBtn.btn {
  background: #7f1d1d !important;
  background-color: #7f1d1d !important;
  color: #fecaca !important;
  border: 1px solid #991b1b !important;
  box-shadow: 0 2px 10px rgba(127, 29, 29, 0.35) !important;
  filter: none !important;
}
html[data-theme="dark"] #logoutBtn.btn.btn-secondary:hover,
html[data-theme="dark"] #logoutBtn.btn:hover {
  background: #991b1b !important;
  background-color: #991b1b !important;
  color: #fff !important;
  filter: none !important;
}

html[data-theme="dark"] #checkUpdatesBtn.btn.btn-info,
html[data-theme="dark"] #checkUpdatesBtn.btn {
  background: #14532d !important;
  background-color: #14532d !important;
  color: #bbf7d0 !important;
  border: 1px solid #166534 !important;
  box-shadow: 0 2px 10px rgba(20, 83, 45, 0.35) !important;
  filter: none !important;
}
html[data-theme="dark"] #checkUpdatesBtn.btn.btn-info:hover,
html[data-theme="dark"] #checkUpdatesBtn.btn:hover {
  background: #166534 !important;
  background-color: #166534 !important;
  color: #fff !important;
  filter: none !important;
}

/* ⋯ в карточке дома — оранжевая (перебивает .btn.btn-secondary выше) */
html[data-theme="dark"] .btn.btn-secondary.house-card-menu-btn,
html[data-theme="dark"] .house-actions .btn.house-card-menu-btn,
html[data-theme="dark"] #houseViewModal .btn.house-card-menu-btn {
  background: #e95420 !important;
  background-color: #e95420 !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 10px rgba(233, 84, 32, 0.35) !important;
  filter: none !important;
}
html[data-theme="dark"] .btn.btn-secondary.house-card-menu-btn:hover,
html[data-theme="dark"] .btn.btn-secondary.house-card-menu-btn:focus-visible,
html[data-theme="dark"] .house-actions .btn.house-card-menu-btn:hover,
html[data-theme="dark"] .house-actions .btn.house-card-menu-btn:focus-visible,
html[data-theme="dark"] #houseViewModal .btn.house-card-menu-btn:hover,
html[data-theme="dark"] #houseViewModal .btn.house-card-menu-btn:focus-visible {
  background: #ff6b35 !important;
  background-color: #ff6b35 !important;
  color: #fff !important;
  filter: none !important;
}
html[data-theme="dark"] .house-card-menu.is-open .btn.btn-secondary.house-card-menu-btn,
html[data-theme="dark"] .house-card-menu.is-open .btn.house-card-menu-btn {
  background: #c2410c !important;
  background-color: #c2410c !important;
  color: #fff !important;
}

html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn.btn-danger,
html[data-theme="dark"] .up-btn-danger,
html[data-theme="dark"] .chat-group-btn-danger {
  background: var(--br-btn-danger, #dc2626) !important;
  color: #fff !important;
}
html[data-theme="dark"] .btn-danger:hover,
html[data-theme="dark"] .btn.btn-danger:hover,
html[data-theme="dark"] .up-btn-danger:hover,
html[data-theme="dark"] .chat-group-btn-danger:hover {
  background: var(--br-btn-danger-hover, #ef4444) !important;
}

html[data-theme="dark"] .btn-warning {
  background: #e95420 !important;
  color: #fff !important;
}
html[data-theme="dark"] .btn-warning:hover {
  background: #ff6b35 !important;
  color: #fff !important;
}

/* Кнопка «Задания» на /houses — тот же жёлтый, что в светлой теме + белый текст */
html[data-theme="dark"] .houses-act-jobs-btn.btn-warning {
  background: #f59e0b !important;
  color: #fff !important;
  border-color: #f59e0b !important;
}
html[data-theme="dark"] .houses-act-jobs-btn.btn-warning:hover,
html[data-theme="dark"] .houses-act-jobs-btn.btn-warning:focus-visible {
  background: #d97706 !important;
  color: #fff !important;
  border-color: #d97706 !important;
}
html[data-theme="dark"] .houses-act-jobs-btn .queue-counter {
  background-color: rgba(0, 0, 0, 0.35);
  color: #fff;
}

/* ---- Text readability bump ---- */
html[data-theme="dark"] .page-header h1,
html[data-theme="dark"] .user-welcome,
html[data-theme="dark"] .page-header p,
html[data-theme="dark"] .card-content h3,
html[data-theme="dark"] .card-content p,
html[data-theme="dark"] .search-header h3,
html[data-theme="dark"] .search-header p {
  color: var(--br-text) !important;
}
html[data-theme="dark"] .user-welcome,
html[data-theme="dark"] .search-header p,
html[data-theme="dark"] .card-content p {
  color: var(--br-muted-text) !important;
}

html[data-theme="dark"] .site-footer,
html[data-theme="dark"] footer.site-footer {
  background: transparent !important;
  color: var(--br-muted-text) !important;
  border-top-color: transparent !important;
}

html[data-theme="dark"] .site-footer-inner {
  border-top-color: rgba(238, 246, 242, 0.12);
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .site-footer-name {
  color: #e95420;
}

html[data-theme="dark"] .site-footer .footer-link {
  color: #8a9e96 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .site-footer .footer-link:hover,
html[data-theme="dark"] .site-footer .footer-link:focus-visible {
  background: transparent !important;
  border: none !important;
  color: #c5d4ce !important;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  box-shadow: none !important;
}

html[data-theme="dark"] .site-footer-copy {
  color: #6f837c;
}

/* Вход: «Забыли пароль» / «Зарегистрироваться» — оранжевые в тёмной теме */
html[data-theme="dark"] .btn-link,
html[data-theme="dark"] #forgotPasswordBtn.btn-link,
html[data-theme="dark"] .register-link,
html[data-theme="dark"] #registerBtn.register-link {
  color: #ffa780 !important;
}
html[data-theme="dark"] .btn-link:hover,
html[data-theme="dark"] #forgotPasswordBtn.btn-link:hover,
html[data-theme="dark"] .register-link:hover,
html[data-theme="dark"] #registerBtn.register-link:hover {
  color: #e95420 !important;
  background: rgba(233, 84, 32, 0.14) !important;
  border-radius: 6px;
  text-decoration: none;
  box-shadow: 0 0 0 4px rgba(233, 84, 32, 0.14);
}

html[data-theme="dark"] .chat-dev-badge {
  color: #fde68a !important;
  background: #78350f !important;
  border-color: #92400e !important;
}

/* Chat dividers / chrome */
html[data-theme="dark"] .tg-chat .chat-sidebar-top,
html[data-theme="dark"] .tg-chat .chat-main-header,
html[data-theme="dark"] .tg-chat .chat-inchat-search,
html[data-theme="dark"] .tg-chat .composer,
html[data-theme="dark"] .tg-chat .chat-composer {
  border-color: var(--br-divider) !important;
}
html[data-theme="dark"] .tg-chat .chat-search {
  background: transparent !important;
  border: none !important;
  border-color: transparent !important;
}
html[data-theme="dark"] .chat-menu-divider {
  background: var(--br-divider) !important;
}
html[data-theme="dark"] .chat-menu-item {
  border-bottom-color: var(--br-divider) !important;
}
html[data-theme="dark"] .tg-chat .chat-item {
  border-color: var(--br-divider) !important;
}
html[data-theme="dark"] .tg-chat .chat-item::after {
  background: none !important;
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}
html[data-theme="dark"] .tg-chat .chat-day-sep span,
html[data-theme="dark"] .tg-chat .chat-pinned {
  background: var(--br-surface) !important;
  border-color: var(--br-border) !important;
  color: var(--br-text) !important;
}
html[data-theme="dark"] .chat-directory-presence,
html[data-theme="dark"] #chatMembersModal .chat-group-online {
  border-color: var(--br-surface) !important;
}
html[data-theme="dark"] #chatMembersModal .chat-group-input {
  border-bottom-color: var(--br-border) !important;
  color: var(--br-text) !important;
}
html[data-theme="dark"] .suggestion-item,
html[data-theme="dark"] .suggestion-group {
  border-color: var(--br-divider) !important;
}
html[data-theme="dark"] .tg-chat .chat-title,
html[data-theme="dark"] .tg-chat .chat-main-title,
html[data-theme="dark"] .tg-chat .chat-peer-name {
  color: var(--br-text) !important;
}
html[data-theme="dark"] .tg-chat .chat-main-title.chat-main-title--group {
  color: var(--br-accent) !important;
}
html[data-theme="dark"] .tg-chat .chat-main-subtitle,
html[data-theme="dark"] .tg-chat .chat-title-dot {
  color: var(--br-muted-text) !important;
}

/* Активные сеансы в профиле: серые строки, без белых бликов, оранжевый hover */
html[data-theme="dark"] .sessions-list {
  background: var(--br-surface2) !important;
  border-color: var(--br-border) !important;
}
html[data-theme="dark"] .session-item {
  background: #323232 !important;
  color: var(--br-text) !important;
}
html[data-theme="dark"] .session-item.current {
  background: #2e2e2e !important;
  border-left-color: var(--br-accent) !important;
}
html[data-theme="dark"] .session-item:hover,
html[data-theme="dark"] .session-item.current:hover {
  background: rgba(233, 84, 32, 0.28) !important;
}
html[data-theme="dark"] .session-device {
  color: var(--br-text2) !important;
}
html[data-theme="dark"] .session-details,
html[data-theme="dark"] .session-time {
  color: var(--br-muted-text) !important;
}
html[data-theme="dark"] .session-status.active {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
html[data-theme="dark"] .session-status.current {
  background: rgba(233, 84, 32, 0.28) !important;
  color: #ffa780 !important;
}

/* =========================================================
   Dark badges — единый набор для всего сайта
   ========================================================= */

/* Общая «таблетка» */
html[data-theme="dark"] .role-badge,
html[data-theme="dark"] .status-badge,
html[data-theme="dark"] .position-badge,
html[data-theme="dark"] .houses-badge,
html[data-theme="dark"] .audit-action,
html[data-theme="dark"] .sec-event-type,
html[data-theme="dark"] .sec-event-sev,
html[data-theme="dark"] .ipblock-status,
html[data-theme="dark"] .count-badge,
html[data-theme="dark"] .up-tag,
html[data-theme="dark"] .team-tag.tag,
html[data-theme="dark"] .chat-role-badge,
html[data-theme="dark"] .chat-group-tag,
html[data-theme="dark"] .chat-directory-online-badge,
html[data-theme="dark"] .chat-attach-badge,
html[data-theme="dark"] .district-badge,
html[data-theme="dark"] .stat-badge,
html[data-theme="dark"] .old-role-badge,
html[data-theme="dark"] .new-role-badge {
  border-color: transparent !important;
}
html[data-theme="dark"] .district-badge--stripe {
  border: none !important;
  background: transparent !important;
  box-shadow: inset 4px 0 0 var(--district-accent, #94a3b8) !important;
  color: var(--br-text, #f5f5f5) !important;
}

/* Роли */
html[data-theme="dark"] .role-badge.user,
html[data-theme="dark"] .role-user,
html[data-theme="dark"] .up-tag-blue,
html[data-theme="dark"] .chat-role-badge--user,
html[data-theme="dark"] #chatMembersModal .chat-group-tag--user,
html[data-theme="dark"] .team-tag.team-role--user {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
}
html[data-theme="dark"] .role-badge.moderator,
html[data-theme="dark"] .role-moderator,
html[data-theme="dark"] .up-tag-yellow,
html[data-theme="dark"] .chat-role-badge--moderator,
html[data-theme="dark"] #chatMembersModal .chat-group-tag--moderator,
html[data-theme="dark"] .team-tag.team-role--moderator {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .role-badge.admin,
html[data-theme="dark"] .role-admin,
html[data-theme="dark"] .up-tag-red,
html[data-theme="dark"] .chat-role-badge--admin,
html[data-theme="dark"] #chatMembersModal .chat-group-tag--admin,
html[data-theme="dark"] .team-tag.team-role--admin {
  background: #7f1d1d !important;
  color: #fecaca !important;
}
html[data-theme="dark"] .role-badge.main_admin,
html[data-theme="dark"] .role-main_admin,
html[data-theme="dark"] .up-tag-purple,
html[data-theme="dark"] .chat-role-badge--main_admin,
html[data-theme="dark"] #chatMembersModal .chat-group-tag--main_admin,
html[data-theme="dark"] .team-tag.team-role--main_admin {
  background: #4c1d95 !important;
  color: #ddd6fe !important;
}

html[data-theme="dark"] .position-badge {
  background: #1e3a8a !important;
  color: #bfdbfe !important;
}
html[data-theme="dark"] .houses-badge,
html[data-theme="dark"] #statsModal .team-tag.tag.team-tag--houses,
html[data-theme="dark"] .team-tag.team-tag--houses {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}

/* Статусы пользователя / системы */
html[data-theme="dark"] .status-badge.status-pending,
html[data-theme="dark"] .status-pending {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .status-badge.status-approved,
html[data-theme="dark"] .status-approved,
html[data-theme="dark"] .status-badge.status-ok,
html[data-theme="dark"] .status-ok {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
html[data-theme="dark"] .status-badge.status-banned,
html[data-theme="dark"] .status-banned,
html[data-theme="dark"] .status-badge.status-error,
html[data-theme="dark"] .status-error {
  background: #7f1d1d !important;
  color: #fecaca !important;
}
html[data-theme="dark"] .status-badge.status-warning,
html[data-theme="dark"] .status-warning {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .status-badge.status-info,
html[data-theme="dark"] .status-info {
  background: #1e3a8a !important;
  color: #bfdbfe !important;
}

/* Аудит */
html[data-theme="dark"] .audit-action.create,
html[data-theme="dark"] .audit-action.grant_district_access,
html[data-theme="dark"] .audit-action.site_register,
html[data-theme="dark"] .audit-action.house_card_review,
html[data-theme="dark"] .audit-action.ip_unblock {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
html[data-theme="dark"] .audit-action.update {
  background: #1e3a8a !important;
  color: #bfdbfe !important;
}
html[data-theme="dark"] .audit-action.delete,
html[data-theme="dark"] .audit-action.delete_comment,
html[data-theme="dark"] .audit-action.delete_photo,
html[data-theme="dark"] .audit-action.revoke_district_access,
html[data-theme="dark"] .audit-action.restart,
html[data-theme="dark"] .audit-action.SERVER_RESTART,
html[data-theme="dark"] .audit-action.wipe_security_events,
html[data-theme="dark"] .audit-action.ip_block {
  background: #7f1d1d !important;
  color: #fecaca !important;
}
html[data-theme="dark"] .audit-action.export,
html[data-theme="dark"] .audit-action.change_role,
html[data-theme="dark"] .audit-action.forgot_password_request {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .audit-action.import,
html[data-theme="dark"] .audit-action.change_position,
html[data-theme="dark"] .audit-action.change_status {
  background: #312e81 !important;
  color: #c7d2fe !important;
}
html[data-theme="dark"] .audit-action.comment {
  background: #155e75 !important;
  color: #a5f3fc !important;
}
html[data-theme="dark"] .audit-action.upload_photo {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
}
html[data-theme="dark"] .audit-action.backup,
html[data-theme="dark"] .audit-action.download_project_backup,
html[data-theme="dark"] .audit-action.download_database_backup {
  background: #9f1239 !important;
  color: #fecdd3 !important;
}
html[data-theme="dark"] .audit-action.gamification_settings {
  background: #831843 !important;
  color: #fbcfe8 !important;
}
html[data-theme="dark"] .audit-action.seasonal_effects_settings {
  background: #0c4a6e !important;
  color: #bae6fd !important;
}
html[data-theme="dark"] .audit-action.city_add_request {
  background: #1e3a8a !important;
  color: #bfdbfe !important;
}
html[data-theme="dark"] .audit-action.district_add_request {
  background: #064e3b !important;
  color: #a7f3d0 !important;
}
html[data-theme="dark"] .audit-action.levels_backfill {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .audit-state-on { color: #6ee7b7 !important; }
html[data-theme="dark"] .audit-state-off { color: #fcd34d !important; }
html[data-theme="dark"] .audit-state-unknown { color: #9ca3af !important; }

/* События безопасности */
html[data-theme="dark"] .sec-event-sev.info {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
  border-color: #0369a1 !important;
}
html[data-theme="dark"] .sec-event-sev.warn,
html[data-theme="dark"] .sec-event-sev.warning {
  background: #78350f !important;
  color: #fde68a !important;
  border-color: #92400e !important;
}
html[data-theme="dark"] .sec-event-sev.error {
  background: #7f1d1d !important;
  color: #fecaca !important;
  border-color: #991b1b !important;
}
html[data-theme="dark"] .sec-event-sev.critical {
  background: #111827 !important;
  color: #f9fafb !important;
  border-color: #374151 !important;
}
html[data-theme="dark"] .sec-event-type.IP_BLOCKED,
html[data-theme="dark"] .sec-event-type.INVALID_JSON_BAN,
html[data-theme="dark"] .sec-event-type.SECRET_PROBE_BAN {
  background: #7f1d1d !important;
  color: #fecaca !important;
  border-color: #991b1b !important;
}
html[data-theme="dark"] .sec-event-type.IP_UNBLOCKED {
  background: #064e3b !important;
  color: #a7f3d0 !important;
  border-color: #047857 !important;
}
html[data-theme="dark"] .sec-event-type.REQUEST_ABORTED_SPIKE {
  background: #78350f !important;
  color: #fde68a !important;
  border-color: #92400e !important;
}

/* Блокировки IP */
html[data-theme="dark"] .ipblock-status.active {
  background: #7f1d1d !important;
  color: #fecaca !important;
}
html[data-theme="dark"] .ipblock-status.inactive {
  background: #3a3a3a !important;
  color: #b5b5b5 !important;
}

/* Счётчики / мелкие чипы */
html[data-theme="dark"] .count-badge,
html[data-theme="dark"] .comment-attach-badge,
html[data-theme="dark"] .stat-badge {
  background: #3a3a3a !important;
  color: #e0e0e0 !important;
}
html[data-theme="dark"] .chat-attach-badge {
  background: #78350f !important;
  color: #fde68a !important;
}
html[data-theme="dark"] .chat-directory-online-badge {
  background: #064e3b !important;
  color: #a7f3d0 !important;
  border-color: #047857 !important;
}
html[data-theme="dark"] .chat-dev-badge {
  background: #78350f !important;
  color: #fde68a !important;
  border-color: #92400e !important;
}
html[data-theme="dark"] .tg-chat .chat-item-badge {
  background: var(--br-btn-primary, #e95420) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(233, 84, 32, 0.28) !important;
}
html[data-theme="dark"] .district-badge:not(.district-badge--colored) {
  background: #3a3a3a !important;
  color: #e8e8e8 !important;
}
html[data-theme="dark"] .admin-act-scope-modes,
html[data-theme="dark"] .admin-act-houses-list,
html[data-theme="dark"] .admin-act-job-card,
html[data-theme="dark"] .act-job-user-card,
html[data-theme="dark"] .admin-act-stat-card {
  background: var(--br-surface2, #2a2a2a) !important;
  border-color: var(--br-border, #404040) !important;
  color: var(--br-text) !important;
}

html[data-theme="dark"] .admin-act-radio,
html[data-theme="dark"] .admin-act-house-item {
  color: var(--br-text2) !important;
}

html[data-theme="dark"] .house-fresh-badge--ok {
  background: #14532d !important;
  color: #bbf7d0 !important;
}
html[data-theme="dark"] .house-fresh-badge--reviewed {
  background: #312e81 !important;
  color: #c7d2fe !important;
}
html[data-theme="dark"] .house-fresh-badge--walk {
  background: #7c2d12 !important;
  color: #fed7aa !important;
}
html[data-theme="dark"] .house-fresh-badge--warn,
html[data-theme="dark"] button.house-fresh-badge--warn,
html[data-theme="dark"] .house-header-badges .house-fresh-warn-btn.house-card-menu-btn,
html[data-theme="dark"] .house-header-badges button.house-fresh-badge.house-card-menu-btn {
  background: transparent !important;
  color: inherit !important;
  border: none !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .house-header-badges .house-fresh-menu.is-open .house-fresh-warn-btn.house-card-menu-btn,
html[data-theme="dark"] .house-header-badges .house-fresh-warn-btn.house-card-menu-btn:hover,
html[data-theme="dark"] .house-header-badges .house-fresh-warn-btn.house-card-menu-btn:focus-visible {
  background: transparent !important;
  color: inherit !important;
  border: none !important;
  box-shadow: none !important;
  opacity: 0.9;
}
html[data-theme="dark"] .admin-act-job-card,
html[data-theme="dark"] .act-job-user-card,
html[data-theme="dark"] .admin-act-houses-list {
  border-color: var(--br-border, #404040) !important;
  background: var(--br-surface2, #2a2a2a) !important;
}
html[data-theme="dark"] .old-role-badge {
  background: #3d3d3d !important;
  color: #c8c8c8 !important;
}
html[data-theme="dark"] .new-role-badge {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
}
html[data-theme="dark"] .role-change-content.demotion .new-role-badge {
  background: #7f1d1d !important;
  color: #fecaca !important;
}

/* Ники-«бейджи» по ролям (аудит / списки / карточки домов) */
html[data-theme="dark"] .clickable-username.username-role-user,
html[data-theme="dark"] .house-card .clickable-username.username-role-user,
html[data-theme="dark"] .house-meta .clickable-username.username-role-user {
  color: #7dd3fc !important;
  background: #0c4a6e !important;
  text-decoration: none !important;
}
html[data-theme="dark"] .clickable-username.username-role-moderator,
html[data-theme="dark"] .house-card .clickable-username.username-role-moderator,
html[data-theme="dark"] .house-meta .clickable-username.username-role-moderator {
  color: #fde68a !important;
  background: #78350f !important;
  text-decoration: none !important;
}
html[data-theme="dark"] .clickable-username.username-role-admin,
html[data-theme="dark"] .house-card .clickable-username.username-role-admin,
html[data-theme="dark"] .house-meta .clickable-username.username-role-admin {
  color: #fecaca !important;
  background: #7f1d1d !important;
  text-decoration: none !important;
}
html[data-theme="dark"] .clickable-username.username-role-main_admin,
html[data-theme="dark"] .house-card .clickable-username.username-role-main_admin,
html[data-theme="dark"] .house-meta .clickable-username.username-role-main_admin {
  color: #ddd6fe !important;
  background: #4c1d95 !important;
  text-decoration: none !important;
  font-weight: 600 !important;
}

/* Dashboard news — last word over inline styles from saved HTML */
html[data-theme="dark"] #newsCard {
  background: #2b2b2b !important;
  color: #e8e8e8 !important;
}
html[data-theme="dark"] #newsCard .card-content h3 {
  color: #f2f2f2 !important;
}
html[data-theme="dark"] #newsContent,
html[data-theme="dark"] #newsContent.news-content,
html[data-theme="dark"] #newsContent *:not(a):not(img):not(svg):not(path):not(.news-spoiler-header):not(.news-spoiler-icon):not(h3):not(h4) {
  color: #e8e8e8 !important;
}
html[data-theme="dark"] #newsContent a,
html[data-theme="dark"] #newsContent a * {
  color: #ffa780 !important;
}
html[data-theme="dark"] #newsContent .news-meta {
  color: #a8a8a8 !important;
}
html[data-theme="dark"] #newsContent .news-spoiler-header,
html[data-theme="dark"] #newsContent .news-spoiler-icon,
html[data-theme="dark"] #newsContent h3,
html[data-theme="dark"] #newsContent h4 {
  color: #ffa780 !important;
  background: rgba(233, 84, 32, 0.18) !important;
  border-left-color: #e95420 !important;
}
html[data-theme="dark"] #newsContent .news-spoiler-header:hover,
html[data-theme="dark"] #newsContent h3:hover,
html[data-theme="dark"] #newsContent h4:hover {
  background: rgba(233, 84, 32, 0.28) !important;
  color: #ffc4a8 !important;
}

