.app-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.app-dialog-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.app-dialog-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    border: 1px solid #e2e8f0;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s ease;
    overflow: hidden;
}

.app-dialog-backdrop.is-open .app-dialog-card {
    transform: translateY(0) scale(1);
}

.app-dialog-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 20px 20px 8px;
}

.app-dialog-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.app-dialog-icon.is-default {
    background: #edf2f7;
    color: var(--primary-color, #4a5568);
}

.app-dialog-icon.is-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.app-dialog-icon.is-info {
    background: #e0f2fe;
    color: #0369a1;
}

.app-dialog-titles {
    flex: 1;
    min-width: 0;
}

.app-dialog-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 6px;
    line-height: 1.45;
}

.app-dialog-message {
    font-size: 0.925rem;
    color: #4a5568;
    margin: 0;
    line-height: 1.65;
    white-space: pre-wrap;
}

.app-dialog-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 20px 20px;
}

.app-dialog-btn {
    min-width: 96px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.app-dialog-btn:focus-visible {
    outline: 2px solid var(--primary-color, #4a5568);
    outline-offset: 2px;
}

.app-dialog-btn-cancel {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.app-dialog-btn-cancel:hover {
    background: #edf2f7;
}

.app-dialog-btn-confirm {
    background: var(--primary-color, #4a5568);
    color: #fff;
}

.app-dialog-btn-confirm:hover {
    filter: brightness(1.06);
    box-shadow: 0 4px 12px rgba(74, 85, 104, 0.25);
}

.app-dialog-btn-confirm.is-danger {
    background: #dc2626;
}

.app-dialog-btn-confirm.is-danger:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.app-dialog-alert .app-dialog-footer {
    justify-content: center;
}

.app-toast-stack {
    position: fixed;
    z-index: 10040;
    inset-inline: 12px;
    top: max(16px, env(safe-area-inset-top, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: min(420px, 100%);
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 28px rgba(45, 55, 72, 0.14);
    color: #1a202c;
    font-size: 0.875rem;
    line-height: 1.5;
    animation: app-toast-in 0.28s ease-out;
}

.app-toast.is-leaving {
    animation: app-toast-out 0.2s ease-in forwards;
}

.app-toast-icon {
    flex-shrink: 0;
    width: 1.35rem;
    margin-top: 1px;
    color: var(--primary-color, #4a5568);
    font-size: 1.1rem;
    line-height: 1;
}

.app-toast-message {
    flex: 1;
    min-width: 0;
}

@keyframes app-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes app-toast-out {
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}
