:root {
    --feedback-navy: #082f3d;
    --feedback-blue: #0798b4;
    --feedback-green: #a4e548;
    --feedback-red: #ef5b57;
    --feedback-amber: #df981a;
    --feedback-border: #cbdbe1;
    --feedback-muted: #6b8290;
    --feedback-surface: #ffffff;
}

.app-feedback-root {
    position: relative;
    z-index: 2500;
}

.app-toast-region {
    position: fixed;
    top: 86px;
    right: 22px;
    display: grid;
    gap: 10px;
    width: min(410px, calc(100vw - 32px));
    z-index: 2600;
    pointer-events: none;
}

.app-toast {
    display: grid;
    grid-template-columns: 44px 1fr 32px;
    align-items: start;
    border: 1px solid var(--feedback-border);
    border-left: 4px solid var(--feedback-blue);
    background: var(--feedback-surface);
    box-shadow: 0 16px 38px rgba(8, 47, 61, .18);
    color: var(--feedback-navy);
    pointer-events: auto;
    animation: app-toast-in .22s ease-out both;
}

.app-toast.is-leaving {
    animation: app-toast-out .18s ease-in both;
}

.app-toast-icon {
    display: grid;
    place-items: center;
    min-height: 64px;
    background: #eaf6f8;
    color: var(--feedback-blue);
    font-size: 19px;
    font-weight: 800;
}

.app-toast-copy {
    padding: 12px 10px;
}

.app-toast-copy strong,
.app-toast-copy span {
    display: block;
}

.app-toast-copy strong {
    margin-bottom: 3px;
    font-size: 14px;
}

.app-toast-copy span {
    color: var(--feedback-muted);
    font-size: 12px;
    line-height: 1.45;
}

.app-toast-close {
    border: 0;
    background: transparent;
    color: var(--feedback-muted);
    cursor: pointer;
    min-height: 42px;
    font-size: 20px;
}

.app-toast-success { border-left-color: #35b978; }
.app-toast-success .app-toast-icon { background: #ebf9f1; color: #15945b; }
.app-toast-error { border-left-color: var(--feedback-red); }
.app-toast-error .app-toast-icon { background: #fff0ef; color: #cc3733; }
.app-toast-warning { border-left-color: var(--feedback-amber); }
.app-toast-warning .app-toast-icon { background: #fff7e8; color: #ba7410; }
.app-toast-session { border-left-color: #617585; }
.app-toast-session .app-toast-icon { background: #edf2f4; color: #526877; }

.app-processing,
.app-confirm {
    position: fixed;
    inset: 0;
    z-index: 2700;
}

.app-processing {
    display: grid;
    place-items: center;
    background: rgba(5, 35, 47, .42);
    backdrop-filter: blur(2px);
}

.app-processing[hidden],
.app-confirm[hidden] {
    display: none;
}

.app-processing-card {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-width: 230px;
    padding: 28px;
    border-top: 3px solid var(--feedback-green);
    background: var(--feedback-surface);
    box-shadow: 0 20px 55px rgba(0, 0, 0, .25);
    color: var(--feedback-navy);
}

.app-processing-card span:last-child {
    color: var(--feedback-muted);
    font-size: 12px;
}

.app-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #dce6e9;
    border-top-color: var(--feedback-blue);
    border-radius: 50%;
    animation: app-spin .7s linear infinite;
}

.app-confirm {
    display: grid;
    place-items: center;
    padding: 20px;
}

.app-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 35, 47, .68);
}

.app-confirm-dialog {
    position: relative;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 18px;
    width: min(510px, 100%);
    padding: 28px;
    border-top: 4px solid var(--feedback-red);
    background: var(--feedback-surface);
    box-shadow: 0 22px 65px rgba(0, 0, 0, .3);
    color: var(--feedback-navy);
}

.app-confirm-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    background: #fff0ef;
    color: #cc3733;
    font-size: 24px;
    font-weight: 900;
}

.app-confirm-dialog small {
    color: #cc3733;
    font-weight: 800;
    letter-spacing: .12em;
}

.app-confirm-dialog h2 {
    margin: 5px 0 8px;
    font-size: 24px;
}

.app-confirm-dialog p {
    margin: 0;
    color: var(--feedback-muted);
}

.app-confirm-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.app-confirm-actions button {
    min-height: 48px;
    border: 1px solid var(--feedback-border);
    background: #fff;
    color: var(--feedback-navy);
    font-weight: 800;
    cursor: pointer;
}

.app-confirm-actions .app-confirm-accept {
    border-color: var(--feedback-red);
    background: var(--feedback-red);
    color: #fff;
}

.app-inline-state,
.app-empty-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--feedback-border);
    border-left: 3px solid var(--feedback-blue);
    background: #f7fafb;
    color: var(--feedback-navy);
}

.app-inline-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    height: 34px;
    background: #eaf6f8;
    color: var(--feedback-blue);
    font-weight: 900;
}

.app-inline-state strong,
.app-inline-state p {
    display: block;
    margin: 0;
}

.app-inline-state p {
    margin-top: 2px;
    color: var(--feedback-muted);
    font-size: 13px;
}

.app-inline-success { border-left-color: #35b978; }
.app-inline-success .app-inline-icon { background: #ebf9f1; color: #15945b; }
.app-inline-error { border-left-color: var(--feedback-red); }
.app-inline-error .app-inline-icon { background: #fff0ef; color: #cc3733; }
.app-inline-warning { border-left-color: var(--feedback-amber); }
.app-inline-warning .app-inline-icon { background: #fff7e8; color: #ba7410; }

@keyframes app-spin { to { transform: rotate(360deg); } }
@keyframes app-toast-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes app-toast-out { to { opacity: 0; transform: translateX(20px); } }

@media (max-width: 767px) {
    .app-toast-region {
        top: 68px;
        right: 10px;
        width: calc(100vw - 20px);
    }

    .app-confirm-dialog {
        grid-template-columns: 40px 1fr;
        gap: 13px;
        padding: 21px;
    }

    .app-confirm-dialog h2 {
        font-size: 20px;
    }

    .app-confirm-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast,
    .app-toast.is-leaving,
    .app-spinner {
        animation: none;
    }
}
/* Página de error controlado */
.safe-error-page {
    box-sizing: border-box;
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #edf3f5;
    color: #082f3d;
    font-family: Arial, sans-serif;
}

.safe-error-page *,
.safe-error-page *::before,
.safe-error-page *::after {
    box-sizing: border-box;
}

.safe-error {
    width: min(720px, 100%);
    border-top: 4px solid #ef5b57;
    background: #fff;
    box-shadow: 0 18px 45px rgba(8, 47, 61, .14);
}

.safe-error-head {
    padding: 30px 34px 22px;
    border-bottom: 1px solid #cbdbe1;
}

.safe-error-label {
    color: #cc3733;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

.safe-error h1 {
    margin: 8px 0;
    font-size: clamp(26px, 5vw, 38px);
}

.safe-error p {
    margin: 0;
    color: #6b8290;
    line-height: 1.55;
}

.safe-error-body {
    display: grid;
    gap: 18px;
    padding: 26px 34px 34px;
}

.safe-error-code {
    padding: 12px 14px;
    border-left: 3px solid #0798b4;
    background: #f1f6f7;
    font-size: 13px;
}

.safe-error-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.safe-error-actions a {
    display: inline-grid;
    place-items: center;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid #cbdbe1;
    color: #082f3d;
    font-weight: 800;
    text-decoration: none;
}

.safe-error-actions .primary {
    border-color: #a4e548;
    background: #a4e548;
}

@media (max-width: 560px) {
    .safe-error-head,
    .safe-error-body {
        padding-right: 22px;
        padding-left: 22px;
    }

    .safe-error-actions a {
        width: 100%;
    }
}
