.app-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(11, 22, 48, 0.56);
    z-index: 9999;
}

.app-modal.show {
    display: flex;
    animation: appFadeIn 0.2s ease;
}

.app-modal-card {
    width: min(520px, 92vw);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 26px 80px rgba(22, 35, 70, 0.22);
    padding: 20px 18px 16px;
    position: relative;
}

.app-modal-open {
    overflow: hidden;
}

.modal-close,
.app-notify-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #eef1f6;
    color: #6b7690;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.modal-close:hover,
.app-notify-close:hover {
    background: #e5e9f1;
    color: #54617d;
}

.app-notify-body {
    text-align: center;
    padding: 8px 8px 6px;
}

.app-notify-icon-wrap {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fae8d9;
    color: #ec6b0a;
}

.app-notify-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-notify-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-notify-icon.text {
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
}

.app-notify-title {
    margin: 0;
    font-size: clamp(20px, 2.1vw, 32px);
    line-height: 1.15;
    color: #4b5678;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.app-notify-message {
    margin: 8px auto 0;
    font-size: clamp(14px, 1.3vw, 18px);
    line-height: 1.35;
    color: #7d89a5;
    font-weight: 500;
    max-width: 92%;
    white-space: pre-line;
}

.app-notify-actions {
    margin-top: 12px;
}

.app-notify-btn,
.app-modal-card .btn-primary {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #f68a00 0%, #ff9a1f 100%);
    color: #ffffff;
    font-size: clamp(15px, 1.25vw, 20px);
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 14px 34px rgba(246, 138, 0, 0.22);
}

.app-toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.app-toast {
    min-width: 260px;
    max-width: 360px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e6ebf3;
    box-shadow: 0 14px 30px rgba(16, 24, 40, 0.12);
    color: #3f4b68;
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: auto;
    animation: appToastIn 0.2s ease;
}

.app-toast-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4f5f83;
    background: #edf1f7;
}

.app-toast-icon svg {
    width: 14px;
    height: 14px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-toast-content {
    flex: 1;
}

.app-toast-title {
    font-size: 13px;
    font-weight: 700;
    color: #3f4b68;
    line-height: 1.4;
}

.app-toast-message {
    margin-top: 2px;
    font-size: 13px;
    color: #65708a;
    line-height: 1.45;
    white-space: pre-line;
}

.app-toast-close {
    border: 0;
    background: transparent;
    color: #8894ac;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    line-height: 1;
    font-size: 14px;
}

.app-toast-close:hover {
    background: #f2f5fa;
}

.app-notify-state-success .app-notify-icon-wrap {
    background: #e8f8ee;
    color: #1f9a53;
}

.app-notify-state-error .app-notify-icon-wrap {
    background: #ffeceb;
    color: #d75045;
}

.app-notify-state-info .app-notify-icon-wrap {
    background: #e9f1ff;
    color: #3c6fd0;
}

.app-toast-state-success .app-toast-icon {
    background: #e8f8ee;
    color: #1f9a53;
}

.app-toast-state-error .app-toast-icon {
    background: #ffeceb;
    color: #d75045;
}

.app-toast-state-info .app-toast-icon {
    background: #e9f1ff;
    color: #3c6fd0;
}

@media (max-width: 768px) {
    .app-modal {
        padding: 14px;
    }

    .app-modal-card {
        border-radius: 24px;
        padding: 16px 12px 14px;
    }

    .modal-close,
    .app-notify-close {
        width: 34px;
        height: 34px;
        top: 10px;
        right: 10px;
        font-size: 18px;
    }

    .app-notify-body {
        padding: 4px 4px 4px;
    }

    .app-notify-icon-wrap {
        width: 70px;
        height: 70px;
        margin-bottom: 8px;
    }

    .app-notify-icon {
        width: 30px;
        height: 30px;
    }

    .app-notify-icon.text {
        font-size: 24px;
    }

    .app-notify-title {
        font-size: 24px;
    }

    .app-notify-message {
        max-width: 96%;
        font-size: 14px;
        margin-top: 6px;
    }

    .app-notify-btn,
    .app-modal-card .btn-primary {
        min-height: 44px;
        font-size: 16px;
    }

    .app-toast-stack {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .app-toast {
        max-width: none;
    }
}

@keyframes appFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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