.sheet {
  box-sizing: border-box;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(22, 26, 44, 0.22) transparent;
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius-tile);
  background: var(--glass-solid);
  box-shadow: var(--shadow-sheet);
  color: var(--ink);
  font-family: var(--font-body);
}

.sheet::backdrop {
  background: rgba(22, 26, 44, 0.16);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  backdrop-filter: blur(6px) saturate(1.2);
}

.sheet[open] { animation: sheet-in 0.42s var(--ease-expo); }

.sheet[open]::backdrop { animation: sheet-fade 0.3s ease-out; }

@supports (transition-behavior: allow-discrete) {
  .sheet {
    transition: opacity 0.2s ease-in, transform 0.2s ease-in, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
  }
  .sheet::backdrop {
    transition: opacity 0.2s ease-in, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
  }
  .sheet:not([open]) {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  .sheet:not([open])::backdrop { opacity: 0; }
}

.sheet form { margin: 0; }

.sheet-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.sheet-lede {
  margin: 0 0 20px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.sheet-field { margin: 0; }

.sheet-scope { margin: -2px -16px 2px; }

.sheet-error {
  margin: 10px 0 0;
  color: var(--bad);
  font-size: 14px;
}

.sheet-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  font-size: 14px;
}

.sheet-note {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.965); }
}

@keyframes sheet-rise {
  from { transform: translateY(calc(100% + 24px)); }
}

@media (max-width: 559px) {
  .sheet {
    width: calc(100% - 16px);
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto auto max(8px, env(safe-area-inset-bottom));
    padding: 24px 22px max(22px, env(safe-area-inset-bottom));
    border-radius: 30px;
  }
  .sheet[open] { animation: sheet-rise 0.46s var(--ease-expo); }
  @supports (transition-behavior: allow-discrete) {
    .sheet:not([open]) { transform: translateY(48px); }
  }
}

@keyframes sheet-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open],
  .sheet[open]::backdrop { animation: none; }
  .sheet,
  .sheet::backdrop { transition: none; }
}

.sheet-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 21px;
  background: var(--modal-icon-surface);
  box-shadow: var(--modal-icon-raised-shadow);
  isolation: isolate;
  color: #fffaf3;
}
.sheet-icon::before {
  content: '';
  position: absolute;
  inset: 4.5px;
  border-radius: 16.5px;
  background: linear-gradient(180deg, #76507c12, transparent 45%, #eeab690d);
  box-shadow: inset 0 1px 1px #8552921a, inset 0 -1px 1px #c7875514;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.sheet-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--modal-icon-rim);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.sheet-icon > :is(svg, .icon) {
  position: relative;
  width: 32px;
  height: 32px;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px #875c7333) drop-shadow(0 3px 3px #875c731c);
}
.sheet-icon [data-calendar-date] { fill: #92788f !important; }

.sheet-icon > .icon:not(.icon-google, .icon-outlook) { background: currentColor; }

.sheet-icon[data-theme="lip-gloss"] {
  --modal-icon-surface: var(--mesh-icon-lilac);
}
.sheet-icon[data-theme="peach"] {
  --modal-icon-surface: var(--mesh-icon-coral);
}

.sheet-icon::after {
  inset: 4.5px;
  border-radius: 16.5px;
  background-image: linear-gradient(110deg, transparent 32%, #ffffff80 48%, transparent 64%);
  background-size: 240% 100%, 100% 100%;
  background-position: 100% 0, 0 0;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 240ms ease;
  animation: sheet-icon-shine 6s linear infinite paused;
}
@media (hover: hover) and (pointer: fine) {
  .sheet-icon:hover::after { opacity: 1; animation-play-state: running; }
}
.sheet-icon:focus-visible::after,
.sheet-icon:focus-within::after { opacity: 1; animation-play-state: running; }
@keyframes sheet-icon-shine {
  from { background-position: 100% 0, 0 0; }
  to { background-position: 0% 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet-icon::after { animation: none; transition: none; background-position: 50% 0, 0 0; }
}

.sheet-icon-mesh { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; z-index: -1; }
.sheet-icon-mesh[hidden] { display: none; }
