.sheet-toolbar {
  display: none;
}

.sheet-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

@media (max-width: 760px) {
  body {
    --sheet-peek: 46px;
    --sheet-gap: 12px;
  }

  .workspace {
    overflow: clip;
  }

  .map-section {
    z-index: 0;
  }

  .sidebar,
  .sidebar.detail-mode {
    --sheet-top-gap: 8px;
    --sheet-full-height: calc(100% - 73px - env(safe-area-inset-bottom) - var(--sheet-top-gap));
    --sheet-position: var(--sheet-offset, var(--sheet-rest, 0px));
    max-height: var(--sheet-full-height);
    border: 0;
    transform: translateY(var(--sheet-position));
    clip-path: inset(0 0 var(--sheet-position) round 20px);
    transition: height .22s, transform .22s, clip-path .22s;
  }

  /* The visible sheet shrinks while its layout box slides down. Draw its
     outline around the visible area, not the hidden full-height box. */
  .sidebar::after {
    content: '';
    position: absolute;
    inset: 0 0 var(--sheet-position);
    border: 1px solid var(--rule);
    border-radius: 20px;
    pointer-events: none;
    z-index: 5;
    transition: bottom .22s;
  }

  .sidebar.is-dragging::after { transition: none; }
  .sidebar.collapsed-mobile .sidebar-handle { border-bottom-color: transparent; }

  .sidebar.expanded-mobile {
    height: var(--sheet-full-height);
  }

  .sidebar.is-dragging {
    transition: none;
  }

  .sidebar.collapsed-mobile {
    --sheet-rest: calc(100% - var(--sheet-peek));
  }

  .sidebar.collapsed-mobile .sheet-chevron {
    transform: rotate(180deg);
  }

  .sidebar.collapsed-mobile ~ .map-section .leaflet-bottom {
    bottom: calc(var(--sheet-peek) + var(--sheet-gap));
  }

  .sidebar.collapsed-mobile ~ .map-section .map-bottom {
    bottom: calc(25px + var(--sheet-peek) + var(--sheet-gap));
  }

  .workspace:has(.sidebar.collapsed-mobile) ~ .toast {
    bottom: calc(80px + env(safe-area-inset-bottom) + var(--sheet-peek));
  }

  .mobile-nav button {
    touch-action: manipulation;
  }

  .sheet-toolbar {
    display: block;
    position: relative;
    flex: none;
  }

  .sidebar button.sheet-size {
    position: absolute;
    inset: 0 8px 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 9px;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
    touch-action: manipulation;
  }

  .sheet-size .icon {
    display: block;
    width: 14px;
    height: 14px;
    transform: rotate(180deg);
  }

  .expanded-mobile .sheet-size .icon {
    transform: none;
  }

  .sheet-size:focus-visible {
    outline-offset: -3px;
  }

  .sidebar button.sidebar-handle {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: calc(var(--sheet-peek) - 2px);
    margin: 0;
    padding: 13px 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: inherit;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    background: transparent;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    touch-action: none;
    user-select: none;
    cursor: grab;
  }

  .sidebar-handle:active {
    cursor: grabbing;
  }

  .sidebar-handle:focus-visible {
    outline-offset: -3px;
  }

  .sidebar-handle .icon {
    display: block;
    width: 15px;
    height: 15px;
  }

  .sheet-grip {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 32px;
    height: 3px;
    border-radius: 2px;
    background: var(--muted);
    transform: translateX(-50%);
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .sidebar.detail-mode:not(.expanded-mobile) {
    height: 56%;
  }
}
