:root {
    --ui-shadow: 0 28px 80px rgba(15, 23, 42, 0.12);
    --ui-soft-border: rgba(15, 23, 42, 0.08);
}

/* ================= ALERT ================= */
.ui-alert {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 22px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid var(--ui-soft-border);
    box-shadow: var(--ui-shadow);
    color: #0f172a;
    overflow: hidden;
    animation: ui-fade-in 0.26s ease both;
    margin-bottom: 20px;
}

.ui-alert-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.ui-alert-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-alert-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ui-alert-message {
    margin: 0;
    color: #475569;
    line-height: 1.75;
    font-size: 0.98rem;
    text-align: justify;
}

.ui-alert-actions {
    margin-top: 6px;
}

.ui-alert-close {
    border: none;
    background: transparent;
    color: #667085;
    cursor: pointer;
    padding: 10px;
    border-radius: 999px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.ui-alert-close:hover {
    color: #0f172a;
    transform: scale(1.08);
}

.ui-alert-info {
    border-color: rgba(16, 186, 203, 0.18);
}

.ui-alert-info .ui-alert-icon {
    background: rgba(16, 186, 203, 0.14);
    color: var(--primary-dark);
}

.ui-alert-success {
    border-color: rgba(16, 186, 203, 0.14);
}

.ui-alert-success .ui-alert-icon {
    background: rgba(16, 186, 203, 0.14);
    color: #0f766e;
}

.ui-alert-warning {
    border-color: rgba(245, 158, 11, 0.16);
}

.ui-alert-warning .ui-alert-icon {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.ui-alert-danger {
    border-color: rgba(239, 68, 68, 0.16);
}

.ui-alert-danger .ui-alert-icon {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.ui-alert-neutral {
    border-color: rgba(148, 163, 184, 0.16);
}

.ui-alert-neutral .ui-alert-icon {
    background: rgba(148, 163, 184, 0.14);
    color: #334155;
}

/* ================= TOASTS ================= */
.ui-toast-stack {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1100;
    width: min(420px, calc(100vw - 32px));
    padding: 0;
}

.ui-toast {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--ui-shadow);
    overflow: hidden;
    animation: ui-toast-slide-in 0.35s ease forwards;
    opacity: 0;
    transform: translateX(18px);
}

.ui-toast-exit {
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-toast-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ui-toast-icon {
    width: 46px;
    min-width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(16, 186, 203, 0.14);
    color: var(--primary-dark);
    font-size: 1rem;
}

.ui-toast-content {
    flex: 1;
    display: grid;
    gap: 6px;
}

.ui-toast-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.98rem;
    color: #0f172a;
}

.ui-toast-message {
    margin: 0;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.7;
    text-align: justify;
}

.ui-toast-close {
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 999px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.ui-toast-close:hover {
    color: #0f172a;
    transform: scale(1.05);
}

.ui-toast-action {
    display: flex;
    justify-content: flex-end;
}

.ui-toast-info .ui-toast-icon {
    background: rgba(16, 186, 203, 0.14);
}

.ui-toast-success .ui-toast-icon {
    background: rgba(16, 186, 203, 0.14);
}

.ui-toast-warning .ui-toast-icon {
    background: rgba(245, 158, 11, 0.14);
}

.ui-toast-danger {
    background: #fee2e2;
    border-color: #fecaca;
}

.ui-toast-danger .ui-toast-icon {
    background: rgba(239, 68, 68, 0.14);
    color: #dc2626;
}

.ui-toast-danger .ui-toast-message {
    color: #7f1d1d;
}

.ui-toast-neutral .ui-toast-icon {
    background: rgba(148, 163, 184, 0.14);
}

/* ================= MODAL ================= */
.ui-modal {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 1200;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.ui-modal-open {
    visibility: visible;
    opacity: 1;
}

.ui-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(6px);
}

.ui-modal-panel {
    position: relative;
    width: min(100%, 560px);
    background: #ffffff;
    border-radius: 28px;
    padding: 36px 32px 28px;
    box-shadow: 0 40px 120px rgba(15, 23, 42, 0.16);
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.ui-modal-open .ui-modal-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ui-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    border: none;
    background: rgba(148, 163, 184, 0.12);
    color: #334155;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.ui-modal-close:hover {
    transform: scale(1.05);
    background: rgba(16, 186, 203, 0.14);
    color: var(--primary-dark);
}

.ui-modal-status {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    box-shadow: 0 18px 40px rgba(16, 186, 203, 0.12);
}

.ui-modal-status i {
    font-size: 1.8rem;
}

.ui-modal-info {
    background: rgba(16, 186, 203, 0.14);
    color: var(--primary-dark);
}

.ui-modal-success {
    background: rgba(16, 186, 203, 0.14);
    color: #0f766e;
}

.ui-modal-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.ui-modal-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.ui-modal-neutral {
    background: rgba(148, 163, 184, 0.14);
    color: #334155;
}

.ui-modal-content {
    text-align: center;
    margin-bottom: 20px;
}

.ui-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
}

.ui-modal-subtitle {
    margin: 10px auto 0;
    color: #334155;
    font-size: 1rem;
    line-height: 1.7;
    max-width: 82%;
}

.ui-modal-copy {
    margin: 16px auto 0;
    color: #475569;
    line-height: 1.75;
    font-size: 0.98rem;
    max-width: 88%;
    text-align: justify;
}

.ui-modal-body {
    margin-bottom: 26px;
    color: #334155;
    font-size: 0.97rem;
    line-height: 1.75;
    text-align: justify;
}

.ui-modal-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ui-modal-close {
    border: none;
    background: rgba(148, 163, 184, 0.12);
    color: #334155;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.ui-modal-close:hover {
    transform: scale(1.05);
    background: rgba(16, 186, 203, 0.14);
    color: var(--primary-dark);
}

.ui-modal-button {
    min-width: 110px;
}

@keyframes ui-toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@media (max-width: 520px) {
    .ui-toast-stack {
        right: 12px;
        left: 12px;
        width: auto;
    }

    .ui-modal-panel {
        padding: 24px;
        border-radius: 24px;
        margin: 0 12px;
    }
}
