:root {
    --tp-toast-surface: #ffffff;
    --tp-toast-border: rgba(12, 35, 62, 0.10);
    --tp-toast-title: #0c233e;
    --tp-toast-text: #55657a;
    --tp-toast-shadow: 0 14px 32px -14px rgba(12, 35, 62, 0.34), 0 4px 12px -6px rgba(12, 35, 62, 0.16);
    --tp-toast-close: rgba(12, 35, 62, 0.34);
    --tp-toast-close-hover: #0c233e;
    --tp-toast-close-bg: rgba(12, 35, 62, 0.06);
    --tp-toast-success: #15a34a;
    --tp-toast-error: #dc2626;
    --tp-toast-warning: #d97706;
    --tp-toast-info: #1d4ed8;
    --tp-toast-neutral: #0c233e;
    --tp-toast-scrim: rgba(12, 35, 62, 0.07);
}

[data-theme="dark"] {
    --tp-toast-surface: #123055;
    --tp-toast-border: rgba(255, 255, 255, 0.12);
    --tp-toast-title: #ffffff;
    --tp-toast-text: rgba(255, 255, 255, 0.72);
    --tp-toast-shadow: 0 18px 38px -16px rgba(0, 0, 0, 0.7), 0 6px 14px -8px rgba(0, 0, 0, 0.55);
    --tp-toast-close: rgba(255, 255, 255, 0.44);
    --tp-toast-close-hover: #ffffff;
    --tp-toast-close-bg: rgba(255, 255, 255, 0.10);
    --tp-toast-success: #34d399;
    --tp-toast-error: #f87171;
    --tp-toast-warning: #fbbf24;
    --tp-toast-info: #60a5fa;
    --tp-toast-neutral: #ffffff;
    --tp-toast-scrim: rgba(255, 255, 255, 0.12);
}

#toast-container {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
}

#toast-container * {
    box-sizing: border-box;
}

#toast-container.toast-bottom-right {
    right: 24px;
    bottom: 24px;
}

body:has(.tkcw-launcher:not(.tkcw-hidden)) #toast-container.toast-bottom-right {
    bottom: 100px;
}

#toast-container.toast-top-right {
    right: 20px;
    top: 20px;
}

#toast-container.toast-bottom-left {
    left: 20px;
    bottom: 20px;
}

#toast-container.toast-top-left {
    left: 20px;
    top: 20px;
}

#toast-container.toast-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: auto;
}

#toast-container.toast-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: auto;
}

#toast-container > div {
    --tp-accent: var(--tp-toast-neutral);
    --tp-accent-tint: rgba(12, 35, 62, 0.10);
    position: relative;
    pointer-events: auto;
    overflow: hidden;
    box-sizing: border-box;
    width: 372px;
    max-width: calc(100vw - 32px);
    margin: 0 0 12px;
    padding: 15px 40px 15px 54px;
    background: var(--tp-toast-surface);
    background-image: none !important;
    border: 1px solid var(--tp-toast-border);
    border-radius: 14px;
    box-shadow: var(--tp-toast-shadow);
    color: var(--tp-toast-title);
    opacity: 1;
    filter: none;
    -ms-filter: none;
    line-height: 1.45;
    animation: tpToastIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#toast-container.toast-top-right > div,
#toast-container.toast-top-left > div,
#toast-container.toast-top-center > div {
    animation-name: tpToastInTop;
}

#toast-container > div:hover {
    box-shadow: var(--tp-toast-shadow);
    opacity: 1;
    filter: none;
    -ms-filter: none;
    cursor: default;
}

#toast-container > div::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--tp-accent);
}

#toast-container > div::after {
    content: "";
    position: absolute;
    left: 15px;
    top: 15px;
    width: 26px;
    height: 26px;
    background-color: var(--tp-accent);
    background-image: none !important;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: 26px 26px;
    mask-size: 26px 26px;
}

#toast-container > div.toast,
#toast-container > div.toast-success,
#toast-container > div.toast-error,
#toast-container > div.toast-warning,
#toast-container > div.toast-info {
    background-color: var(--tp-toast-surface);
    background-image: none !important;
    background-repeat: no-repeat;
    background-position: 0 0;
    color: var(--tp-toast-title);
}

#toast-container > .toast-success {
    --tp-accent: var(--tp-toast-success);
    --tp-accent-tint: rgba(21, 163, 74, 0.12);
}

#toast-container > .toast-error {
    --tp-accent: var(--tp-toast-error);
    --tp-accent-tint: rgba(220, 38, 38, 0.12);
}

#toast-container > .toast-warning {
    --tp-accent: var(--tp-toast-warning);
    --tp-accent-tint: rgba(217, 119, 6, 0.14);
}

#toast-container > .toast-info {
    --tp-accent: var(--tp-toast-info);
    --tp-accent-tint: rgba(29, 78, 216, 0.12);
}

[data-theme="dark"] #toast-container > .toast-success {
    --tp-accent-tint: rgba(52, 211, 153, 0.18);
}

[data-theme="dark"] #toast-container > .toast-error {
    --tp-accent-tint: rgba(248, 113, 113, 0.18);
}

[data-theme="dark"] #toast-container > .toast-warning {
    --tp-accent-tint: rgba(251, 191, 36, 0.18);
}

[data-theme="dark"] #toast-container > .toast-info {
    --tp-accent-tint: rgba(96, 165, 250, 0.18);
}

#toast-container > .toast-success::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M8.3 13.3l3.2 3.2 6.2-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M8.3 13.3l3.2 3.2 6.2-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
}

#toast-container > .toast-error::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M9.5 9.5l7 7M16.5 9.5l-7 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M9.5 9.5l7 7M16.5 9.5l-7 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
}

#toast-container > .toast-warning::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M13 7.4v6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='13' cy='17.6' r='1.25' fill='%23000'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M13 7.4v6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='13' cy='17.6' r='1.25' fill='%23000'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
}

#toast-container > .toast-info::after {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M13 18.4v-5.6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='13' cy='8.6' r='1.25' fill='%23000'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cmask id='c'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23fff'/%3E%3Cpath d='M13 18.4v-5.6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='13' cy='8.6' r='1.25' fill='%23000'/%3E%3C/mask%3E%3Ccircle cx='13' cy='13' r='13' fill='%23000' mask='url(%23c)'/%3E%3C/svg%3E");
}

#toast-container > div .toast-title {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--tp-toast-title);
}

#toast-container > div .toast-message {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tp-toast-title);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

#toast-container > div:has(.toast-title) .toast-message {
    font-size: 13px;
    font-weight: 400;
    color: var(--tp-toast-text);
}

#toast-container > div .toast-message a {
    color: var(--tp-accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#toast-container > div .toast-message a:hover {
    color: var(--tp-accent);
    opacity: 0.8;
}

#toast-container > div .toast-close-button {
    position: absolute;
    right: 10px;
    top: 12px;
    float: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    color: var(--tp-toast-close);
    text-shadow: none;
    opacity: 1;
    filter: none;
    -ms-filter: none;
    transition: background 0.15s ease, color 0.15s ease;
}

#toast-container > div .toast-close-button:hover {
    color: var(--tp-toast-close-hover);
    background: var(--tp-toast-close-bg);
    opacity: 1;
    filter: none;
    -ms-filter: none;
}

#toast-container > div .toast-close-button:focus-visible,
.tp-undo-toast .tp-undo-btn:focus-visible {
    outline: 2px solid var(--tp-accent);
    outline-offset: 2px;
}

#toast-container > div .toast-progress {
    position: absolute;
    left: 0;
    right: auto;
    bottom: 0;
    height: 3px;
    background: var(--tp-accent);
    border-radius: 0 3px 0 0;
    opacity: 0.55;
    filter: none;
    -ms-filter: none;
}

.tp-undo-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.tp-undo-toast .tp-undo-text {
    flex: 1 1 auto;
    min-width: 0;
}

.tp-undo-toast .tp-undo-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border: 1px solid var(--tp-accent, #0c233e);
    border-radius: 8px;
    background: var(--tp-accent-tint, rgba(12, 35, 62, 0.10));
    color: var(--tp-toast-title, #0c233e);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.tp-undo-toast .tp-undo-btn:hover {
    box-shadow: inset 0 0 0 2em var(--tp-toast-scrim);
}

.tp-undo-toast .tp-undo-btn:active {
    transform: translateY(1px);
}

.tp-undo-toast .tp-undo-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.72;
    letter-spacing: 0;
}

.tp-undo-row-pending {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

@keyframes tpToastIn {
    from {
        transform: translateY(14px) scale(0.98);
    }
    to {
        transform: none;
    }
}

@keyframes tpToastInTop {
    from {
        transform: translateY(-14px) scale(0.98);
    }
    to {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #toast-container > div {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    #toast-container.toast-bottom-right,
    #toast-container.toast-bottom-left,
    #toast-container.toast-bottom-center,
    #toast-container.toast-bottom-full-width {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        transform: none;
    }

    #toast-container.toast-top-right,
    #toast-container.toast-top-left,
    #toast-container.toast-top-center,
    #toast-container.toast-top-full-width {
        left: 12px;
        right: 12px;
        top: calc(12px + env(safe-area-inset-top, 0px));
        width: auto;
        transform: none;
    }

    #toast-container > div {
        width: 100%;
        max-width: 100%;
        margin: 0 0 10px;
        padding: 14px 38px 14px 50px;
        border-radius: 12px;
    }

    #toast-container > div::after {
        left: 13px;
        top: 14px;
    }

    #toast-container > div .toast-close-button {
        width: 32px;
        height: 32px;
        right: 6px;
        top: 8px;
    }
}
