/* cignyl-sftp 20260824 */
/* ------------------------------ */
/* v2 Modal                       */
/* ------------------------------ */

/* Scroll lock while any v2 Modal with lockScroll=true is open (JS-managed) */
body.v2-modal-body-locked {
  overflow: hidden;
}

.v2-theme .v2-modal-wrapper {
  display: contents;
}

.v2-theme .v2-modal__trigger {
  display: inline-block;
  cursor: pointer;
}

.v2-theme .v2-modal__trigger[data-v2-hidden="true"] {
  display: none;
}

.v2-theme .v2-modal__trigger:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius);
}

.v2-theme .v2-modal {
  --v2-modal-width: auto; /* Custom width via CSS var (set by JS when width config is provided) */

  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Must be higher than any app chrome (sticky headers/tabs) + third party layers (PDF.js, Maps labels, etc.) */
  /* Base z-index set by JS (2147483000 + stack index) */
  isolation: isolate; /* ensure overlay/content z-index are self-contained */
  pointer-events: none; /* enabled only when open */
}

.v2-theme .v2-modal[data-state="open"] {
  pointer-events: auto;
}

/* Size tokens */
.v2-theme .v2-modal--size-xsm .v2-modal__content {
  width: 20rem;
  max-width: calc(100vw - 2rem);
}
.v2-theme .v2-modal--size-sm .v2-modal__content {
  width: 24rem;
  max-width: calc(100vw - 2rem);
}
.v2-theme .v2-modal--size-default .v2-modal__content {
  width: 32rem;
  max-width: calc(100vw - 2rem);
}
.v2-theme .v2-modal--size-lg .v2-modal__content {
  width: 42rem;
  max-width: calc(100vw - 2rem);
}
.v2-theme .v2-modal--size-xlg .v2-modal__content {
  width: 56rem;
  max-width: calc(100vw - 2rem);
}

/* Custom width (when width config is provided) */
.v2-theme .v2-modal[style*="--v2-modal-width"] .v2-modal__content {
  width: var(--v2-modal-width);
  max-width: calc(100vw - 2rem);
}

.v2-theme .v2-modal__overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.60);
  opacity: 0;
  transition: opacity 150ms ease;
}

.v2-theme .v2-modal__overlay[data-state="open"] {
  opacity: 1;
}

.v2-theme .v2-modal__overlay[data-v2-hidden="true"] {
  display: none;
}

.v2-theme .v2-modal__content {
  position: relative;
  z-index: 1;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 30px hsl(0 0% 0% / 0.25);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  /* transform: none in the open state avoids creating a containing block,
     which allows nested position:fixed children (e.g. nested modals) to
     reference the viewport instead of being trapped inside this element. */
  transform: scale(0.95);
  opacity: 0;
  transition: transform 150ms ease, opacity 150ms ease;
}

.v2-theme .v2-modal__content[data-state="open"] {
  transform: none;
  opacity: 1;
}

.v2-theme .v2-modal__content-inner {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
}

.v2-theme .v2-modal__header {
  padding: var(--v2-space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--v2-space-md);
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.v2-theme .v2-modal__header-left {
  flex: 1 1 auto;
  min-width: 0;
}

.v2-theme .v2-modal__title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.v2-theme .v2-modal__description {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.35;
  color: hsl(var(--muted-foreground));
}

.v2-theme .v2-modal__close {
  all: unset;
  box-sizing: border-box;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
  flex-shrink: 0;
  margin-left: auto;
}

.v2-theme .v2-modal__close:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.v2-theme .v2-modal__close:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.v2-theme .v2-modal__close-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.v2-theme .v2-modal__body {
  padding: var(--v2-space-md);
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.v2-theme .v2-modal__body-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--background) / 0.9);
  backdrop-filter: blur(2px);
}

.v2-theme .v2-modal__body-loading.v2-is-hidden {
  display: none;
}

.v2-theme .v2-modal__body-loading-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-theme .v2-modal__error {
  padding: var(--v2-space-lg);
  color: hsl(var(--destructive));
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.5;
}

.v2-theme .v2-modal__footer {
  padding: var(--v2-space-md);
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .v2-theme .v2-modal__overlay,
  .v2-theme .v2-modal__content {
    transition: none !important;
  }
}
