/* ── Native <dialog> modal ─────────────────────────────── */

dialog.app-dialog[open] {
  display: flex;
  flex-direction: column;
  margin: auto;
  padding: 0;
  width: 500px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 64px);
  border: 1px solid var(--sts-color-border, #b8c4d1);
  border-radius: 10px;
  background: #fff;
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.14),
    0 1px 4px rgba(15, 23, 42, 0.08);
  color: var(--sts-color-text, #1f2937);
  overflow: hidden;
}

dialog.app-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(1px);
}

/* Header */

.app-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--sts-color-border, #b8c4d1);
  flex-shrink: 0;
  background: var(--sts-color-surface-subtle, #f3f6f9);
  cursor: move;
  user-select: none;
  touch-action: none;
}

.app-dialog__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sts-color-block-title, #17446f);
  line-height: 1.4;
}

.app-dialog__close-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--sts-color-text-muted, #475569);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.app-dialog__close-x:hover {
  color: var(--sts-color-text, #1f2937);
  background: var(--sts-color-surface-tinted, #e6ebf1);
  border-color: var(--sts-color-border, #b8c4d1);
}

/* Body */

.app-dialog__body {
  flex: 1 1 auto;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

/* Footer */

.app-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--sts-color-border, #b8c4d1);
  flex-shrink: 0;
  background: var(--sts-color-surface-subtle, #f3f6f9);
}

/* ── Error state ────────────────────────────────────────── */

.app-dialog-error {
  padding: 20px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  text-align: center;
}

.app-dialog-error p {
  margin: 0;
}
