/* Modales compartidos de TIOXAdmingas: Login, Menu y modulos internos. */
.app-dialog {
    --dialog-blue: #1e3a8a;
    --dialog-accent: #2563eb;
    --dialog-orange: #f15a29;
    --dialog-heading: #172554;
    --dialog-ink: #172033;
    --dialog-border: #d7e2ef;
    --dialog-text: #24324a;
    position: fixed;
    inset: 0;
    width: min(520px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    color: var(--dialog-text);
    font-family: inherit;
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--dialog-border);
    border-radius: 20px;
    box-shadow: 0 28px 90px rgba(15, 35, 71, .28), 0 4px 16px rgba(15, 35, 71, .12);
}

.app-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: appDialogSlideUp .22s ease-out;
}

.app-dialog::backdrop {
    background: rgba(11, 25, 52, .48);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.dialog-header {
    position: relative;
    isolation: isolate;
    flex-shrink: 0;
    overflow: hidden;
    padding: 18px 26px 26px;
    background:
        radial-gradient(ellipse at 100% 0, rgba(241, 90, 41, .16), transparent 60%),
        linear-gradient(135deg, #f3f6ff, #dbe8fb);
    border-bottom: 1px solid var(--dialog-border);
}

.dialog-header::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: -145px;
    right: -55px;
    width: 270px;
    height: 270px;
    border: 1px solid rgba(255, 255, 255, .68);
    border-radius: 50%;
    box-shadow: 0 0 0 32px rgba(255, 255, 255, .14), 0 0 0 64px rgba(255, 255, 255, .1);
    pointer-events: none;
}

.dialog-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    margin-bottom: 14px;
}

.dialog-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #435a7b;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.dialog-kicker i {
    color: var(--dialog-orange);
    font-size: 1rem;
}

.dialog-close {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    height: 36px;
    padding: 0;
    color: var(--dialog-blue);
    font: inherit;
    font-size: .9rem;
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(30, 58, 138, .16);
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.dialog-close:hover {
    background: #ffffff;
    border-color: var(--dialog-accent);
    transform: translateY(-1px);
}

.dialog-heading {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dialog-heading > div,
.dialog-detail > div {
    min-width: 0;
}

.dialog-symbol {
    display: grid;
    place-items: center;
    flex: 0 0 56px;
    height: 56px;
    color: var(--dialog-blue);
    font-size: 1.65rem;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .98);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(30, 58, 138, .1), inset 0 -2px 0 rgba(241, 90, 41, .12);
}

.dialog-heading h2 {
    margin: 0;
    color: var(--dialog-heading);
    font-size: clamp(1.3rem, 4vw, 1.55rem);
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
}

.dialog-heading p {
    margin: 7px 0 0;
    color: #506685;
    font-size: .84rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.app-dialog p:empty {
    display: none;
}

.dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
}

.dialog-detail {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(120deg, #fbfcff, #f0f5fc);
    border: 1px solid #dce6f2;
    border-radius: 14px;
}

.dialog-detail-icon {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    height: 40px;
    color: var(--dialog-blue);
    font-size: 1.2rem;
    background: #e4ecfb;
    border-radius: 11px;
}

.dialog-detail h3 {
    margin: 0 0 5px;
    color: var(--dialog-ink);
    font-size: .88rem;
    line-height: 1.45;
}

.dialog-detail p {
    margin: 0;
    color: #52647c;
    font-size: .84rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.message-detail {
    align-items: center;
}

.message-detail p {
    white-space: pre-line;
}

.message-dialog.is-warning .dialog-symbol,
.message-dialog.is-warning .dialog-detail-icon {
    color: #9a6208;
    background: #fff4d9;
}

.message-dialog.is-error .dialog-symbol,
.message-dialog.is-error .dialog-detail-icon {
    color: #b33137;
    background: #fff0f0;
}

.message-dialog.is-success .dialog-symbol,
.message-dialog.is-success .dialog-detail-icon {
    color: #16724f;
    background: #e7f6ee;
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    flex-shrink: 0;
    gap: 12px;
    padding: 20px 24px;
    background: #f5f8fc;
    border-top: 1px solid #dce5f0;
}

.dialog-actions-single {
    grid-template-columns: minmax(0, 1fr);
}

.dialog-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px;
    color: inherit;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 650;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.dialog-actions .btn:hover {
    transform: translateY(-1px);
}

.dialog-primary {
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--dialog-blue), var(--dialog-accent));
    box-shadow: 0 6px 16px rgba(30, 58, 138, .2), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.dialog-primary:hover {
    background: linear-gradient(135deg, var(--dialog-heading), var(--dialog-blue));
}

.dialog-secondary {
    color: var(--dialog-blue) !important;
    background: #ffffff;
    border-color: #c8d5e7 !important;
}

.dialog-secondary:hover {
    background: #edf3fb;
    border-color: #9fb5d1 !important;
}

.dialog-success {
    color: #ffffff !important;
    background: linear-gradient(135deg, #15803d, #10b981);
    box-shadow: 0 6px 16px rgba(21, 128, 61, .18), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.dialog-success:hover {
    background: linear-gradient(135deg, #166534, #15803d);
}

.dialog-danger {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ad343e, #dc4b55);
    box-shadow: 0 4px 12px rgba(173, 52, 62, .16);
}

.dialog-danger:hover {
    background: linear-gradient(135deg, #942c35, #ad343e);
}

.app-dialog .btn:focus-visible,
.app-dialog .dialog-close:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .42);
    outline-offset: 3px;
}

.inactivity-dialog .dialog-detail {
    align-items: center;
}

.inactivity-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 80px;
    padding: 16px 8px;
    color: var(--dialog-blue);
    background: #e7eefb;
    border: 1px solid #ccd9ec;
    border-radius: 12px;
}

.inactivity-timer strong {
    font-size: 2.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.inactivity-timer span {
    margin-top: 6px;
    font-size: .65rem;
    font-weight: 650;
}

.alarms-dialog {
    width: min(580px, calc(100% - 32px));
}

.alarms-dialog .alarms-list-container {
    margin-top: 0;
}

.form-dialog {
    width: min(560px, calc(100% - 32px));
}

.form-dialog .dialog-body {
    padding-top: 20px;
}

@media (max-width: 480px) {
    .app-dialog {
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 16px;
    }

    .dialog-header {
        padding: 14px 18px 20px;
    }

    .dialog-heading {
        gap: 12px;
    }

    .dialog-symbol {
        flex-basis: 46px;
        height: 46px;
        font-size: 1.4rem;
        border-radius: 12px;
    }

    .dialog-kicker {
        font-size: .6rem;
        letter-spacing: .06em;
    }

    .dialog-body,
    .dialog-actions {
        padding: 18px;
    }

    .dialog-detail {
        gap: 12px;
        padding: 14px;
    }

    .dialog-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .inactivity-timer {
        flex-basis: 68px;
    }
}

@media (max-height: 540px) {
    .app-dialog {
        overflow-y: auto;
    }

    .dialog-body {
        flex: 0 0 auto;
        overflow: visible;
    }

    .dialog-header,
    .dialog-body,
    .dialog-actions {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .dialog-topline {
        margin-bottom: 8px;
    }
}

@keyframes appDialogSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-dialog[open] {
        animation: none;
    }

    .dialog-actions .btn,
    .dialog-close {
        transition: none;
    }
}
