/* A shared, mobile-first shelf for product links and birthdays. */
.shelf-dialog.glass-dialog {
  --sheet-limit: min(84dvh, 770px, var(--sheet-available));
  --shelf-ink: #edf9f7;
  --shelf-muted: #b7cfd5;
  --shelf-line: #b4eaf040;
  --shelf-focus: #abfce5;
  inset: 0;
  margin: auto;
  padding: 0;
  width: min(568px, calc(100vw - 28px));
  max-width: none;
  max-height: var(--sheet-limit);
  overflow: hidden;
  border: 1px solid #b6e8ed92;
  border-radius: 24px;
  color: var(--shelf-ink);
  background:
    radial-gradient(ellipse at 16% -10%, #aaf2ef3c, transparent 53%),
    linear-gradient(147deg, #294c5bee, #193641ef 46%, #122936f5);
  box-shadow: inset 0 1px 2px #e7ffffb5, inset 0 0 0 3px #d1f6fb19, 0 21px 65px #001017b5;
  backdrop-filter: blur(13px) saturate(115%);
  animation: none;
}

.shelf-dialog::backdrop {
  background: #04172291;
  backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity 175ms cubic-bezier(.17, .8, .28, 1);
}

.shelf-dialog[data-phase="exit"] { pointer-events: none; }
.shelf-dialog[data-phase="exit"]::backdrop { opacity: 0; transition-duration: 115ms; }

@starting-style {
  .shelf-dialog[open]::backdrop { opacity: 0; }
}

.shelf-frame { display: flex; flex-direction: column; min-height: 0; max-height: calc(var(--sheet-limit) - 2px); }
.shelf-head {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 18px 12px; flex: none; border-bottom: 1px solid var(--shelf-line);
}
.shelf-head h2 { margin: 0; color: var(--shelf-ink); font-size: clamp(20px, 5vw, 26px); line-height: 1.16; font-weight: 720; letter-spacing: -.025em; overflow-wrap: anywhere; }
.shelf-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 15px 18px 18px; scrollbar-color: #9dcbd47a transparent; }
.shelf-body p { margin: 0; }
.shelf-icon { flex: 0 0 17px; width: 17px; height: 17px; }
.shelf-close .shelf-icon { width: 20px; height: 20px; flex-basis: 20px; }

.shelf-icon-button, .shelf-primary, .shelf-secondary, .shelf-danger, .shelf-text-button {
  appearance: none; min-height: 44px; margin: 0;
  color: var(--shelf-ink); font: inherit; font-size: .9rem; font-weight: 650;
  display: inline-flex; justify-content: center; align-items: center; gap: 7px;
  align-self: stretch; padding: 8px 13px; border: 1px solid transparent; border-radius: 11px;
  cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.shelf-icon-button {
  width: 44px; height: 44px; padding: 0; flex: 0 0 44px; align-self: center;
  color: #bde0e6; border-color: #b6e8ed2a; background: #15334287;
}
.shelf-close { border-radius: 50%; }
.shelf-primary {
  border-color: #c3fff4a8; background: linear-gradient(155deg, #c0ffed, #86dfd1);
  box-shadow: inset 0 1px 2px #edfffada, 0 3px 8px #08292359; color: #0c302b;
}
.shelf-secondary { background: #153342be; border-color: #c0e8ef42; }
.shelf-danger { background: #6b3044; border-color: #ffc9d485; color: #ffeff2; }
.shelf-text-button { background: transparent; padding-inline: 5px; font-size: .84rem; color: #c4e7e9; }
.shelf-text-button[aria-pressed="true"] { color: #ffcec7; }
.shelf-icon-button:active, .shelf-primary:active, .shelf-secondary:active, .shelf-danger:active { transform: scale(.975); }

.shelf-dialog :is(button, input, select, summary, a):focus-visible {
  outline: 2px solid var(--shelf-focus); outline-offset: 3px;
}
.shelf-dialog button:disabled { opacity: .58; cursor: wait; }

.shelf-toolbar { display: flex; margin-bottom: 11px; }
.shelf-toolbar > .shelf-primary { text-align: center; }
.shelf-list { display: grid; width: 100%; gap: 0; padding: 0; margin: 0; list-style: none; }
.shelf-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; column-gap: 5px;
  min-height: 64px; border-bottom: 1px solid var(--shelf-line);
}
.shelf-row:first-child { border-top: 1px solid var(--shelf-line); }
.shelf-row-main, .shelf-row-link {
  min-width: 0; min-height: 56px; padding: 7px 3px;
  display: grid; grid-template-columns: 39px minmax(0, 1fr); align-items: center; column-gap: 9px;
}
.shelf-row-link { color: var(--shelf-ink); text-decoration: none; border-radius: 8px; }
.shelf-row-thumb {
  display: grid; place-items: center; box-sizing: border-box;
  width: 39px; height: 39px; border-radius: 9px; object-fit: cover; color: #b9f1e7;
  background: #2b5b686e; border: 1px solid #bbf2f145; flex: none;
}
.shelf-row-content { display: grid; min-width: 0; gap: 2px; }
.shelf-row-title { color: var(--shelf-ink); font-size: .99rem; font-weight: 710; line-height: 1.26; overflow-wrap: anywhere; }
.shelf-row-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 6px; min-width: 0; color: var(--shelf-muted); font-size: .78rem; line-height: 1.36; overflow-wrap: anywhere; }
.shelf-row-emphasis { color: #c0ebe6; font-weight: 670; font-variant-numeric: tabular-nums; }
.shelf-row-next { color: var(--shelf-muted); font-weight: 475; }
.shelf-row-reminders { align-items: center; }
.shelf-row-reminders .shelf-icon { flex-basis: 13px; width: 13px; height: 13px; }
.shelf-row-edit { border-color: transparent; background: transparent; }
.shelf-empty, .shelf-muted { color: var(--shelf-muted); font-size: .84rem; line-height: 1.43; }
.shelf-body p.shelf-empty { padding-block: 9px 5px; }

.shelf-body p.shelf-note {
  display: flex; align-items: center; gap: 7px; padding: 5px 8px; margin-bottom: 9px;
  border-radius: 8px; background: #21695235; color: #ccffeb; font-size: .82rem; overflow-wrap: anywhere;
}
.shelf-body p.shelf-note[hidden] { display: none; }
.shelf-body p.shelf-note[data-tone="error"] { background: #6b2e4772; color: #ffdedc; }
.shelf-form p.shelf-note { margin: 0; }

.shelf-form, .shelf-disclosure-body, .shelf-field { min-width: 0; display: grid; gap: 10px; }
.shelf-field { gap: 5px; }
.shelf-field > span:first-child, .shelf-reminders legend { color: #cde2e6; font-size: .82rem; font-weight: 640; }
.shelf-field input:not([type="file"]), .shelf-field select {
  box-sizing: border-box; min-width: 0; min-height: 46px; width: 100%; padding: 8px 10px;
  border: 1px solid #b4e0ea4f; border-radius: 9px; background: #102a36ed;
  color: var(--shelf-ink); font: inherit; font-size: 1rem; text-overflow: ellipsis;
}
.shelf-field input::placeholder { color: #9cbdc2; }
.shelf-field:has(select) { position: relative; }
.shelf-field:has(select)::after {
  content: ''; pointer-events: none; position: absolute; right: 13px; bottom: 20px;
  width: 7px; height: 7px; border-right: 1.5px solid #c1e6e9; border-bottom: 1.5px solid #c1e6e9;
  transform: rotate(45deg);
}
.shelf-field select { appearance: none; padding-inline-end: 30px; }
.shelf-date-fields, .shelf-product-extra { min-width: 0; display: grid; gap: 8px; grid-template-columns: minmax(72px, .7fr) minmax(0, 1.3fr); }
.shelf-field-hint { color: #c0e9df; font-size: .78rem; margin-top: -6px; }
.shelf-disclosure {
  border: 1px solid var(--shelf-line); border-radius: 11px;
  background: #17344280; min-width: 0;
}
.shelf-disclosure > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 7px; min-height: 44px;
  padding: 5px 10px; border-radius: 9px; cursor: pointer; list-style: none;
  color: #d7edee; font-size: .84rem; font-weight: 630;
}
.shelf-disclosure > summary::-webkit-details-marker { display: none; }
.shelf-disclosure > summary .shelf-icon { transition: transform 160ms ease; }
.shelf-disclosure[open] > summary .shelf-icon { transform: rotate(180deg); }
.shelf-disclosure-body { padding: 0 10px 11px; }
.shelf-file-target {
  position: relative; box-sizing: border-box; min-width: 0; min-height: 46px; display: flex; align-items: center;
  gap: 6px; border: 1px solid #b4e0ea54; border-radius: 9px; padding: 6px 8px;
  color: #d4efee; background: #1437479c; font-size: .82rem; font-weight: 625;
}
.shelf-file-target input[type="file"], .shelf-choice input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.shelf-file-target > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-file-target:focus-within, .shelf-choice:focus-within { outline: 2px solid var(--shelf-focus); outline-offset: 2px; }
.shelf-photo-preview { display: flex; gap: 7px; align-items: center; }
.products-form[data-remove-photo="true"] .shelf-photo-preview img { opacity: .36; }
.shelf-link { display: inline-flex; gap: 6px; width: fit-content; min-height: 44px; align-items: center; color: #b8eee2; font-size: .83rem; text-decoration: none; border-radius: 5px; }

.shelf-reminders { min-width: 0; border: 0; margin: 0; padding: 0; }
.shelf-reminders legend { margin-bottom: 5px; }
.shelf-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.shelf-choice {
  position: relative; display: flex; justify-content: center; align-items: center; gap: 5px; min-height: 44px;
  padding: 5px 3px; border: 1px solid #a9dfe444; border-radius: 9px; cursor: pointer;
  background: #102b38b8; color: #c8dfe3; font-size: clamp(.72rem, 3.2vw, .82rem); font-weight: 630; line-height: 1.1;
}
.shelf-choice-mark {
  width: 13px; height: 13px; flex: 0 0 13px; border-radius: 4px; display: grid; place-items: center;
  border: 1px solid #b8e3e38c; color: transparent;
}
.shelf-choice-mark .shelf-icon { width: 11px; height: 11px; }
.shelf-choice:has(input:checked) { color: #d8fff1; border-color: #abe9d89a; background: #2b655aa6; }
.shelf-choice input:checked + .shelf-choice-mark { color: #0a362d; border-color: #aae9d8; background: #aae9d8; }
.birthday-leap-note { color: #f0dfab; }

.shelf-actions {
  display: grid; grid-template-columns: minmax(0, .68fr) minmax(0, 1.32fr); gap: 7px;
  border-top: 1px solid var(--shelf-line); padding-top: 11px;
}
.shelf-actions button { min-width: 0; }
.shelf-delete > summary {
  width: fit-content; display: flex; align-items: center; min-height: 44px; padding: 0 5px; border-radius: 6px;
  cursor: pointer; color: #f5bfc4; font-size: .84rem; list-style: none;
}
.shelf-delete > summary::-webkit-details-marker { display: none; }
.shelf-confirm { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #f1a3b243; border-radius: 9px; background: #502a3c6b; }
.shelf-confirm p { color: #f9d4db; font-size: .83rem; }

@media (hover: hover) {
  .shelf-primary:hover { border-color: #e0fff8; }
  .shelf-icon-button:hover, .shelf-secondary:hover { background-color: #2b526398; border-color: #afe0e678; }
  .shelf-row-link:hover { background-color: #8bc9cf14; }
  .shelf-disclosure > summary:hover, .shelf-choice:hover { background-color: #91dfe112; }
  .shelf-delete > summary:hover { color: #ffeef0; }
}

@media (max-width: 760px) {
  .shelf-dialog.glass-dialog {
    --sheet-limit: min(92dvh, var(--sheet-available));
    inset: auto 0 0; width: min(540px, calc(100vw - 12px));
    margin: 0 auto var(--sheet-bottom);
    border-radius: 23px 23px 17px 17px;
  }
  .shelf-head { padding: 10px 12px 8px 14px; }
  .shelf-body { padding: 12px 13px 15px; }
  .shelf-row { min-height: 59px; }
  .shelf-row-main, .shelf-row-link { min-height: 54px; }
  .shelf-actions .shelf-primary, .shelf-actions .shelf-secondary { padding-inline: 6px; font-size: .86rem; }
}
:root[data-soft-keyboard] .shelf-dialog.glass-dialog {
  --sheet-limit: var(--sheet-available);
  inset: auto 0 0;
  margin: 0 auto var(--sheet-bottom);
}

@media (prefers-reduced-motion: reduce) {
  .shelf-dialog::backdrop, .shelf-dialog :is(button, summary .shelf-icon) { transition: none; }
  .shelf-dialog button:active { transform: none; }
}
