/* v24.1 hotfix: readable dark toasts + header overflow guard */

/* Toasty nesmí v nočním režimu svítit ani mizet textem */
.toast-stack {
    top: 18px;
    right: 18px;
    left: auto;
    width: min(370px, calc(100vw - 36px));
    max-width: 370px;
}

.app-toast {
    overflow: hidden;
    max-width: 100%;
}

.app-toast-copy {
    min-width: 0;
}

body.dark-mode .app-toast,
body.dark-mode .admin-shell .app-toast {
    background: rgba(15, 23, 42, .97) !important;
    border-color: rgba(148, 163, 184, .26) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .48) !important;
    color: #edf3ff !important;
}

body.dark-mode .app-toast-copy,
body.dark-mode .admin-shell .app-toast-copy {
    color: #edf3ff !important;
}

body.dark-mode .app-toast-icon,
body.dark-mode .admin-shell .app-toast-icon {
    background: rgba(129, 140, 248, .18) !important;
    color: #c7d2fe !important;
}

body.dark-mode .app-toast.success .app-toast-icon,
body.dark-mode .admin-shell .app-toast.success .app-toast-icon {
    background: rgba(34, 197, 94, .18) !important;
    color: #86efac !important;
}

body.dark-mode .app-toast.error .app-toast-icon,
body.dark-mode .admin-shell .app-toast.error .app-toast-icon {
    background: rgba(248, 113, 113, .18) !important;
    color: #fca5a5 !important;
}

body.dark-mode .app-toast-close,
body.dark-mode .admin-shell .app-toast-close {
    background: rgba(30, 41, 59, .9) !important;
    border: 1px solid rgba(148, 163, 184, .22) !important;
    color: #cbd5e1 !important;
}

body.dark-mode .app-toast-close:hover,
body.dark-mode .admin-shell .app-toast-close:hover {
    background: rgba(51, 65, 85, .95) !important;
    color: #fff !important;
}

/* Horní lišta: žádné přetékání profilu/searchbaru mimo kartu */
.site-header {
    max-width: 100%;
}

.site-header .topbar {
    display: grid;
    grid-template-columns: minmax(210px, 280px) minmax(0, 1fr) minmax(300px, auto);
    align-items: center;
    gap: 14px;
}

.site-header .brand-mark,
.site-header .main-nav,
.site-header .header-actions {
    min-width: 0;
}

.site-header .main-nav {
    justify-content: center;
    overflow: hidden;
}

.site-header .main-nav a {
    white-space: nowrap;
    flex: 0 0 auto;
    padding-left: 12px;
    padding-right: 12px;
}

.site-header .header-actions {
    justify-self: end;
    max-width: 100%;
    flex-wrap: nowrap;
}

.site-header .search-chip {
    min-width: 0;
    width: clamp(190px, 22vw, 290px);
    max-width: 100%;
    flex: 1 1 auto;
}

.site-header .notification-wrap,
.site-header .user-menu {
    flex: 0 0 auto;
}

.site-header .user-chip {
    max-width: 210px;
    min-width: 0;
}

.site-header .user-chip-name {
    max-width: 115px;
    min-width: 0;
}

@media (max-width: 1280px) {
    .site-header .topbar {
        grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
        grid-template-areas:
            "brand actions"
            "nav nav";
    }

    .site-header .brand-mark { grid-area: brand; }
    .site-header .main-nav { grid-area: nav; justify-content: center; }
    .site-header .header-actions { grid-area: actions; }

    .site-header .search-chip {
        width: clamp(180px, 32vw, 320px);
    }
}

@media (max-width: 860px) {
    .site-header .topbar {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "actions";
        align-items: stretch;
    }

    .site-header .brand-mark,
    .site-header .header-actions {
        width: 100%;
    }

    .site-header .header-actions {
        justify-self: stretch;
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 10px;
    }

    .site-header .search-chip {
        width: 100%;
    }

    .site-header .main-nav {
        display: none;
    }
}

@media (max-width: 520px) {
    .toast-stack {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }

    .site-header .brand-text {
        font-size: 1.18rem;
    }

    .site-header .header-actions {
        grid-template-columns: 1fr auto;
    }

    .site-header .notification-wrap {
        order: 2;
    }

    .site-header .user-menu {
        order: 3;
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .site-header .user-chip {
        width: 100%;
        max-width: none;
        justify-content: space-between;
    }

    .site-header .user-chip-name {
        max-width: none;
    }
}
