@scope (.dialog) {
  :scope {
    --_bg: var(--color-surface-raised);
    --_border: var(--color-border);
    --_radius: var(--radius-xl);
    --_shadow: var(--shadow-xl);
    --_width: min(32rem, 90vw);

    display: grid;
    grid-template-rows: auto 1fr auto;
    width: var(--_width);
    max-height: 90vh;
    background: var(--_bg);
    border: 1px solid var(--_border);
    border-radius: var(--_radius);
    box-shadow: var(--_shadow);
    padding: var(--space-xl);
  }

  :scope.dialog--wide {
    --_width: min(60rem, 92vw);
  }

  .dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-lg);
  }

  .dialog__title {
    font-size: var(--text-heading-4);
    font-weight: var(--font-semibold);
    color: var(--color-text-heading);
  }

  .dialog__body {
    color: var(--color-text);
    line-height: var(--leading-relaxed);
    overflow-y: auto;
    min-height: 0;
  }

  .dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
  }
}

@scope (.dialog-backdrop) {
  :scope {
    position: fixed;
    inset: 0;
    background: var(--color-surface-overlay);
    display: grid;
    place-items: center;
    z-index: var(--z-50);
    backdrop-filter: blur(4px);
  }
}
