/* Shared dialog presentation. Receipt and calendar layouts retain their purpose. */
dialog {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 28px 90px #001b3850;
  max-height: calc(100dvh - 36px);
}
dialog::backdrop {
  background: #071d356e;
  backdrop-filter: blur(5px);
}
dialog[open] {
  animation: shared-modal-enter 180ms ease-out;
}
dialog.confirmation-dialog {
  padding: 28px;
  width: min(500px, calc(100% - 28px));
  overflow: auto;
}
dialog.confirmation-dialog.has-preview {
  width: min(850px, calc(100% - 28px));
}

dialog.confirmation-dialog.delete-dialog {
  width: min(400px, calc(100% - 32px));
  padding: 30px 26px 26px;
  text-align: center;
}

dialog.confirmation-dialog.delete-dialog > h2 {
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 0;
  margin: 0 0 12px;
  border: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

dialog.delete-dialog .modal-heading-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  color: #f43f5e;
  background: #fff0f3;
  font-size: 26px;
}

dialog.confirmation-dialog.delete-dialog > p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

dialog.delete-dialog .confirmation-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  padding: 0;
  border: 0;
}

dialog.delete-dialog .confirmation-actions .btn {
  flex: 1;
  min-width: 120px;
  border-radius: 24px;
}

dialog.delete-dialog .confirmation-actions .btn-primary {
  color: #ffffff;
  background: #f43f5e;
  border-color: #f43f5e;
}

dialog.delete-dialog .confirmation-actions .btn-primary:hover {
  color: #ffffff;
  background: #df2446;
  border-color: #df2446;
}

[data-theme='dark'] dialog.delete-dialog .modal-heading-icon {
  color: #ff8c9f;
  background: #45212d;
}

dialog.confirmation-dialog.success-dialog {
  width: min(400px, calc(100% - 32px));
  padding: 32px 26px 26px;
  text-align: center;
}

dialog.confirmation-dialog.success-dialog > h2 {
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  font-size: 1.65rem;
  font-weight: 800;
}

.success-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 50%;
  color: #ffffff;
  background: #0cbd29;
  font-size: 34px;
  line-height: 1;
}

dialog.confirmation-dialog.success-dialog > p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

dialog.success-dialog .confirmation-actions {
  justify-content: center;
  margin-top: 24px;
  padding: 0;
  border: 0;
}

dialog.success-dialog .confirmation-actions .btn {
  min-width: 120px;
}
dialog.confirmation-dialog > h2,
.customer-import-heading h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--color-ink);
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}
dialog.confirmation-dialog > h2::before,
.customer-import-heading h2::before {
  content: none;
}
.modal-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  font-size: 24px;
  color: #087de0;
  background: #e0f2ff;
}
.modal-heading-icon.is-success {
  color: #079650;
  background: #ddf8e9;
}
.modal-heading-icon.is-danger {
  color: #dc2626;
  background: #fff1f2;
}
[data-theme='dark'] .modal-heading-icon {
  background: #153b50;
  filter: brightness(1.35);
}
dialog.confirmation-dialog > p {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--color-ink-muted);
}
dialog .confirmation-actions {
  gap: 10px;
  padding-top: 20px;
  margin-top: 22px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}
dialog .btn {
  min-height: 42px;
  border-radius: 7px;
}
dialog .btn-primary {
  background: #087fa3;
  border-color: #087fa3;
  color: white;
}
dialog .btn-primary:hover {
  background: #066781;
  border-color: #066781;
}
dialog button:focus-visible {
  outline: 2px solid #1ca0bc;
  outline-offset: 3px;
}
dialog :is(input, select, textarea):is(:focus, :focus-visible) {
  outline: none;
  box-shadow: none;
  border-color: var(--color-primary, #087fa3);
}
dialog.customer-import-dialog {
  width: min(600px, calc(100% - 28px));
}
.customer-import-heading {
  padding: 22px 24px;
  gap: 16px;
}
.customer-import-heading h2 {
  padding: 0;
  margin: 0;
  border: 0;
  font-size: 1.05rem;
}
dialog.customer-import-dialog .admin-body {
  padding: 24px;
}
@keyframes shared-modal-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 480px) {
  dialog.confirmation-dialog {
    padding: 20px;
  }
  dialog.confirmation-dialog > h2 {
    font-size: 1.05rem;
  }
  dialog .confirmation-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .customer-import-heading,
  dialog.customer-import-dialog .admin-body {
    padding: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open] {
    animation: none;
  }
}
@media print {
  dialog {
    box-shadow: none;
  }
}

.entry-modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.entry-modal-heading h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.4;
}
.entry-modal-heading > .btn { flex-shrink: 0; }
.entry-modal-description { margin: 0; line-height: 1.6; }
dialog.ledger-setup-dialog.confirmation-dialog {
  width: min(600px, calc(100% - 28px));
  padding: 28px;
}
#ledgerSetupDialog #ledgerSetupForm {
  padding: 0;
  gap: 20px;
}

/* Keep close controls to one border, including keyboard focus. */
dialog :is(button[aria-label^='Close'], .receipt-close, .setup-modal-close):is(:focus, :focus-visible) {
  outline: none;
  box-shadow: none;
  border-color: var(--color-primary, #087fa3);
  background: var(--table-heading);
}
