/* =========================================================
   1. ПАЛИТРА И ПЕРЕМЕННЫЕ
   ========================================================= */
:root {
  --primary: #2563eb;     /* blue-600 */
  --secondary: #0ea5e9;   /* sky-500 */
  --danger: #dc2626;      /* red-600 */
  --muted: #6b7280;       /* gray-500 */
}

/* =========================================================
   2. БАЗОВЫЕ СТИЛИ
   ========================================================= */
html, body {
  height: 100%;
}

body {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

input,
select,
textarea,
.card,
.modal,
header,
nav,
.table th,
.table td {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* Fade эффект */
html.theme-fade {
  opacity: 0;
  transition: opacity .25s ease;
}

/* =========================================================
   3. ТЁМНАЯ ТЕМА
   ========================================================= */
html.theme-dark {
  background: #0f172a;
  color: #e5e7eb;
}

html.theme-dark header {
  background: #0b1220;
  border-color: #1f2937;
}

html.theme-dark .card {
  background: #0b1220;
  border-color: #1f2937;
  color: #e5e7eb;
}

html.theme-dark .btn-light {
  background: #1f2937;
  color: #e5e7eb;
}

html.theme-dark .nav-link.active {
  background: #1e3a8a;
  color: #e5e7eb;
}

html.theme-dark .chip {
  background: #1f2937;
  color: #93c5fd;
}

html.theme-dark .badge {
  background: #111827;
  color: #e5e7eb;
}

html.theme-dark .badge-warn {
  background: #78350f;
  color: #fde68a;
}

html.theme-dark pre {
  background: #111827;
  color: #e5e7eb;
}

/* Тёмная тема — таблицы */
html.theme-dark .table th {
  background: #1f2937;
  color: #e5e7eb;
}

html.theme-dark .table td {
  border-color: #374151;
}

html.theme-dark .table tr:hover {
  background: #111827;
}

/* Тёмная тема — модалки */
html.theme-dark #modalRoot .modal {
  background: #0b1220;
  border-color: #1f2937;
  color: #e5e7eb;
}

html.theme-dark .modal-header,
html.theme-dark .modal-footer {
  border-color: #1f2937;
}

/* Тёмная тема — инпуты */
html.theme-dark .input,
html.theme-dark input,
html.theme-dark select {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #374151;
}

html.theme-dark .input::placeholder {
  color: #6b7280;
}

html.theme-dark option {
  background: #1f2937;
  color: #e5e7eb;
}

/* Тёмная тема — прочее */
html.theme-dark .bg-white {
  background: #0b1220 !important;
}

html.theme-dark .border {
  border-color: #1f2937 !important;
}

html.theme-dark .hover\:bg-gray-100:hover {
  background: #1f2937 !important;
}

html.theme-dark .bg-gray-200 {
  background: #374151 !important;
}

html.theme-dark li {
  color: #e5e7eb;
}

html.theme-dark td,
html.theme-dark th {
  color: #e5e7eb;
}

/* =========================================================
   4. СВЕТЛАЯ ТЕМА (усиленная)
   ========================================================= */
html.theme-light {
  background: #dfe3e6;
  color: #1f2937;
}

html.theme-light .card {
  background: #e7eaee; /* чуть темнее */
  border-color: #c5c9ce;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}


html.theme-light .table th {
  background: #e2e6ea;
  color: #374151;
}

html.theme-light .table tr:hover {
  background: #d6dbe0;
}

html.theme-light #modalRoot .modal {
  background: #f2f3f5;
  border-color: #cfd3d7;
}

html.theme-light .input {
  background: #ffffff;
  border-color: #c7ccd1;
  color: #1f2937;
}

html.theme-light .chip {
  background: #e8eaef;
  border-color: #cfd3d7;
  color: #374151;
}

html.theme-light .badge {
  background: #e9ebee;
  color: #374151;
}

html.theme-light footer {
  background: #eef1f4;
}

html.theme-light input,
html.theme-light .input,
html.theme-light select,
html.theme-light textarea {
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}

html.theme-light .badge {
  background: #eef2f7;
  color: #374151;
}

/* =========================================================
   5. LAYOUT (header, footer, wrapper)
   ========================================================= */

.panel-wrapper {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: #eef1f4;
}

html.theme-dark .panel-wrapper {
  background: #0f172a;
}

footer {
  margin-top: auto;
  background: #eef1f4;
}

html.theme-dark footer {
  background: #0f172a;
}

/* Sticky header */
header.sticky {
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  backdrop-filter: blur(6px);
}

html.theme-dark header.sticky {
  background: rgba(15, 23, 42, 0.85);
  border-color: #1f2937;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
}

/* =========================================================
   6. CARD
   ========================================================= */

.card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.85rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  padding: 1rem;
}

html.theme-dark .card {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* Request card hover */
.request-card {
  transition: box-shadow .2s ease, transform .08s ease;
}

.request-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

.card {
    margin-bottom: 20px;
}


/* =========================================================
   7. BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem .8rem;
  border-radius: .5rem;
  font-weight: 500;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-light {
  background: #f3f4f6;
  color: #111827;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Success button override */
.btn-success {
  background-color: #22c55e !important;
  color: white !important;
}

.btn-success:hover {
  background-color: #22c55e !important;
  color: white !important;
  transition: none;
}

/* Desktop button size adjustments */
@media (min-width: 768px) {
  .btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
    border-radius: 0.35rem;
    min-width: auto;
  }

  .btn i {
    font-size: 0.7rem;
  }

  .btn-success,
  .btn-danger,
  .btn-primary {
    box-shadow: none;
  }

  .btn-no-hover {
    background-color: #dc2626;
    color: white;
  }

  .btn-no-hover:hover {
    background-color: #dc2626;
  }

  .btn-no-hover-dark {
    background-color: #b91c1c;
    color: white;
  }

  .btn-no-hover-dark:hover {
    background-color: #b91c1c;
  }
}

/* =========================================================
   8. CHIPS & BADGES
   ========================================================= */

.chip {
  display: inline-block;
  padding: 0.32rem 0.75rem;   /* было 0.55rem 1.2rem */
  border-radius: 0.45rem;     /* было 0.6rem */
  font-weight: 600;
  font-size: 0.82rem;         /* добавлено — уменьшает текст */
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
  cursor: pointer;
  transition: all .18s ease;
  text-decoration: none;
}


.chip:hover {
  background: #e5e7eb;
  box-shadow: 0 3px 6px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.chip-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(37,99,235,.35);
  transform: translateY(-1px);
}

/* Dark theme chips */
html.theme-dark .chip {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #374151;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}

html.theme-dark .chip:hover {
  background: #374151;
  box-shadow: 0 3px 6px rgba(0,0,0,.55);
}

html.theme-dark .chip-active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: #374151;
  background: #f3f4f6;
  padding: .2rem .5rem;
  border-radius: .4rem;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

/* =========================================================
   9. TABLES
   ========================================================= */

.table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.table th,
.table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.table tr:hover {
  background: #f3f4f6;
}

/* Sticky table header */
.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background-clip: padding-box;
}

/* Table scroll containers */
.table-wrapper {
  max-height: 70vh;
}

.table-card {
  max-height: 70vh;
  min-height: 120px;
}

.table-scroll {
  max-height: 70vh;
  overflow-y: auto;
}

/* Scrollbars */
.table-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

html.theme-dark .table-scroll::-webkit-scrollbar-track {
  background: #0f172a;
}

html.theme-dark .table-scroll::-webkit-scrollbar-thumb {
  background: #1f2937;
}

html.theme-dark .table-scroll::-webkit-scrollbar-thumb:hover {
  background: #374151;
}

html.theme-light .table-scroll::-webkit-scrollbar-track {
  background: #e5e7eb;
}

html.theme-light .table-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

html.theme-light .table-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
/* =========================================================
   10. MODALS
   ========================================================= */

#modalRoot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: flex-start;   /* ← ВАЖНО */
  padding: 4rem 1rem 1rem;   /* отступ сверху */
  background: rgba(0,0,0,.5);
}


#modalRoot:not(.hidden) {
  display: flex;
}


.modal {
  width: 100%;
  max-width: 860px;
  max-height: 85vh;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header,
.modal-footer {
  padding: .75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-footer {
  border-top: 1px solid #e5e7eb;
  border-bottom: none;
}

.modal-content {
  flex: 1;
  padding: 1rem;
  overflow: visible !important;
}



/* Mobile modal adjustments */
@media (max-width: 768px) {
  #modalRoot .modal {
    max-width: 96vw;
    max-height: 90vh;
    border-radius: .5rem;
  }



  .modal-content {
    padding: .75rem;
  }
}

/* =========================================================
   11. SEARCH BAR
   ========================================================= */

.search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  padding: .4rem .75rem;
  width: 360px;
}

html.theme-dark .search-bar {
  background: #1f2937;
  border-color: #374151;
}

.search-input {
  all: unset;
  flex: 1;
  font-size: .9rem;
  color: #1f2937;
}

html.theme-dark .search-input {
  color: #e5e7eb;
}

.search-input::placeholder {
  color: #6b7280;
}

html.theme-dark .search-input::placeholder {
  color: #6b7280;
}

/* =========================================================
   12. MOBILE MENU
   ========================================================= */

@media (max-width: 768px) {
  #menu {
    position: absolute;
    top: 60px;
    left: 12px;
    right: 12px;
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .7rem;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    border-radius: .75rem;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    z-index: 999;
  }

  #menu.show {
    display: flex;
  }

  html.theme-dark #menu {
    background: rgba(15,23,42,0.85);
  }

  #menu .nav-link {
    width: auto;
    padding: .55rem .9rem;
  }
}

/* =========================================================
   13. REQUEST DETAIL (в модалке)
   ========================================================= */

.request-detail {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.request-detail .info-block p {
  margin: 0 0 10px;
  line-height: 1.55;
  font-size: 0.95rem;
}

.request-detail .info-block b {
  display: inline-block;
  min-width: 160px;
  font-weight: 600;
  color: var(--muted);
}

.request-detail h2 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
}

.request-detail .media-block img,
.request-detail .media-block video {
  max-width: 100%;
  border-radius: .5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

/* Dark theme */
html.theme-dark .request-detail .info-block b {
  color: #9ca3af;
}

html.theme-dark .request-detail .media-block img,
html.theme-dark .request-detail .media-block video {
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* Mobile */
@media (max-width: 768px) {
  .request-detail {
    flex-direction: column;
  }

  .request-detail .info-block b {
    min-width: 130px;
  }
}

/* =========================================================
   14. CUSTOM SCROLLBARS (generic)
   ========================================================= */

div[style*="overflow-y: auto"]::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* =========================================================
   15. UTILITY CLASSES
   ========================================================= */

.h-60vh {
  height: 60vh;
}

.overflow-y-auto::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: #999;
}
/* =========================================================
   16. TAILWIND-FRIENDLY OVERRIDES
   ========================================================= */

/* Tailwind использует inline-flex для кнопок, но нам нужен flex */
.filters-card .btn {
  display: flex !important;
}

/* =========================================================
   17. FIX: ФИЛЬТРЫ + КНОПКИ (идеальный, финальный)
   ========================================================= */

/* Десктоп: фильтры слева, кнопки справа, всё в одну линию */
@media (min-width: 768px) {
  .filters-card > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100%;
  }
}

/* Мобильный: вертикальная колонка */
@media (max-width: 767px) {
  .filters-card > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }
}
/* === FIX: фон панели должен быть серым в светлой теме === */
html.theme-light body {
  background: #dfe3e6 !important;
}
/* === FIX: фон в тёмной теме должен быть тёмным === */
html.theme-dark body,
html.theme-dark .panel-wrapper,
html.theme-dark main {
  background: #0f172a !important;
}
/* === FIX: тёмная тема — глобальный фон страницы === */
html.theme-dark .bg-gray-100 {
  background-color: #0f172a !important;
}

/* === FIX: тёмная тема — шапка таблицы === */
html.theme-dark thead.bg-white,
html.theme-dark thead {
  background-color: #1f2937 !important;
}

/* === FIX: тёмная тема — карточки заявок === */
html.theme-dark .card {
  background-color: #111827 !important;
  border-color: #1f2937 !important;
}

/* === FIX: тёмная тема — мобильные карточки === */
html.theme-dark article.card {
  background-color: #111827 !important;
}

/* === FIX: тёмная тема — таблица (ячейки) === */
html.theme-dark table td {
  background-color: #0f172a !important;
}

/* === FIX: тёмная тема — контейнер таблицы === */
html.theme-dark .table-card {
  background-color: #0f172a !important;
}
/* === FIX: правильное выравнивание кнопок справа === */
@media (min-width: 768px) {
  .filters-card > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100%;
  }

  .filters-card > div > div:first-child {
    flex-grow: 0 !important;
  }

  .filters-card > div > div:last-child {
    margin-left: auto !important;
  }
}
/* === FIX: скругление активной вкладки === */
.nav-link.active {
  border-radius: 0.8rem !important;
}
/* === FIX: активная вкладка — корректный внутренний отступ === */
.nav-link.active {
  padding: 0.45rem 0.75rem !important; /* чуть больше воздуха */
  border-radius: 0.6rem !important;    /* возвращаем скругление */
  display: inline-flex !important;     /* предотвращает распирание */
  align-items: center !important;
  line-height: 1 !important;           /* убирает вертикальный вылет */
}
/* === FIX: вернуть скруглённые поля ввода === */
.input,
input,
select,
textarea {
  border-radius: 0.55rem !important; /* как было раньше */
}
/* === FIX: нормальные внутренние отступы в инпутах === */
.input,
input,
select,
textarea {
  padding: 0.55rem 0.75rem !important; /* комфортный отступ */
  border-radius: 0.55rem !important;   /* как мы уже вернули */
  line-height: 1.3 !important;         /* чтобы текст не прилипал сверху */
}
/* === Toggle switch (для модалки города) === */
.toggle {
  width: 46px;
  height: 24px;
  background: #d1d5db;
  border-radius: 24px;
  position: relative;
  cursor: pointer;
  transition: background .25s ease;
}

.toggle::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.toggle.active {
  background: #2563eb;
}

.toggle.active::before {
  transform: translateX(22px);
}
/* === FIX: мобильная таблица истории рассылки в тёмной теме === */
html.theme-dark .history-card,
html.theme-dark .history-item,
html.theme-dark .history-row,
html.theme-dark .mobile-table,
html.theme-dark .mobile-table-row,
html.theme-dark .mobile-table-cell {
  background-color: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #1f2937 !important;
}

/* Перекрываем Tailwind-классы bg-white/bg-gray-* */
html.theme-dark .bg-white,
html.theme-dark .bg-gray-50,
html.theme-dark .bg-gray-100 {
  background-color: #0f172a !important;
}

/* Текст внутри мобильных карточек */
html.theme-dark .history-card *,
html.theme-dark .history-item *,
html.theme-dark .mobile-table *,
html.theme-dark .mobile-table-row *,
html.theme-dark .mobile-table-cell * {
  color: #e5e7eb !important;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrapper .card {
    width: 100%;
    max-width: 420px;
    background: var(--color-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 0 12px rgba(0,0,0,0.08);
}


/* Прокручиваем только тело */
#modalBody {
    overflow-y: auto;
    max-height: calc(90vh - 60px); /* минус высота заголовка */
    padding: 20px;
}

/* Медиа внутри модалки */
#modalBody img,
#modalBody video {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    margin: 0 auto 16px;
}

/* Любой контент не должен ломать ширину */
#modalBody * {
    max-width: 100%;
    word-break: break-word;
}

/* === UNIVERSAL MODAL FIX — идеальная высота и прокрутка === */


#modalRoot .modal-header,
#modalRoot .modal-footer {
    flex-shrink: 0;            /* не сжимаются */
}


/* Для модалок с длинными списками (назначение городов) */
#modalBody .table-scroll,
#modalBody .scrollable {
    max-height: 60vh;
    overflow-y: auto;
}

.modal-city-list {
    max-height: 50vh;   /* список занимает не больше половины экрана */
    overflow-y: auto;
}
.modal-city-list::-webkit-scrollbar {
    width: 6px;
}

.modal-city-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-city-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-city-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* === CUSTOM SCROLL FOR CITY MODAL (LIGHT THEME) === */
.modal-city-list::-webkit-scrollbar {
    width: 6px;
}

.modal-city-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-city-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-city-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* === CUSTOM SCROLL FOR CITY MODAL (DARK THEME) === */
html.theme-dark .modal-city-list::-webkit-scrollbar-track {
    background: #0f172a;
}

html.theme-dark .modal-city-list::-webkit-scrollbar-thumb {
    background: #1f2937;
}

html.theme-dark .modal-city-list::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

/* === CUSTOM SCROLL FOR REQUEST DETAIL MODAL === */
#modalBody::-webkit-scrollbar {
    width: 6px;
}

#modalBody::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#modalBody::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#modalBody::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* === DARK THEME === */
html.theme-dark #modalBody::-webkit-scrollbar-track {
    background: #0f172a;
}

html.theme-dark #modalBody::-webkit-scrollbar-thumb {
    background: #1f2937;
}

html.theme-dark #modalBody::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

/* === LIGHTBOX (увеличение фото) === */

#lightbox.hidden {
    display: none;
}

#lightbox {
    animation: fadeIn .15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#lightboxImg {
    animation: zoomIn .15s ease;
}

@keyframes zoomIn {
    from { transform: scale(.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Тёмная тема */
html.theme-dark #lightboxBackdrop {
    background: rgba(0,0,0,0.75);
}
body.lightbox-open {
    background: transparent !important;
}
html.theme-dark body.lightbox-open {
    background: transparent !important;
}

.media-photo {
    max-width: 100%;
    border-radius: 8px;
    cursor: zoom-in;
}


/* Лайтбокс всегда поверх всего */
#lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000; /* выше header (z-40) и modalRoot (9999) */
}
#modalBody img.media-photo {
    max-width: 60%;      /* уменьшает фото */
    margin-left: auto;
    margin-right: auto;
    display: block;
}

#lightboxImg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* MOBILE FIXES FOR LIGHTBOX */
@media (max-width: 768px) {

    /* Уменьшаем картинку */
    #lightboxImg {
        max-width: 95vw !important;
        max-height: 70vh !important;
    }

    /* Убираем стрелки */
    #lbPrev,
    #lbNext {
        display: none !important;
    }
}

/* Мобильные инпуты — на всю ширину */
@media (max-width: 768px) {
  .input {
    width: 100% !important;
  }
}

@media (min-width: 769px) {
  input.input,
  select.input {
    width: auto !important;
  }
}

/* Мобильная версия — кнопка Добавить на всю ширину */
@media (max-width: 768px) {
  .btn-primary {
    width: 100% !important;
  }
}

/* Десктоп — автоширина */
@media (min-width: 769px) {
  .btn-primary {
    width: auto !important;
  }
}
@media (max-width: 768px) {
  .btn-small {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
}
/* Унифицированные кнопки в мобильных карточках */
@media (max-width: 768px) {
  .user-card footer button,
  .user-card footer form button {
    padding: 0.55rem 0.75rem !important;
    font-size: 0.85rem !important;
    line-height: 1.1 !important;
    border-radius: 0.55rem !important;
    height: auto !important;
  }
}
/* === CUSTOM SELECT — ФИНАЛЬНАЯ ВЕРСИЯ === */

/* Обёртка */
.custom-select-wrapper {
    position: relative;
}

/* Поле */
.custom-select-display {
    cursor: pointer;
    user-select: none;
}

/* Dropdown — теперь поверх всего, через JS ставим position: fixed */
.custom-select-dropdown {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.55rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 999999;
    padding: 4px;
}

/* Опции */
.custom-option {
    padding: 6px 10px;
    border-radius: 0.45rem;
    cursor: pointer;
}

.custom-option:hover {
    background: #e5e7eb;
}

/* Scrollbar */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Dark theme */
html.theme-dark .custom-select-dropdown {
    background: #1f2937;
    border-color: #374151;
}

html.theme-dark .custom-option:hover {
    background: #374151;
}

html.theme-dark .custom-select-dropdown::-webkit-scrollbar-track {
    background: #0f172a;
}

html.theme-dark .custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #1f2937;
}


/* === МОДАЛКА ДОЛЖНА ПРОПУСКАТЬ DROPDOWN === */

.custom-select-dropdown.open-up {
    top: auto !important;
    bottom: calc(100% + 4px) !important;
}
#modalBody .custom-select-wrapper {
    width: 100%;
    display: block;
}

/* === FIX: sticky-шапка специалистов работает внутри таблицы === */
@media (min-width: 1024px) {
  .table-card.specialists .table-scroll {
    max-height: 70vh !important;
    overflow-y: auto !important;
  }
}

  @media (min-width: 1024px) {
  .table-card.specialists {
    max-height: none !important;
    overflow: visible !important;
  }
}
/* === FIX: специалисты — таблица не должна растягивать страницу === */
@media (min-width: 1024px) {

  /* карточка — фиксированная область */
  .table-card {
    max-height: 70vh !important;
    overflow: hidden !important;
  }

  /* таблица — единственный scroll-контейнер */
  .table-card .table-scroll {
    max-height: 70vh !important;
    overflow-y: auto !important;
  }

  /* sticky работает внутри table-scroll */
  .table-card thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}
/* FIX: последняя строка таблицы не должна обрезаться */
.table-card .table-scroll {
    padding-bottom: 24px;
}

.custom-select-wrapper {
  position: relative;
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
}

@media (max-width: 768px) {
    #cityFilterWrapper {
        width: 100% !important;
    }

    #cityFilterWrapper .custom-select-display {
        width: 100% !important;
    }

    #cityFilterWrapper .custom-select-dropdown {
        width: 100% !important;
        left: 0 !important;
    }
}

.custom-select-display {
    white-space: nowrap;        /* не переносить текст */
    overflow: hidden;           /* если вдруг слишком длинно */
    
}

.media-video {
    max-width: 100%;
    max-height: 300px;   /* или любое другое ограничение */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: #000;
}

#lightboxImg,
#lightboxVideo {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

/* === FIX: видео в лайтбоксе должно вести себя как картинка === */
#lightboxVideo {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;

    max-width: 90vw !important;
    max-height: 90vh !important;

    width: auto !important;
    height: auto !important;

    object-fit: contain !important;

    display: block !important;
    margin: 0 !important;
}

#lightboxVideo.hidden {
    display: none !important;
}

#lightboxImg.hidden {
    display: none !important;
}

#lightboxVideo {
    animation: zoomIn .15s ease;
}
