.app-toast-container {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    z-index: 2200;
    width: min(390px, calc(100vw - 36px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.app-toast {
    --feedback-color: #0f4c5c;
    --feedback-soft: #e8f5f4;
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--feedback-color) 28%, #dce6eb);
    border-radius: 8px;
    background: rgba(255, 255, 255, .98);
    color: #102331;
    box-shadow: 0 22px 58px rgba(15, 35, 49, .2);
    pointer-events: auto;
    opacity: 1;
    transform: none;
    animation: app-toast-enter .38s cubic-bezier(.22, 1, .36, 1) both;
    transition: opacity .24s ease, transform .24s ease;
}

.app-toast--success {
    --feedback-color: #126b43;
    --feedback-soft: #e9f8ef;
}

.app-toast--error {
    --feedback-color: #a82431;
    --feedback-soft: #fff0f1;
}

.app-toast--warning {
    --feedback-color: #815006;
    --feedback-soft: #fff7e8;
}

.app-toast--info {
    --feedback-color: #0b6574;
    --feedback-soft: #e9f7f9;
}

.app-toast.is-hiding {
    opacity: 0;
    transform: translate3d(0, -12px, 0) scale(.985);
}

.app-toast-header {
    min-height: 52px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 30px;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-bottom: 1px solid #edf2f4;
    background: linear-gradient(90deg, var(--feedback-soft), #fff 58%);
}

html[dir="rtl"] .app-toast-header {
    background: linear-gradient(270deg, var(--feedback-soft), #fff 58%);
}

.app-toast-header strong {
    min-width: 0;
    color: var(--feedback-color);
    font-size: .92rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.app-toast-header small {
    color: #52616d;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-toast-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--feedback-color);
    color: #fff;
}

.app-toast-icon svg,
.app-toast-close svg,
.app-confirm-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-toast-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #657586;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
    background: #edf3f5;
    color: #102331;
    outline: none;
}

.app-toast-close:active {
    transform: scale(.94);
}

.app-toast-body {
    padding: 12px 14px 14px;
    color: #344b5f;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.65;
    text-align: start;
    overflow-wrap: anywhere;
}

.app-toast-body p {
    margin: 0;
}

.app-toast-body ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-inline-start: 20px;
}

.app-toast-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--feedback-color);
    transform-origin: right center;
    animation: app-toast-progress var(--feedback-delay, 6000ms) linear forwards;
}

html[dir="ltr"] .app-toast-progress {
    transform-origin: left center;
}

.app-toast.is-paused .app-toast-progress {
    animation-play-state: paused;
}

.app-confirm-layer {
    position: fixed;
    inset: 0;
    z-index: 2300;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(6, 42, 52, .48);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity .22s ease;
}

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

.app-confirm-layer.is-open {
    opacity: 1;
}

.app-confirm-dialog {
    width: min(440px, 100%);
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 14px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .76);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 30px 86px rgba(7, 34, 45, .3);
    text-align: start;
    opacity: 0;
    transform: translateY(14px) scale(.98);
    transition: opacity .25s ease, transform .25s cubic-bezier(.22, 1, .36, 1);
}

.app-confirm-layer.is-open .app-confirm-dialog {
    opacity: 1;
    transform: none;
}

.app-confirm-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #fff0f1;
    color: #c83f4a;
}

.app-confirm-copy {
    min-width: 0;
}

.app-confirm-copy h2 {
    margin: 1px 0 5px;
    color: #102331;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.app-confirm-copy p {
    margin: 0;
    color: #657586;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.app-confirm-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 5px;
}

.app-confirm-button {
    min-width: 104px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.app-confirm-button:hover {
    transform: translateY(-1px);
}

.app-confirm-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 167, 165, .16);
}

.app-confirm-button.is-secondary {
    border-color: #d4e0e5;
    background: #fff;
    color: #405568;
}

.app-confirm-button.is-secondary:hover {
    background: #f4f8f9;
}

.app-confirm-button.is-danger {
    background: #c83f4a;
    color: #fff;
}

.app-confirm-button.is-danger:hover {
    background: #a92d37;
}

.app-confirm-button:disabled {
    cursor: wait;
    opacity: .82;
    transform: none;
}

.app-confirm-spinner {
    width: 15px;
    height: 15px;
    display: none;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: app-confirm-spin .7s linear infinite;
}

.app-confirm-button.is-submitting .app-confirm-spinner {
    display: block;
}

body.app-confirm-open {
    overflow: hidden;
}

.status-pill {
    --status-color: #526777;
    --status-background: #eef3f5;
    --status-border: #d8e2e7;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border: 1px solid var(--status-border);
    border-radius: 999px;
    background: var(--status-background);
    color: var(--status-color);
    font-size: .8rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
}

.status-pill::before {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
    content: "";
}

.status-pill.is-success {
    --status-color: #147a4b;
    --status-background: #e9f8ef;
    --status-border: #bfe9ce;
}

.status-pill.is-danger {
    --status-color: #b4232c;
    --status-background: #fff0f1;
    --status-border: #f3c0c4;
}

.status-pill.is-warning {
    --status-color: #986008;
    --status-background: #fff7e8;
    --status-border: #f1d79f;
}

@keyframes app-toast-enter {
    from {
        opacity: 0;
        transform: translate3d(0, -14px, 0) scale(.985);
    }
}

@keyframes app-toast-progress {
    to { transform: scaleX(0); }
}

@keyframes app-confirm-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
    .app-toast-container {
        right: 16px;
        left: 16px;
        width: auto;
    }

    .app-toast-header {
        grid-template-columns: 34px minmax(0, 1fr) 30px;
    }

    .app-toast-header small {
        display: none;
    }

    .app-confirm-dialog {
        grid-template-columns: 42px minmax(0, 1fr);
        padding: 18px;
    }

    .app-confirm-icon {
        width: 42px;
        height: 42px;
    }

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

    .app-confirm-button {
        min-width: 0;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast,
    .app-toast-progress,
    .app-confirm-layer,
    .app-confirm-dialog,
    .app-confirm-spinner {
        animation: none;
        transition: none;
    }
}
