/* Right-side toast stack (ALIA MetricsNotify style) */
.tw-notify-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    left: auto;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    max-width: 22.5rem;
    width: min(22.5rem, calc(100vw - 1.5rem));
    pointer-events: none;
}

.tw-notify {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.5rem 0.5rem 0.625rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    opacity: 0;
    width: 100%;
    transform: translateX(110%);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.4, 0, .2, 1);
    min-height: 2.75rem;
}

.tw-notify.tw-notify-show {
    opacity: 1;
    transform: translateX(0);
}

.tw-notify.tw-notify-hide {
    opacity: 0;
    transform: translateX(110%);
}

.tw-notify-panel {
    max-width: 22.5rem;
    width: 100%;
    align-items: flex-start;
    padding: 0.75rem 0.625rem 0.75rem 0.75rem;
}

.tw-notify-icon-wrap {
    flex-shrink: 0;
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tw-notify-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tw-notify-icon .fa {
    font-size: 0.875rem;
    line-height: 1;
}

.tw-notify-body {
    min-width: 0;
    flex: 1 1 auto;
}

.tw-notify-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.tw-notify-msg {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-word;
    max-height: min(36vh, 10rem);
    overflow-y: auto;
}

.tw-notify-panel .tw-notify-msg {
    font-weight: 400;
    margin-top: 0.15rem;
}

.tw-notify-close {
    flex-shrink: 0;
    margin: -0.125rem -0.125rem 0 0;
    width: 1.375rem;
    height: 1.375rem;
    min-height: 1.375rem !important;
    padding: 0 !important;
    color: inherit !important;
    opacity: 0.55;
    font-size: 1rem !important;
    line-height: 1 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tw-notify-close:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    opacity: 0.85;
}

.tw-notify-desc {
    margin: 0.2rem 0 0.45rem;
    font-size: 0.6875rem;
    line-height: 1.4;
    opacity: 0.85;
}

.tw-notify-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(40vh, 14rem);
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.45);
}

.tw-notify-list-item {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.tw-notify-list-item:last-child {
    border-bottom: none !important;
}

.tw-notify-list-msg {
    font-size: 0.75rem;
}

.tw-notify-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    transform: scaleX(0);
    opacity: 0.55;
}

.tw-notify-progress.tw-notify-progress-run {
    animation: tw-notify-progress linear forwards;
}

@keyframes tw-notify-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.tw-notify-success {
    background: #ecfdf5 !important;
    border-color: #86efac !important;
    color: #166534 !important;
}
.tw-notify-success .tw-notify-title { color: #15803d !important; }
.tw-notify-success .tw-notify-msg { color: #166534 !important; }
.tw-notify-success .tw-notify-icon-wrap {
    background: #bbf7d0;
    color: #15803d;
}
.tw-notify-success .tw-notify-progress { background: #16a34a; }

.tw-notify-error {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}
.tw-notify-error .tw-notify-title { color: #b91c1c !important; }
.tw-notify-error .tw-notify-msg { color: #991b1b !important; }
.tw-notify-error .tw-notify-icon-wrap {
    background: #fecaca;
    color: #dc2626;
}
.tw-notify-error .tw-notify-progress { background: #ef4444; }

.tw-notify-validation {
    background: #fffbeb !important;
    border-color: #fcd34d !important;
    color: #92400e !important;
}
.tw-notify-validation .tw-notify-title { color: #b45309 !important; }
.tw-notify-validation .tw-notify-msg { color: #92400e !important; }
.tw-notify-validation .tw-notify-icon-wrap {
    background: #fde68a;
    color: #d97706;
}
.tw-notify-validation .tw-notify-progress { background: #f59e0b; }

.tw-notify-info {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #1e40af !important;
}
.tw-notify-info .tw-notify-title { color: #1d4ed8 !important; }
.tw-notify-info .tw-notify-msg { color: #1e40af !important; }
.tw-notify-info .tw-notify-icon-wrap {
    background: #bfdbfe;
    color: #2563eb;
}
.tw-notify-info .tw-notify-progress { background: #3b82f6; }

.tw-notify-warning {
    background: #fffbeb !important;
    border-color: #fcd34d !important;
    color: #92400e !important;
}
.tw-notify-warning .tw-notify-title { color: #b45309 !important; }
.tw-notify-warning .tw-notify-msg { color: #92400e !important; }
.tw-notify-warning .tw-notify-icon-wrap {
    background: #fde68a;
    color: #d97706;
}
.tw-notify-warning .tw-notify-progress { background: #f59e0b; }

html.theme-dark .tw-notify,
body.theme-dark .tw-notify {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

#tw-notify-container .tw-notify button {
    color: inherit !important;
}
