/* ── Toasts (revamp E3) ─────────────────────────────────────────────────────
   Bottom-right, compact (360px at most), icon and text on one baseline,
   a thin progress line for the auto-dismiss. A toast is a surface with a
   coloured icon, not a coloured slab: the colour says the kind, the text
   stays readable. Enters and leaves with transform and opacity only. */

.toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-2);
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 10px 10px 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-2), inset 0 0 0 1px var(--border);
    color: var(--text);
    font-size: var(--fs-13);
    line-height: 1.45;
    pointer-events: all;
    animation: toast-in var(--dur-enter) var(--ease-out);
}
.toast[hidden] { display: none; }
.toast.dismissing { animation: toast-out var(--dur-exit) var(--ease-out) forwards; }
.toast-icon { display: grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--accent); }
.toast-icon svg { width: 16px; height: 16px; }
.toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.toast-msg { color: var(--text); font-weight: 500; }
.toast-detail { margin-top: 2px; font-size: var(--fs-12); color: var(--text-2); overflow-wrap: anywhere; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warn); }
.toast.info    .toast-icon { color: var(--accent); }
.toast.error { box-shadow: var(--shadow-2), inset 0 0 0 1px color-mix(in srgb, var(--error) 45%, transparent); }
.toast.warning { box-shadow: var(--shadow-2), inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.toast-close {
    display: grid; place-items: center;
    flex: none;
    width: 24px; height: 24px;
    margin: -2px -2px 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}
.toast-close svg { width: 14px; height: 14px; }
.toast-close:hover { background: var(--hover); color: var(--text); }
.toast-action {
    flex: none;
    align-self: center;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent-text);
    font: inherit;
    font-size: var(--fs-12);
    font-weight: 600;
    cursor: pointer;
}
.toast-action:hover { background: var(--accent-dim); }
.toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    opacity: 0.3;
    transform-origin: left;
    animation-name: toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
.toast-more-chip {
    pointer-events: all;
    padding: 4px 12px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--border);
    color: var(--text-2);
    font: inherit;
    font-size: var(--fs-12);
    font-weight: 600;
    cursor: pointer;
}
.toast-more-chip:hover { color: var(--text); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px); } }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 640px) {
    .toast-container { right: 12px; left: 12px; bottom: 12px; width: auto; }
}
