/* TourCare phone layout. Desktop is unchanged. */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  .layout__resize {
    display: none !important;
  }

  .layout__col-1 {
    position: fixed !important;
    z-index: 80;
    top: 0;
    bottom: 0;
    left: 0 !important;
    width: min(88vw, 320px) !important;
    max-width: 88vw !important;
    transform: translateX(-110%);
    transition: transform 0.18s ease;
    background: #fff;
    pointer-events: none;
  }

  html[dir="rtl"] .layout__col-1,
  body[dir="rtl"] .layout__col-1 {
    left: auto !important;
    right: 0 !important;
    transform: translateX(110%);
  }

  body.tc-nav-open .layout__col-1 {
    transform: none;
    pointer-events: auto;
    box-shadow: 0 0 28px rgba(16, 28, 42, 0.18);
  }

  body.tc-nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(16, 28, 42, 0.35);
  }

  .layout__col-2 {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .layout__col-2-scroll,
  .layout__col-2-2 {
    max-width: 100%;
  }

  .layout__col-2 .header,
  .header__filter,
  .header__buttons,
  .header__right {
    max-width: 100%;
    min-width: 0;
  }

  .header:has(.header__filter) {
    flex-wrap: nowrap !important;
    align-items: center;
    height: 48px !important;
    min-height: 48px;
    max-height: 48px;
    overflow: hidden;
    padding-left: 42px !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }

  .header__filter {
    flex: 1 1 auto !important;
    flex-wrap: nowrap !important;
    align-items: center;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .header__filter-item,
  .header__filter-link {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
  }

  .header__search {
    min-width: 0;
    flex: 1 1 auto;
  }

  #tc-nav-btn {
    position: fixed;
    z-index: 40;
    top: 8px;
    left: 6px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  #tc-nav-btn span,
  #tc-nav-btn span::before,
  #tc-nav-btn span::after {
    display: block;
    width: 14px;
    height: 2px;
    background: #12356b;
    position: relative;
  }

  #tc-nav-btn span::before,
  #tc-nav-btn span::after {
    content: "";
    position: absolute;
    left: 0;
  }

  #tc-nav-btn span::before {
    top: -5px;
  }

  #tc-nav-btn span::after {
    top: 5px;
  }

  .grid-view__row-more,
  .row-comments-expand-button {
    visibility: visible !important;
    width: 44px !important;
    height: 32px !important;
    min-height: 32px;
    font-size: 16px;
  }

  .context {
    z-index: 120 !important;
  }

  .context:has(.dashboard__user-workspaces) {
    max-height: 70dvh !important;
    overflow: auto !important;
    max-width: calc(100vw - 16px);
  }

  .context:has(.filters__content),
  .context:has(.sortings__content),
  .context:has(.group-bys__content),
  .context.tc-tool-sheet {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    max-height: 72dvh !important;
    overflow: auto !important;
    transform: none !important;
    box-sizing: border-box;
    z-index: 200;
  }

  .filters__content,
  .sortings__content,
  .group-bys__content {
    max-width: 100%;
    box-sizing: border-box;
  }

  .filters__item,
  .filters__group-item-wrapper {
    grid-template-columns: minmax(0, 1fr) !important;
    row-gap: 6px;
  }

  .filters__condition-item,
  .sortings__item,
  .group-bys__item {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px;
    min-width: 0;
    width: 100%;
    height: auto !important;
  }

  .filters__field,
  .filters__type,
  .filters__value,
  .filters__condition-item > * {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .modal__wrapper {
    padding: 0 !important;
  }

  .modal__box,
  .modal__box--with-sidebar,
  .modal__box--wide,
  .modal__box--full-screen {
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    background: #fff !important;
  }

  .modal__box--with-sidebar,
  .modal__box--full-screen {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    overflow: visible !important;
  }

  .modal__box--with-sidebar > .tc-side {
    display: none !important;
  }

  body.tc-comments-open .modal__box--with-sidebar > .tc-side {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    z-index: 130;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    bottom: var(--tc-kb, 0px);
    height: min(72dvh, calc(100dvh - var(--tc-kb, 0px) - 8px));
    background: #fff;
    box-shadow: 0 -8px 28px rgba(16, 28, 42, 0.16);
    overflow: auto;
  }

  .modal__wrapper .row-modal__field-list,
  .modal__wrapper .row-modal__field-item,
  .modal__wrapper .row-modal__field-item .control,
  .modal__wrapper .control__label {
    position: relative !important;
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word;
    float: none !important;
  }

  .modal__wrapper .row-modal__field-item {
    margin-bottom: 12px;
  }

  .modal__wrapper .control__label {
    display: flex !important;
    flex-wrap: wrap;
    line-height: 1.45 !important;
  }

  #tc-field-search {
    display: block;
    width: calc(100% - 24px);
    margin: 8px 12px 12px;
    min-height: 44px;
    border: 1px solid #d7d8d9;
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
    box-sizing: border-box;
  }

  #tc-comments-btn {
    border: 0;
    background: transparent;
    color: #12356b;
    font-size: 22px;
    line-height: 44px;
    text-align: center;
  }

  .row-comments__foot {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #fff;
    z-index: 2;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .row-comments__foot .rich-text-editor,
  .row-comments__foot .rich-text-editor__content {
    flex: 1 1 auto;
    min-width: 0;
  }

  #tc-send-comment {
    flex: 0 0 auto;
    height: 36px;
    margin: 0 12px 2px 0;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: #12356b;
    color: #fff;
    font: inherit;
  }

}

@media (pointer: coarse) {
  .grid-view__description-width,
  .grid-view__head-group-width-handle,
  .grid-view__divider-width {
    touch-action: none;
    z-index: 6;
  }
}
