.ui-edit-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  background: var(--card);
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ui-edit-btn.is-active {
  border-color: color-mix(in srgb, #dcaa2e 45%, transparent);
  border-color: color-mix(in srgb, var(--accent, #dcaa2e) 45%, transparent);
  background: color-mix(in srgb, #dcaa2e 16%, transparent);
  background: color-mix(in srgb, var(--accent, #dcaa2e) 16%, transparent);
  color: #1f2328;
  color: var(--fg, #1f2328);
}

.ui-edit-row-shell {
  display: flex;
  align-items: center;
  gap: 0;
  transition: gap 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ui-edit-row-shell.is-edit-mode {
  gap: 8px;
}

.ui-edit-row {
  flex: 1 1;
}

.ui-edit-row.is-clickable {
  cursor: pointer;
}

.ui-edit-delete-btn {
  width: 0;
  min-width: 0;
  height: 22px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  margin-left: 0;
  overflow: hidden;
  box-shadow: none;
  opacity: 0;
  transform: translateX(8px) scale(0.6);
  pointer-events: none;
  transition:
    width 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
    margin-left 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.18s ease,
    transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.2s ease;
}

.ui-edit-delete-btn.is-visible {
  width: 22px;
  margin-left: 8px;
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.ui-edit-delete-btn:active {
  transform: translateX(0) scale(0.95);
  background: #e0352b;
}

.ui-edit-minus-mark {
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.portal-bottom-sheet__backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.35);
  animation: portalBottomSheetBackdropIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-bottom-sheet {
  position: relative;
  width: min(560px, 100%);
  border-radius: 18px;
  padding: 10px;
  background: #fff;
  background: var(--card, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  box-shadow:
    0 16px 50px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
  animation: portalBottomSheetIn 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-bottom-sheet::after {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(100% - 1px);
  height: calc(0px + env(safe-area-inset-bottom, 0px));
  height: calc(var(--sheet-underhang, 0px) + var(--app-bottom-safe-reserve, env(safe-area-inset-bottom, 0px)));
  background: #fff;
  background: var(--card, #fff);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-right: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  pointer-events: none;
}

.portal-bottom-sheet.is-dragging,
.portal-bottom-sheet.is-closing-by-drag {
  animation: none;
}

.portal-bottom-sheet__header {
  position: relative;
  padding-top: 2px;
  cursor: grab;
  touch-action: none;
}

.portal-bottom-sheet__header-end {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
}

.portal-bottom-sheet__header.is-handle-only {
  cursor: default;
}

.portal-bottom-sheet__handle {
  width: 36px;
  height: 4px;
  margin: 2px auto 10px;
  border-radius: 999px;
  
  background: rgba(120, 120, 128, 0.36);
}

.portal-bottom-sheet.is-dragging {
  transition: none;
}

.portal-bottom-sheet.is-closing-by-drag {
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-bottom-sheet.is-dragging .portal-bottom-sheet__header {
  cursor: grabbing;
}

.portal-bottom-sheet__title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.portal-bottom-sheet__subtitle {
  margin-top: -4px;
  margin-bottom: 6px;
  text-align: center;
  color: var(--sub);
  font-size: 13px;
}

.portal-bottom-sheet__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-dark .portal-bottom-sheet {
  background: #1b1b1b;
  background: var(--card, #1b1b1b);
  border-color: #2a2a2a;
  border-color: var(--border, #2a2a2a);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.46),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.theme-dark .portal-bottom-sheet::after {
  background: #1b1b1b;
  background: var(--card, #1b1b1b);
  border-left-color: #2a2a2a;
  border-left-color: var(--border, #2a2a2a);
  border-right-color: #2a2a2a;
  border-right-color: var(--border, #2a2a2a);
}

.theme-dark .portal-bottom-sheet__handle {
  background: rgba(174, 174, 178, 0.36);
}

@media (max-width: 519px) {
  .portal-bottom-sheet__backdrop {
    padding:
      max(10px, calc(env(safe-area-inset-top, 0px) + 8px))
      8px
      0;
    padding:
      max(10px, calc(var(--app-top-safe-reserve, env(safe-area-inset-top, 0px)) + 8px))
      8px
      0;
    align-items: flex-end;
  }

  .portal-bottom-sheet {
    width: 100%;
    max-width: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding:
      10px
      10px
      calc(10px + env(safe-area-inset-bottom, 0px));
    padding:
      10px
      10px
      calc(10px + var(--app-bottom-safe-reserve, env(safe-area-inset-bottom, 0px)));
    box-shadow:
      0 -1px 0 rgba(255, 255, 255, 0.2) inset,
      0 -24px 48px rgba(0, 0, 0, 0.22);
    animation-duration: 0.46s;
  }

  .portal-bottom-sheet__header {
    padding-top: 4px;
  }
}

@keyframes portalBottomSheetBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes portalBottomSheetIn {
  0% {
    opacity: 0;
    transform: translateY(calc(100% + 24px)) scale(0.982);
  }
  68% {
    opacity: 1;
    transform: translateY(-4px) scale(1.003);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

