/* Confirm / prompt dialogs (dialog.js): a warm, rounded card with a serif title, in the style of Anthropic's apps. */

.dg { position: fixed; inset: 0; z-index: 25000; display: grid; place-items: center; padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.dg.is-in { opacity: 1; pointer-events: auto; }
.dg.is-out { opacity: 0; pointer-events: none; transition: opacity 0.24s ease-out; }
.dg__scrim { position: absolute; inset: 0; background: color-mix(in srgb, #1f1e1d 42%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dg__card {
  position: relative; width: min(27rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 1.25rem; background: var(--cf-surface); color: var(--cf-text); border: 1px solid var(--cf-border);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.06);
  opacity: 0; transform: translateY(12px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1), transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.dg.is-in .dg__card { opacity: 1; transform: none; }
.dg.is-out .dg__card { opacity: 0; transform: translateY(8px) scale(0.97); transition: opacity 0.22s ease-out, transform 0.24s ease-out; }

.dg__ico { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: 0.9rem; border-radius: 0.8rem; color: var(--cf-text-secondary); background: var(--cf-surface-2, var(--cf-surface-hover)); }
.dg--danger .dg__ico { color: #b42318; background: color-mix(in srgb, #ef4444 14%, transparent); }
.dg__title { margin: 0; font-family: var(--od-serif); font-size: 1.4rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.dg__msg { margin: 0.55rem 0 0; font-size: 0.93rem; line-height: 1.55; color: var(--cf-text-secondary); overflow-wrap: anywhere; }
.dg__quote { margin: 0.9rem 0 0; padding: 0.65rem 0.8rem; border-radius: 0.75rem; background: var(--cf-surface-2, var(--cf-surface-hover)); border: 1px solid var(--cf-border);
  font-size: 0.88rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; max-height: 7.5rem; overflow: auto; }
.dg__notes { margin: 0.8rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; font-size: 0.84rem; color: var(--cf-text-secondary); }
.dg__notes li { display: flex; gap: 0.5rem; align-items: flex-start; }
.dg__notes li::before { content: ""; flex: none; width: 0.35rem; height: 0.35rem; margin-top: 0.5rem; border-radius: 50%; background: var(--cf-text-muted); }

.dg__field { display: block; margin-top: 1rem; }
.dg__label { display: block; margin-bottom: 0.35rem; font-size: 0.8rem; color: var(--cf-text-secondary); }
.dg__label b { color: var(--cf-text); font-weight: 600; }
.dg__input { width: 100%; height: 2.6rem; padding: 0 0.8rem; border-radius: 0.7rem; border: 1px solid var(--cf-border-strong); background: var(--cf-surface); color: var(--cf-text); font: inherit; font-size: 0.93rem; outline: none; transition: border-color 0.14s, box-shadow 0.14s; }
.dg__input:focus { border-color: var(--al-blue, #3b82f6); box-shadow: 0 0 0 3px color-mix(in srgb, var(--al-blue, #3b82f6) 22%, transparent); }

.dg__err { display: block; min-height: 1.1rem; margin-top: 0.4rem; font-size: 0.78rem; line-height: 1.35; color: #b42318; }
.dg__err--block { margin: 0.7rem 0 0; min-height: 0; }
.dg__err--block:empty { display: none; }
.dg__hint { display: block; margin-top: 0.3rem; font-size: 0.76rem; line-height: 1.4; color: var(--cf-text-muted); }
.dg__textarea { height: auto; min-height: 4.6rem; padding: 0.6rem 0.8rem; resize: vertical; line-height: 1.45; }
.dg__select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385827a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; }
.dg__field + .dg__field, .dg__field + .dg__check { margin-top: 0.85rem; }
.dg__check small { display: block; margin-top: 0.15rem; }
.dg__check { display: flex; gap: 0.6rem; align-items: flex-start; margin-top: 1rem; font-size: 0.88rem; color: var(--cf-text-secondary); cursor: pointer; }
.dg__check input { appearance: none; -webkit-appearance: none; flex: none; width: 1.1rem; height: 1.1rem; margin: 0.1rem 0 0; border-radius: 0.3rem; border: 1.5px solid var(--cf-border-strong); background: var(--cf-surface); display: grid; place-items: center; cursor: pointer; transition: background-color 0.12s, border-color 0.12s; }
.dg__check input:checked { background: #1f1e1d; border-color: #1f1e1d; }
.dg__check input:checked::after { content: ""; width: 0.3rem; height: 0.55rem; margin-top: -0.1rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
:root[data-theme="dark"] .dg__check input:checked { background: #f5f4ee; border-color: #f5f4ee; }
:root[data-theme="dark"] .dg__check input:checked::after { border-color: #1f1e1d; }
.dg__check input:focus-visible { outline: 2px solid var(--al-blue, #3b82f6); outline-offset: 2px; }

.dg__foot { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.4rem; }
.dg__btn { height: 2.5rem; padding: 0 1.1rem; border-radius: 0.75rem; font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background-color 0.14s, opacity 0.14s, transform 0.1s; }
/* Three choices (for example "Leave without saving?") stack as full-width buttons so no label wraps */
.dg__foot:has(.dg__btn:nth-child(3)) { flex-direction: column-reverse; }
.dg__foot:has(.dg__btn:nth-child(3)) .dg__btn { width: 100%; }
.dg__btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }
.dg__btn:active { transform: scale(0.97); }
.dg__btn:focus-visible { outline: 2px solid var(--al-blue, #3b82f6); outline-offset: 2px; }
.dg__btn--ghost { background: transparent; border-color: var(--cf-border-strong); color: var(--cf-text); }
.dg__btn--ghost:hover { background: var(--cf-surface-hover); }
.dg__btn--ink { background: #1f1e1d; color: #fff; }
.dg__btn--ink:hover { background: #3a3936; }
:root[data-theme="dark"] .dg__btn--ink { background: #f5f4ee; color: #1f1e1d; }
:root[data-theme="dark"] .dg__btn--ink:hover { background: #e2e0d6; }
.dg__btn--danger { background: #c2410c; color: #fff; }
.dg__btn--danger:hover { background: #9a3412; }
.dg__btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.dg__btn[disabled]:active { transform: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dg__check input:checked { background: #f5f4ee; border-color: #f5f4ee; }
  :root:not([data-theme="light"]) .dg__check input:checked::after { border-color: #1f1e1d; }
  :root:not([data-theme="light"]) .dg__btn--ink { background: #f5f4ee; color: #1f1e1d; }
  :root:not([data-theme="light"]) .dg__btn--ink:hover { background: #e2e0d6; }
}
@media (max-width: 520px) {
  .dg { place-items: end center; padding: 0.5rem; }
  .dg__foot { flex-direction: column-reverse; }
  .dg__btn { width: 100%; height: 2.8rem; }
}
@media (prefers-reduced-motion: reduce) { .dg, .dg__card { transition: none; } }

/* password field helpers: eye button and strength meter */
.dg__pw { position: relative; display: block; }
.dg__pw .dg__input { padding-right: 2.6rem; }
.dg__eye { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 0.5rem; background: transparent; color: var(--cf-text-muted); cursor: pointer; }
.dg__eye:hover { color: var(--cf-text); background: var(--cf-surface-hover); }
.dg__eye[aria-pressed="true"] { color: var(--al-blue, #3b82f6); }
.dg__meter { display: grid; grid-template-columns: 1fr; gap: 0.3rem; margin-top: 0.5rem; }
.dg__meter i { display: block; height: 4px; width: 0; border-radius: 9999px; background: #ef4444; transition: width 0.25s ease, background-color 0.25s ease; }
.dg__meter { position: relative; }
.dg__meter::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 9999px; background: var(--cf-border); z-index: 0; }
.dg__meter i { position: relative; z-index: 1; }
.dg__meter small { font-size: 0.76rem; color: var(--cf-text-muted); line-height: 1.35; margin-top: 0.15rem; }
.dg__meter[data-level="1"] i, .dg__meter[data-level="2"] i { background: #ef4444; }
.dg__meter[data-level="3"] i { background: #f59e0b; }
.dg__meter[data-level="4"] i { background: #22c55e; }
.dg__meter[data-level="5"] i { background: #16a34a; }
