html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.shell,
.main,
.panel {
  min-width: 0;
}

.mobile-operator {
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

td,
dd,
.message,
.list-row {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

@media (max-width: 850px) {
  body {
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  .sidebar nav {
    flex-wrap: wrap;
    overflow: visible;
  }

  .sidebar nav a {
    white-space: normal;
  }

  .logout {
    display: block;
    margin-top: 4px;
  }

  .logout button {
    width: 100%;
  }

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

  .section-head,
  .list-row {
    flex-wrap: wrap;
    min-width: 0;
  }

  img,
  iframe,
  input,
  select,
  textarea {
    max-width: 100%;
  }

  .form-actions .button {
    width: 100%;
    white-space: normal;
  }

  .calendar-tabs {
    gap: 10px 16px;
  }

  .calendar-tabs a,
  .calendar-tabs span {
    white-space: normal;
  }
}

@media (max-width: 850px) {
  .main {
    padding: 16px 12px;
  }

  .panel {
    padding: 15px;
  }

  .table-wrap:has(.mobile-cards) {
    overflow-x: visible;
  }

  .mobile-operator .table-wrap {
    overflow-x: visible;
  }

  .mobile-cards,
  .mobile-cards tbody,
  .mobile-cards tr,
  .mobile-cards td {
    display: block;
    width: 100%;
  }

  .mobile-cards thead {
    display: none;
  }

  .mobile-cards tr {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
  }

  .mobile-cards tr:last-child {
    margin-bottom: 0;
  }

  .mobile-cards td {
    display: grid;
    grid-template-columns: minmax(100px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-cards td:last-child {
    border-bottom: 0;
  }

  .mobile-cards td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-cards .empty-row {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .mobile-cards .empty-row td {
    display: block;
  }

  .mobile-cards .empty-row td::before {
    content: none;
  }

  .calendar-scroll {
    overflow-x: visible;
  }

  .work-calendar,
  .work-calendar tbody,
  .work-calendar tr,
  .work-calendar td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .work-calendar thead,
  .work-calendar td:not(:has(.calendar-order)) {
    display: none;
  }

  .work-calendar tr {
    display: contents;
  }

  .work-calendar td {
    height: auto;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }
}
