/* X-04 night / dark theme — toggled via html.theme-dark */

.a11y-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0.5rem;
  vertical-align: middle;
  z-index: 50;
}

.a11y-controls__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.a11y-controls__special,
.a11y-controls__theme {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(36, 176, 152, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #147a68;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.a11y-controls__special:hover,
.a11y-controls__theme:hover {
  background: #e8f5f2;
  border-color: #24B098;
}

.a11y-controls__special:focus-visible,
.a11y-controls__theme:focus-visible {
  outline: 3px solid rgba(36, 176, 152, 0.45);
  outline-offset: 2px;
}

.a11y-controls__special svg {
  display: block;
  flex-shrink: 0;
}

/* Icon swap via theme class (JS .hidden on SVG is unreliable) */
.a11y-controls__theme [data-theme-icon="moon"] {
  display: block !important;
}

.a11y-controls__theme [data-theme-icon="sun"] {
  display: none !important;
}

html.theme-dark .a11y-controls__theme [data-theme-icon="moon"] {
  display: none !important;
}

html.theme-dark .a11y-controls__theme [data-theme-icon="sun"] {
  display: block !important;
}

html.theme-dark {
  color-scheme: dark;
}

html.theme-dark body {
  background-color: #12161c;
  color: #e8eef5;
}

html.theme-dark header {
  background-color: #1a212b;
}

html.theme-dark .header-logo img,
html.theme-dark .header-logo-hidden img {
  filter: invert(1) hue-rotate(180deg) brightness(1.05);
}

html.theme-dark ul.burger-trigger li {
  background-color: #5ee0c8;
}

html.theme-dark header .first-line .item,
html.theme-dark header .header-menu .first-line .item a,
html.theme-dark header .mobile-menu .first-line .item a {
  color: #7de8d4;
}

html.theme-dark header .header-menu .second-line .item ul,
html.theme-dark header .mobile-menu {
  color: #e8eef5;
  background: rgba(26, 33, 43, 0.96);
}

html.theme-dark .user-info {
  background-color: #1a212b !important;
  color: #e8eef5 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  border: 1px solid #2e3d50;
}

html.theme-dark .user-info a,
html.theme-dark .user-cabinet-name,
html.theme-dark .user-header-icon,
html.theme-dark .user-info .nav-link {
  color: #e8eef5 !important;
}

html.theme-dark .user-info select {
  background-color: #243040 !important;
  color: #e8eef5 !important;
  border-color: #3a4a5c !important;
}

html.theme-dark .gradient-line {
  opacity: 0.7;
}

html.theme-dark .a11y-controls__special,
html.theme-dark .a11y-controls__theme {
  background: #243040;
  color: #f6d860;
  border-color: rgba(246, 216, 96, 0.45);
}

html.theme-dark .a11y-controls__special:hover,
html.theme-dark .a11y-controls__theme:hover {
  background: #2e3d50;
  border-color: #f6d860;
}

html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark h4,
html.theme-dark h5,
html.theme-dark h6 {
  color: #f1f5f9;
}

html.theme-dark #programms h2 {
  color: #5ee0c8;
}

html.theme-dark a:not(.btn):not(.nav-link):not(.dropdown-item) {
  color: #7de8d4;
}

html.theme-dark a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
  color: #a6f0e2;
}

html.theme-dark .text-muted,
html.theme-dark .text-secondary,
html.theme-dark .form-text {
  color: #9aa8b8 !important;
}

html.theme-dark .text-dark {
  color: #e8eef5 !important;
}

html.theme-dark .text-black {
  color: #f1f5f9 !important;
}

html.theme-dark .bg-white,
html.theme-dark .bg-light,
html.theme-dark .bg-body {
  background-color: #1a212b !important;
  color: #e8eef5;
}

html.theme-dark .card,
html.theme-dark .portal-menu-page .card,
html.theme-dark .list-group-item,
html.theme-dark .modal-content,
html.theme-dark .dropdown-menu,
html.theme-dark .accordion-item,
html.theme-dark .offcanvas {
  background-color: #1a212b;
  color: #e8eef5;
  border-color: #2e3d50;
}

html.theme-dark .card-header,
html.theme-dark .card-footer,
html.theme-dark .modal-header,
html.theme-dark .modal-footer,
html.theme-dark .accordion-button,
html.theme-dark .list-group-item-action {
  background-color: #212a36;
  color: #e8eef5;
  border-color: #2e3d50;
}

html.theme-dark .accordion-button:not(.collapsed) {
  background-color: #243040;
  color: #7de8d4;
}

html.theme-dark .accordion-button::after {
  filter: invert(1);
}

html.theme-dark .dropdown-item {
  color: #e8eef5;
}

html.theme-dark .dropdown-item:hover,
html.theme-dark .dropdown-item:focus {
  background-color: #243040;
  color: #7de8d4;
}

html.theme-dark .table {
  color: #e8eef5;
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
  --bs-table-hover-bg: rgba(36, 176, 152, 0.12);
  --bs-table-border-color: #2e3d50;
  border-color: #2e3d50;
}

html.theme-dark .table > :not(caption) > * > * {
  background-color: transparent;
  border-color: #2e3d50;
  color: inherit;
}

html.theme-dark .table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(255, 255, 255, 0.04);
  color: inherit;
}

html.theme-dark .table thead th,
html.theme-dark .table th {
  background-color: #212a36;
  color: #f1f5f9;
  border-color: #2e3d50;
}

html.theme-dark .form-control,
html.theme-dark .form-select,
html.theme-dark input[type="text"],
html.theme-dark input[type="password"],
html.theme-dark input[type="email"],
html.theme-dark input[type="number"],
html.theme-dark input[type="search"],
html.theme-dark input[type="date"],
html.theme-dark input[type="datetime-local"],
html.theme-dark textarea,
html.theme-dark select {
  background-color: #12161c;
  color: #e8eef5;
  border-color: #3a4a5c;
}

html.theme-dark .form-control:focus,
html.theme-dark .form-select:focus,
html.theme-dark input:focus,
html.theme-dark textarea:focus,
html.theme-dark select:focus {
  background-color: #12161c;
  color: #e8eef5;
  border-color: #24B098;
  box-shadow: 0 0 0 0.2rem rgba(36, 176, 152, 0.25);
}

html.theme-dark .form-control::placeholder,
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
  color: #7a8796;
}

html.theme-dark .form-check-input {
  background-color: #12161c;
  border-color: #3a4a5c;
}

html.theme-dark .input-group-text {
  background-color: #212a36;
  color: #e8eef5;
  border-color: #3a4a5c;
}

html.theme-dark .btn-outline-secondary,
html.theme-dark .btn-outline-dark {
  color: #c5d0dc;
  border-color: #3a4a5c;
}

html.theme-dark .btn-outline-secondary:hover,
html.theme-dark .btn-outline-dark:hover {
  background-color: #243040;
  color: #e8eef5;
  border-color: #5ee0c8;
}

html.theme-dark .btn-light,
html.theme-dark .btn-close {
  filter: invert(1) grayscale(1);
}

html.theme-dark .alert {
  border-color: #3a4a5c;
}

html.theme-dark .alert-light,
html.theme-dark .alert-secondary {
  background-color: #212a36;
  color: #e8eef5;
}

html.theme-dark .alert-info {
  background-color: #1a2f3d;
  color: #b6e3f7;
  border-color: #2a4a5c;
}

html.theme-dark .alert-warning {
  background-color: #3a2f14;
  color: #f6e0a0;
  border-color: #5a4820;
}

html.theme-dark .alert-danger {
  background-color: #3a1c1c;
  color: #f5b4b4;
  border-color: #5a2a2a;
}

html.theme-dark .alert-success {
  background-color: #14352e;
  color: #a6f0e2;
  border-color: #1f5548;
}

html.theme-dark .breadcrumb {
  --bs-breadcrumb-divider-color: #7a8796;
}

html.theme-dark .breadcrumb-item,
html.theme-dark .breadcrumb-item a {
  color: #9aa8b8;
}

html.theme-dark .breadcrumb-item.active {
  color: #e8eef5;
}

html.theme-dark .nav-tabs {
  border-bottom-color: #2e3d50;
}

html.theme-dark .nav-tabs .nav-link {
  color: #9aa8b8;
}

html.theme-dark .nav-tabs .nav-link.active {
  background-color: #1a212b;
  color: #7de8d4;
  border-color: #2e3d50 #2e3d50 #1a212b;
}

html.theme-dark .pagination .page-link {
  background-color: #1a212b;
  color: #7de8d4;
  border-color: #2e3d50;
}

html.theme-dark .pagination .page-item.active .page-link {
  background-color: #24B098;
  border-color: #24B098;
  color: #fff;
}

html.theme-dark .pagination .page-item.disabled .page-link {
  background-color: #12161c;
  color: #5a6775;
}

html.theme-dark hr {
  border-color: #2e3d50;
  opacity: 1;
}

html.theme-dark .border,
html.theme-dark .border-top,
html.theme-dark .border-bottom,
html.theme-dark .border-start,
html.theme-dark .border-end {
  border-color: #2e3d50 !important;
}

html.theme-dark #hero .slider .item,
html.theme-dark .video {
  background-color: #243040;
}

html.theme-dark #reviews .card {
  background-color: #1a212b;
  color: #e8eef5;
}

html.theme-dark #policyModal > div,
html.theme-dark .modal-backdrop.show {
  /* keep backdrop dark; modal content already covered */
}

html.theme-dark #policyModal > div {
  background: #1a212b;
  color: #e8eef5;
}

/* Common cabinet / portal surfaces with hard-coded light fills */
html.theme-dark .portal-menu-page,
html.theme-dark main,
html.theme-dark .content,
html.theme-dark .page-content {
  background-color: transparent;
  color: #e8eef5;
}

html.theme-dark .shadow,
html.theme-dark .shadow-sm,
html.theme-dark .shadow-lg {
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45) !important;
}

/* Prefer readable contrast on Bootstrap utility whites used in templates */
html.theme-dark [style*="background:#fff"],
html.theme-dark [style*="background: #fff"],
html.theme-dark [style*="background:#ffffff"],
html.theme-dark [style*="background: #ffffff"],
html.theme-dark [style*="background-color:#fff"],
html.theme-dark [style*="background-color: #fff"],
html.theme-dark [style*="background-color:#ffffff"],
html.theme-dark [style*="background-color: #ffffff"],
html.theme-dark [style*="background:white"],
html.theme-dark [style*="background: white"] {
  background-color: #1a212b !important;
  color: #e8eef5 !important;
}

/* Bootstrap CSS variables — cards / body inherit correctly */
html.theme-dark {
  --bs-body-bg: #12161c;
  --bs-body-color: #e8eef5;
  --bs-secondary-bg: #1a212b;
  --bs-tertiary-bg: #212a36;
  --bs-border-color: #2e3d50;
  --bs-card-bg: #1a212b;
  --bs-card-color: #e8eef5;
  --bs-card-border-color: #2e3d50;
  --bs-card-cap-bg: #212a36;
  --bs-modal-bg: #1a212b;
  --bs-modal-color: #e8eef5;
  --bs-dropdown-bg: #1a212b;
  --bs-dropdown-color: #e8eef5;
  --bs-dropdown-link-color: #e8eef5;
  --bs-dropdown-link-hover-bg: #243040;
  --bs-dropdown-border-color: #2e3d50;
}

/* ——— Portal news (inline <style> in _portal_news.html — need !important) ——— */
html.theme-dark .portal-news {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .portal-news-head h3,
html.theme-dark .portal-news-all,
html.theme-dark .portal-news-more,
html.theme-dark .portal-news-title {
  color: #7de8d4 !important;
}

html.theme-dark .portal-news-item {
  border-top-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .portal-news-item:hover {
  background: rgba(36, 176, 152, 0.1) !important;
}

html.theme-dark .portal-news-date,
html.theme-dark .portal-news-excerpt {
  color: #9aa8b8 !important;
}

html.theme-dark .portal-news-thumb {
  background: #243040 !important;
}

html.theme-dark .portal-news-item:hover .portal-news-title,
html.theme-dark .portal-news-item:hover .portal-news-more {
  color: #a6f0e2 !important;
}

/* ——— Biblio (inline styles in biblio_form.html) ——— */
html.theme-dark body:has(.book-card),
html.theme-dark body:has(.sidebar-card) {
  background-color: #12161c !important;
}

html.theme-dark .sidebar-card,
html.theme-dark .search-container,
html.theme-dark .book-card {
  background-color: #1a212b !important;
  color: #e8eef5 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

html.theme-dark .book-card .card-body,
html.theme-dark .book-card h5,
html.theme-dark .book-card p,
html.theme-dark .book-card .card-title {
  color: #e8eef5 !important;
}

html.theme-dark .book-card-actions {
  border-top-color: rgba(126, 232, 212, 0.22);
}

html.theme-dark .book-card .text-muted,
html.theme-dark .search-container .form-label,
html.theme-dark .sidebar-card a {
  color: #9aa8b8 !important;
}

html.theme-dark .sidebar-card a:hover {
  color: #7de8d4 !important;
}

html.theme-dark .no-image,
html.theme-dark .book-image {
  background-color: #243040 !important;
  border-color: #2e3d50 !important;
}

html.theme-dark .search-bar,
html.theme-dark .search-container .form-control,
html.theme-dark .search-container .form-select {
  background-color: #12161c !important;
  color: #e8eef5 !important;
  border-color: #3a4a5c !important;
}

/* ——— DPO catalog / course ——— */
html.theme-dark .dpo-catalog-card,
html.theme-dark .dpo-course-nav,
html.theme-dark .dpo-course-main .card,
html.theme-dark .dpo-catalog-card .card-body {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .dpo-catalog-card .card-title,
html.theme-dark .dpo-course-header h1,
html.theme-dark .dpo-course-nav__section,
html.theme-dark .dpo-course-nav a.course-link {
  color: #e8eef5 !important;
}

html.theme-dark .dpo-catalog-card .card-text,
html.theme-dark .dpo-catalog-card .card-text.truncated,
html.theme-dark .dpo-progress-label,
html.theme-dark .dpo-course-header p,
html.theme-dark .dpo-course-nav__title,
html.theme-dark .dpo-course-nav__progress-meta,
html.theme-dark .dpo-progress-meta {
  color: #9aa8b8 !important;
}

html.theme-dark .dpo-catalog-card .read-more-link {
  color: #7de8d4 !important;
}

html.theme-dark .dpo-course-nav__progress-bar,
html.theme-dark .dpo-progress-bar {
  background: #2e3d50 !important;
}

html.theme-dark .dpo-course-nav a.course-link:hover,
html.theme-dark .dpo-course-nav a.course-link.active {
  background: #243040 !important;
  color: #7de8d4 !important;
}

/* ——— Сведения / CMS HTML (sveden) ——— */
html.theme-dark .sveden-page,
html.theme-dark .sveden-wrap {
  color: #e8eef5;
}

html.theme-dark .sveden-page-title,
html.theme-dark .sveden-lead,
html.theme-dark .sveden-crumb,
html.theme-dark .sveden-crumb__current {
  color: #e8eef5 !important;
}

html.theme-dark .sveden-crumb a {
  color: #7de8d4 !important;
}

html.theme-dark .sveden-tile {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .sveden-tile:hover,
html.theme-dark .sveden-tile:focus-visible {
  color: #7de8d4 !important;
  border-color: #24B098 !important;
}

html.theme-dark .sveden-cms {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .sveden-cms,
html.theme-dark .sveden-cms p,
html.theme-dark .sveden-cms li,
html.theme-dark .sveden-cms td,
html.theme-dark .sveden-cms th,
html.theme-dark .sveden-cms span,
html.theme-dark .sveden-cms div,
html.theme-dark .sveden-cms font {
  color: #e8eef5 !important;
}

html.theme-dark .sveden-cms h1,
html.theme-dark .sveden-cms h2,
html.theme-dark .sveden-cms h3,
html.theme-dark .sveden-cms h4,
html.theme-dark .sveden-cms h5 {
  color: #7de8d4 !important;
}

html.theme-dark .sveden-cms a {
  color: #7de8d4 !important;
  border-bottom-color: rgba(125, 232, 212, 0.35) !important;
}

html.theme-dark .sveden-cms a.text-big,
html.theme-dark .sveden-cms .text-big {
  background: #212a36 !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .sveden-cms figure.table,
html.theme-dark .sveden-table-wrap,
html.theme-dark .sveden-cms table {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
}

html.theme-dark .sveden-cms table td,
html.theme-dark .sveden-cms table th {
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .sveden-cms table tr:first-child td,
html.theme-dark .sveden-cms table tr:first-child th,
html.theme-dark .sveden-cms table thead td,
html.theme-dark .sveden-cms table thead th {
  background: #243040 !important;
  color: #f1f5f9 !important;
}

html.theme-dark .sveden-cms table tbody tr:nth-child(even) td {
  background: #212a36 !important;
}

html.theme-dark .sveden-cms table tbody tr:hover td {
  background: #2a3848 !important;
}

html.theme-dark .sveden-cms hr {
  border-top-color: #2e3d50 !important;
}

/* ——— Other common light panels (cabinets / journals / pays) ——— */
html.theme-dark .portal-menu-page .card,
html.theme-dark .portal-menu-page .card-body,
html.theme-dark .att-card,
html.theme-dark .att-panel,
html.theme-dark .diary-card,
html.theme-dark .diary-panel,
html.theme-dark .poll-card,
html.theme-dark .poll-shell,
html.theme-dark .pay-card,
html.theme-dark .pay-panel,
html.theme-dark .student-home-card,
html.theme-dark .shd-card,
html.theme-dark .notify-card,
html.theme-dark .pmessage-card {
  background-color: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .portal-menu-page .card-title,
html.theme-dark .portal-menu-page .card-text {
  color: #e8eef5 !important;
}

html.theme-dark .portal-menu-page .text-muted,
html.theme-dark .portal-menu-page .card-text.text-muted {
  color: #9aa8b8 !important;
}

html.theme-dark .attendance-table-wrap,
html.theme-dark .attendance-section .card,
html.theme-dark .attendance-section .card-header,
html.theme-dark .att-kpi,
html.theme-dark .att-hub-card,
html.theme-dark .shd-card,
html.theme-dark .poll-card,
html.theme-dark .poll-content-panel,
html.theme-dark .pay-receipt-wrap .print-payment-form,
html.theme-dark .diary-shell,
html.theme-dark .diary-entry-card,
html.theme-dark .diary-card {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .att-insight,
html.theme-dark .att-insight-ok {
  background: #212a36 !important;
  color: #e8eef5 !important;
  border-color: #2e3d50 !important;
}

/* ——— Лекции ——— */
html.theme-dark .lekcii-page .lecture-card,
html.theme-dark .lekcii-page .sidebar-card,
html.theme-dark .lekcii-page .search-container {
  background-color: #1a212b !important;
  color: #e8eef5 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

html.theme-dark .lekcii-page .lecture-title {
  color: #7de8d4 !important;
}

html.theme-dark .lekcii-page .lecture-description,
html.theme-dark .lekcii-page .lecture-spec {
  color: #9aa8b8 !important;
}

html.theme-dark .lekcii-page .search-bar,
html.theme-dark .lekcii-page .form-control,
html.theme-dark .lekcii-page .form-select {
  background-color: #12161c !important;
  color: #e8eef5 !important;
  border-color: #3a4a5c !important;
}

html.theme-dark .lekcii-page .list-group-item {
  background-color: #1a212b !important;
  color: #e8eef5 !important;
  border-color: #2e3d50 !important;
}

html.theme-dark .lekcii-page .list-group-item.active {
  background-color: #24B098 !important;
  border-color: #24B098 !important;
  color: #fff !important;
}

/* ——— Обратная связь /postreview/ ——— */
html.theme-dark .review-form,
html.theme-dark .review-list .review-card,
html.theme-dark .review-body {
  background: #1a212b !important;
  border-color: #2e3d50 !important;
  color: #e8eef5 !important;
}

html.theme-dark .review-form h3,
html.theme-dark .review-list h3,
html.theme-dark .review-form label,
html.theme-dark .review-per,
html.theme-dark .review-body {
  color: #e8eef5 !important;
}

html.theme-dark .review-form .text-muted {
  color: #9aa8b8 !important;
}

html.theme-dark .review-per a,
html.theme-dark .review-per .review-per-btn,
html.theme-dark .review-pagination a,
html.theme-dark .review-pagination span {
  background: #212a36 !important;
  color: #e8eef5 !important;
  border-color: #2e3d50 !important;
}

html.theme-dark .review-per a:hover,
html.theme-dark .review-pagination a:hover {
  background: #243040 !important;
  color: #7de8d4 !important;
  border-color: #24B098 !important;
}

html.theme-dark .review-per .review-per-btn.is-active,
html.theme-dark .review-pagination span.current-page {
  background: #24B098 !important;
  color: #fff !important;
  border-color: #24B098 !important;
}
