/* ==========================================================================
   Layout — shell do sysrep: sidebar fixa estilo "rail" (só ícones) no
   desktop, que expande pra 220px sobrepondo o conteúdo no hover/focus
   (o conteúdo não reflui — margem fixa). Estilo Zendesk/Discord.
   ========================================================================== */

.app-shell,
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Sidebar (rail fixo de ícones, largura constante no desktop)
   -------------------------------------------------------------------------- */
.app-sidebar,
.sidebar {
    width: var(--sidebar-collapsed-width);
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow: visible;            /* deixa o tooltip "escapar" pra direita */
    display: flex;
    flex-direction: column;
}

/* Esconde os textos no rail (labels, títulos de seção, badges, logo-text). */
.app-sidebar .nav-section-title,
.app-sidebar .nav-item-label,
.app-sidebar .nav-item-arrow,
.app-sidebar .nav-item-badge,
.app-sidebar .sidebar-logo-text,
.app-sidebar .sidebar-footer-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Itens do menu — só ícone, centralizado */
.app-sidebar .nav-item {
    position: relative;
    justify-content: center;
    gap: 0;
    padding: 0.7rem 0;
}

.app-sidebar .sidebar-header,
.app-sidebar .sidebar-footer {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
}

.app-sidebar .sidebar-logo {
    gap: 0;
    justify-content: center;
}

/* Divisor sutil entre seções (preserva o agrupamento sem texto) */
.app-sidebar .nav-section + .nav-section {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--wash-light-soft);
}

/* Sidebar header */
.sidebar-header {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--wash-light);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-logo:hover {
    color: var(--text-light);
    text-decoration: none;
}

.sidebar-logo i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-logo-img {
    max-height: 44px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    display: block;
}

/* Ícone PB quadrado no rail de 56px (sempre colapsado no desktop) */
.app-sidebar .sidebar-logo-img {
    max-height: 36px;
    max-width: 36px;
}

/* Sidebar nav — rola por dentro quando as categorias abrem e o conteúdo
   passa de 100vh (a sidebar é fixed, então sem isto os itens de baixo ficam
   inalcançáveis). O `overflow: visible` de antes existia pro tooltip por
   item escapar pra direita; esse tooltip não existe mais (ver comentário do
   rail expandido, abaixo), então o motivo caducou.
   `min-height: 0` é obrigatório: sem ele o flex item recusa encolher
   (min-height: auto) e o overflow nunca dispara. */
.sidebar-nav {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    /* No rail recolhido (56px) a barra não aparece — só o scroll por roda /
       teclado. Ela ganha corpo quando a sidebar expande (regras abaixo). */
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section.logout-section {
    margin-top: auto;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.nav-item {
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.95rem;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-light);
    text-decoration: none;
}

.nav-item.active {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.nav-item svg,
.nav-item-icon {
    width: 20px;
    height: 20px;
    font-size: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-item svg.nav-item-arrow,
.nav-item-arrow {
    margin-left: auto;
    width: 16px;
    height: 16px;
    font-size: 11px;
    color: var(--secondary-color);
    transition: transform 0.2s;
    flex: 0 0 auto;
}

.nav-item.open .nav-item-arrow {
    transform: rotate(90deg);
}

.nav-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.25s ease;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--primary-color);
    color: var(--text-light);
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Submenu */
.nav-submenu,
.submenu {
    display: none;
    padding-left: 1rem;
}

.nav-submenu.open,
.submenu.active {
    display: block;
}

.nav-submenu .nav-item,
.submenu .nav-item {
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
}

/* RAIL (desktop): a sidebar inteira expande de 56px pra 220px no hover/focus
   do container (ver .app-sidebar:hover / :focus-within abaixo — a margem do
   conteúdo, em "Main content area", não muda, a sidebar sobrepõe). Com o
   menu expandido a categoria abre em linha, exatamente como no drawer
   mobile — só ícone no rail recolhido, como sempre. Escopo é o inverso
   exato do media query mobile logo abaixo, então nada daqui vaza pro
   drawer. */
@media (hover: hover) and (min-width: 1025px) {
    /* Cabeçalho da categoria: mostra só o ícone, como qualquer item do rail
       (a regra geral .app-sidebar .nav-item já cuida do display:flex/centro). */
    .app-sidebar .nav-cat > [data-action="toggle-submenu"] {
        display: flex;
    }

    /* Categoria com a página atual dentro dela: mesma marcação .open que o PHP
       já calcula (usada hoje pro drawer) — aqui vira destaque permanente no
       rail, recolhido ou expandido. */
    .app-sidebar .nav-cat > [data-action="toggle-submenu"].open {
        background-color: var(--sidebar-hover);
    }

    /* Rail recolhido: submenu sempre fora do fluxo, mesmo se .open (a página
       atual está dentro dele) — só reaparece quando a sidebar expande. */
    .app-sidebar .nav-cat > .nav-submenu {
        display: none;
    }

    /* Sem título próprio no rail/expandido — o nome da categoria já está no
       botão que abre a lista, igual ao drawer mobile (não duplica). */
    .app-sidebar .nav-cat .nav-submenu-title {
        display: none;
    }

    /* --- Sidebar expandida: hover OU foco em qualquer descendente --- */
    .app-sidebar,
    .sidebar {
        transition: width 0.15s ease;
    }

    .app-sidebar:hover,
    .app-sidebar:focus-within,
    .sidebar:hover,
    .sidebar:focus-within {
        width: var(--sidebar-width);
    }

    /* Desfaz o esconde-acessibilidade — mesmo padrão do drawer mobile (ver
       media query abaixo), aqui disparado pelo hover/focus da sidebar em
       vez da largura da viewport. */
    .app-sidebar:hover .nav-section-title,
    .app-sidebar:hover .nav-item-label,
    .app-sidebar:hover .nav-item-arrow,
    .app-sidebar:hover .nav-item-badge,
    .app-sidebar:hover .sidebar-logo-text,
    .app-sidebar:hover .sidebar-footer-text,
    .app-sidebar:focus-within .nav-section-title,
    .app-sidebar:focus-within .nav-item-label,
    .app-sidebar:focus-within .nav-item-arrow,
    .app-sidebar:focus-within .nav-item-badge,
    .app-sidebar:focus-within .sidebar-logo-text,
    .app-sidebar:focus-within .sidebar-footer-text {
        position: static;
        width: auto;
        height: auto;
        padding: initial;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
        border: initial;
    }

    /* `padding: initial` acima volta ao valor inicial do CSS (0), não ao valor
       da folha de estilo — sem isto o título de categoria fica colado na
       borda, sem o respiro lateral que os itens do menu têm. Devolve. */
    .app-sidebar:hover .nav-section-title,
    .app-sidebar:focus-within .nav-section-title {
        padding: 0.5rem 1.5rem;
    }

    /* Com o label visível em linha, o tooltip por item não existe mais (foi
       removido acima) — nada a desligar aqui, evita duplicar texto por
       construção. */
    .app-sidebar:hover .nav-item,
    .app-sidebar:focus-within .nav-item {
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.65rem 1.25rem;
    }

    /* Categoria abre no clique (data-action="toggle-submenu" em app.js),
       não mais no hover dela. O .open calculado pelo PHP é só o estado
       inicial: a categoria da página atual já vem aberta ao carregar. */
    .app-sidebar:hover .nav-cat > .nav-submenu.open,
    .app-sidebar:focus-within .nav-cat > .nav-submenu.open {
        display: block;
    }

    /* Sidebar expandida: a barra ganha corpo, discreta sobre o fundo escuro. */
    .app-sidebar:hover .sidebar-nav,
    .app-sidebar:focus-within .sidebar-nav,
    .sidebar:hover .sidebar-nav,
    .sidebar:focus-within .sidebar-nav {
        scrollbar-width: thin;
        scrollbar-color: var(--wash-light-heavy) transparent;
    }

    .app-sidebar:hover .sidebar-nav::-webkit-scrollbar,
    .app-sidebar:focus-within .sidebar-nav::-webkit-scrollbar,
    .sidebar:hover .sidebar-nav::-webkit-scrollbar,
    .sidebar:focus-within .sidebar-nav::-webkit-scrollbar {
        width: 6px;
    }

    .app-sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb,
    .app-sidebar:focus-within .sidebar-nav::-webkit-scrollbar-thumb,
    .sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb,
    .sidebar:focus-within .sidebar-nav::-webkit-scrollbar-thumb {
        background: var(--wash-light-heavy);
        border-radius: var(--radius-pill);
    }

    .app-sidebar:hover .sidebar-nav::-webkit-scrollbar-track,
    .app-sidebar:focus-within .sidebar-nav::-webkit-scrollbar-track,
    .sidebar:hover .sidebar-nav::-webkit-scrollbar-track,
    .sidebar:focus-within .sidebar-nav::-webkit-scrollbar-track {
        background: transparent;
    }

    /* Quando o rail abre, o conteúdo acompanha a largura real do menu em vez
       de ficar escondido sob ele. O seletor de irmão preserva o shell atual e
       só atua enquanto a sidebar desktop estiver expandida. */
    .app-sidebar:hover ~ .app-main,
    .app-sidebar:focus-within ~ .app-main,
    .sidebar:hover ~ .main-content,
    .sidebar:focus-within ~ .main-content {
        margin-left: var(--sidebar-width);
    }

    .app-main,
    .main-content {
        transition: margin-left 0.15s ease;
    }
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--wash-light);
    padding: 0.75rem 0.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Main content area
   -------------------------------------------------------------------------- */
.app-main,
.main-content {
    flex: 1;
    margin-left: var(--sidebar-collapsed-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* min-width:0 + max-width: sem isso o flex item recusa encolher (min-width:auto)
       e QUALQUER conteúdo largo (faixa horizontal, tabela) estica o shell inteiro pra
       fora da janela em vez de rolar por dentro (bug do kanban, Lucas 21/07). */
    min-width: 0;
    max-width: 100%;
}

/* Topbar */
.app-topbar,
.topbar {
    background: var(--input-bg);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle,
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    color: var(--text-muted);
    font-size: 1.25rem;
    border-radius: var(--radius);
}

.topbar-toggle:hover,
.menu-toggle:hover {
    background: var(--bg-gray);
    color: var(--text-dark);
}

.user-menu,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.2s;
    border: none;
    background: transparent;
    font-family: inherit;
    text-decoration: none;
    color: inherit;
}

.user-menu:hover,
.topbar-user:hover {
    background-color: var(--bg-gray);
    text-decoration: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Chapado, nao gradiente: avatar e chrome, e o sistema reserva cor pra
       sinal de estado. O roxo daqui veio de template, nunca foi decisao. */
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.user-avatar-image { height: 100%; object-fit: cover; position: absolute; width: 100%; }
.user-avatar-fallback { position: relative; z-index: 1; }

.user-avatar.sm { width: 28px; height: 28px; font-size: 0.75rem; }
.user-avatar.lg { width: 56px; height: 56px; font-size: 1rem; }

.user-info { text-align: left; line-height: 1.2; }
.user-name { font-size: 0.95rem; font-weight: 500; color: var(--text-dark); }
.user-role { font-size: 0.85rem; color: var(--text-muted); }

/* Conteúdo principal */
.app-content,
.content {
    flex: 1;
    padding: 2rem;
}

/* Header da página dentro do content */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   Backdrop para mobile drawer
   -------------------------------------------------------------------------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Mobile (igual ao sysrep: sidebar vira drawer abaixo de 1024px)
   -------------------------------------------------------------------------- */
@media (hover: none), (max-width: 1024px) {
    .app-sidebar,
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .app-sidebar:hover,
    .app-sidebar:focus-within,
    .sidebar:hover,
    .sidebar:focus-within {
        width: var(--sidebar-width);
    }

    .app-sidebar.active,
    .app-sidebar.open,
    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    /* Em mobile o sidebar vira drawer largo — reverte o esconde-acessibilidade
       e o comportamento de tooltip, mostrando os textos como menu normal. */
    .app-sidebar .nav-section-title,
    .app-sidebar .nav-item-label,
    .app-sidebar .nav-item-arrow,
    .app-sidebar .nav-item-badge,
    .app-sidebar .sidebar-logo-text,
    .app-sidebar .sidebar-footer-text {
        position: static;
        width: auto;
        height: auto;
        padding: initial;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
        border: initial;
    }

    /* `padding: initial` acima volta ao valor inicial do CSS (0), não ao valor
       da folha de estilo — sem isto o título de categoria fica colado na
       borda, sem o respiro lateral que os itens do menu têm. Devolve. */
    .app-sidebar .nav-section-title {
        padding: 0.5rem 1.5rem;
    }
    .app-sidebar .nav-item:hover .nav-item-label,
    .app-sidebar .nav-item:focus-visible .nav-item-label {
        position: static;
        transform: none;
        background: transparent;
        color: inherit;
        padding: initial;
        box-shadow: none;
        font-size: inherit;
        z-index: auto;
    }
    .app-sidebar .nav-section + .nav-section {
        margin-top: 1.5rem;
        padding-top: 0;
        border-top: 0;
    }
    .app-sidebar .nav-item {
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.65rem 1.25rem;
    }

    /* DRAWER (mobile): aqui ha largura, entao o agrupamento vale — o cabecalho da
       categoria aparece e o submenu colapsa. E o inverso do rail, onde o cabecalho
       some e os itens ficam soltos. */
    .app-sidebar [data-action="toggle-submenu"] {
        display: flex;
        width: 100%;
        border: 0;
        background: none;
        color: inherit;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    .app-sidebar .nav-submenu {
        display: none;
    }

    .app-sidebar .nav-submenu.open {
        display: block;
    }

    /* Seta indicando aberto/fechado — o mesmo icone gira, sem trocar de classe. */
    .app-sidebar [data-action="toggle-submenu"] .nav-item-arrow {
        margin-left: auto;
        transition: transform 0.15s ease;
    }

    .app-sidebar [data-action="toggle-submenu"].open .nav-item-arrow {
        transform: rotate(90deg);
    }

    .app-sidebar .nav-submenu .nav-item {
        padding-left: 2.75rem;
        font-size: 0.85rem;
    }

    /* Título do flyout (rail) não existe em mobile — o nome da categoria já
       aparece no botão que abre/fecha o submenu, não duplica aqui. */
    .app-sidebar .nav-submenu-title {
        display: none;
    }

    /* Drawer aberto: menu longo (categorias expandidas) rola por dentro,
       com barra visível — aqui a sidebar já está sempre na largura cheia. */
    .sidebar-nav {
        scrollbar-width: thin;
        scrollbar-color: var(--wash-light-heavy) transparent;
    }

    .sidebar-nav::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: var(--wash-light-heavy);
        border-radius: var(--radius-pill);
    }

    .sidebar-nav::-webkit-scrollbar-track {
        background: transparent;
    }

    .app-main,
    .main-content {
        margin-left: 0;
    }

    .app-sidebar:hover ~ .app-main,
    .app-sidebar:focus-within ~ .app-main,
    .sidebar:hover ~ .main-content,
    .sidebar:focus-within ~ .main-content {
        margin-left: 0;
    }

    .sidebar-backdrop {
        display: block;
    }

    .topbar-toggle,
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-topbar,
    .topbar {
        padding: 0.75rem 1rem;
    }

    .app-content,
    .content {
        padding: 1rem;
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 540px) {
    .topbar-title {
        font-size: 1rem;
    }
    .app-content,
    .content {
        padding: 0.75rem;
    }
    .page-title {
        font-size: 1.25rem;
    }
}

/* --------------------------------------------------------------------------
   Variantes de nav-item: disabled (placeholder) e back (rodapé "Trocar setor")
   -------------------------------------------------------------------------- */
.nav-item-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-item-back {
    color: var(--secondary-color);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    width: 100%;
}

.nav-item-back:hover {
    color: var(--text-light);
    background: var(--wash-light-soft);
}

/* --------------------------------------------------------------------------
   Topbar — variantes light (avatar card + ícones) espelhando o hero do seletor
   -------------------------------------------------------------------------- */
.topbar-user-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dark);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.topbar-user-card:hover {
    border-color: var(--border-light);
    color: var(--text-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.topbar-user-card .user-avatar {
    background: var(--bg-gray);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

.topbar-user-text {
    line-height: 1.3;
    text-align: left;
}

.topbar-user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}

.topbar-user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.topbar-icon-btn:hover {
    border-color: var(--border-light);
    color: var(--text-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.topbar-notifications {
    position: relative;
}

.topbar-notifications-toggle {
    position: relative;
}

.topbar-notifications-badge {
    position: absolute;
    top: -0.2rem;
    right: -0.2rem;
    min-width: 1.15rem;
    padding: 0.1rem 0.25rem;
    border-radius: var(--radius-pill);
    background: var(--color-red);
    color: var(--text-light);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.topbar-notifications-menu {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    width: min(22rem, calc(100vw - 2rem));
    max-height: 24rem;
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    box-shadow: var(--shadow-lg);
    z-index: 110;
}

.topbar-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.topbar-notifications-list {
    display: grid;
    gap: 0.35rem;
    padding-top: 0.5rem;
}

.topbar-notification-item {
    display: block;
    padding: 0.65rem;
    border-radius: var(--radius);
    color: var(--text-dark);
    text-decoration: none;
}

.topbar-notification-item:hover,
.topbar-notification-item:focus-visible {
    background: var(--bg-gray);
    color: var(--text-dark);
}

.topbar-notification-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-notification-date,
.topbar-notifications-empty {
    display: block;
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

@media (max-width: 540px) {
    .topbar-notifications-menu {
        position: fixed;
        top: 4.25rem;
        right: 0.75rem;
    }
}

@media (max-width: 540px) {
    .topbar-divider { display: none; }
    .topbar-user-card { padding: 0.25rem; }
}

