:root {
    --toast-bg: #ffffffde;
    --toast-fg: #0f1115;
    --toast-border: rgba(0,0,0,.12);
    --toast-shadow: rgba(0,0,0,.18);
    --toast-close-hover: rgba(0,0,0,.06);
    --toast-success: #1e8e3e;
    --toast-warning: #b76e00;
    --toast-error:   #c62828;
    --toast-info:    #1967d2;
}

body.dark.tme_mode,
html.theme_dark body.tme_mode {
    --toast-bg: #1e1f24de;
    --toast-fg: #e9eef6;
    --toast-border: rgba(255,255,255,.14);
    --toast-shadow: rgba(0,0,0,.6);
    --toast-close-hover: rgba(255,255,255,.08);
    --toast-success: #34a853;
    --toast-warning: #fbbc04;
    --toast-error:   #ea4335;
    --toast-info:    #8ab4f8;
}


/* Контейнеры под разные позиции */
.ttoast {
    position: fixed;
    z-index: 3000;
    display: grid;
    gap: 10px;
    pointer-events: none; /* не блокируем UI */
    padding: 0 12px;
}
.ttoast--bottom-center { left: 50%; transform: translateX(-50%); bottom: 20px; }
.ttoast--bottom-right  { right: 20px; bottom: 20px; }
.ttoast--bottom-left   { left: 20px; bottom: 20px; }
.ttoast--top-right     { right: 20px; top: 20px; }
.ttoast--top-left      { left: 20px; top: 20px; }
.ttoast--top-center    { left: 50%; transform: translateX(-50%); top: 20px; }

/* Элемент тоста */
.ttoast__item {
    pointer-events: auto; /* кликабельна кнопка закрытия */
    display: grid;
    grid-template-columns: auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 240px;
    max-width: min(520px, 90vw);
    padding: 12px 14px;
    border-radius: 12px;
    /*border: 1px solid var(--toast-border);*/
    background: var(--toast-bg);
    color: var(--toast-fg);
    box-shadow: 0 10px 24px var(--toast-shadow);
    font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    animation: ttoast-in 180ms ease-out both;
}

/* Типы */
/*
.ttoast__item[data-type="success"] { border-color: var(--toast-success); }
.ttoast__item[data-type="warning"] { border-color: var(--toast-warning); }
.ttoast__item[data-type="error"]   { border-color: var(--toast-error); }
.ttoast__item[data-type="info"]    { border-color: var(--toast-info); }
*/
/* Иконка + текст + close */
.ttoast__icon { font-size: 16px; line-height: 1; opacity: .9; }
.ttoast__text { word-break: break-word; }
.ttoast__close {
    border: 0; background: transparent; cursor: pointer;
    font-size: 16px; line-height: 1; padding: 4px; border-radius: 8px;
    color: inherit;
}
.ttoast__close:hover { background: var(--toast-close-hover); }

/* Состояния появления/исчезновения */
@keyframes ttoast-in {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}
.ttoast__item.is-leaving {
    animation: ttoast-out 150ms ease-in both;
}
@keyframes ttoast-out {
    from { transform: translateY(0);   opacity: 1; }
    to   { transform: translateY(6px); opacity: 0; }
}

/* Уважение «меньше анимаций» */
@media (prefers-reduced-motion: reduce) {
    .ttoast__item { animation: none; }
    .ttoast__item.is-leaving { animation: none; opacity: 0; }
}
