@layer components {
  /* Panels */
  .modal { padding: 0; border: 0; background: var(--bg); color: var(--ink); }
  .modal::backdrop { background: rgb(var(--shade) / .32); }
  .modal.panel { position: fixed; inset: 0 0 0 auto; width: min(72rem, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; overflow: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgb(var(--shade) / .14); transition: transform .22s ease, opacity .2s ease; }
  @starting-style { .modal.panel[open] { transform: translateX(40px); opacity: 0; } }
  .modal-close { position: sticky; top: 1.2rem; float: right; z-index: 3; display: grid; place-items: center; width: 3.4rem; height: 3.4rem; margin: 1.2rem 1.2rem 0 0; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 2rem; line-height: 1; cursor: pointer; }
  .modal-close:hover { color: var(--ink); border-color: var(--line-strong); }
  @media (max-width: 879px) {
    .modal.panel { inset: auto 0 0 0; width: 100%; height: 92dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 0; }
    @starting-style { .modal.panel[open] { transform: translateY(40px); } }
  }
  .panel-head { padding: 2.4rem 2.8rem 1.8rem; border-top: 4px solid var(--line-strong); border-bottom: 1px solid var(--line); background: var(--surface); }
  .panel-head.is-menu { border-top-color: var(--menu); }
  .panel-head.is-input { border-top-color: var(--input); }
  .panel-head.is-router { border-top-color: var(--router); }
  .panel-head.is-end { border-top-color: var(--end); }
  .panel-head.is-unknown { border-top-color: var(--error); }
  .panel-context { display: flex; align-items: center; gap: .6rem; margin: 0 0 .3rem; font-size: 1.3rem; font-weight: 550; color: var(--ink-3); }
  .panel-context .kind-icon { width: 1.8rem; height: 1.8rem; }
  .panel-title { margin: 0; font-family: var(--mono); font-size: 2.3rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
  /* A container, so the form grids inside collapse by the panel's own width, whether it is resized or the viewport is. */
  .panel-body { container: panel / inline-size; padding: 0 2.8rem; }
  .panel-form { padding-top: 1.6rem; }
  /* A panel with neither: nothing holds its content off the head or the bottom edge, so the body does it itself. */
  .panel-body:not(:has(.panel-form, .panel-actions)) { padding-block: 1.6rem 2.4rem; }
  .panel-actions { position: sticky; bottom: 0; z-index: 2; display: flex; gap: .8rem; margin: 2.4rem -2.8rem 0; padding: 1.2rem 2.8rem 1.6rem; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); }
  .danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; padding: 1.8rem 0 3rem; }
  .danger-zone .hint { margin: 0; }
}
