/* Modal — v2 Figma node 1089:7195. Native <dialog>: white box, 12px radius,
   header with title + close, body, optional footer. */

dialog.modal {
  position: fixed;
  inset: 0;
  display: none;
  height: fit-content;
  max-height: calc(100dvh - var(--secan-space-2xl));
  margin: auto;
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: var(--secan-radius-3);
  background-color: var(--secan-white);
  color: var(--secan-black);
  box-shadow: var(--secan-shadow-3);
  width: 560px;
  max-width: calc(100vw - var(--secan-space-2xl));
}

dialog.modal[open] {
  display: block;
}

dialog.modal.modal--small {
  width: 400px;
}

dialog.modal.modal--medium {
  width: 560px;
}

dialog.modal.modal--large {
  width: 760px;
}

/* Wide report modals (member chart modals, Figma 3:22705, 1237px). Below
   desktop they become a full-screen sheet: no frames exist for tablet or
   mobile, and wide year tables scroll inside it. */
dialog.modal.modal--xlarge {
  width: 1237px;
}

@media (max-width: 1023px) {
  dialog.modal.modal--xlarge {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

dialog.modal::backdrop {
  background-color: rgba(16, 16, 16, 0.5);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--secan-space-s);
  padding: var(--secan-space-m);
  border-bottom: 1px solid var(--secan-input-bg);
}

.modal__title {
  margin: 0;
  font-family: var(--secan-font-heading);
  font-weight: var(--secan-fw-bold);
  font-size: var(--secan-fs-h6);
  line-height: var(--secan-lh-h6);
  color: var(--secan-black);
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--secan-radius-pill);
  background: transparent;
  color: var(--secan-gray-dark);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}

.modal__close:hover {
  background-color: var(--secan-container-hover);
}

.modal__close:focus-visible {
  outline: none;
  box-shadow: var(--secan-focus-ring);
}

.modal__close svg {
  display: block;
  width: 20px;
  height: 20px;
}

.modal__body {
  padding: var(--secan-space-l);
  font-family: var(--secan-font-body);
  font-size: var(--secan-fs-body);
  line-height: var(--secan-lh-body);
  color: var(--secan-gray);
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--secan-space-xs);
  padding: var(--secan-space-s);
}

@media (max-width: 480px) {
  dialog.modal {
    max-height: calc(88dvh - var(--secan-space-2xl));
  }
}