.action-loading-bar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10000;
    height: 3px;
    pointer-events: none;
    background: #0ea5e9;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 220ms ease, opacity 180ms ease;
}

.action-loading-bar.is-loading {
    opacity: 1;
    transform: scaleX(.72);
}

.action-loading-bar.is-finishing {
    opacity: 0;
    transform: scaleX(1);
}

.action-button-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 9999px;
    animation: action-button-spin .65s linear infinite;
}

[data-action-loading="true"] {
    cursor: wait !important;
    opacity: .78;
}

.action-toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 1.75rem;
    align-items: start;
    gap: .65rem;
    width: min(390px, calc(100vw - 2rem));
    padding: .8rem;
    border: 1px solid;
    border-radius: 5px;
    background: #fff;
    color: #1e293b;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
}

.action-toast.is-leaving { opacity: 0; transform: translateY(-8px); }
.action-toast--success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.action-toast--warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.action-toast--error { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.action-toast__icon { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 5px; background: currentColor; }
.action-toast__icon::after { color: #fff; font-size: .8rem; font-weight: 900; content: "✓"; }
.action-toast--warning .action-toast__icon::after { content: "!"; }
.action-toast--error .action-toast__icon::after { content: "×"; }
.action-toast__message { padding-top: .3rem; font-size: .875rem; font-weight: 700; line-height: 1.35; }
.action-toast__close { display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border: 0; background: transparent; color: currentColor; cursor: pointer; font-size: 1.15rem; line-height: 1; opacity: .65; }
.action-toast__close:hover { opacity: 1; }

.action-confirm {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 12000;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    overflow: auto;
    box-sizing: border-box;
    overscroll-behavior: contain;
    padding: 1rem;
}
.action-confirm[hidden] { display: none; }
.action-confirm__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, .58);
    cursor: default;
}
.action-confirm__panel {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1.25rem;
    border: 1px solid #e7e5e4;
    border-radius: 5px;
    background: #fff;
    color: #1e293b;
    outline: none;
}
.action-confirm__heading { display: flex; align-items: flex-start; gap: 1rem; }
.action-confirm__icon {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 5px;
    background: #fff1f2;
    color: #e11d48;
    font-size: 1.1rem;
    font-weight: 900;
}
.action-confirm__title { margin: 0; color: #0f172a; font-size: 1.1rem; font-weight: 800; line-height: 1.35; }
.action-confirm__message { margin: .45rem 0 0; color: #64748b; font-size: .875rem; line-height: 1.55; }
.action-confirm__actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; }
.action-confirm__button {
    min-height: 2.75rem;
    padding: .65rem 1.1rem;
    border: 1px solid;
    border-radius: 5px;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 800;
}
.action-confirm__button--cancel { border-color: #e2e8f0; background: #fff; color: #334155; }
.action-confirm__button--cancel:hover { background: #f8fafc; }
.action-confirm__button--danger { border-color: #e11d48; background: #e11d48; color: #fff; }
.action-confirm__button--danger:hover { border-color: #be123c; background: #be123c; }

@keyframes action-button-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .action-loading-bar,
    .action-toast,
    .action-confirm__panel { transition: none; }
    .action-button-spinner { animation-duration: 1.2s; }
}
