.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.station-row {
    cursor: pointer;
}

.station-row:hover {
    background-color: #f3f3f3;
    transition: 0.2s;
}

.modal-body label {
    font-weight: 500;
}

#stationsTable th {
    white-space: nowrap;
}

#stationsTable td {
    vertical-align: middle;
}

/* затемнение внутри модального окна */
.param-inline {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.param-inline.hidden {
    display: none;
}

.param-inline-content {
    background: white;
    padding: clamp(12px, 2vw, 20px);
    border-radius: 10px;
    width: min(300px, 90vw);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.param-content {
    background: white;
    padding: clamp(12px, 2vw, 20px);
    border-radius: 10px;
    width: min(350px, 90vw);
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-body::-webkit-scrollbar {
    display: none;
}

.sample-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Таблица станций ===== */
.stations-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(165, 160, 145, 0.12);
    border: 1px solid #eadecc;
}

.stations-table thead {
    background-color: #e9edd0;
}

.stations-table th {
    color: #485438;
    font-weight: 600;
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid #d8ddbd;
}

.stations-table td {
    padding: 12px;
    border-bottom: 1px solid #efe7d8;
    vertical-align: middle;
}

.stations-table tbody tr {
    transition: background-color 0.15s ease;
}

.stations-table tbody tr:hover {
    background-color: #f8f5ec;
}

.stations-table tbody tr:last-child td {
    border-bottom: none;
}

.stations-table .btn {
    padding: 4px 8px;
    margin: 4px;
    min-width: 36px;
}

.stations-table .btn-warning {
    margin-right: 4px;
}

.table-wrapper {
    border-radius: 12px;
}

.inline-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}

.title-center th {
    text-align: center;
}

.main-center td {
    text-align: center;
}

.form-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    justify-content: space-between;
    align-items: center;
}

.form-check-label {
    white-space: normal;
    word-break: break-word;
}

.params {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    justify-content: space-between;
}

.form-param {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    margin-right: 10px;
    margin-bottom: 10px;
}

.form-param > div {
    flex: 1;
    min-width: 0;
    margin-right: 10px;
}

.edit-param-btn {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Прячем названия на десктопе */
.td-label {
  display: none;
}

@media (max-width: 768px) {
  
  .btn {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    padding: clamp(0.4rem, 1vw, 0.5rem)
             clamp(0.9rem, 2vw, 1.2rem);
  }

  .stations-table,
  .stations-table thead,
  .stations-table tbody,
  .stations-table th,
  .stations-table td,
  .stations-table tr {
    display: block;
  }
  .stations-table thead {
    display: none;
  }
  .stations-table tbody tr {
    margin-bottom: 1.5rem;
    border: 1px solid #eadecc;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 8px rgba(165, 160, 145, 0.1);
    overflow: hidden;
  }

  /* Двухколоночная сетка: название | значение */
  .stations-table td {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;                 /* вертикальное центрирование */
    padding: 10px 14px;
    border-bottom: 1px solid #efe7d8;
    font-size: clamp(0.75rem, 2vw, 1rem);
  }
  .stations-table td:last-child {
    border-bottom: none;
  }

  /* Показываем скрытые названия */
  .td-label {
    display: block;
    font-weight: 600;
    color: #485438;
    word-break: break-word;              /* перенос длинных названий */
    overflow-wrap: break-word;
    hyphens: auto;
    padding-right: 8px;
  }

  /* Адаптивный размер кнопок (только до 768px) */
  .stations-table .btn {
    font-size: clamp(0.65rem, calc(0.9rem * 100vw / 768px), 0.9rem);
    padding: 0.4em 0.8em;
  }

  .inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Убираем конфликт с прежним flex-wrap */
  .stations-table td:nth-child(2) {
    flex-wrap: unset;
  }
}

/* ============================
   Модальные окна
   ============================ */

/* --- 1. Обнуляем ограничения Bootstrap для .modal-dialog --- */
.modal-dialog {
  max-width: 100% !important;   /* убираем лимит 500px/800px */
  margin: 0;                   /* центрированием будет управлять родительский .modal */
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;                /* чтобы flex работал на всю высоту */
}

/* Не даём Bootstrap-стилям перебить наше обнуление */
.modal-dialog.modal-lg {
  max-width: 100% !important;
}

/* --- 2. Само окно (общие стили) --- */
.modal-content {
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border-radius: 1rem;
  overflow-y: auto;
  max-height: 85vh;
  /* ширину зададим ниже по брейкпоинтам */
}

/* Типографика по умолчанию (десктоп) */
.modal-title {
  font-size: 1.5rem;
  line-height: 1.3;
  word-wrap: break-word;
}

.modal-body {
  font-size: 1rem;
}

.modal-body .form-label {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.modal-body .form-control {
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
}

.modal-footer .btn,
.modal-content .btn {
  font-size: 0.9rem;
  padding: 0.5rem 1.2rem;
  border-radius: 0.4rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* --- 3. ДЕСКТОП (> 768px) - фиксированные размеры --- */
@media (min-width: 769px) {
  .modal-content {
    width: 600px;
    max-width: 90vw;
    padding: 24px;
  }

  .modal-dialog.modal-lg .modal-content {
    width: 800px;
    max-width: 95vw;
  }
}

/* --- 4. МОБИЛЬНЫЕ (≤ 768px) - адаптивные размеры --- */
@media (max-width: 768px) {
  .modal-content {
    width: auto;
    max-width: calc(100vw - 2rem);  /* отступ по 1rem с каждой стороны */
    padding: clamp(12px, 2.5vw, 20px);
  }

  .modal-dialog.modal-lg .modal-content {
    max-width: calc(100vw - 2rem);
  }

  /* Плавное уменьшение шрифтов */
  .modal-title {
    font-size: clamp(1rem, 4.5vw, 1.5rem);
  }
  .modal-body {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
  }
  .modal-body .form-label {
    font-size: 0.9em;
  }
  .modal-body .form-control {
    font-size: 1em;
    padding: 0.5em 0.7em;
  }
  .modal-footer .btn,
  .modal-content .btn {
    font-size: 0.85em;
    padding: 0.5em 1em;
  }
}

/* --- 5. Очень узкие (≤ 400px) - кнопки вертикально --- */
@media (max-width: 400px) {
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-footer .btn {
    width: 100%;
  }

  /* Специфичный фикс для editSampleModal */
  #editSampleModal .d-flex.gap-2 {
    flex-direction: column;
    gap: 8px !important;
  }
  #editSampleModal .dropdown button {
    width: 100%;
  }
}


.params .check-all {
    justify-self: end;      /* прижимаем ячейку сетки к правому краю */
    text-align: right;      /* содержимое внутри выравниваем вправо */
    white-space: nowrap;    /* чтобы label не переносился */
}