/* sheets and dialogs */

/* ----- dim background + sheet container ----- */
.backdrop { position: fixed; inset: 0; z-index: 100; background: transparent; display: flex; align-items: flex-end; justify-content: center; transition: background-color .2s; }
.backdrop.in { background: var(--backdrop); }
.backdrop:has(.sheet.dialog) { align-items: center; padding: 16px; }

.sheet {
  width: 100%; max-width: 640px; max-height: 94dvh; display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  border-radius: 24px 24px 0 0; box-shadow: 0 -10px 50px rgba(0, 0, 0, .25); overflow: hidden; outline: none;
  transform: translateY(24px); opacity: 0; transition: transform .28s var(--ease), opacity .2s;
}
.backdrop.in .sheet { transform: none; opacity: 1; }
.sheet.tall { height: 94dvh; }
.sheet.dialog { max-width: 420px; border-radius: 22px; max-height: 90dvh; }
.sheet > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* ----- sheet header / scrolling body / footer ----- */
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; min-width: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 20px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--surface); }
.sheet-foot .btn { flex: 1; }

/* ----- small dialog content ----- */
.dlg { padding: 22px 22px 18px; display: grid; gap: 12px; overflow-y: auto; }
.dlg h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; }
.dlg-msg { color: var(--muted); display: grid; gap: 8px; }
.dlg-msg b { color: var(--text); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.dlg-actions .btn { flex: 1 1 auto; }

/* >=700px: sheets become centred modal cards instead of bottom sheets */
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: 24px; max-height: 90dvh; }
  .sheet.tall { height: min(90dvh, 860px); }
}
