/*
 * Avisos del panel (toast.js). Tarjeta solida, sin transparencia: se lee
 * igual encima de cualquier pantalla. Cada tipo trae su color de acento.
 */
.nwt-stack {
    --nwt-bg: #121c16;
    --nwt-bg-2: #18241d;
    --nwt-line: rgba(255, 255, 255, .09);
    --nwt-text: #eef5f0;
    --nwt-muted: #9fb2a6;
    position: fixed;
    z-index: 2147483000;
    top: 76px;
    right: 20px;
    width: min(400px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.nwt {
    --nwt-acc: #34d399;
    --nwt-acc-2: #10b981;
    --nwt-glow: rgba(52, 211, 153, .28);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 12px;
    padding: 14px 12px 16px 14px;
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, var(--nwt-glow) 0%, transparent 46%),
        linear-gradient(180deg, var(--nwt-bg-2), var(--nwt-bg));
    border: 1px solid var(--nwt-line);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .06),
        0 1px 2px rgba(0, 0, 0, .3),
        0 12px 28px -6px rgba(0, 0, 0, .55),
        0 28px 60px -18px rgba(0, 0, 0, .6);
    color: var(--nwt-text);
    font: 500 14px/1.42 inherit;
    font-family: inherit;
    overflow: hidden;
    pointer-events: auto;
    touch-action: pan-y;
    user-select: none;
    /* entrada: llega desde la derecha y asienta con un rebote corto */
    opacity: 0;
    transform: translateX(calc(100% + 24px)) scale(.96);
    transition:
        transform .55s cubic-bezier(.2, 1.35, .35, 1),
        opacity .3s ease,
        margin .34s ease,
        max-height .34s ease;
    max-height: 240px;
}
.nwt::before {             /* filo de color a la izquierda */
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--nwt-acc), var(--nwt-acc-2));
}
.nwt.is-in { opacity: 1; transform: none; }
.nwt.is-out {
    opacity: 0;
    transform: translateX(calc(100% + 24px)) scale(.94);
    max-height: 0;
    margin-top: -10px;
    padding-top: 0;
    padding-bottom: 0;
    transition:
        transform .3s cubic-bezier(.5, 0, .75, 0),
        opacity .25s ease,
        max-height .3s ease .08s,
        margin .3s ease .08s,
        padding .3s ease .08s;
}
.nwt.is-drag { transition: none; }

.nwt.is-err  { --nwt-acc: #fb7185; --nwt-acc-2: #e11d48; --nwt-glow: rgba(251, 113, 133, .26); }
.nwt.is-warn { --nwt-acc: #fbbf24; --nwt-acc-2: #f59e0b; --nwt-glow: rgba(251, 191, 36, .22); }
.nwt.is-info { --nwt-acc: #60a5fa; --nwt-acc-2: #3b82f6; --nwt-glow: rgba(96, 165, 250, .24); }

/* ---------------------------------------------------- icono */
.nwt-ic {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--nwt-acc), var(--nwt-acc-2));
    box-shadow: 0 6px 16px -4px var(--nwt-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
    color: #06140c;
    transform: scale(.4) rotate(-12deg);
    transition: transform .5s cubic-bezier(.2, 1.6, .4, 1) .12s;
}
.nwt.is-in .nwt-ic { transform: none; }
.nwt-ic::after {           /* onda que sale del icono al llegar */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--nwt-acc);
    opacity: 0;
}
.nwt.is-in .nwt-ic::after { animation: nwt-ping .9s ease-out .25s 1; }
.nwt-ic svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}
.nwt.is-in .nwt-ic svg { animation: nwt-draw .45s cubic-bezier(.65, 0, .35, 1) .28s forwards; }
.nwt.is-err.is-in .nwt-ic { animation: nwt-shake .42s ease .3s 1; }
.nwt.is-err .nwt-ic, .nwt.is-warn .nwt-ic, .nwt.is-info .nwt-ic { color: #fff; }
.nwt.is-warn .nwt-ic { color: #2a1a00; }

@keyframes nwt-draw  { to { stroke-dashoffset: 0; } }
@keyframes nwt-ping  { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes nwt-shake {
    20% { transform: translateX(-3px) rotate(-4deg); }
    40% { transform: translateX(3px) rotate(4deg); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

/* ---------------------------------------------------- texto */
.nwt-b { min-width: 0; padding-top: 1px; }
.nwt-t {
    display: block;
    font-weight: 750;
    font-size: 14.5px;
    letter-spacing: -.01em;
    color: var(--nwt-acc);
    margin-bottom: 1px;
}
.nwt-x-t { display: block; color: var(--nwt-text); overflow-wrap: anywhere; }
.nwt-x-t:empty { display: none; }
.nwt-sub { display: block; margin-top: 3px; color: var(--nwt-muted); font-size: 12.5px; }

/* ---------------------------------------------------- botones */
.nwt-acts { display: flex; align-items: center; gap: 2px; margin: -3px -2px 0 0; }
.nwt-acts button {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--nwt-muted);
    cursor: pointer;
    border-radius: 9px;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nwt-snd, .nwt-close { width: 30px; height: 30px; }
.nwt-acts button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nwt-acts button:hover { background: rgba(255, 255, 255, .07); color: var(--nwt-text); }
.nwt-acts button:active { transform: scale(.92); }
.nwt-acts button:focus-visible { outline: 2px solid var(--nwt-acc); outline-offset: 1px; }
.nwt-snd { opacity: .55; }
.nwt:hover .nwt-snd, .nwt-snd:focus-visible { opacity: 1; }
.nwt-snd.is-off { color: #fb7185; opacity: .9; }
.nwt-act {
    display: inline-flex;
    align-items: center;
    margin-top: 9px;
    height: 30px;
    padding: 0 13px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
    font: 700 13px/1 inherit;
    font-family: inherit;
    color: var(--nwt-acc) !important;
    background: rgba(255, 255, 255, .06) !important;
    border: 1px solid color-mix(in srgb, var(--nwt-acc) 45%, transparent) !important;
}
.nwt-act:active { transform: scale(.95); }
.nwt-act:hover { background: color-mix(in srgb, var(--nwt-acc) 16%, transparent) !important; }

/* ---------------------------------------------------- barra de tiempo */
.nwt-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, .05);
}
.nwt-bar > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--nwt-acc-2), var(--nwt-acc));
    box-shadow: 0 0 10px var(--nwt-acc);
    transform-origin: left center;
    animation: nwt-time var(--nwt-ms, 4000ms) linear forwards;
}
.nwt.is-paused .nwt-bar > i { animation-play-state: paused; }
@keyframes nwt-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------------------------------------------- tema claro del panel */
:root[data-theme="light"] .nwt-stack,
.theme-light .nwt-stack {
    --nwt-bg: #ffffff;
    --nwt-bg-2: #fbfdfc;
    --nwt-line: rgba(15, 23, 42, .1);
    --nwt-text: #0f1a14;
    --nwt-muted: #5b6b62;
}
:root[data-theme="light"] .nwt,
.theme-light .nwt {
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 14px 34px -10px rgba(15, 23, 42, .28);
}
:root[data-theme="light"] .nwt-t,
.theme-light .nwt-t { color: color-mix(in srgb, var(--nwt-acc-2) 80%, #000); }

/* ---------------------------------------------------- telefono: arriba, de ancho completo */
@media (max-width: 640px) {
    .nwt-stack {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        right: 12px;
        left: 12px;
        width: auto;
    }
    .nwt { transform: translateY(-120%) scale(.96); }
    .nwt.is-out { transform: translateY(-120%) scale(.94); }
}

@media (prefers-reduced-motion: reduce) {
    .nwt, .nwt.is-out { transform: none !important; transition: opacity .12s linear; }
    .nwt-ic { transform: none; transition: none; }
    .nwt.is-in .nwt-ic, .nwt.is-in .nwt-ic::after { animation: none; }
    .nwt-ic svg { stroke-dashoffset: 0; animation: none !important; }
}

/* La pila vieja (flashes.php) no se pinta: toast.js la convierte al cargar. */
.nwt-on .toast-stack { visibility: hidden; }
