/* ---------------------------------------------------------------------------
   Minimal confirmation dialogs (SweetAlert2)

   Applies to every modal in the app without touching the call sites. Toasts are
   excluded on purpose: they already have their own compact look.

   Colours are forced because the sweetalert flash-message package styles its
   buttons inline, which would otherwise win over these rules.
--------------------------------------------------------------------------- */

.swal2-popup:not(.swal2-toast) {
    width: 20.5rem;
    max-width: calc(100vw - 2rem);
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: .75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
    font-size: .875rem;
}

/* Scale the whole icon rather than resizing it: the success and error glyphs
   are built from absolutely positioned pieces that do not survive a resize.
   The negative margins claw back the space the full-size icon still reserves. */
.swal2-popup:not(.swal2-toast) .swal2-icon {
    transform: scale(.52);
    margin: -.85em auto -.6em;
    border-width: .2em;
}

/* The icon's entry animation keyframes set their own transform, which would
   drop the scale above and flash the icon at full size. The glyphs inside keep
   their animations; only the container's is dropped. */
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-icon-show {
    animation: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-title {
    margin: 0;
    padding: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    color: #101828;
}

.swal2-popup:not(.swal2-toast) .swal2-html-container {
    margin: .4rem 0 0;
    padding: 0;
    font-size: .8125rem;
    font-weight: 400;
    line-height: 1.5;
    color: #667085;
    overflow: visible;
}

.swal2-popup:not(.swal2-toast) .swal2-actions {
    margin: 1.25rem 0 0;
    gap: .5rem;
    width: 100%;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm,
.swal2-popup:not(.swal2-toast) .swal2-cancel,
.swal2-popup:not(.swal2-toast) .swal2-deny {
    margin: 0 !important;
    padding: .45rem 1.1rem !important;
    min-width: 5.75rem;
    border: 1px solid transparent !important;
    border-radius: .4rem !important;
    font-size: .8125rem !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
    transition: background-color .15s ease, border-color .15s ease;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
}

/* Added by swal-minimal.js when the confirm button reads as destructive. */
.swal2-popup:not(.swal2-toast) .swal2-confirm.swal2-confirm-danger {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm.swal2-confirm-danger:hover {
    background: #bb2d3b !important;
    border-color: #bb2d3b !important;
}

.swal2-popup:not(.swal2-toast) .swal2-cancel {
    background: #fff !important;
    border-color: #d0d5dd !important;
    color: #475467 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-cancel:hover {
    background: #f9fafb !important;
    border-color: #98a2b3 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-deny {
    background: #fff !important;
    border-color: #fda29b !important;
    color: #b42318 !important;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm:focus,
.swal2-popup:not(.swal2-toast) .swal2-cancel:focus,
.swal2-popup:not(.swal2-toast) .swal2-deny:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .2) !important;
}

.swal2-popup:not(.swal2-toast) .swal2-confirm.swal2-confirm-danger:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .22) !important;
}

/* Inputs, when a dialog asks for one. */
.swal2-popup:not(.swal2-toast) .swal2-input,
.swal2-popup:not(.swal2-toast) .swal2-textarea,
.swal2-popup:not(.swal2-toast) .swal2-select {
    margin: .9rem 0 0;
    padding: .45rem .7rem;
    height: auto;
    border: 1px solid #d0d5dd;
    border-radius: .4rem;
    box-shadow: none;
    font-size: .8125rem;
}

.swal2-popup:not(.swal2-toast) .swal2-validation-message {
    margin: .75rem 0 0;
    padding: .4rem .7rem;
    border-radius: .4rem;
    font-size: .75rem;
    background: #fef3f2;
    color: #b42318;
}

.swal2-popup:not(.swal2-toast) .swal2-close {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1.5rem;
    color: #98a2b3;
    box-shadow: none !important;
}

.swal2-popup:not(.swal2-toast) .swal2-timer-progress-bar {
    background: rgba(37, 99, 235, .3);
}

.swal2-backdrop-show {
    background: rgba(15, 23, 42, .4);
}

/* ---------------------------------------------------------------------------
   Toasts (top-right)

   Both the server-side flash messages and, via swal-minimal.js, every plain
   success / error dialog land here.
--------------------------------------------------------------------------- */

.swal2-container.swal2-top-end,
.swal2-container.swal2-top-right {
    padding: 1rem;
}

.swal2-popup.swal2-toast {
    width: auto;
    min-width: 15rem;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: .7rem .85rem;
    border: 1px solid #eaecf0;
    border-radius: .6rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
    background: #fff;
}

.swal2-popup.swal2-toast .swal2-title {
    margin: 0;
    padding: 0;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.45;
    color: #101828;
    text-align: left;
}

.swal2-popup.swal2-toast .swal2-html-container {
    margin: .1rem 0 0;
    padding: 0;
    font-size: .75rem;
    line-height: 1.45;
    color: #667085;
    text-align: left;
    overflow: visible;
}

/* Only the spacing is touched here. The toast icon's tick and cross are laid
   out in em units against the library's own box, so resizing it breaks them. */
.swal2-popup.swal2-toast .swal2-icon {
    margin: 0 .6rem 0 0;
}

.swal2-popup.swal2-toast .swal2-close {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
    color: #98a2b3;
    box-shadow: none !important;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar-container {
    height: .1875rem;
    border-radius: 0 0 .6rem .6rem;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar {
    background: rgba(16, 24, 40, .14);
}

/* A hint of the message's colour, so success and error read apart instantly.
   :has() keys off the icon sweetalert renders, which works for the toasts the
   flash-message package fires too. Where it is unsupported the toast simply
   has no coloured edge; the icon still says which it is. */
.swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) {
    border-left: 3px solid #12b76a;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-error) {
    border-left: 3px solid #f04438;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-warning) {
    border-left: 3px solid #f79009;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-info),
.swal2-popup.swal2-toast:has(.swal2-icon.swal2-question) {
    border-left: 3px solid #2563eb;
}
