[data-tn-bottom-sheet][hidden] {
  display: none !important;
}

html.tn-sheet-system-surface-active,
html.tn-sheet-system-surface-active body {
  background: var(--tn-sheet-system-surface, var(--wash, #f3f7f4));
}

[data-tn-bottom-sheet] {
  position: fixed;
  z-index: 140;
  top: var(--tn-visual-viewport-offset-top, 0px);
  right: 0;
  bottom: auto;
  left: 0;
  box-sizing: border-box;
  display: grid;
  align-items: end;
  justify-items: center;
  height: var(--tn-visual-viewport-height, 100dvh);
  max-height: var(--tn-visual-viewport-height, 100dvh);
  overflow: hidden;
  padding-bottom: var(--tn-sheet-keyboard-offset, 0px);
  overscroll-behavior: none;
  touch-action: pan-y;
}

[data-tn-bottom-sheet][data-tn-sheet-input-ready="false"]::after {
  position: absolute;
  z-index: 5;
  inset: 0;
  content: "";
  background: transparent;
  touch-action: none;
}

[data-tn-sheet-backdrop] {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  opacity: 0;
  background: rgba(24, 34, 48, 0.48);
  transition: opacity 180ms ease-out;
  touch-action: none;
}

[data-tn-sheet-panel] {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(100%, var(--tn-sheet-max-width, 680px));
  height: min(var(--tn-sheet-viewport-height, 86dvh), var(--tn-sheet-max-height, 760px));
  max-height: min(var(--tn-sheet-viewport-height, 86dvh), var(--tn-sheet-max-height, 760px));
  overflow: hidden;
  border: 1px solid rgba(208, 213, 221, 0.9);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--wash, #f3f7f4);
  box-shadow: 0 -18px 48px rgba(24, 34, 48, 0.22);
  transform: translate3d(0, 100%, 0);
  transition: transform 220ms cubic-bezier(0.22, 0.8, 0.26, 1);
  overscroll-behavior: contain;
  touch-action: pan-y;
  will-change: transform;
}

[data-tn-bottom-sheet][data-tn-sheet-state="open"] [data-tn-sheet-backdrop] {
  opacity: 1;
}

[data-tn-bottom-sheet][data-tn-sheet-state="open"] [data-tn-sheet-panel] {
  transform: translate3d(0, 0, 0);
}

[data-tn-bottom-sheet][data-tn-sheet-dragging="true"] :is([data-tn-sheet-panel], [data-tn-sheet-backdrop]) {
  transition: none;
}

[data-tn-sheet-handle] {
  position: relative;
  width: 100%;
  height: 24px;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

[data-tn-sheet-handle]::before {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #b8c1c7;
  transform: translateX(-50%);
  content: "";
}

[data-tn-bottom-sheet][data-tn-sheet-dragging="true"] [data-tn-sheet-handle] {
  cursor: grabbing;
}

[data-tn-sheet-header] {
  min-width: 0;
}

[data-tn-sheet-scroll] {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding: 14px 0 calc(28px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

[data-tn-sheet-footer] {
  position: relative;
  z-index: 2;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

[data-tn-bottom-sheet][data-tn-sheet-has-footer="true"] [data-tn-sheet-panel] {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

[data-tn-bottom-sheet][data-tn-sheet-size="compact"] {
  --tn-sheet-max-width: 520px;
  --tn-sheet-max-height: 620px;
}

[data-tn-bottom-sheet][data-tn-sheet-size="compact"] [data-tn-sheet-panel] {
  height: auto;
}

@media (max-width: 1024px) {
  [data-tn-bottom-sheet] :is(input, select, textarea) {
    font-size: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-tn-sheet-backdrop],
  [data-tn-sheet-panel] {
    transition-duration: 1ms;
  }
}
