.mp-dialog {
  --sheet-edge: clamp(1.35rem, 3.5vw, 3.25rem);
  --sheet-gap: clamp(2rem, 4vw, 4.5rem);
  position: fixed;
  inset: auto 0 max(1.25rem, env(safe-area-inset-bottom));
  width: min(var(--layout-width), 66rem);
  max-width: none;
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--sand-dark);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.52 var(--body);
}
.mp-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.5fr);
  grid-template-rows: minmax(0, 1fr);
}
.mp-dialog:not([open]), .mp-dialog [hidden] { display: none; }
.mp-dialog::backdrop { background: rgb(39 32 26 / 34%); }
html:has(.mp-dialog[open]) { overflow: hidden; }
.mp-dialog__heading {
  container-type: inline-size;
  padding: var(--sheet-edge) 0 var(--sheet-edge) var(--sheet-edge);
}
.mp-dialog__signature { display: block; width: 7.6rem; max-width: 62%; height: auto; }
.mp-dialog h2 {
  margin: clamp(1.1rem, 2.3vw, 2.2rem) 0 0;
  max-width: 13ch;
  font: 700 2.5rem/1.04 var(--display);
  font-size: clamp(1.8rem, 13.2cqi, 3rem);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.mp-dialog h2:focus { outline: 0; }
.mp-dialog__close {
  position: absolute;
  z-index: 1;
  inset: .55rem .55rem auto auto;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.mp-dialog__close span { display: grid; width: 1.05rem; }
.mp-dialog__close span::before, .mp-dialog__close span::after {
  content: "";
  grid-area: 1 / 1;
  height: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
}
.mp-dialog__close span::after { transform: rotate(-45deg); }
.mp-dialog__content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sheet-edge) max(var(--sheet-edge), 3.65rem) 1.15rem var(--sheet-gap);
  scroll-padding-block: 1rem;
}
.mp-dialog p { margin: 0; max-width: 57ch; overflow-wrap: anywhere; }
.mp-dialog [data-partner-disclosure] { margin-top: .7rem; }
.mp-dialog .mp-dialog__note {
  margin-top: .85rem;
  color: var(--ch500);
  font: 400 .9rem/1.45 var(--body);
}
.mp-dialog__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  column-gap: .6rem;
  margin-top: 1.3rem;
}
.mp-dialog__actions button {
  min-width: 0;
  min-height: 2.85rem;
  padding: .55rem .45rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: 550 1rem/1.3 var(--body);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.mp-dialog__actions [data-partner-choice="managed"] { background: var(--ink); color: var(--paper); }
.mp-dialog__link {
  min-height: 2.75rem;
  margin-top: .2rem;
  padding: .35rem 0;
  border: none;
  background: transparent;
  color: var(--oxide-text);
  font: 600 1rem/1.35 var(--body);
  text-decoration: underline;
  text-underline-offset: .2em;
}

.mp-dialog__ledger { margin-top: 1.15rem; border-top: 1px solid var(--rule); }
.mp-dialog__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1.4rem;
  gap: .2rem .65rem;
  align-items: baseline;
  padding-block: .85rem;
  border-bottom: 1px solid var(--rule);
}
.mp-dialog__row-name { grid-area: 1 / 1; font: 600 1rem/1.35 var(--mono); overflow-wrap: anywhere; }
.mp-dialog__row small { grid-area: 1 / 2; color: var(--ch500); font: 400 .875rem/1.4 var(--body); }
.mp-dialog__detail { grid-area: 2 / 1 / 3 / 3; font: 400 .9375rem/1.5 var(--body); }
.mp-dialog__row input {
  grid-area: 1 / 3;
  align-self: center;
  justify-self: end;
  width: 1.16rem;
  height: 1.16rem;
  margin: 0;
  accent-color: var(--oxide-text);
}
.mp-dialog__row:has(input:enabled), .mp-dialog__row input:enabled { cursor: pointer; }
.mp-dialog :is(button, input):focus-visible { outline: 2px solid var(--oxide-text); outline-offset: 3px; }
.mp-feedback { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mp-feedback:not(:empty) {
  position: fixed;
  z-index: 100;
  inset: auto 1rem 1rem auto;
  width: max-content;
  max-width: calc(100% - 2rem);
  height: auto;
  padding: .55rem .8rem;
  clip-path: none;
  white-space: normal;
  pointer-events: none;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--canvas);
  font: 400 .9375rem/1.45 var(--body);
}
@media (hover: hover) {
  .mp-dialog__actions button:hover { background: var(--ink); color: var(--paper); }
  .mp-dialog__actions [data-partner-choice="managed"]:hover { background: var(--chapter); }
  .mp-dialog__link:hover { color: var(--ink); text-decoration-thickness: 2px; }
  .mp-dialog__close:hover { color: var(--oxide-text); }
  .mp-dialog__row:has(input:enabled):hover .mp-dialog__row-name { color: var(--oxide-text); }
}
@media (max-width: 49rem) {
  .mp-dialog {
    --sheet-edge: clamp(1rem, 4vw, 1.75rem);
    width: min(37rem, calc(100% - 1.25rem));
    inset-block-end: max(.625rem, env(safe-area-inset-bottom));
  }
  .mp-dialog[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .mp-dialog__heading { padding: 1.05rem var(--sheet-edge) .85rem; }
  .mp-dialog__signature { width: 6rem; }
  .mp-dialog h2 { margin-top: .7rem; max-width: none; font-size: clamp(1.8rem, 5vw, 2.45rem); }
  .mp-dialog__content { padding: 0 var(--sheet-edge) .75rem; }
}
@media (max-width: 32rem) {
  .mp-dialog__actions { grid-template-columns: minmax(0, 1fr); row-gap: .45rem; }
  .mp-dialog__row { grid-template-columns: minmax(0, 1fr) 1.4rem; }
  .mp-dialog__row small { grid-area: auto / 1; }
  .mp-dialog__row input { grid-area: 1 / 2; }
  .mp-dialog__detail { grid-area: auto / 1; }
}
@media (max-height: 25rem) {
  .mp-dialog[open] { overflow-y: auto; overscroll-behavior: contain; grid-template-rows: auto; }
  .mp-dialog__content { overflow: visible; }
}
@media (prefers-reduced-motion: no-preference) {
  .mp-dialog[open] { animation: mp-appear 130ms ease-out; }
  @keyframes mp-appear { from { opacity: 0; } }
}
