.st-slide-panel-root,
.st-modal-root {
  inset: 0;
  position: fixed;
  z-index: 620;
}

.st-slide-panel-backdrop,
.st-modal-backdrop {
  background: var(--st-color-backdrop);
  border: 0;
  inset: 0;
  padding: 0;
  position: absolute;
  width: 100%;
}

.st-slide-panel {
  background: var(--st-color-surface-white);
  box-shadow: var(--st-elevation-panel);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: 0;
  width: min(var(--st-panel-width-lg), 100vw);
}

.st-slide-panel-header,
.st-slide-panel-footer,
.st-modal-header,
.st-modal-footer {
  align-items: center;
  display: flex;
  gap: var(--st-space-4);
}

.st-slide-panel-header {
  border-bottom: 1px solid var(--st-color-border-default);
  flex: 0 0 auto;
  justify-content: space-between;
  padding: var(--st-space-6) var(--st-panel-padding-x);
}

.st-slide-panel-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: var(--st-space-4);
  margin-left: auto;
}

.st-slide-panel-header h2,
.st-modal-header h2 {
  color: var(--st-color-text-primary);
  font-size: var(--st-font-title-h3-size);
  font-weight: var(--st-font-weight-bold);
  line-height: var(--st-line-height-tight);
  margin: 0;
}

.st-slide-panel-header p,
.st-modal-header p {
  color: var(--st-color-text-secondary);
  font-size: var(--st-font-small-size);
  line-height: var(--st-line-height-body);
  margin: var(--st-space-1) 0 0;
}

.st-slide-panel-close {
  flex: 0 0 auto;
}

.st-slide-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--st-space-6) var(--st-panel-padding-x);
}

.st-slide-panel-footer {
  border-top: 1px solid var(--st-color-border-default);
  flex: 0 0 auto;
  justify-content: space-between;
  padding: var(--st-space-4) var(--st-panel-padding-x) calc(var(--st-space-4) + env(safe-area-inset-bottom, 0px));
}

.st-modal-root {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: var(--st-space-6);
}

.st-modal-dialog {
  background: var(--st-color-surface-white);
  border: 1px solid var(--st-color-border-default);
  border-radius: var(--st-radius-2xl);
  box-shadow: var(--st-elevation-modal);
  display: grid;
  gap: var(--st-space-4);
  max-height: calc(100dvh - var(--st-space-12));
  max-width: 460px;
  min-width: 0;
  overflow-y: auto;
  padding: var(--st-space-6);
  position: relative;
  width: 100%;
}

.st-modal-header {
  align-items: flex-start;
  flex-direction: column;
  gap: var(--st-space-1);
}

.st-modal-body {
  color: var(--st-color-text-secondary);
  font-size: var(--st-font-body-size);
  line-height: var(--st-line-height-body);
}

.st-modal-footer {
  justify-content: flex-end;
}

.st-modal-dialog.is-danger {
  border-color: var(--st-color-danger-surface);
}

@media (max-width: 699px) {
  .st-slide-panel-backdrop {
    display: none;
  }

  .st-slide-panel {
    box-shadow: none;
    left: 0;
    width: auto;
  }

  .st-slide-panel-header,
  .st-slide-panel-body,
  .st-slide-panel-footer {
    padding-left: var(--st-space-4);
    padding-right: var(--st-space-4);
  }

  .st-slide-panel-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .st-slide-panel-footer .st-btn {
    width: 100%;
  }

  .st-modal-root {
    align-items: flex-end;
    padding: var(--st-space-3);
  }

  .st-modal-dialog {
    border-radius: var(--st-radius-xl);
    max-height: calc(100dvh - var(--st-space-6));
    padding: var(--st-space-4);
  }

  .st-modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}
