/* Barra superior */
#topbar {
    height: var(--topbar-height);
    background-color: var(--background-card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 160;
}

/* Botón toggle del sidebar */
#sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background-color var(--transition-speed);
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 210;
}

#sidebar-toggle:hover {
    background-color: var(--background-soft);
    color: var(--text-primary);
}

/* Título de la página actual */
#topbar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Reducir padding lateral en pantallas pequeñas */
@media (max-width: 767px) {
    #topbar {
        padding: 0 12px;
        gap: 10px;
    }
}

/* ── Notificaciones ── */
.notif-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-notif {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.btn-notif:hover {
    background: var(--background-soft);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background: var(--danger);
    color: #fff;
    border-radius: 8px;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--background-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-dropdown[hidden] {
    display: none;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--background-soft);
}

.notif-dropdown-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-marcar-todo {
    font-size: 0.75rem;
    color: var(--primary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notif-marcar-todo:hover {
    color: var(--primary-hover);
}

.notif-lista {
    overflow-y: auto;
    flex: 1;
    padding: 6px 0;
}

.notif-empty {
    padding: 20px 14px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

.notif-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: default;
    border-left: 3px solid var(--primary);
    transition: background 0.12s;
}

.notif-item:hover {
    background: var(--background-soft);
}

.notif-item--leida {
    border-left-color: transparent;
    opacity: 0.6;
    cursor: default;
}

.notif-item--leida:hover {
    background: transparent;
}

.notif-item-titulo {
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.notif-item-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.notif-item-fecha {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.notif-item-ir {
    flex-shrink: 0;
    align-self: center;
    height: 26px;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-primary);
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.notif-item-ir:hover {
    background: var(--primary-hover);
}

@media (max-width: 767px) {
    .notif-dropdown {
        width: calc(100vw - 24px);
        right: -8px;
    }
}
