@font-face {
  font-family: "OnestRegular";
  src: url("/static/fonts/Onest-Regular.ttf");
}

* {
  padding: 0px;
  margin: 0px;
  border: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

a,
a:link,
a:visited {
  text-decoration: none;
  color: white;
}

a:hover {
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 6px;
}

html {
  scrollbar-width: thin;
}

aside,
nav,
footer,
header,
section,
main {
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  font-size: inherit;
  font-weight: inherit;
}

ul,
ul li {
  list-style: none;
}

img {
  vertical-align: top;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

address {
  font-style: normal;
}

input,
textarea,
button,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background-color: transparent;
}

input::-ms-clear {
  display: none;
}

button,
input[type="submit"] {
  display: inline-block;
  box-shadow: none;
  background-color: transparent;
  background: none;
  cursor: pointer;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input:focus,
input:active,
button:focus,
button:active {
  outline: none;
}

button::-moz-focus-inner {
  padding: 0;
  border: 0;
}

label {
  cursor: pointer;
}

legend {
  display: block;
}

body {
  background-color: black;
  padding: 10px;
}

th {
  white-space: nowrap;
}

textarea {
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
  color: white;
}

.invisible {
  display: none !important;
}

.btn-red {
  background: #a30606 !important;
}

.main-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'OnestRegular';
  color: white;
}

.main-table thead {
  background-color: rgb(0, 100, 50);
}

.main-table th,
.main-table td {
  padding: 5px;
  text-align: center;
  border: 1px solid rgb(0, 150, 75);
}

.filter-form {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  row-gap: 12px;
  color: white;
  margin-left: 10px;
  font-family: 'OnestRegular';
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.filter-form__primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  row-gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  /* дочерние блоки не сжимаем — иначе <select> визуально наезжает на соседей */
  align-content: flex-start;
  order: 1;
}

.filter-form label {
  font-weight: bold;
  flex-shrink: 0;
}

.filter-form__preset-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

.filter-form__preset-field select {
  flex-shrink: 0;
  min-width: 9.5em;
  max-width: 16em;
  box-sizing: border-box;
}

.filter-form__date-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-form__date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-form__sort-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

.filter-form__sort-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  flex: 0 1 auto;
  min-width: 0;
  box-sizing: border-box;
}

.filter-form__sort-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

.filter-form__sort-field select {
  flex-shrink: 0;
  min-width: 10em;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-form input[type="date"],
.filter-form select {
  padding: 5px;
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
  color: white;
  box-sizing: border-box;
  max-width: 100%;
}

.filter-form input[type="date"] {
  flex: 0 1 auto;
  min-width: 8.5rem;
  width: auto;
  max-width: 11.5rem;
}

.filter-form select option {
  background-color: rgb(0, 50, 25);
  color: white;
}

.channel-label {
  margin-left: 0;
}

.channel {
  background-color: rgb(0, 50, 25);
  border: 1px solid rgb(0, 150, 75);
  padding: 5px;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 15px;
}

.filter-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

.filter-form__action-button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 150, 75);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}

.filter-form__redirect-buttons {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
  order: 0;
}

@media (min-width: 769px) {
  .filter-form__redirect-buttons {
    order: 2;
  }

  /* Сетка вместо flex-wrap: ровные ряды при любой ширине окна */
  .filter-form__primary {
    display: grid;
    align-items: center;
    column-gap: 14px;
    row-gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .filter-form__date-row,
  .filter-form__dropdown-row,
  .filter-form__sort-actions {
    min-width: 0;
  }
}

/* ПК без запаса по ширине: ряды не в одну линию — иначе средняя колонка (канал/гео)
   с flex-shrink: 0 наезжает на сортировку при ~1024–1279px */
@media (min-width: 769px) and (max-width: 1279px) {
  .filter-form__primary {
    grid-template-columns: 1fr 1fr;
  }

  .filter-form__date-row {
    grid-column: 1 / -1;
  }

  .filter-form__dropdown-row {
    grid-column: 1 / -1;
  }

  .filter-form__sort-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
  }
}

/* Достаточно широкий экран: одна строка — даты | канал/гео | сортировка+период+кнопки */
@media (min-width: 1280px) {
  .filter-form__primary {
    grid-template-columns: max-content minmax(0, 1fr) minmax(0, auto);
    grid-template-rows: auto;
  }

  .filter-form__date-row {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .filter-form__dropdown-row {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .filter-form__sort-actions {
    grid-column: 3;
    grid-row: 1;
    flex-wrap: nowrap;
    justify-self: end;
    min-width: 0;
  }
}

.filter-form__redirect-buttons__button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}


.gohome {
  margin-top: 5px;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1em;
}

.gohome__button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'OnestRegular';
}

.settings-data {
  color: white;
  font-family: 'OnestRegular';
  width: 100%;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.settings-data li {
  margin-bottom: 5px;
  display: flex;
  font-size: 13px;
  align-items: center;
  justify-content: space-between;
}

.settings-data__form {
  white-space: nowrap;
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: .5em;
}

.settings-data__form__input {
  padding: 5px;
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
}

.settings-data__header {
  font-size: 20px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-data__add-button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.settings-data__update-button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.settings-data__delete-button {
  margin-left: 5px;
  padding: 2.5px 10px 2.5px 10px;
  font-size: 11px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.settings-data,
.settings-percent {
  color: white;
  font-family: 'OnestRegular';
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-self: center;
  align-content: center;
  flex-wrap: wrap;
}

.settings-percent form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.settings-percent select {
  padding: 2.5px;
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
  color: white;
  margin-bottom: 10px;
}

.settings-percent div {
  margin-bottom: 10px;
}

.settings-percent input {
  padding: 2.5px;
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
}

.settings-data button,
.settings-percent button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.login-form {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-family: 'OnestRegular';
  color: white;
}

.login-form input {
  padding: 2.5px;
  font-size: 14px;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 5px;
  background-color: rgb(0, 50, 25);
}

.login-form button {
  margin-top: 5px;
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 150, 75);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.login-form a,
.login-form .secondary-button {
  margin-top: 15px;
  padding: 3.3px 7.5px;
  font-size: 12px;
  background-color: rgb(0, 50, 25);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: inline-block;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  padding: 20px;
}

.modal.is-open {
  display: flex;
}

.modal__content {
  position: relative;
  width: 100%;
  max-width: 520px;
  background-color: #0e0e0e;
  border: 1px solid rgb(0, 150, 75);
  border-radius: 8px;
  padding: 28px 24px 20px;
  padding-right: 44px;
  color: white;
  font-family: 'OnestRegular';
  text-align: center;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background-color: rgb(0, 50, 25);
  color: white;
  font-size: 16px;
  line-height: 1;
}

.modal__text {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.modal__text:first-of-type {
  margin-top: 0;
}

.modal__text a {
  color: white;
  text-decoration: underline;
}

.w-100 {
  width: 100%;
}

.text-bold {
  font-weight: bold;
}

.d-flex {
  display: flex;
}

.justify-space-between {
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.ml-2 {
  margin-left: 2em !important;
}

.mt-2 {
  margin-top: 2em !important;
}

.mt-5 {
  margin-top: 5em !important;
}

.font-11 {
  font-size: 11px !important;
  padding: 2.5px 10px !important;
}

#user_channel_list_container {
  min-width: 205px;
}

#user_add_channel_container {
  display: flex;
  width: 205px;
  justify-content: center;
  align-items: center;
}

#user_add_channel_container>input {
  width: 100%;
}

.perc-input {
  max-width: 3.2em;
}

.user-list-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.filter-form__dropdown-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-form__dropdown-wrap {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.dropdown {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.filter-form .dropdown {
  display: block;
}

.dropdown button {
  padding: 5px 10px;
  font-size: 14px;
  background-color: rgb(0, 150, 75);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #0e0e0e;
  min-width: 120px;
  width: max-content;
  overflow-y: auto;
  max-height: 300px;
  border: 1px solid #ddd;
  z-index: 1;
}

.dropdown-content.dropdown-content--channels {
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 220px;
  max-height: 300px;
  padding: 0;
}

.dropdown-content.dropdown-content--channels.show {
  display: flex;
}

.channel-dropdown-sticky {
  flex-shrink: 0;
  border-bottom: 1px solid #333;
}

.channel-dropdown-search-wrap {
  padding: 8px;
  background-color: #0e0e0e;
}

.channel-dropdown-search {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  background-color: #1a1a1a;
}

.channel-dropdown-search::placeholder {
  color: #888;
}

.channel-options-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.dropdown-content label {
  display: block;
  padding: 5px 10px;
  cursor: pointer;
}

.dropdown-content label:hover {
  background-color: #0e0e0e;
}

.show {
  display: block;
}

.selected-items {
  width: 100px;
  margin-top: 5px;
  padding: 5px;
}

.selected-items div {
  margin-bottom: 5px;
}

#user-info-note-content {
  resize: none;
  margin-left: 10px;
}

.settings-selector {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.settings-selector>span {
  cursor: pointer;
}

.selected {
  color: green;
  text-decoration: underline;
}

@media (max-width: 900px) {
  .filter-form {
    margin-left: 0;
  }

  .filter-form__preset-field,
  .filter-form__sort-field {
    flex-wrap: wrap;
  }

  .filter-form__date-row {
    flex: 1 1 100%;
    width: 100%;
  }

  .filter-form__date-row .filter-form__date-field {
    flex: 1 1 0;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .filter-form__dropdown-row {
    flex: 1 1 100%;
    width: 100%;
  }

  .filter-form__dropdown-row .filter-form__dropdown-wrap {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  body {
    padding: 6px;
  }

  .main-table {
    font-size: 11px;
    min-width: 600px;
  }

  .main-table th,
  .main-table td {
    padding: 6px 4px;
    font-size: 10px;
  }

  .main-table th {
    font-size: 9px;
    padding: 5px 3px;
  }

  .filter-form {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    align-content: stretch;
    gap: 8px;
    margin-left: 0;
    margin-bottom: 10px;
    max-width: 100%;
    width: 100%;
    padding-right: 0;
    font-size: 10px;
  }

  .filter-form__primary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .filter-form__sort-stack {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .filter-form input[type="date"] {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: 1 1 auto;
  }

  .filter-form__preset-field,
  .filter-form__date-row,
  .filter-form__dropdown-row,
  .filter-form__date-field,
  .filter-form__sort-field,
  .filter-form__sort-stack,
  .filter-form__sort-actions,
  .filter-form__actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .filter-form__sort-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .filter-form label {
    font-size: 10px;
  }

  .filter-form input[type="date"],
  .filter-form select {
    font-size: 10px;
    padding: 3px 5px;
    border-radius: 4px;
  }

  .filter-form__action-button,
  .filter-form__redirect-buttons__button {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
  }

  .filter-form .dropdown-content label {
    font-size: 10px;
    padding: 4px 8px;
  }

  .filter-form .channel-dropdown-search-wrap {
    padding: 5px;
  }

  .filter-form .channel-dropdown-search {
    padding: 4px 6px;
    font-size: 10px;
  }

  .filter-form__date-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .filter-form__date-row .filter-form__date-field {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .filter-form__dropdown-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
  }

  .filter-form__dropdown-row .filter-form__dropdown-wrap {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .filter-form__dropdown-row .dropdown {
    width: 100%;
    max-width: 100%;
  }

  .filter-form__sort-field,
  .filter-form__preset-field {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
  }

  .filter-form__preset-field select,
  .filter-form__sort-field select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
  }

  .filter-form .dropdown button {
    width: 100%;
    box-sizing: border-box;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
  }

  .filter-form__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .filter-form__actions .filter-form__action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
  }

  .filter-form__redirect-buttons {
    margin-left: 0;
    width: 100%;
    flex: none;
    justify-content: stretch;
    gap: 6px;
  }

  .filter-form__redirect-buttons__button {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
  }

  .filter-form .dropdown-content:not(.dropdown-content--channels) {
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
    min-width: 0;
  }

  .filter-form .dropdown-content.dropdown-content--channels {
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    max-width: 100%;
  }
}

