:root {
  --background-color: #ffffff;
  --text-color: #000000;

  --main-menu-bg: #d3d3d6;
  --main-menu-icon-bg: #F4F3F8;
  --main-menu-scroll-bg: #a7a6a6;
  --main-menu-category-active: #b9b9b9;
  --main-menu-portrait-categories-bg: #e4e4e7;
  --main-menu-portrait-category-active: #b9b9b9;

  --pagination-bg: #ffffff;
  --pagination-text: #131314;

  --combobox-bg: #ffffff;
  --combobox-text: #131314;
  --combobox-select: #e0e0e0;
}

body.dark-theme {
  --background-color: #000000;
  --text-color: #e9e9e9;

  --main-menu-bg: #292929;
  --main-menu-icon-bg: #cecece;
  --main-menu-scroll-bg: #4d4d4d;
  --main-menu-category-active: #3f3e3e;
  --main-menu-portrait-categories-bg: #272727;
  --main-menu-portrait-category-active: #363636;

  --pagination-bg: #131314;
  --pagination-text: #ffffff;

  --combobox-bg: #131314;
  --combobox-text: #ffffff;
  --combobox-select: #3a3a3d;
}

body,
html {
  height: 100%;
  margin: 0;
  font-family: 'Lato', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  overflow: hidden;
}

.authorization {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
}

.authorization .wnd {
  width: 300px;
  max-width: 90%;
  margin: 20px auto;
  border-radius: 10px;
  background-color: white;
  box-shadow: #00000069 0 0 10px;
  padding: 10px;
  text-align: center;
}

.authorization .text {
  font-weight: bold;
  font-size: 20px;
  margin-bottom: 15px;
}

.authorization .input-wrap {
  width: 80%;
  margin: 0 auto 10px;
  text-align: left;
}

.authorization .error-wrap {
  color: #f44336;
  margin: 10px 0;
}

.authorization .input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d3d3d3;
  background-color: #f1f1f1;
  padding: 5px;
}

.authorization .button {
  background-color: #4CAF50;
  color: white;
  margin: 20px auto 10px;
  padding: 14px 5px;
  box-sizing: border-box;
  width: 80%;
  cursor: pointer;
  opacity: 0.9;
}

.authorization .button:hover {
  opacity: 1;
}

.button.logout {
  display: block;
  position: relative;
  background-color: #f44336;
  color: white;
  margin: 7px;
  padding: 14px 5px;
  box-sizing: border-box;
  width: 200px;
  text-align: center;
  cursor: pointer;
  opacity: 0.9;
}

.button.disabled {
  background-color: #6d6969;
}

.button.logout:hover {
  opacity: 1;
}

.grid {
  display: grid;
  grid-template-columns: 200px auto;
}

/* Главное меню */
.main-menu {
  display: block;
  width: 180px;
  height: 98vh;
  padding: 1vh 10px 1vh 10px;
  background-color: var(--main-menu-bg);
  overflow-y: auto;
}

@media (pointer: fine) {
  .main-menu {
    overflow-y: hidden;
  }

  .main-menu:hover {
    overflow: auto;
  }
}

/* Стилизуем полосу прокрутки */
.main-menu::-webkit-scrollbar {
  width: 0.3vw;
}

/* Цвет фона трека */
.main-menu::-webkit-scrollbar-track {
  background: transparent;
}

/* Цвет фона трека */
.main-menu::-webkit-scrollbar-thumb {
  background: var(--main-menu-scroll-bg);
}

.main-menu .group {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 5px;
}

.main-menu .group .name {
  display: flex;
}

.main-menu .group .icon-wrap {
  display: flex;
  width: 30px;
  height: 30px;
}

.main-menu .group .icon {
  display: flex;
  width: 30px;
  height: 30px;
  background-color: var(--main-menu-icon-bg);
  border-radius: 20%;
}

.main-menu .group .text {
  display: flex;
  width: 100%;
  height: auto;
  margin-left: 5px;
  align-items: center;
  font-size: 15px;
}

.main-menu .categories {
  display: block;
  margin-bottom: 10px;
  border-radius: 20px;
  z-index: 1;
}

.main-menu .category {
  display: flex;
  width: 90%;
  height: auto;
  margin-bottom: 2px;
  margin-left: 5%;
  padding: 0 3% 0 3%;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.5s;
}

.main-menu .category:hover {
  background-color: var(--main-menu-category-active);
}

.main-menu .active {
  background-color: var(--main-menu-category-active);
}

.main-menu .category .text {
  display: flex;
  width: auto;
  height: auto;
  margin: 2px;
  font-size: 15px;
}

.content-wrap {
  display: block;
}

.content {
  display: flex;
  width: calc(100vw - 200px);
  height: calc(var(--vh, 1vh) * 100 - 50px);
  overflow: auto;
}

.layer {
  display: none;
  min-width: 100%;
}

.layer-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  /* или конкретная высота, если контейнер ограничен */
}

.layer.active {
  display: flex;
  flex-direction: column;
}

.layer .row {
  display: flex;
  margin: 0 0 1vw 1vw;
}

.tools {
  display: flex;
  position: sticky;
  bottom: 0;
  /* Прилипает к нижней части экрана */
  background-color: var(--tools-bg);
  height: 50px;
  width: auto;
  align-items: center;
}

.tools-button {
  display: inline-block;
  width: 30px;
  height: 30px;
  margin-left: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}

.tools-button.add {
  background-image: url("img/add.svg");
}

.tools-button.edit {
  background-image: url("img/edit.svg");
}

.tools-button.print {
  background-image: url("img/print.svg");
}

.tools-button.delete {
  background-image: url("img/delete.svg");
}

.tools-button.sync {
  background-image: url("img/sync.svg");
  transition: transform 0.1s ease;
}

.tools-button.sync.off {
  background-image: url("img/sync_off.svg");
}

.tools-button.sync.wait {
  animation: spin 1s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

.tools-button-wrap {
  display: flex;
}

.tools-cache-version-label {
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 10px;
  opacity: 0.6;
  pointer-events: none;
  color: inherit;
  margin-right: 2vw;
}

.sync-time {
  display: flex;
  height: 30px;
  font-size: 12px;
  align-items: center;
  text-align: center;
  margin-left: 5px;
}

.custom-checkbox {
  display: none;
}

/* Всплывающее окно {*/
.modal {
  display: grid;
  justify-items: center;
  align-items: center;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  background-color: #00000060;
}

/* Поля ввода полной ширины */
.modal input[type=text],
.modal input[type=tel],
.modal input[type=password] {
  width: 100%;
  padding: 5px;
  margin: 5px 0 2px 0;
  display: inline-block;
  box-sizing: border-box;
  border: 1px solid #919191;
  background: #f1f1f1;
  flex: 1;
}

/* Добавить цвет фона, когда входы получают фокус */
.modal input[type=text]:focus,
.modal input[type=tel]:focus,
.modal input[type=password]:focus {
  background-color: #ddd;
  outline: none;
}

.modal input.error {
  background: #eccece;
}

.modal .input-container {
  display: flex;
}

.modal .input-button {
  width: 27px;
  height: 27px;
  margin: 5px 0 2px 5px;
  box-sizing: border-box;
  border: 1px solid #919191;
  background: #f1f1f1;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.5s;
}

.modal .input-button:hover {
  background: #dfdfdf;
}

.modal label,
.modal h1,
.modal p {
  display: block;
  color: #000000;
}

.modal label.error {
  color: #ff5454;
  line-height: 10px;
  font-size: 14px;
  margin: -7px 0 15px 0;
}

.modal .modal-content {
  position: relative;
  width: 80vw;
  background-color: #fefefe;
  border: 1px solid #888;
  padding: 16px;
}

.modal .modal-content.mini {
  width: 30vw;
}

.modal .modal-content button {
  background-color: #4CAF50;
  color: white;
  padding: 14px 20px;
  margin: 8px 0 -8px;
  border: none;
  cursor: pointer;
  width: 100%;
  opacity: 0.9;
}

.modal .modal-content button:hover {
  opacity: 1;
}

@media (orientation: portrait) {
  .modal .modal-content {
    width: 90vw;
  }

  .modal .modal-content.mini {
    width: 80vw;
  }
}

.modal .modal-content .title {
  position: relative;
  display: block;
  width: 100%;
}

.modal .modal-content .title .button {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  width: 35px;
  height: 20px;
  background-color: #139e36;
  color: white;
  opacity: 0.9;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 40%;
  text-align: center;
  cursor: pointer;
}

.modal .modal-content .title .button:hover {
  opacity: 1;
}

.modal .modal-content .title .button.save {
  background-image: url("img/ok.svg");
  right: 90px;
}

.modal .modal-content .title .button.conf_save {
  background-image: url("img/ok.svg");
  right: 90px;
  background-color: #5c3ee2;
}

.modal .modal-content .title .button.conf_del {
  background-image: url("img/sync_delete.svg");
}

.modal .modal-content .title .button.collapse {
  background-image: url("img/collapse.svg");
  right: 45px;
  background-color: #bdc01a;
}

.modal .modal-content .title .button.close {
  background-image: url("img/cancel.svg");
  background-color: #f44336;
}

.loader {
  position: absolute;
  display: flex;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  background-color: #00000041;
}

.loader svg {
  width: 40px;
  height: 40px;
}

.loader .wrap {
  width: 50px;
  height: 50px;
}

.loader circle {
  fill: none;
  stroke: #007bff;
  stroke-width: 5;
  stroke-linecap: round;
  animation: loadingCircleAnim 2s linear infinite;
  transform-origin: center;
  width: 50px;
  height: 50px;
}

#loader-progress-text.text {
  position: fixed;
  top: calc(50% + 60px);
  left: 50%;
  transform: translateX(-50%);
  color: #565663;
  font-size: 16px;
  text-align: center;
  z-index: 1000000;
  pointer-events: none;
}

.modal .modal-content .tabs {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0 40px 0 10px;
  color: black;
}

.modal .modal-content .tab {
  display: inline-block;
  cursor: pointer;
  transition: all 0.5s;
  color: #424fff;
  font-weight: bold;
  padding: 3px 5px 3px 5px;
}

.modal .modal-content .tab:hover {
  text-decoration: underline;
}

.modal .modal-content .tab.block {
  display: block;
  border-radius: 5px;
}

.modal .modal-content .tab.selected {
  background-color: #424fffa4;
  color: white;
}

.modal .modal-content .more {
  position: absolute;
  top: 0;
  right: 15px;
  width: 7px;
  height: 30px;
  color: #424fff;
  cursor: pointer;
  padding: 3px;
  background-image: url("img/more.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.modal .modal-content .more .menu {
  position: fixed;
  top: 0;
  left: 0;
  background-color: white;
  padding: 5px;
  border: 1px solid #cfcfcf;
  z-index: 150;
  overflow: hidden;
}

.modal .modal-content .layers {
  display: flex;
  flex-direction: column;
  width: 100%;
  color: black;
  height: auto;
}

.modal .modal-content .layers .column {
  display: block;
  width: 100%;
  height: auto;
  break-inside: avoid;
}

.modal .modal-content .layers-container {
  height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 5px;
}

/* Стилизуем полосу прокрутки */
.modal .modal-content .layers-container::-webkit-scrollbar {
  width: 3px;
}

/* Цвет фона трека */
.modal .modal-content .layers-container::-webkit-scrollbar-track {
  background: transparent;
}

/* Цвет фона трека */
.modal .modal-content .layers-container::-webkit-scrollbar-thumb {
  background: var(--main-menu-scroll-bg);
}

.modal .modal-content .layer {
  display: block;
  column-count: 2;
  /* Количество столбцов */
}

.modal .modal-content .spoiler {
  display: block;
  break-inside: avoid;
}

.modal .modal-content .spoiler .header {
  cursor: pointer;
  color: green;
  /* Заголовок зелёного цвета */
  font-weight: bold;
  display: flex;
  align-items: center;
  margin: 3px;
}

.modal .modal-content .spoiler .arrow {
  margin-right: 8px;
  /* Отступ между стрелкой и текстом */
  transition: transform 0.3s ease;
  /* Плавное изменение стрелки */
}

.modal .modal-content .spoiler .arrow.open {
  transform: rotate(180deg);
  /* Поворачиваем стрелку вверх */
}

.modal .modal-content .spoiler .content {
  display: block;
  height: 0;
  width: 100%;
  overflow-y: hidden;
  transition: height 0.5s ease-in-out;
}

.modal .modal-content .spoiler .content.open {
  height: var(--content-height);
}

.modal .modal-content .input-title {
  display: block;
  font-size: 12px;
}

.modal .modal-content .list {
  display: block;
  height: 60vh;
}

.modal .modal-content .list .contact {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid gray;
  box-sizing: border-box;
  margin: 5px 0;
  cursor: pointer;
}

.modal hr {
  border: 1px solid #f1f1f1;
  margin: 0;
  margin-bottom: 15px;
}

.modal h1 {
  color: #000000;
  margin: 0;
  font-size: 120%;
}

.modal p.err {
  margin: 10px;
  text-align: center;
  color: red;
}

.modal .modal-row {
  display: flex;
  justify-items: center;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 10px;
}

.modal .modal-row::after {
  content: "";
  clear: both;
  display: table;
}

.conflict-variants {
  display: grid;
  grid-template-columns: auto 2vw auto;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1b0ed19a;
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -3px 20px #00000033;
  z-index: 9999;
  box-sizing: border-box;
}

.conflict-variants .button {
  display: flex;
  width: auto;
  height: auto;
  border-radius: 5px;
  margin: 0.2vw;
  padding: 0 0.4vw 0 0.4vw;
  color: #d9ddff;
  cursor: pointer;
}

.conflict-variants .button.selected {
  color: white;
}

.conflict-variants .button:hover {
  text-decoration: underline;
}

.conflict-input {
  border-color: red !important;
}

.conflict-text {
  color: red !important;
}

.conflict-delete {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #d10e0e;
  padding: 4px 10px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 -3px 20px #00000033;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.conflict-delete.visible {
  opacity: 1;
}

.modals-panel {
  position: fixed;
  display: flex;
  flex-wrap: wrap;
  bottom: 0;
  right: 0;
  margin: 0 4px 4px 0;
  max-width: 40%;
}

.modals-drop-panel {
  position: fixed;
  display: block;
  width: 100px;
  height: auto;
  bottom: 50px;
  right: 0;
  z-index: 1000;
}

.modals-panel-button {
  position: fixed;
  display: flex;
  visibility: visible;
  width: 56px;
  height: 38px;
  right: 0;
  bottom: 0;
  margin: 2px;
  padding: 5px;
  cursor: pointer;
  background-image: url("img/wnd_show.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 40%;
}

.modals-panel-button.hide_modals {
  background-image: url("img/wnd_hide.svg");
}

.modals-panel .modal,
.modals-drop-panel .modal {
  position: relative;
  display: flex;
  width: 86px;
  height: 30px;
  margin: 2px;
  padding: 5px;
  overflow: hidden;
  white-space: normal;
  word-wrap: break-word;
  align-items: center;
  background-color: #ffffff;
  box-shadow: #000000 0vw 0vw 2px;
  border-radius: 3px;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.modals-panel .modal.hide {
  display: none;
  visibility: hidden;
  height: 0;
}

/*}*/

/* Таблица */
.table {
  flex: 1 1 auto;
  /* занимает всё доступное пространство */
  overflow: auto;
  /* если нужен скролл у самой таблицы */
}

/* Шапка таблицы всегда видна на десктопе */
@media (orientation: landscape) {
  .layer-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .table {
    display: flex;
    flex-direction: column;
    table-layout: fixed;
    width: 100%;
  }

  .table-head {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .table-body {
    display: block;
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - 111px);
    /* подстройтка под панель инструментов, пагинацию и т.д. */
  }

  .table-body .table-row {
    display: grid;
    width: 100%;
  }
}

:root {
  --table-sort-arrow: #000000;
  --table-context-text-color: #000000;

  --tools-bg: #d3d3d6;

  --select-border: #777;
  --select-focus: blue;
  --select-arrow: var(--select-border);
}

body.dark-theme {
  --table-sort-arrow: #999999;
  --table-context-text-color: #000000;

  --tools-bg: #292929;
}

/* Стиль 1 */
.style_blue {
  --table-head-bg: #6C7AE0;
  --table-head-text: #ffffff;
  --table-row-hover-bg: initial;
  --table-row-hover-text: initial;
  --table-row-selected-bg: #a7addb;
  --table-row-selected-text: #ffffff;
  --table-row-even: #a7addb1f;
  --table-row-odd: transparent;
  --table-row-separator: transparent;
}

.style_blue.dark-theme {
  --table-head-bg: #6a6f96;
}

.style_blue th {
  background-color: var(--table-head-bg);
  color: var(--table-head-text);
}

.style_blue tr:nth-child(even) {
  background-color: var(--table-row-even);
}

.style_blue tr:nth-child(odd) {
  background-color: var(--table-row-odd);
}

.style_blue .table-body .table-row.selected {
  background-color: var(--table-row-selected-bg);
  color: var(--table-row-selected-text);
}

/* Стиль 2 */
.style_light {
  --table-head-bg: #e1e8f2;
  --table-head-text: #000000;
  --table-row-hover-bg: #fc84a8;
  --table-row-hover-bg-dark: #705a61;
  --table-row-hover-text: #ffffff;
  --table-row-selected-bg: #fb4f83;
  --table-row-selected-bg-dark: #743f4f;
  --table-row-selected-text: #ffffff;
  --table-row-even: transparent;
  --table-row-odd: transparent;
  --table-row-separator: #edeef2;
  --table-row-separator-dark: #59595a;
}

.style_light.dark-theme {
  --table-head-bg: #92969c;
}

@media (pointer: fine) {
  .style_light.dark-theme .table-body .table-row:hover {
    background-color: var(--table-row-hover-bg-dark);
    color: var(--table-row-hover-text);
  }
}

.style_light.dark-theme .table-body .table-row.selected {
  background-color: var(--table-row-selected-bg-dark);
  color: var(--table-row-selected-text);
}

.style_light.dark-theme .table-body .table-row {
  border-bottom: 1px solid var(--table-row-separator-dark);
}

.style_light.dark-theme .table-head .table-row {
  border-bottom: 1px solid var(--table-row-separator-dark);
}

.style_light th {
  background-color: var(--table-head-bg);
  color: var(--table-head-text);
}

.style_light tr:nth-child(even) {
  background-color: var(--table-row-even);
}

.style_light tr:nth-child(odd) {
  background-color: var(--table-row-odd);
}

@media (pointer: fine) {
  .style_light .table-body .table-row:hover {
    background-color: var(--table-row-hover-bg);
    color: var(--table-row-hover-text);
  }
}

.style_light .table-body .table-row.selected {
  background-color: var(--table-row-selected-bg);
  color: var(--table-row-selected-text);
}

/* Стиль 3 */
.style_gray {
  --table-head-bg: #d8d8d8;
  --table-row-even: #f3f3f3;
  --table-row-border: #ddd;
  --table-row-selected-bg: #ecebeb;
}

.style_gray.dark-theme {
  --table-head-bg: #757575;
  --table-row-even: #292929;
  --table-row-border: #363636;
  --table-row-selected-bg: #353535;
}

.style_gray th {
  font-weight: bold;
  text-align: left;
  border: none;
  padding: 10px 15px;
  background: var(--table-head-bg);
  font-size: 14px;
  border-left: 1px solid var(--table-row-border);
  border-right: 1px solid var(--table-row-border);

}

.style_gray td {
  text-align: left;
  border-left: 1px solid var(--table-row-border);
  border-right: 1px solid var(--table-row-border);
  padding: 10px 15px;
  font-size: 14px;
  vertical-align: top;
}

.style_gray thead tr th:first-child,
.style_gray tbody tr td:first-child {
  border-left: none;
}

.style_gray thead tr th:last-child,
.style_gray tbody tr td:last-child {
  border-right: none;
}

.style_gray tbody tr:nth-child(even) {
  background: var(--table-row-even);
}

.style_gray tr:nth-child(even) {
  background-color: var(--table-row-even);
}

.style_gray tr:nth-child(odd) {
  background-color: var(--table-row-odd);
}

.style_gray .table-body .table-row.selected {
  background-color: var(--table-row-selected-bg);
}

/* Общие стили таблицы */

.table-head {
  background-color: var(--table-head-bg);
  width: auto;
  min-width: 100%;
}

.table-row {
  display: grid;
  grid-template-columns: auto;
  border-bottom: 1px solid var(--table-row-separator);
  min-width: 100%;
}

.table-row.conflict {
  color: #ff0000 !important;
}

/* Другие стили */
.table .loader {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.table .loader.hide {
  visibility: hidden;
  height: 0;
}

.table .loader .wrap {
  width: 50px;
  height: 50px;
}

.table .loader circle {
  fill: none;
  stroke: #007bff;
  stroke-width: 5;
  stroke-linecap: round;
  animation: loadingCircleAnim 2s linear infinite;
  transform-origin: center;
  width: 50px;
  height: 50px;
}

.table-row th,
.table-row td {
  padding: 0.5rem;
  position: relative;
  min-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 14px;
}

.table-row th[data-special],
.table-row td[data-special-select] {
  padding: 0.3rem;
  min-width: auto;
  cursor: default;
}

.table-row td {
  padding: 0.3rem;
}

.table-checkbox-select {
  display: inline-block;
  width: 22px;
  height: 22px;
  background-image: url("img/unselect.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  cursor: pointer;
}

.custom-checkbox:checked+.table-checkbox-select {
  background-image: url("img/select.svg");
}

.table-checkbox-select_all {
  display: inline-block;
  width: 22px;
  height: 22px;
  background-image: url("img/unselect_all.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  cursor: pointer;
}

.custom-checkbox:checked+.table-checkbox-select_all {
  background-image: url("img/select_all.svg");
}

.table-head-title {
  display: flex;
  align-items: center;
  text-transform: capitalize;
  cursor: pointer;
  min-width: 80px;
  text-align: left;
}

.table-head-title.resizing {
  pointer-events: none;
}

.sort-arrow {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-left: 4px;
}

.sort-arrow svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.table-head-title .up-arrow,
.collapsible-title .up-arrow {
  display: none;
}

.table-head-title--sorted-asc .up-arrow,
.table-head-title--sorted-desc .up-arrow,
.collapsible-title.table-head-title--sorted-asc .up-arrow,
.collapsible-title.table-head-title--sorted-desc .up-arrow {
  display: inline-block !important;
}

.table-head-title--sorted-asc .up-arrow,
.collapsible-title.table-head-title--sorted-asc .up-arrow {
  transform: rotate(0deg);
}

.table-head-title--sorted-desc .up-arrow,
.collapsible-title.table-head-title--sorted-desc .up-arrow {
  transform: rotate(180deg);
}

.table-body .table-row {
  transition: 0.1s linear;
  transition-property: color, background;
}

.table-body .table-row:last-child {
  border-bottom: none;
}

.table-body .table-row.unconfirmed {
  color: blue;
}

.table-body .table-row.server-update {
  color: green !important;
}

.table-body .table-row.confirmed {
  color: black !important;
}

.table .table-row.deleted,
.table .table-row.deleted td,
.table .table-row.deleted div {
  color: #8a2be2 !important;
}

.table-body-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.table-body-text--collapsible {
  flex-direction: column;
  align-items: flex-start !important;
}

.table-body-text--collapsible .collapsible-item {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  justify-content: flex-start !important;
  text-align: left !important;
  width: 100%;
}

.data-pagination-container {
  position: sticky;
  display: flex;
  bottom: 0;
  z-index: 10;
  justify-content: center;
  width: 100%;
  background: var(--pagination-bg);
  box-shadow: 0px 2px 5px #00000033;
  flex-shrink: 0;
}

.table-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  width: max-content;
  padding: 1px;
  padding-top: 3px;
  border-radius: 5px;
}

.data-pagination-count {
  display: flex;
  width: auto;
  font-size: 14px;
}

.data-pagination-span {
  display: flex;
  width: auto;
  font-size: 14px;
  white-space: nowrap;
  justify-content: center;
  padding: 1px;
}

.data-pagination-button {
  display: flex;
  width: 16px;
  height: 16px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  cursor: pointer;
}

.data-pagination-button.first {
  background-image: url("/img/pg_first.svg");
}

.data-pagination-button.prev {
  background-image: url("/img/pg_prev.svg");
}

.data-pagination-button.next {
  background-image: url("/img/pg_next.svg");
}

.data-pagination-button.last {
  background-image: url("/img/pg_last.svg");
}

.data-pagination-button.first.disable {
  background-image: url("/img/pg_first_d.svg");
  cursor: default;
}

.data-pagination-button.prev.disable {
  background-image: url("/img/pg_prev_d.svg");
  cursor: default;
}

.data-pagination-button.next.disable {
  background-image: url("/img/pg_next_d.svg");
  cursor: default;
}

.data-pagination-button.last.disable {
  background-image: url("/img/pg_last_d.svg");
  cursor: default;
}

.select.table-pagination-select {
  width: 60px;
  padding: 3px;
  font-size: 14px;
  margin: -3px 0 0 5px;
  appearance: auto;
}

.table-context-menu {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 2px 2px 5px #00000033;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 150px;
  z-index: 20;
  color: var(--table-context-text-color);
}

.table-context-menu li {
  padding: 8px 12px;
  cursor: pointer;
}

.table-context-menu li:hover {
  background: #f0f0f0;
}

.table-checkbox-eye {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  background-image: url("img/hide.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
  cursor: pointer;
}

.custom-checkbox:checked+.table-checkbox-eye {
  background-image: url("img/show.svg");
}

/* SVG Up Arrow Style */
.up-arrow {
  height: 10px;
  margin-left: 5px;
  transition: transform 0.2s;
  fill: var(--table-sort-arrow);
}

/* SVG User Icon Style */
.user-icon {
  width: 100%;
  max-width: 4rem;
  height: auto;
  margin-right: 1rem;
}

/* Status Indicator Style */
.status-indicator {
  display: inline-block;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #222222;
  margin-right: 0.5rem;
}

.status-indicator--active {
  background: #25be64;
}

.status-indicator--inactive {
  background: #dadde4;
}

.status-indicator--new {
  background: #febf02;
}

/* Resizer Styles */
.resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  z-index: 10;
}

.resize-handle:hover,
.resize-handle.active {
  background: #0000001a;
}

.table-head-title--collapsible {
  flex-direction: column;
  align-items: flex-start;
}

.table-head-title--collapsible .collapsible-title {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
}

@media (orientation: landscape) {
  .table-head-title {
    white-space: nowrap;
  }
}

/*}*/

.hide {
  display: none;
  width: 0;
  height: 0;
  visibility: hidden;
  overflow: hidden;
}

.show {
  display: block !important;
}

.zoomOutAnim {
  -webkit-animation-name: zoomOutAnim;
  animation-name: zoomOutAnim;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.zoomInAnim {
  -webkit-animation-name: zoomInAnim;
  animation-name: zoomInAnim;
  -webkit-animation-duration: 0.3s;
  animation-duration: 0.3;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.collapseAnim {
  -webkit-animation-name: collapseAnim;
  animation-name: collapseAnim;
  -webkit-animation-duration: 0.5s;
  animation-duration: 0.5s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.expandAnim {
  -webkit-animation-name: expandAnim;
  animation-name: expandAnim;
  -webkit-animation-duration: 0.5s;
  animation-duration: 0.5s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.fadeOutAnim {
  animation-name: fadeOutAnim;
  animation-duration: 1s;
}

.fadeInAnim {
  animation-name: fadeInAnim;
  animation-duration: 1s;
}

/* Переключатель {*/
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .1s;
  transition: .1s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .1s;
  transition: .1s;
}

input:checked+.slider {
  background-color: #2196F3;
}

input:focus+.slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

.switch-label {
  display: inline-block;
  width: auto;
  height: 20px;
  line-height: 20px;
  margin: 2px 10px 2px 10px;
}

/*}*/

/* Переключатель на всплывающих окнах {*/
.toggle {
  cursor: pointer;
  display: inline-block;
  margin-bottom: 5px;
}

.toggle-switch {
  display: inline-block;
  background: #ccc;
  border-radius: 16px;
  width: 58px;
  height: 32px;
  position: relative;
  vertical-align: middle;
  transition: background 0.25s;

}

.toggle-switch:before,
.toggle-switch:after {
  content: "";
}

.toggle-switch:before {
  display: block;
  background: linear-gradient(to bottom, #fff 0%, #eee 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px #00000040;
  width: 24px;
  height: 24px;
  position: absolute;
  top: 4px;
  left: 4px;
  transition: left 0.25s;
}

.toggle:hover .toggle-switch:before {
  background: linear-gradient(to bottom, #fff 0%, #fff 100%);
  box-shadow: 0 0 0 1px #00000080;
}

.toggle-checkbox:checked+.toggle-switch {
  background: #56c080;
}

.toggle-checkbox:checked+.toggle-switch:before {
  left: 30px;
}

.toggle-checkbox {
  position: absolute;
  visibility: hidden;
}

.toggle-label {
  margin-left: 5px;
  position: relative;
  top: 2px;
}

/* } */

/* select { */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: transparent;
  border: none;
  padding: 0 1em 0 0;
  margin: 0;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  cursor: inherit;
  line-height: inherit;
  z-index: 1;
  outline: none;
}

select::-ms-expand {
  display: none;
}

.select {
  display: grid;
  grid-template-areas: "select";
  align-items: center;
  position: relative;
  /* min-width: 15ch;
    max-width: 30ch; */
  border: 1px solid var(--select-border);
  border-radius: 0.25em;
  padding: 0.25em 0.5em;
  margin-bottom: 5px;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1.1;
  background-color: #fff;
  background-image: linear-gradient(to top, #f9f9f9, #fff 33%);
}

.select select,
.select::after {
  grid-area: select;
}

.select:not(.select--multiple)::after {
  content: "";
  justify-self: end;
  width: 0.8em;
  height: 0.5em;
  background-color: var(--select-arrow);
  -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);
  clip-path: polygon(100% 0%, 0 0%, 50% 100%);
}

select:focus+.focus {
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border: 2px solid var(--select-focus);
  border-radius: inherit;
}

select[multiple] {
  padding-right: 0;
  height: 6rem;
}

select[multiple] option {
  white-space: normal;
  outline-color: var(--select-focus);
}

.select--disabled {
  cursor: not-allowed;
  background-color: #eee;
  background-image: linear-gradient(to top, #ddd, #eee 33%);
}

.select.settings {
  font-size: 16px;
}

/* } */

/* Кастомный select { */

.custom-select-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.custom-select-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 3px;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 4px;
  cursor: pointer;
  min-width: 40px;
  font-size: 14px;
  outline: none;
  user-select: none;
  height: 12px;
  background-color: var(--combobox-bg);
  color: var(--combobox-text);
}

.custom-select-arrow {
  margin-left: 6px;
  transition: transform 0.2s ease;
  color: #666;
  /* Поворачиваем "стрелку вниз" на 180° → получаем "вверх" */
  transform: rotate(180deg);
}

/* Когда список открыт — стрелка смотрит вниз */
.custom-select-wrapper.open .custom-select-arrow {
  transform: rotate(0deg);
}

.custom-select-dropdown {
  position: absolute;
  bottom: 100%;
  /* ← Ключевое: прикрепляем к НИЖНЕЙ части wrapper'а */
  left: 10px;
  right: 0;
  width: 58px;
  border: 1px solid var(--border-color, #ccc);
  border-bottom: none;
  /* ← граница теперь снизу */
  border-radius: 4px;
  /* ← скругление сверху */
  list-style: none;
  margin: 0;
  padding: 4px 0;
  box-shadow: 0 -2px 6px #00000026;
  /* тень вверх */
  background-color: var(--combobox-bg);
  color: var(--combobox-text);
}

.custom-select-option {
  padding: 6px 10px;
  cursor: pointer;
  text-align: center;
}

.custom-select-option:hover {
  background-color: var(--combobox-bg);
}

.custom-select-option.selected {
  background-color: var(--combobox-select);
  font-weight: bold;
}

/* } */

@media (orientation: portrait) {
  .grid {
    display: grid;
    grid-template-columns: auto;
    grid-template-rows: 18vw auto;
    height: calc(var(--vh, 1vh) * 100);
  }

  .main-menu {
    display: flex;
    width: 100vw;
    min-height: 0;
    height: auto;
    justify-content: space-between;
    align-items: stretch;
    overflow-y: visible;
    padding: 0;
  }

  .main-menu:hover {
    overflow: visible;
  }

  .main-menu .group {
    display: block;
    position: relative;
    height: auto;
    align-items: center;
    text-align: center;
  }

  .main-menu .group .name {
    display: block;
    height: auto;
    cursor: pointer;
    padding-top: 1.5vw;
    margin: 0.5vw;
    border-radius: 2vw;
  }

  .main-menu .group .icon-wrap {
    display: flex;
    width: 100%;
    height: 9vw;
    justify-content: center;
  }

  .main-menu .group .icon {
    display: flex;
    width: 9vw;
    height: 9vw;
  }

  .main-menu .group .text {
    width: 90%;
    display: flex;
    font-size: 4vw;
    justify-content: center;
    margin-top: 1.5vw;
    margin-left: 5%;
  }

  .main-menu .categories {
    display: none;
    position: absolute;
    background-color: var(--main-menu-portrait-categories-bg);
    top: 11vw;
    left: 2vw;
    padding: 3vw 0 3vw 0;
    box-shadow: #0000005d 0vw 0vw 2vw;
    width: 40vw;
    z-index: 25;
  }

  .main-menu .last {
    margin-left: -21vw;
  }

  .main-menu .category {
    display: flex;
    width: 85%;
    border-radius: 1vw;
    padding: 2%;
    margin-bottom: 5%;
    align-items: center;
  }

  .main-menu .category:hover {
    background-color: var(--main-menu-portrait-category-active);
  }

  .main-menu .active {
    background-color: var(--main-menu-portrait-category-active);
  }

  .main-menu .category .text {
    display: flex;
    width: 80%;
    height: 100%;
    margin: 0;
    font-size: 3.5vw;
    justify-content: left;
    text-align: left;
    align-items: center;
  }

  .modal .modal-content .layer {
    column-count: 1;
    /* Количество столбцов */
  }

  .content-wrap {
    display: grid;
    grid-template-rows: calc(100% - 50px) 50px;
    width: 100vw;
    height: 100%;
    overflow: auto;
  }

  .content {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: auto;
  }

  .tools {
    position: relative;
    height: 50px;
  }

  .tools-button {
    width: 30px;
    height: 30px;
    margin-left: 20px;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeOutAnim {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

@keyframes fadeInAnim {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 1;
  }
}

@-webkit-keyframes zoomOutAnim {
  0% {}

  50% {
    -webkit-transform: scale3d(.3, .3, .3);
    transform: scale3d(.3, .3, .3);
  }

  100% {}
}

@keyframes zoomOutAnim {
  0% {}

  50% {
    -webkit-transform: scale3d(.3, .3, .3);
    transform: scale3d(.3, .3, .3);

  }

  100% {}
}

@keyframes zoomInAnim {
  0% {
    transform: scale3d(0.3, 0.3, 0.3);
    -webkit-transform: scale3d(.3, .3, .3);
    opacity: 0;
  }

  100% {
    transform: scale3d(1, 1, 1);
    -webkit-transform: scale3d(1, 1, 1);
    opacity: 1;
  }
}

@-webkit-keyframes collapseAnim {
  0% {}

  100% {
    -webkit-transform: scale(.0, 1) translateY(1000px);
    transform: scale(.0, 1) translateY(1000px);
  }
}

@keyframes collapseAnim {
  0% {}

  100% {
    -webkit-transform: scale(.0, 1) translateY(1000px);
    transform: scale(.0, 1) translateY(1000px);
  }
}

@-webkit-keyframes expandAnim {
  0% {
    -webkit-transform: scale(.0, 1) translateY(1000px);
    transform: scale(.0, 1) translateY(1000px);
  }

  100% {
    -webkit-transform: scale(1, 1) translateY(0px);
    transform: scale(1, 1) translateY(0px);
  }
}

@keyframes expandAnim {
  0% {
    -webkit-transform: scale(.0, 1) translateY(1000px);
    transform: scale(.0, 1) translateY(1000px);
  }

  100% {
    -webkit-transform: scale(1, 1) translateY(0px);
    transform: scale(1, 1) translateY(0px);
  }
}

@keyframes loadingCircleAnim {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    transform: rotate(0deg);
  }

  50% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -35;
  }

  100% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -124;
    transform: rotate(360deg);
  }
}